Jump to content

Solved (kinda) custom product condition


wiscardboard

Recommended Posts

I've gone through the process of modifying the database product and product_shop tables condition enum to accept different conditions than 'new', 'used' etc. Everything works fine, my front office updates the conditions just as it is supposed to, I can toggle on/off to display the condition as I should be able to. 

The problem is, no matter what I do I can not seem to get the product condition to display on the product page. You can see from the link below that I can successfully modify the page to look the way I want, and I'm sure I have gone through and modified all the required pages to change the condition values. I just don't understand what is going on..

 

https://wiscardboard.com/sun-moon/79-alolan-diglett.html

This is the code I want to have input under the price of the product on the above linked page. Please help, I really don't know what to do and why it won't work.

      <div class="product-condition">
        <label class="label"><b>{l s='Condition: ' d='Shop.Theme.Catalog'}</b> </label>
                <span>{$product.condition.label}</span>
      </div>

 

Prestashop version 1.7.5.0

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

After thinking about how to get the condition to display correctly, I decided to take a roundabout way of making it happen, and here is what I came up with.

 

I added this code to product.tpl

{foreach from=$product.features item=feature}
							
{if $feature.id_feature == 11}
<span><label class="label"><b> {$feature.name}:</b></label> <font class="label">{$feature.value}</font></span> 
{/if}
							
{/foreach}

In the code '11' is the id of the 'Condition' feature I created. I added my desired conditions to the feature and I simply add them to the product when I put them into the catalog. The code then displays the condition I selected on the product page. I've also added the condition to the quick view as well as the miniature page (with slightly different coding), as well as the invoice product tab.tpl via the invoice.php file.

Link to comment
Share on other sites

Hi, same problem here.

Fresh install of Prestashop 1.7.5.0 and default theme (classic)

I try to print $product.condition but only get empty strings. After that i try $product.condition.label with same result.

Then i try wiscardboard's suggestion, but my foreach never run.

i'm missing something???

PD. clear cache after every code change
PPD. i print text flags before and after so i can confirm that i'm changin the right file.

 

 

Link to comment
Share on other sites

Try to run it without the {if} section. It should print out all the features of the product. The only reason my condition shows is because I have a feature named 'Condition' with values set for the product(s). If you don't have any features added to the product nothing will show.

 

{foreach from=$product.features item=feature}
							
<span><label class="label"><b> {$feature.name}:</b></label> <font class="label">{$feature.value}</font></span> 
							
{/foreach}

If you want a specific feature to display you can add the {if} back in with that specific feature ID, you can see the ID on the feature tab in the back office.

Link to comment
Share on other sites

Yes, my code is:

*start*
{foreach from=$product.features item=feature}
	*step*
{/foreach}
*end*

Clear cache and reload page and only see the *start* and the *end* flags. I feel i missing something really obious... sorry.

Btw, i forgott to mention that althought my prestashop is a fresh installation, my products are migrated with a miggration addon, so i check de old ps_product and the new one and noticed a new field called show_condition with value 0. After change to 1 in ps_product and ps_product_shop the $product.condition.label is showing fine.

In the options tab of the product page i find a checkbox called "show condition in product page" but i can't find a global option to configure all new products in the backoffice.

(Sorry for my English)

  • Like 1
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...