// Fix product multishop association when the product is created before the shop
This commit is contained in:
1 parent
001cf9a5bd
commit
f17f9c9bee
1 file changed
+9
@@ -356,7 +356,16 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
$result = parent::loadObject($opt);
|
$result = parent::loadObject($opt);
|
||||||
if ($result && Validate::isLoadedObject($this->object))
|
if ($result && Validate::isLoadedObject($this->object))
|
||||||
|
{
|
||||||
|
if (Shop::getContext() == Shop::CONTEXT_SHOP && !$this->object->isAssociatedToShop())
|
||||||
|
{
|
||||||
|
$default_product = new Product((int)$this->object->id, false, null, (int)$this->object->id_shop_default);
|
||||||
|
$def = ObjectModel::getDefinition($this->object);
|
||||||
|
foreach ($def['fields'] as $field_name => $row)
|
||||||
|
$this->object->$field_name = $default_product->$field_name;
|
||||||
|
}
|
||||||
$this->object->loadStockData();
|
$this->object->loadStockData();
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user