This one is worth two gold stars.
I am working out of Cristian Darie's PHP and MySQL Ecommerce 2nd edition book and am woefully stuck on chapter 6. For some reason, on the main page load (i.e., index pulling in products_list.tpl) I am getting a repeating option dropdown and all of the choices are a single attribute.
Attached is a picture of the problem. Also, the following is, what I believe, is the relevant code:
From the file called products_list.tpl:
{* Generate the list of attribute values *}
<p class="attributes">
{* Parse the list of attributes and attribute values *}
{section name=1 loop=$obj->mProducts[k].attributes}
{* Generate a new select tag? *}
{if $smarty.section.1.first ||
$obj->mProducts[k].attributes[1].attribute_name !==
$obj->mProducts[k].attributes[1.index_prev].attribute_name}
{$obj->mProducts[k].attributes[1].attribute_name}:
<select name="attr_{$obj->mProducts[k].attributes[1].attribute_name}">
{/if}
{* Generate a new option tag *}
<option value="{$obj->mProducts[k].attributes[1].attribute_value}">
{$obj->mProducts[k].attributes[1].attribute_value}
</option>
{* Close the select tag? *}
{if $smarty.section.1.last ||
$obj->mProducts[k].attributes[1].attribute_name !==
$obj->mProducts[k].attributes[1.index_next].attribute_name}
</select>
{/if}
{/section}
</p>
</td>
To help visually express this problem, I have attached two screen shots. The first shows what the index file shows, which is a strange attribute error. The second picture shows what clicking on an individual product displays: a nice, properly rendered page.
Before you suggest that I simply copy the code block from the latter tpl to replace the former, I will let you know that that experiment yielded fascinatingly bizarre errors that lacked any backtrace save only references to the Smarty framework files.
I am upping the ante on this one: 10 bucks on Amazon to the sleuth who can solve this! problem