Jump to:

2082 Posts in 1002 Topics by 452 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Is it possible to have temporary per-product discounts?

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 565 Views
  • HansR
    Avatar
    Community Member
    140 Posts

    Is it possible to have temporary per-product discounts? Link to this post

    Does the e-commerce module (version 0.9, I haven't had time to upgrade to 1.0 yet) have the ability to set temporary discounts for a product? I'm thinking along the lines of the usual <<insert holiday>> specials in which the original price is quoted but crossed out, and the special price is shown. The product template does include this feature, but I haven't seen any method to set a discounted price on a per-product basis.

    If this feature isn't available yet, what would be the best method of adding it? I'm not particularly familiar with the e-commerce module's APIs for adding custom behaviour.

    Hans

  • AlphaCactus
    Avatar
    Community Member
    11 Posts

    Re: Is it possible to have temporary per-product discounts? Link to this post

    A simple way would be to decorate the Product class, and ProductVariation if using them. I added a SalePrice and OnSale Boolean then

    function updateCalculatedPrice( $price ) {
          return ($this->owner->OnSale ? $this->owner->SalePrice : null);
       }


    You could also add Start/End dates for the sale.
    However, this requires setting each product's price manually.

    For a more advanced approach, you would likely have to create your own completely separate ProductDiscount class that allows you to employ more advanced rules and perhaps the ability to apply the same rule to multiple products. Then parse those rules in updateCalculatedPrice.

  • AlphaCactus
    Avatar
    Community Member
    11 Posts
  • HansR
    Avatar
    Community Member
    140 Posts

    Re: Is it possible to have temporary per-product discounts? Link to this post

    @AlphaCactus

    Thanks. That's easier than I thought.

    The complex pricing documentation is a bit vague, but it might do almost everything that I want. The one thing that's missing is being able to display a name for the special and the deadline on the product page (e.g., "<<event>> sale ends <<date>>").

    Hans

    565 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.