Prestashop: can't display some $product variables content from cart-detailed*.tpl context

Created on 23 May 2019  路  15Comments  路  Source: PrestaShop/PrestaShop

Hello, it's me again (about the "$(product.unity) not showing up in cart" problem).
I was searching in the classe lazyarray and trying to use the accessor it was suggested to me.

And then I sudendly realised that $(product.unity) was showing well on a 7.4 localhost version with the VERY SAME theme (the one I made from scratch using the deprecated StarterTheme project) .

Then I use 1 click upgrade so I got the same version that is on my server (where the problem appens) everything worked fine and my local is now in 7.5.2 just like my server (my server is 7.5.0 to be fair) , I just add again the same product in cart, got into the cart and then my $(product.unity) doesn't show up anymore..

I can reproduce the problem and either I chose my StarterTheme or the classic theme, the variable display nothing.

I have the error as soon as I put {$product.unity} somewhere in cart-detailed-product-line.tpl no matter which theme I use in 1.7.5+ but not in 1.7.4

1.7.5.2 Bug FO Fixed Minor Shopping carts FO

All 15 comments

Hi @vincent-dp,

If you made the changes in the core, then you made an upgrade => those changes will disappear.
What are the exact changes that you made?
Thanks!

I didn't change anything before the theme forlder

@vincent-dp, so what are the exact changes that you made?
Thanks!

to the core? none.
Go like this:

  • Install 1.7.5.2 (the one we find on prestashop.com)
  • Go to back office and set the debug mode -> ON
  • set the template compilation -> force compilation
  • turn off the cache
  • Go to the product, select any of them, in the price tab, type in the field next to unitary_price "2.21" for example
  • go to %root%\themes\classic\templates\checkout_partial\cart-detailed-product-line.tpl and put {$product.unity} (which is refering to the field you typed in 2.21 before)
  • save and add the product we play with in your cart.
  • go to your cart and you get the lazyarray error thrown by symphoni
    "Warning: htmlspecialchars() expects parameter 1 to be string, array given"

you can turn off the debug as you see nothing displayed at the place you put the {$product.unity} variable

It do the same with many lazyarray variables like features' variables for example

this is a very big problem for me since my client use this input to store a number we have to show in the cart display and it cannont be another input (except if I put one myself but I don't want to change anything in the admin to keep a clean prestashop) How to fix it? Is it fixed in the next update?

@vincent-dp, so your issue is to display product unity in the cart page as your previous ticket?
Thanks!

Yes,
Except I now know it's a bug and not a normal behavior

@vincent-dp,

I did not manage to reproduce the issue with PS1.7.6.0beta1
I attached a video record
https://drive.google.com/file/d/1ARGL9jPb3m1_G7nzVnSxLyzSBHhfEgKk/view
I edited themes\classic\templates\checkout_partial\cart-detailed-product-line.tpl and I added {$product.unity}
I cleared cached => FO => Cart page => ok

Thanks!

Ok, but what about 1.7.5.2?

@vincent-dp, yes, it doesn't work with PS1.7.5.2
image

But it is fixed with PS1.7.6.0.
Since it is fixed, I close the issue.
Thanks!

"Since it is fixed, I close the issue."
Yes? Can you tell me how?

@vincent-dp, we should ask our developers.
ping @PrestaShop/prestashop-core-developers what do you think?

@vincent-dp, in the meantime, here's the changelog of the latest version PS1.7.6.0beta1:
https://assets.prestashop2.com/en/system/files/ps_releases/changelog_1.7.6.0-beta.1.txt

Thanks!

Ok I'll read it

How can I simply upgrade my presta to a beta version (does 1clickupgrade do it?)

@vincent-dp, as always, you can use the 1-click update to upgrade between minor versions without much trouble. In order to avoid problems, remember not to change core files, check the compatibility of your modules and theme beforehand, and test the upgrade on a separate machine from your production.

PS1.7.6.0 is a beta version & not a stable release.

Thanks!

Hello @khouloudbelguith @vincent-dp
I have currently the same trouble for themes\classic\templates\checkout_partial\cart-detailed-product-line.tpl
My customer is on PS1.7.5.1 and can't update to next version. I need to fix the bug manually. I checked the changlog but didn't see anything. Do you have any suggestion? Thank's a lot.

Was this page helpful?
0 / 5 - 0 ratings