[-] BO: Fix PSCFV-3911

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17188 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-09-05 12:49:57 +00:00
parent dbd39f3a5b
commit f4b42a63a9
2 changed files with 10 additions and 4 deletions
@@ -1137,7 +1137,13 @@ class AdminProductsControllerCore extends AdminController
{
$result = parent::loadObject($opt);
if ($result)
{
if ($this->object->id)
if (!$this->object->isAssociatedToShop() && $this->object->id_shop_default)
$this->object = new $this->className((int)$this->object->id, false, null, (int)$this->object->id_shop_default);
$this->object->loadStockData();
}
return $result;
}
@@ -2691,7 +2697,7 @@ class AdminProductsControllerCore extends AdminController
$root = Category::getRootCategory();
$default_category = Tools::getValue('id_category', Context::getContext()->shop->id_category);
if (!$product->id)
if (!$product->id || !$product->isAssociatedToShop())
$selected_cat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language);
else
{
@@ -990,11 +990,11 @@ class AdminStockManagementControllerCore extends AdminController
$query->select('IFNULL(CONCAT(pl.`name`, \' : \', GROUP_CONCAT(agl.`name`, \' - \', al.`name` SEPARATOR \', \')),pl.`name`) as name');
$query->from('product_attribute', 'a');
$query->join('INNER JOIN '._DB_PREFIX_.'product_lang pl ON (pl.`id_product` = a.`id_product` AND pl.`id_lang` = '.$lang_id.')
$query->join('INNER JOIN '._DB_PREFIX_.'product_lang pl ON (pl.`id_product` = a.`id_product` AND pl.`id_lang` = '.(int)$lang_id.')
LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.`id_product_attribute` = a.`id_product_attribute`)
LEFT JOIN '._DB_PREFIX_.'attribute atr ON (atr.`id_attribute` = pac.`id_attribute`)
LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON (al.`id_attribute` = atr.`id_attribute` AND al.`id_lang` = '.$lang_id.')
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.`id_attribute_group` = atr.`id_attribute_group` AND agl.`id_lang` = '.$lang_id.')'
LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON (al.`id_attribute` = atr.`id_attribute` AND al.`id_lang` = '.(int)$lang_id.')
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.`id_attribute_group` = atr.`id_attribute_group` AND agl.`id_lang` = '.(int)$lang_id.')'
);
$query->where('a.`id_product_attribute` = '.$id_product_attribute);
$name = Db::getInstance()->getValue($query);