protected function loadObject($opt = false) { $result = parent::loadObject($opt); if ($result && Validate::isLoadedObject($this->object)) { if (Shop::getContext() == Shop::CONTEXT_SHOP && Shop::isFeatureActive() && !$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) { if (is_array($default_product->{$field_name})) { foreach ($default_product->{$field_name} as $key => $value) { $this->object->{$field_name}[$key] = $value; } } else { $this->object->{$field_name} = $default_product->{$field_name}; } } } $this->object->loadStockData(); } return $result; }