[email protected] Posted April 18, 2016 Share Posted April 18, 2016 Hi, I have a custom list with radio buttons for the declination of the product. But I want to get the product quantity by declination (and not all). I have the var ($product->quantity) but it display all quantity and not for each declination. I would like to dispkay near the radio button in the loop but I don't know which is the smarty var to use ? this is my loop : {foreach from=$group.attributes key=id_attribute item=group_attribute} <li> <input type="radio" class="attribute_radio" name="{$groupName|escape:'html':'UTF-8'}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} /> <span>{$group_attribute|escape:'html':'UTF-8'}</span> </li> {/foreach} If anyone know how can get the number of item inside the loop for each attribute I would be realy gratefull. Link to comment Share on other sites More sharing options...
musicmaster Posted April 18, 2016 Share Posted April 18, 2016 I don't know such details. But with some debugging code you can easily see whether the data you are looking for are already available inside the template. You can put {debug} in the template to get a complete overview of all data tranfered from PHP or you look at individual structures like this: {$products|print_r} 1 Link to comment Share on other sites More sharing options...
[email protected] Posted April 18, 2016 Author Share Posted April 18, 2016 the data I need is in the var $combination Smarty_Variable Object (3)->value = Array (4) 1 => Array (14) attributes_values => Array (1) 1 => "S" attributes => Array (1) 0 => 1 price => 0 specific_price => Array (0) ecotax => 0 weight => 0 quantity => 0 reference => "" unit_impact => 0 minimal_quantity => "1" date_formatted => "" available_date => "" id_image => -1 list => "'1'" 2 => Array (14) attributes_values => Array (1) 1 => "M" attributes => Array (1) 0 => 2 price => 0 specific_price => Array (0) ecotax => 0 weight => 0 quantity => 18 reference => "" unit_impact => 0 minimal_quantity => "1" date_formatted => "" available_date => "" id_image => -1 list => "'2'" 3 => Array (14) attributes_values => Array (1) 1 => "L" attributes => Array (1) 0 => 3 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 => "'3'" 4 => Array (14) attributes_values => Array (1) 1 => "XL" attributes => Array (1) 0 => 4 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 => "'4'" But I don't know how can I use this in my loop because it is not the same var name so I don't know how to go through the $combination with $groupname. I will do more research. Thank you for your help. Link to comment Share on other sites More sharing options...
[email protected] Posted April 18, 2016 Author Share Posted April 18, 2016 I got it {$combinations[$id_attribute]['quantity']} Thank you for your help Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now