Jump to content

get product quantity by declination


piotrowski-s@hotmail.fr
 Share

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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}

  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More