在产品列表和产品页面上的Prestashop 1.6中添加制造商的城市和国家



我的productController.php如下,以显示制造乡村。

class ProductController extends ProductControllerCore
{
   public function initContent()
   {
       $manufacturer_country = "";
       if($this->product->id_manufacturer > 0)
       {
           $manufacturer = new Manufacturer($this->product->id_manufacturer, $this->context->language->id);
           $manufacturer_country = $manufacturer->country;
       }
       $this->context->smarty->assign('manufacturer_country', $manufacturer_country);
       parent::initContent();
   }

}

在product.tpl中,我写了{$ manufacturer_country},但没有打印。任何人都可以指导我如何在product.tpl和product-list.tpl

上打印

覆盖控制器

可以将文件放置在这两个位置中:

/override/controllers/front/ProductController.php
/modules/my_module/override/controllers/front/ProductController.php
/themes/prestashop/modules/my_module/my_module.tpl
/themes/prestashop/css/modules/my_module/my_module.css
/themes/prestashop/js/modules/my_module/my_module.js

您需要根据1.6版的要求,在上下文中调整路径。问候

最新更新