View Single Post
  #9  
Old 09-27-2011, 02:34 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: help with products_list.tpl problem, repeating product?

Cool lets look at that file and disect it starting from the top.
Code:
{list2matrix assign="products_matrix" assign_width="cell_width" list=$products row_length=$config.Appearance.products_per_row}
First it is generating a matrix and assigning the products list. This is creaing a higher level of array than the typical array you would get from $products. See that row_length attribute? That is pulling the value from the DB that you select in the field I keep pointing you to. In fact you could just hard code that number here replace $config.Appearance.products_per_row with your number of columns. (but it would be better to just leave it configurable via general settings)

Right below that you can see it defining a foreach loop
Code:
{foreach from=$products_matrix item=row name=products_matrix}
This loop will create each row of the typical product table. See the <tr> right below it.

Then we see:
Code:
{foreach from=$row item=product name=products}
This is defining each cell of the table, see the <td> and </td>

Now look down the code, you will see the 2nd foreach statement is closing. {/foreach}

This entire first foreach statement simply displays the product codes, so for your intents and purposes you could remove it completely. The next foreach finally has some meat in it, the product thumbnails and links. They are called from customer/main/program_thumbnail.tpl with an include statement.

Of course I could go on, but hopefully you are seeing the pattern. It is not madness, it does make sense after you understand the concepts.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote