You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
Pages: 1
Goal: Offer a $1.50 discount on more than one item bought in the v8 store.
I scripted this
///START QUANTITY DISCOUNTS CALCS
$orderqty = $info['quantity'];
if($orderqty > 1({
$qtydiscountvalue = $orderqty - 1; $discountcomment = 'Receive a \$1.50 discount per additional item added to your purchase.';
}else{
$qtydiscountvalue = 0; $discountcomment = 'Purchase another item and receive a \$1.50 discount per additional item.';
}
$qtydiscount = 1.50 * $qtydiscountvalue;
//echo both $qtydiscount and $discountcomment
///END QUANTITY DISCOUNTS CALCS
to more or less figure out the logic. There may be a cleaner way. Question now is how to apply it so the customer sees it. Preferably, it show up in the Shopping Cart so that when they see the discount it might encourage them to buy more.
Offline
This is a custom sale, so add it as a Custom Sale script under Store / Commerce / Custom Sale Methods, and activate it under Store / Component / Settings / Checkout, update Custom Sale Method and Custom Sale Method Status. This will get it actually working in checkout. In order to get the quantity of items in the cart:
$cartids = $this->globals('ecom.checkout_cartids'); $count = 0; foreach ($cartids as $cartid => $item) {$count = $count + $item['quantity'];}
You could add this type of code inline, but looking at the $cart in {private}/apps/ecom/ECOM/includes/cartdisplay.php if you want to add it to the shopping cart page too.
Offline
Thanks Nick. Further to that idea, is it possible to limit the application of that script to just our own product line, and not the products we drop ship for other vendors?
Offline
Yes. You're going to want to loop through $cartids and extract the data. Here' a hint. Do this:
print '<pre>'; print_r($cartids); print '</pre>';
To see what's in that array and what you have to work with. If I recall, you want the 'sinshipinfo' key.
Offline
Im not that technically competent.
Offline
Pages: 1