Jump to content

Adding new product condition values


Recommended Posts

By default you can select New, Used and Refurbished in product edit page. I'd like to also add Exibition. I made some changes in /classes/Product.php:

'condition' => 					array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isGenericName', 'values' => array('new', 'used', 'refurbished', 'exhibitioned'), 'default' => 'new'),

... and /adminXXX/themes/default/template/controllers/products/informations.tpl:

<select name="condition" id="condition">
	<option value="new" {if $product->condition == 'new'}selected="selected"{/if} >{l s='New'}</option>
	<option value="used" {if $product->condition == 'used'}selected="selected"{/if} >{l s='Used'}</option>
	<option value="refurbished" {if $product->condition == 'refurbished'}selected="selected"{/if}>{l s='Refurbished'}</option>
	<option value="exhibitioned" {if $product->condition == 'exhibitioned'}selected="selected"{/if}>{l s='Item from exhibition'}</option>
</select>

Now I have another option in the list, there's success note after saving but, value in database ps_product and ps_product_shop tables is always set to New, even if I try to change Used or Refurbished to Exhibitioned. How to make it work?

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

  • 2 weeks later...
  • 5 weeks later...

I think what you've done so far is correct, but still not enough. If you look at the schema of the ps_product table that's in your database, you'll notice that the condition field is of ENUM type which will allow just the new, used and refurbished values. If you try to update the field with any other value, MySql will use the default instead, which is new.

 

So, try to ALTER that table to allow the exhibitioned value as well. Try this locally and then, only if it solves your problem, execute it on the live database.

ALTER TABLE `ps_product` CHANGE COLUMN `condition` `condition` ENUM('new','used','refurbished','exhibitioned') NOT NULL DEFAULT 'new' AFTER `available_date`;

Also, do the same to the ps_product_shop table.

ALTER TABLE `ps_product_shop` CHANGE COLUMN `condition` `condition` ENUM('new','used','refurbished','exhibitioned') NOT NULL DEFAULT 'new' AFTER `available_date`;
Edited by BrightSoul (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 month later...

 

I think what you've done so far is correct, but still not enough. If you look at the schema of the ps_product table that's in your database, you'll notice that the condition field is of ENUM type which will allow just the new, used and refurbished values. If you try to update the field with any other value, MySql will use the default instead, which is new.

 

So, try to ALTER that table to allow the exhibitioned value as well. Try this locally and then, only if it solves your problem, execute it on the live database.

ALTER TABLE `ps_product` CHANGE COLUMN `condition` `condition` ENUM('new','used','refurbished','exhibitioned') NOT NULL DEFAULT 'new' AFTER `available_date`;

Also, do the same to the ps_product_shop table.

ALTER TABLE `ps_product_shop` CHANGE COLUMN `condition` `condition` ENUM('new','used','refurbished','exhibitioned') NOT NULL DEFAULT 'new' AFTER `available_date`;

SHARAK did BrightSoul's suggestion work?

Link to comment
Share on other sites

  • 4 weeks later...

SHARAK did BrightSoul's suggestion work?

Hi Everybody,

 

 

I did all what mentioned above and everything seems working fine except one thing 

In the product page under the product model number where it should show the new condition i added "floor model", it is instead showing empty

 

Any idea what wrong i am doing

Thanks a lot

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

Hi Ravell,

 

I am new to prestashop, could you please explain more how can i access the ps_product table, where do i find that

Thanks a lot

 

 

you have to use database manager like phpmyadmin

you need to open it, then go to table named ps_product

 

you've got an access to phpmyadmin?

Link to comment
Share on other sites

you have to use database manager like phpmyadmin

you need to open it, then go to table named ps_product

 

you've got an access to phpmyadmin?

Yes my friend i did all that and added the condition floor model but still not showing on the customer side

Link to comment
Share on other sites

×
×
  • Create New...