diff --git a/classes/Category.php b/classes/Category.php index 523ae1b4e..ec07f6a8c 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -376,7 +376,7 @@ class CategoryCore extends ObjectModel if (!$this->id_parent) return 0; - $parent_category = new Category($this->id_parent); + $parent_category = new Category((int)$this->id_parent); if (!Validate::isLoadedObject($parent_category)) throw new PrestaShopException('Parent category does not exist'); return $parent_category->level_depth + 1; diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 8195888d7..5dbb50536 100755 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -1106,7 +1106,7 @@ class FrontControllerCore extends Controller $blocksupplier = Module::getInstanceByName('blocksupplier'); $this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0)); $this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1)); - $this->context->smarty->assign('voucherAllowed', (int)Configuration::get('PS_VOUCHERS')); + $this->context->smarty->assign('voucherAllowed', (int)CartRule::isFeatureActive()); $this->context->smarty->assign('display_manufacturer_link', (bool)$blockmanufacturer->active); $this->context->smarty->assign('display_supplier_link', (bool)$blocksupplier->active); $this->context->smarty->assign('PS_DISPLAY_SUPPLIERS', Configuration::get('PS_DISPLAY_SUPPLIERS')); diff --git a/controllers/front/MyAccountController.php b/controllers/front/MyAccountController.php index 962cfa040..72c6fa7a7 100644 --- a/controllers/front/MyAccountController.php +++ b/controllers/front/MyAccountController.php @@ -49,8 +49,8 @@ class MyAccountControllerCore extends FrontController $has_address = $this->context->customer->getAddresses($this->context->language->id); $this->context->smarty->assign(array( 'has_customer_an_address' => empty($has_address), - 'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')), - 'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN')) + 'voucherAllowed' => (int)CartRule::isFeatureActive(), + 'returnAllowed' => (int)Configuration::get('PS_ORDER_RETURN') )); $this->context->smarty->assign('HOOK_CUSTOMER_ACCOUNT', Hook::exec('displayCustomerAccount')); diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index 72da317ed..60533ed6c 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -328,7 +328,7 @@ class ParentOrderControllerCore extends FrontController 'token_cart' => Tools::getToken(false), 'isVirtualCart' => $this->context->cart->isVirtualCart(), 'productNumber' => $this->context->cart->nbProducts(), - 'voucherAllowed' => Configuration::get('PS_VOUCHERS') && CartRule::isFeatureActive(), + 'voucherAllowed' => CartRule::isFeatureActive(), 'shippingCost' => $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 'shippingCostTaxExc' => $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING), 'customizedDatas' => $customizedDatas, diff --git a/controllers/front/SitemapController.php b/controllers/front/SitemapController.php index 949e44f8f..f3d031911 100644 --- a/controllers/front/SitemapController.php +++ b/controllers/front/SitemapController.php @@ -46,7 +46,7 @@ class SitemapControllerCore extends FrontController $this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0)); $this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1)); - $this->context->smarty->assign('voucherAllowed', (int)Configuration::get('PS_VOUCHERS')); + $this->context->smarty->assign('voucherAllowed', (int)CartRule::isFeatureActive()); $blockmanufacturer = Module::getInstanceByName('blockmanufacturer'); $blocksupplier = Module::getInstanceByName('blocksupplier');