I am working on converting commerce theme to Drupal Template and have difficulty understand how the Product attribute selection works in the product display.
i have one product display type for multiple products. There is wide variation of products(i.e. runner shoes, tennis shoes,etc). For each product display instance i have selected few of those variations(i.e for Runner shoes i have red runner shoes small , blue runner shoes small, blue runner shoes large, etc). It works nice where user are able to select the attributes and the particular product is displayed.
In the template.php, i load the product display instance:
$node = $vars['node'];
This instance has reference to the products($node->field_product). So far so good:) The difficulty is to determine which product of these referenced is currently displayed. How can i do that? In what variable is the object or its id is stored? I see in the default html things like:
attributes[field_template_type]
How is this all thing working? Any help or source of reference much appreciated