Jump to content

Add a new attribute to products


Nuvish

Recommended Posts

How to add a new attribute in admin products page?
for example,add a new column 'favorite' between the other attributes.

Iv added a new field in the database of prestashop,table:ps_category_product,iv added favorite(tinyint).

By adding this line in adminproducts.php:
---> 'favorite' => array('title' => $this->l('Favorite'),'active' => 'favorite', 'width' => 30, 'align' => 'center','type' => 'bool','orderby' => false),

This makes favorite appear in the admin catalog page.

Then iv added cp.`favorite` like this in the codes :

$this->_select = 'cp.`position`,cp.`favorite`, i.`id_image`,(a.`price` * ((100 + (t.`rate`))/100)) AS price_final';

This makes the small red crosses appear in the page,in the favorite column.
But then,how to make all this work?
like when i click on a cross,it updates the database(favorite field) and actually make the product become a favorite one.

Link to comment
Share on other sites

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