Jump to content

Prestashop 1.7.X smarty changes


Recommended Posts

Hi, does anybody know if there is an overview about smarty changes in prestashop1.7.X ?

 

I noticed that some prestashop 1.6.X modules will create parse errors in prestashop 1.7.x since smarty tags won't be recognised.

 

I am wondering if there is a list somewhere with replacement options?

This would be very helpful in order to make some 1.6.x modules work in prestashop 1.7.X

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

In Prestashop 1.6 I could include product tags in product.tpl using the tutorial from vekia. The following code won't work in Prestashop 1.7 so something must have changed regarding tags (there isn't even a tag cloud module in PS 1.7)

 

This is my code

{if isset($product->tags) && $product->tags}
<ul class="producttags">
 
{assign var='id_lang' value=Language::getIdByIso($lang_iso)}
{assign var='productTags' value=$product->tags}
{foreach from=$productTags[$id_lang] item=productTag name=productTags}
<li>  <a href="{$base_dir}index.php?controller=search&tag={$productTag|escape:'url'}"><strong>{$productTag}</strong></a></li>{if !$smarty.foreach.productTags.last} {/if}
{/foreach}
</ul>
{/if}

It won't work in Prestashop 1.7 .... nothing happens.

 

If I remove the if-condition I am getting an error message : Undefined index: lang_iso

If I remove the line with the language .. again nothing will happen ..

 

@eleazar I have read that smarty should be replaced. But as long as there is no replacement I will have to use it.

 

@Knowband Plugins thanks for the link. I will go ahead and read it. It seems that there are major changes especially for product.tpl. I will see if I can find a hint.

 

P.S.: I have found another post in this forum that may explain the problems

https://www.prestashop.com/forums/topic/571833-prestashop-17-smarty-global-variables/

 

Yes, this has changed in PrestaShop v1.7. There are many Smarty variables that are no longer available. The new convention is that objects should not be passed into templates, only the values you need to use, so you should create {$lang_iso} and {$id_shop} variables in your module.

 

Thanks again ..

Edited by prestamax (see edit history)
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...