Jump to content

Add a new product condition


Recommended Posts

The shop I'm putting up is selling fruits and vegetables. So obviously, I don't need the "new, used or refurbished" condition. However, I'd like to use this conditions to reflect the way the veggies are sold, such as "per kilo", "per piece", "per slice" or whatever.

 

So far, I've managed to change the admin part (I'm now able to choose the new condition). That's what I did :

 

In /adminxxx/themes/default/template/controllers/products/informations.tpl line 306, I've added my new conditions. 
 
I've changed the field in table _product so it can accept other values as well :
ALTER TABLE  `ps_product` CHANGE  `condition`  `condition` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT  'kilo';
I've also changed the validating type in /classes/Product.php line 291 :
'condition' =>  array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isString'),
That works well. 
 
However, the new conditions are not visible on the frontend. What I did is :
 
in /themes/xxxx/product.tpl line 168 I've made the following changes :
 
{capture name=condition}
{if $product->condition == 'kilo'}{l s='Prix au kilo'}
{elseif $product->condition == 'piece'}{l s='Prix a la piece'}
{elseif $product->condition == 'part'}{l s='Prix a la tranche'}
{elseif $product->condition == 'new'}{l s='New'}
{elseif $product->condition == 'used'}{l s='Used'}
{elseif $product->condition == 'refurbished'}{l s='Refurbished'}
{/if}
{/capture}
I've also changed the page /modules/blocklayered/blocklayered.php, line 2442 (I've added my new conditions)... though I'm not sure what exactly it does :huh2:
 
That's it... but its not working: the new condition is correctly inserted in the db but doesn't show up on the product page (actually, the $product->condition doesn't contain any value = it's empty !).
 
What did I miss ? Any thought on this ?
 
Thank youuuuuuu 
 

PS : I'm using the new 1.6 version

Link to comment
Share on other sites

×
×
  • Create New...