Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fix special price based on percentage


Psytanium

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

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...