Jump to content

display product condition field on product page v1.4


Recommended Posts

Hi all,

You can specify 'condition' of a product in admin. However this does not show in the front end when viewing a product.
I want to display 'condition' below 'reference' on the customer product page.

I added the code below:

reference}style="display: none;"{/if}>{l s='Reference :'} {$product->reference|escape:'htmlall':'UTF-8'}

<!-- condition-->
{if $product->condition}

{l s='Condition :'} {$product->condition|escape:'htmlall':'UTF-8'}{/if} 

<!-- warranty-->
{if $product->warranty}

{l s='Warranty :'} {$product->warranty|escape:'htmlall':'UTF-8'}{/if} 



However although $product->condition & $product->warranty contain different info in the database they are displaying the same information as the product reference.

You can see this here: http://www.happylaptops.co.uk/product.php?id_product=10

The database values for condition and warranty are 'Used' and '3 Months' respectively, but as you can see, they all display the same info on the product page.

Please help!

:)

Link to comment
Share on other sites

I saw your post yesterday but was too busy to look into it. I wanted to let you know that I took your exact code and it worked perfect for me. I didn't add the warranty to the database but the Condition showed up and worked correctly (as did the Reference).

Not sure this helps you but I wanted you to know that it worked in my demo store.

Marty Shue

Link to comment
Share on other sites

Thanks Marty Shue :)

This is a strange one, i've noticed now it works for pretty much all the products on my site e.g. http://www.happylaptops.co.uk/product.php?id_product=16

...but specifically not for this product:

http://www.happylaptops.co.uk/product.php?id_product=10

For this last product above, whichever of the 3 fields 'reference' 'condition' or 'warranty' is at the top, has it's value copied to the 2 fields below.

I just don't get it! I can't see any issues in the database either.

There must be a logical reason for it.
Any ideas?

Thanks

Link to comment
Share on other sites

Hi Marty!,

I have figured out what is causing the 'condition' do display incorrectly.

It happens when a product has 'attributes' set.
This product http://www.happylaptops.co.uk/product.php?id_product=10 has a choice of RAM as you can see. This is set in the 'combinations' TAB in prestashop admin.

Any products which have combinations set have this problem with the condition & warranty showing incorrect values.

I have no idea why this is happening?

Do you?

Cheers

Link to comment
Share on other sites

  • 1 month later...

If you move the 'reference' and 'condition' fields outside of the div they are contained in be default, it works. It's very odd.
Try echoing the variables somewhere else on the page and you'll see they are OK.

I don't know why this happens.

So you can either change where you display the info, or add new code to the product controller or product class ( i can't remember which one off hand) to pass the variables to Smarty with different variable names and it will work.

Link to comment
Share on other sites

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