Jump to content
Psytanium

Fix special price based on percentage

Recommended Posts

Hello,

Is there a way or addon to make the special price change when the original price change ?

For e.g. I added 20% discount on a product priced 1000$, now the special price is 800$, but when I increase the original price to 2000$ the special price is still 800$ instead of 1600$.

Trying to make the special price change automatically if the discount is percentage.

Thanks

Share this post


Link to post
Share on other sites

Special Price is stored as a price.  It does not know it is a percentage:

CREATE TABLE specials (
  specials_id int NOT NULL auto_increment,
  products_id int NOT NULL,
  specials_new_products_price decimal(15,4) NOT NULL,
  specials_date_added datetime,
  specials_last_modified datetime,
  expires_date datetime,
  date_status_change datetime,
  status int(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (specials_id),
  KEY idx_specials_products_id (products_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Therefore what you want, cannot (easily) happen.


Help shape the future of Phoenix; join the Phoenix Club

Share this post


Link to post
Share on other sites

Hi @burt, If I add new column to the specials table, storing the percentage what else should i modify ? You think this can be done on the level of listing_query in index.php ? I mean by changing the final_price value.

Share this post


Link to post
Share on other sites
30 minutes ago, Psytanium said:

If I add new column to the specials table, storing the percentage

This would not be a small change. 

It might be easier to add a categories.preAction hook that checked if the product price changed and updated the specials price appropriately.  This could involve a new column that would be a boolean for update or not.  Or it could happen always.  Then the catalog code would not need to change, only the admin behavior. 

 


Always back up before making changes.

Share this post


Link to post
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

×