"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"
.. ... CHAPTER 6 ?– PRODUCT ATTRIBUTES 187 {* Close the select tag? *}
So how is this output calculated? The key is the Smarty logic included in the product.tpl and products_ list.tpl templates. This code parses the list of attributes that??™s loaded by the business tier. This data is, in fact, the data returned by the catalog_get_product_attributes stored procedure: {section name=k loop=$obj->mProduct.attributes} For each element of that list, several steps are made to decide what kind of output to generate. Take, for example, the following code snippet, which is an {if} conditional statement that returns true for the first element and for the elements whose attribute name is different than the attribute name of the previous element: {* Generate a new select tag? *} {if $smarty.section.k.first || $obj->mProduct.attributes[k].attribute_name !== $obj->mProduct.attributes[k.index_prev].attribute_name} In short, this condition returns true each time a new attribute (such as Size and Color) needs to be displayed. When this happens, we generate a new