Jump to content

Product reference in product list prestashop 1.6 Again


dtwfung
 Share

Recommended Posts

Hi There,

 

With the great help on this thread 

https://www.prestashop.com/forums/topic/352356-product-reference-in-product-list-prestashop-16/

 

in product-list.tpl,

<p id="product_reference"{if empty($product.reference) || !$product.reference} style="display: none;"{/if}>
     <label>{l s='Model#:'} </label>
      <span class="editable" itemprop="sku">{$product.reference}</span>
 </p>
 
I'm able to make product reference number displayed on grid, list view and  "popular" (homefeature) .
 
But strange behavior on "Best Seller block" (BestSellerBlock). Some with reference number display  and some have not. (p.s. all products have reference number)
if I just put this instead
<label>{l s='Model#:'} </label> {$product.reference}
I got this error in those products had NO reference shown before
Model#:XXX/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 200
 
 
Any things I have missed ...
 
note: I am using 1.6.0.14 and standard theme.
 
Thanks in advance.

 

Share this post


Link to post
Share on other sites

Take a look at the file classes/ProductSale.php method: getBestSalesLight

 

In the SQL there, the reference is not selected, you need to add it to the query

 

Add this code after the first select

p.reference,

So it becomes like this

$sql = '
SELECT p.reference, ......

Of course, modifying directly on core files is not recommended because updates will be more difficult

You need to override the method

Copy the attached file, to the folder override/classes/

if the file ProductSale.php exists, copy the method inside it, and then clear PrestaShop cache to refresh the overrides

 

More on overrides here

 

ProductSale.zip

Edited by Tuni-Soft (see edit history)
  • Like 1

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More