//small fix
This commit is contained in:
+6
-1
@@ -4829,12 +4829,17 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getDefaultCategory()
|
public function getDefaultCategory()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->getValue('
|
$default_category = Db::getInstance()->getValue('
|
||||||
SELECT product_shop.`id_category_default`
|
SELECT product_shop.`id_category_default`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.Shop::addSqlAssociation('product', 'p').'
|
'.Shop::addSqlAssociation('product', 'p').'
|
||||||
WHERE p.`id_product` = '.(int)$this->id);
|
WHERE p.`id_product` = '.(int)$this->id);
|
||||||
|
|
||||||
|
if (!$default_category)
|
||||||
|
return array('id_category_default' => Context::getContext()->shop->id_category);
|
||||||
|
else
|
||||||
|
return $default_category;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getShopsByProduct($id_product)
|
public static function getShopsByProduct($id_product)
|
||||||
|
|||||||
@@ -2605,7 +2605,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$data = $this->createTemplate($this->tpl_form);
|
$data = $this->createTemplate($this->tpl_form);
|
||||||
// Prepare Categories tree for display in Associations tab
|
// Prepare Categories tree for display in Associations tab
|
||||||
$root = Category::getRootCategory();
|
$root = Category::getRootCategory();
|
||||||
$default_category = Tools::getValue('id_category', Configuration::get('PS_HOME_CATEGORY'));
|
$default_category = Tools::getValue('id_category', Context::getContext()->shop->id_category);
|
||||||
|
|
||||||
if (!$product->id)
|
if (!$product->id)
|
||||||
$selected_cat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language);
|
$selected_cat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language);
|
||||||
|
|||||||
Reference in New Issue
Block a user