Jump to content

Show product accessoires in product-list


Recommended Posts

Hi fans.

I have a simple problem:
I want to display the product accessoires in the product-list.

 

In the detail view (product.tpl) I find the right part:

{if isset($accessories) && $accessories}
...
{/if}

I copy & paste the part into the product-list.tpl but it seems the variable $accessoires is empty in the list view.

 

Is there a solution to the problem?

 

Cheers André

Link to comment
Share on other sites

Thanks for your tipp!

 

I added some lines to Product.php, which is called from CategoryController

to have all data in an sub-array within the variable $product for the product-list.tpl

{if isset($product.accessories) && $product.accessories}
  ..
  {foreach from=$product.accessories item=accessory name=accessories_list}
    // same code from product.tpl
  {/foreach}
  ..
{/if}

Quick and dirty but it works!

Link to comment
Share on other sites

  • 5 months later...

Hello Andre, could you tell me how did you add the propperty "accessories" to the $product object in product.php to do that property accessible in product-list.tpl

 

I'm a little new with some concepts of prestashop and i need to show in the homefeatured block of the home in my page the price of the most cheap accessorie instead of real price if the product has accessories, and at the momment these kind of products show a 0.00 €

 

It would be very nice if you of someone can reply me as quick as possible because my shop is closed now in maintennance for it.

Link to comment
Share on other sites

  • 3 months later...

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...