Jump to content

smarty get offset of array in product page


piotrowski-s@hotmail.fr

Recommended Posts

I have some trouble in prestashop 1.6 using smarty.


I have an array, but its offset are not reset for each product.


so for the firdst product, with attrivute it has offset 1,2,3,4 Then for the next product it has offest 5,6,7,8 etc.


I have that kind of array



$combinations Smarty_Variable Object (3)
->value = Array (4)
5 => Array (14)
attributes_values => Array (1)
1 => "S"
attributes => Array (1)
0 => 1
price => 0
specific_price => Array (0)
ecotax => 0
weight => 0
quantity => 20
reference => ""
unit_impact => 0
minimal_quantity => "1"
date_formatted => ""
available_date => ""
id_image => -1
list => "'1'"
6 => Array (14)

I try to go trhough this array but it does not work when I put empty offset (it is inside a foreach)



{$combinations[]['quantity']}

How can I tell him to go trhough the first iteration, and then in the second automatically ?


This return to me the following errors.



Fatal error: Cannot use [] for reading in /htdocs/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 584

I can not tell him which offset to use, because for each product it goes up and is not reset to 0.


I would be very gratefull for anykind of help.


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...