Jump to content

a loop in related products


ruisonika

Recommended Posts

Hello guys i need some assistant, please.
I'm working with prestashop 1.6 version.
In database ps_products i've created a field with name compatible_prod and in that field for each product row i will put a number.

Ex.

id_product ... compatible_prod
    1                       256

    2                       256

    3                       123

   4                        763

   5                        256

This means that product with id_product (1,2,5) are compatible, and for this in product.tpl i want to show them (at the end) with a loop.
I was trying like the accessories but with no luck.

 

{if isset($product->compatible_prod) && $product->compatible_prod > 0}
      <section class="block block-borderbox products_block clearfix">
           <h5 id="" class="title_block">{l s='Compatible Products'}</h5>
           <div class="block_content">
           {assign var='column' value=Configuration::get('PTS_CP_PRODUCT_ACCROW')}
           {assign var='scolumn' value=12/$column}
           {include tabname="ptsaccessories" file="$tpl_dir./sub/products_module.tpl" itemsperpage=Configuration::get('PTS_CP_PRODUCT_ACCROW') scolumn=$scolumn products=$accessories class=''}
         </div>
      </section>
{/if}

 

How can i change this to work for me?
or another solution, a simple foreach in tpl file (is it possible)?

Many many thanks...
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...