在Prestashop 1.6中添加制造商城市和国家在产品清单和产品页面

在Prestashop 1.6中添加制造商城市和国家在产品清单和产品页面

问题描述:

我已经覆盖ProductController.php如下显示manufactere国家。在Prestashop 1.6中添加制造商城市和国家在产品清单和产品页面

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和产品list.tpl

+0

我把以上ProductController.php在Project \ override \ controller \ front \目录。我删除缓存。 – MUHIUDDIN

重写控制器

该文件可以被放置在下列位置之一:

/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版本的要求调整自己的路径。问候

+0

是的,我把它放在第一个路径位置。但我没有获得印刷国家。 – MUHIUDDIN

+0

self :: $ smarty-> assign('currentController',..); – 2017-09-15 08:46:58

+0

你分配给manufacturer_country并且没有新变量“currentController”,我认为你的错误在这里,你在同一个模板中有2个相同的变量。 – 2017-09-15 08:48:25