Jump to content

$manufacturer.description in blockmanufacturer.tpl displays only in default language


Recommended Posts

It gives me headache already :/ Please help.

 

In the 'Block manufacturer' module, I have added 

{$manufacturer.description|escape:'text':'UTF-8'[spam-filter]

 to the list of manufacturers. Originally there is just manufacturers name :

{$manufacturer.name|escape:'html':'UTF-8'}

and hyperlink with href:

{$link->getmanufacturerLink($manufacturer.id_manufacturer, manufacturer.link_rewrite)|escape:'html'}

listed.

 

So, everything works fine - each manufacturer description is shown. Till language change. It always shows it in default language. Change (of language) appears anywhere else on home page but here.

Could you guys please advise?

 

Here is a link - tabs with brands are in fact the manufacturers list.

 

 

 

Edited by xraymutation (see edit history)
Link to comment
Share on other sites

It gives me headache already :/ Please help.

 

In the 'Block manufacturer' module, I have added 

{$manufacturer.description|escape:'text':'UTF-8'[spam-filter]

 to the list of manufacturers. Originally there is just manufacturers name :

{$manufacturer.name|escape:'html':'UTF-8'}

and hyperlink with href:

{$link->getmanufacturerLink($manufacturer.id_manufacturer, manufacturer.link_rewrite)|escape:'html'}

listed.

 

So, everything works fine - each manufacturer description is shown. Till language change. It always shows it in default language. Change (of language) appears anywhere else on home page but here.

Could you guys please advise?

 

Here is a link - tabs with brands are in fact the manufacturers list.

Hi,

You must edit the blockmanufacturer.php, because language are not implemented in.

In the construct function add the context:

    public function __construct()
    {
        $this->name = 'blockmanufacturer';
        $this->tab = 'front_office_features';
        $this->version = '1.2.1';
		$this->author = 'PrestaShop';
		$this->need_instance = 0;

        $this->bootstrap = true;
		parent::__construct();	

		$this->displayName = $this->l('Manufacturers block');
        $this->description = $this->l('Displays a block listing product manufacturers and/or brands.');
		$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
		$this->context = Context::getContext();
    }

and in the public function hookLeftColumn add the context language:

	public function hookLeftColumn($params)
	{
		if (!$this->isCached('blockmanufacturer.tpl', $this->getCacheId()))
		{
			$manufacturers = Manufacturer::getManufacturers(false, $this->context->language->id);
			foreach ($manufacturers as &$manufacturer)
			{
				$manufacturer['image'] = $this->context->language->iso_code.'-default';
				if (file_exists(_PS_MANU_IMG_DIR_.$manufacturer['id_manufacturer'].'-'.ImageType::getFormatedName('medium').'.jpg'))
					$manufacturer['image'] = $manufacturer['id_manufacturer'];
			}

			$this->smarty->assign(array(
				'manufacturers' => $manufacturers,
				'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
				'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'),
				'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'),
				'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS'),
			));
		}
		return $this->display(__FILE__, 'blockmanufacturer.tpl', $this->getCacheId());
	}

Enjoy !

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...