Jump to:

2076 Posts in 857 Topics by 449 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » TotalDeliveryModifier help needed

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: 317 Views
  • Zyzzza
    Avatar
    Community Member
    25 Posts

    TotalDeliveryModifier help needed Link to this post

    Hi,

    I'm testing 0.8.2 rc1 and need to create a modifier for adding shipping price if TOTAL is less then 100USD, and would charge 5USD delivery charge if TOTAL is less then 100USD.

    Maybe anyone post a solution here, as I'm not really familiar with modifiersand not surte how to store all that in Database and on invoices

    cheers

  • Zyzzza
    Avatar
    Community Member
    25 Posts

    Re: TotalDeliveryModifier help needed Link to this post

    OK, solved that (in fact I've solved almost all my questions i've asked on forum myself )

    So, just in case someone comes here for the same task , below is the code for the modifier (as usuall - you have to enable it in _config.php, build DB , and then tweak some SS files to ensure it shows up on receipts and reports)

    <?php

    class PriceShippingModifier extends OrderModifier {

       function LiveAmount() {
          
          $order = $this->Order();
          $total = $order->SubTotal();
          
    //If total is more than 200 than delivery is free, otherwise - charge 5 bux

          if ($total<=200){ return 5; }
          else { return 0; }
             
        }
       
        function CartTitle() {
          $order = $this->Order();
          $total = $order->SubTotal();
          
          if ($total<=200){ return "Delivery"; }
          else { return "Free Delivery"; }

        }

        function TableTitle() {
          $order = $this->Order();
          $total = $order->SubTotal();
          
          if ($total<=200){ return "Delivery"; }
          else { return "Free delivery"; }

          
        }

       

    }

    317 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.