Jump to content

[SOLVED] Show Product Reference in categories


Recommended Posts

Hello,

 

Is there a way to make the product reference display next to a product when being viewed in a category?

 

Currently just the short description/title displays but I would also like the reference to display.

 

Does anyone have an idea of how to achieve this?

 

Thank you!

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

Hello,

 

Is there a way to make the product reference display next to a product when being viewed in a category?

 

Currently just the short description/title displays but I would also like the reference to display.

 

Does anyone have an idea of how to achieve this?

 

Thank you!

 

what prestashop version you use?

  • Like 1
Link to comment
Share on other sites

Hello,

 

I am using 1.5.4.1.

 

:)

 

so it's very very easy. All you have to do is to edit produt-list.tpl file.

 

open the themes/YOUR_THEME/product-list.tpl file

 

and insert this:

{$product.reference}

anywhere you want (remember that it must be in foreach loop)

 

for example, reference above the product name:

{$product.reference}
<h3><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'|truncate:35:'...'}</a></h3>

  • Like 2
Link to comment
Share on other sites

You're welcome

 

I've noticed that you're active here on forum, so you probably work hard with your template - so my question is: it is possible to check your website ? ;) I am very curious what you've got;)

Link to comment
Share on other sites

  • 4 months later...
  • 7 months later...
  • 2 months later...

Could it be that this don´t work for ps 1.6? I cheked the product reference in the product.tpl and it is similar as yours ---{$product.reference} --- but altought I paste it in the product list.tpl I cant make it work. This is the full code that appears in the product.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">{if !isset($groups)}{$product->reference|escape:'html':'UTF-8'}{/if}</span>
</p>
Link to comment
Share on other sites

The {$product.reference} worksin ps1.6. The problem is when changing the view from grid to list. Tha is changed in the global.js file but not sure how as it is not a div or class.

 

Any ideas?

 

I used the following code:

 

<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>
 
In the global.js:
html += '<p id="product_reference">'+ $(element).find('.product_reference').html() + '</p>';
 
But when I switch from grid to list it changes to undefined
Edited by Alejandrosi (see edit history)
Link to comment
Share on other sites

  • 2 months later...

What I use on http://www.winerepublic.ro/ro/vin-alb/1697-solo-quinta-cramele-recas-5942084501903.html

 

<!-- SKU EAN Product ID Model -->
 
                                   <meta itemprop="sku" content="{$product->reference|escape:'html':'UTF-8'}" />
                                   <meta itemprop="gtin13" content="{$product->ean13|escape:'html':'UTF-8'}" />
                                   <meta itemprop="productID" content="" />
                                   <meta itemprop="model" content="" />
 
<!-- /SKU EAN Product ID Model -->
Link to comment
Share on other sites

  • 2 weeks later...

Hello all,

I upgrade from 1.5 to 1.6 and I managed to have my theme stable and working, I am having a problem when I go to a product that has combinations as the reference number is not present at the moment that loads, but when I select any option from the combinations the reference appears, the intention is to have the reference all the time visible.

I remember making some changes in my 1.5 install and theme for that porpoise but I do not know what is that it has to be changed for the 1.6.

Here is a link to one of the products http://store.perezsanz.com/us/index.php?id_product=385&controller=product

Any help will be appreciated, please let me know if you need more information. (I am not an expert in code)

Thank you!

Link to comment
Share on other sites

Hello,

 

Look for a style=display: none in the product.tpl and remove it. If not, it can be in the css file.

Thank you soo much for your assistance! it seems it works!

I did the change in product.tpl if any help i am posting where exactly as there are more than one style= display: none

in the file:

    <p id="product_reference" {if isset($groups) OR !$product->reference}style="display: none;"{/if}>

to this:

    <p id="product_reference" {if isset($groups) OR !$product->reference}{/if}>

Other tip, just change it in the theme you are working on and always keep a BAK :)

Link to comment
Share on other sites

  • 1 year later...
  • 3 months later...

Hi. What i do wrong? In Product.tpl this:

<p id="product_reference" {if isset($groups) OR !$product->reference}style="display: none;"{/if}><label for="product_reference">{l s='Model:'}</label><span class="editable">{$product->reference|escape:'htmlall':'UTF-8'}</span></p>

 work ok, but when i copy this code in my modul2.tpl i dont see nothing , only when i delete "display: none;" i see only label 'Model:' not reference.

 Thank You

Link to comment
Share on other sites

  • 11 months later...
  • 1 year later...
On 5/16/2013 at 10:00 PM, vekia said:

so it's very very easy. All you have to do is to edit produt-list.tpl file.

open the themes/YOUR_THEME/product-list.tpl file

and insert this:


{$product.reference}
 

anywhere you want (remember that it must be in foreach loop)

This method worked great for me in PrestaShop 1.6. I am now testing out PrestaShop 1.7 and wanted to add the same thing.

Is this possible and how do I go about it?

Any help would be much appreciated.

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

  • 3 years 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...