Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Product Department Discount


Recommended Posts


I'm working on a contribution which will allow for a per-department style of discount (ie, 10% off this week in manchester, 25% in electronics, etc.). It will also enable these discounts to work for specific customers or not (that's global at the moment, so you won't be able to have Customer A only get their discount in manchester, and Customer B in Electronics only... but I digress)


I've managed to get around 90% of the work done by using as templates the product_attributes, and creating a new table plus extending customer and products. However, I'm kind of 'stuck' at one point.


I don't want a logged in user to see a regular price AND the disccounted price, just the discounted price. However, where to put this? The call to currency->display_price seems to be around the most sensible place to put the logic to subtract the discount. However, this routine has now knowledge of the product_id or the customer_id, both of which are vital to apply and calculate the percentage (if applicable).


I'd appreciate suggestions as to where this extra code (the actual calculation) should go. I'm half of a mind to modify the display_price routine to accept a product_id and customer_id field, but that's obviously going to require re-writing each call of that function. So, before I completely break everything here, I'd appreciate anyone's thoughts.





Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...