M
M
Maxim Maxim2017-01-18 12:41:23
CMS
Maxim Maxim, 2017-01-18 12:41:23

How to display a list of products in simpla cms?

People, tell me please, I ran into a problem ... You need to make the output of the goods in a table, that is, something like this:
e997cc204b4c4b279ef8cc32d2e3adae.JPG
there is a code:

<table id="purchases">
<tr>
  {* Изображение товара *}
  <td class="image">
    {if $product->image}
    <a href="products/{$product->url}"><img src="{$product->image->filename|resize:150:150}" alt="{$product->name|escape}"/></a>
    {/if}
  </td>
 	{* Название товара *}
  <td class="name">
    <a data-product="{$product->id}" href="products/{$product->url}">{$product->name|escape}</a>		
  </td>

  {* Цена за единицу *}
  <td class="price">
    {$product->variant->price|convert} {$currency->sign|escape}
  </td>

  {* Количество *}
  <td class="amount">
   <form class="variants" action="/cart">
                    <table style="display: none;">
                    {foreach $product->variants as $v}
                    <tr class="variant">
                        <td>
                            <input name="variant" value="{$v->id}" type="radio" class="variant_radiobutton" {if [email protected]}checked{/if} {if $product->variants|count<2}style="display:none;"{/if}/>
                        </td>
                        <td>
                            {if $v->name}<label class="variant_name">{$v->name}</label>{/if}
                        </td>
                        <td>
                            {if $v->compare_price > 0}<span class="compare_price">{$v->compare_price|convert}</span>{/if}
                            <span class="price">{$v->price|convert} <span class="currency">{$currency->sign|escape}</span></span>
                        </td>
                    </tr>
                    {/foreach}
                    </table>
                    <input type="submit" class="button2" value="в корзину" data-result-text="добавлено"/>
                </form>
  </td>

</tr>

</table>

Of course, he constantly duplicates the table for each product, how to make it so that there is one table and only lines are added to it when a product is added to the site? thank!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question