Jump to content

Display product description in "bestsellers" module.


Recommended Posts

Hi, I'm developping a theme for PS 1.6 in wich I need to display product description on homefeatured, blocknewproducts, blockspecials and blockbestsellers.

 

So I modified "product-list.tpl" to display full description instead of the short default one.

That's working fine except for "blockbestsellers".

I've checked on a fresh install and it seems to be the same: only description_short can be displayed on this module.

I gave a look at the code but didn't see anynthing special that could explain this...

 

Give a look at the screenshot of the page.

Any idea?

Thanks.

post-960658-0-93640400-1498557658_thumb.jpg

Link to comment
Share on other sites

So, I did a var_dump on the $best_sellers variable in blockbestsellers-home.tpl, where the product-list.tpl file is called:

array (size=39)
      'id_product' => string '100' (length=3)
      'id_product_attribute' => int 905
      'link_rewrite' => string 'tabouret-a-vis' (length=14)
      'name' => string 'Tabouret à vis' (length=15)
      'description_short' => string 'blablabla' (length=9)
      'id_category_default' => string '52' (length=2)
      'id_image' => string '100-827' (length=7)
      'legend' => string 'Tabouret à vis' (length=15)

(...)

No trace of 'description' variable, contrary to the var_dump of $specials from blockspecials-home.tpl :

'pack_stock_type' => string '3' (length=1)
      'id_shop' => string '1' (length=1)
      'description' => string '<p>test description</p>' (length=23)
      'description_short' => string '' (length=0)
      'available_now' => string 'Expédié sous 10 jours ouvrés' (length=31)
      'available_later' => string 'Expédié sous 10 jours ouvrés' (length=31)

(...)

So I guess the varible isn't defined in the bestsellers module. After looking into the code I can't see where it's defined in blockspecials...

Edited by FLORENT GERAULT (see edit history)
Link to comment
Share on other sites

Ok, I solved it by myself ! :)
So the difference of blockbestsellers is that it uses the ProductSale class and not the the Product one (classes/ProductSale.php).

In this class, there's a sql query where developpers only selected the description_short:

 $sql = '
 SELECT
    p.id_product, IFNULL(product_attribute_shop.id_product_attribute,0) id_product_attribute, pl.`link_rewrite`, pl.`name`, pl.`description_short`, product_shop.`id_category_default`,
    image_shop.`id_image` id_image, il.`legend`,
    ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category, p.show_price, p.available_for_order, IFNULL(stock.quantity, 0) as quantity, p.customizable,

So just create an override and add the long description select:

 $sql = '
   SELECT
      p.id_product, IFNULL(product_attribute_shop.id_product_attribute,0) id_product_attribute, pl.`link_rewrite`, pl.`name`, pl.`description`, pl.`description_short`, product_shop.`id_category_default`,
      image_shop.`id_image` id_image, il.`legend`,
      ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category, p.show_price, p.available_for_order, IFNULL(stock.quantity, 0) as quantity, p.customizable,

Clear cache and tadaaam !

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