1999 Posts in 530 Topics by 433 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, Howard, Sean, Ryan M., biapar, Willr, Ingo, Jedateach, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 238 Views |
-
TotalDeliveryModifier help needed

17 October 2011 at 5:45am
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
-
Re: TotalDeliveryModifier help needed

18 October 2011 at 6:26am
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 buxif ($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"; }
}}
| 238 Views | ||
|
Page:
1
|
Go to Top |

