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.
I am trying to activate a bulk standard "Buy 6 Get X percent Off"
I have set Checkout: Custom Sale Method Status* to True & selected the relevant Checkout: Custom Sale Method* from the drop down list. The Custom sale method is an uneditted CCP script.
But nothing happens on the website - no additional text and no discounts when you checkout.
What am I missing???
Rob
Offline
That's all it should take Rob. I just did exactly what you did with a clean installation and when I started through checkout it showed the text and discount as expected (LESS: Buy 3 or More Items and Save 10% Sale .... this is the default custom method output and percentage).
Offline
Hi Dave
Thats what i thought.
I have copied the "Buy 6 Get X Percent Off" script from the demo site to make sure it wasn't a problem with the script. I have also tried using all the other custom methods.
Obviously I must of changed something in one of the CCP files that causing the problem - any ideas what file I should start looking at and comparing to the original script??
Thanks
Rob
Offline
When you're testing this you're emptying your shopping cart then going back and adding something before going to checkout correct? The custom sale methods are found and run by the GBU_Checkout core code so if you haven't been messing with that there shouldn't be anything else in the way of it working from what I can see looking at the debug output.
Offline
OK - So I was missing something obvious(maybe not so obvious)!! The discount doesn't actually show up in the Shopping cart - it only shows when the customer proceeds to Checkout Step 1.
Is it possible/more logical for the discount to also be shown in the Shopping Cart Display.
Thanks
Rob
Offline
At first blush it might seem more logical in the cart but a custom sale method may take shipping or other factors into account that aren't available when viewing the cart.
Offline
Thanks Dave I understand the logic.
Can you give me a pointer if I am heading in the right directions by changing the script below. What I want is:
Buy 6 = 10% off, Buy 24 = 20% Off, Buy 48 = 30% Off.
<?php $cartids = $this->globals('ecom.checkout_cartids'); $cosess = $this->globals('ecom.checkout_cosess'); if ($sale_items => 6){ $sale_percent = 10}; elseif ($sale_items =< 24){ $sale_percent = 20}; else ($sale_items > 24){ $sale_percent = 30}; $sale_textshow = 'Buy ' . $sale_items . ' or More Items and Save ' . $sale_percent . '% Sale'; $count = 0; $subtotal = 0; foreach ($cartids as $cartid => $item) { $count = $count + $item['quantity']; $subtotal = $subtotal + $item['subtotal']; } // End of foreach statement. if ($count >= $sale_items) { $sale_amount = $subtotal * ($sale_percent / 100); $this->globals('ecom.total_customsale',$sale_amount); $this->globals('ecom.customsale_text',$sale_textshow); } // End of if statement. ?>
Thanks
Rob
Offline
You appear to be on the right track but where are you getting/setting the $sale_items variable? It looks like you're using the by x quantity get y percent off supplied method as a base but you are testing for the number of sale items without $sale_items ever being set.
Offline
The original code was
$sale_percent = 10; $sale_items = 3;
So I was just using those variables and changed it to:
if ($sale_items => 6){ $sale_percent = 10}; elseif ($sale_items =< 24){ $sale_percent = 20}; else ($sale_items > 24){ $sale_percent = 30};
From your comments I guess I need to know the Global variable for the item quantity. How do I get that variable into the script.
I have tried:
<?php $cartids = $this->globals('ecom.checkout_cartids'); $cosess = $this->globals('ecom.checkout_cosess'); if ($item['quantity'] =>6) {$sale_items = 6}; elseif ($item['quantity'] =< 24) {$sale_items = 24}; else ($item['quantity'] > 48) {$sale_items = 48}; if ($sale_items = 6){ $sale_percent = 10}; elseif ($sale_items = 24){ $sale_percent = 20}; else ($sale_items = 48){ $sale_percent = 30}; $sale_textshow = 'Buy ' . $sale_items . ' or More Items and Save ' . $sale_percent . '% Sale'; $count = 0; $subtotal = 0; foreach ($cartids as $cartid => $item) { $count = $count + $item['quantity']; $subtotal = $subtotal + $item['subtotal']; } // End of foreach statement. if ($count >= $sale_items) { $sale_amount = $subtotal * ($sale_percent / 100); $this->globals('ecom.total_customsale',$sale_amount); $this->globals('ecom.customsale_text',$sale_textshow); } // End of if statement. ?>
thanks
Rob
Last edited by zanart (07-30-2008 08:02:55)
Offline
Try this Rob (you do know that if someone buys between 25 and 48 items they won't get a discount using this logic):
<?php $cartids = $this->globals('ecom.checkout_cartids'); $cosess = $this->globals('ecom.checkout_cosess'); $sale_textshow = 'Buy ' . $sale_items . ' or More Items and Save ' . $sale_percent . '% Sale'; $count = 0; $subtotal = 0; foreach ($cartids as $cartid => $item) { $count = $count + $item['quantity']; $subtotal = $subtotal + $item['subtotal']; } // End of foreach statement. if ($count >= 6) { $sale_percent = 10; } elseif ($count <= 24) { $sale_percent = 20; } elseif ($count > 48) { $sale_percent = 30; } else { $sale_percent = 0; } if ($sale_percent > 0) { $sale_amount = $subtotal * ($sale_percent / 100); $this->globals('ecom.total_customsale',$sale_amount); $this->globals('ecom.customsale_text',$sale_textshow); } // End of if statement. ?>
Offline
Hi
I didn't know that but I was just trying to get it to work before playing around with the > < = bits.
Anyway the code you gave me just gives 10% off anything over 6 and the
$sale_textshow = 'Buy ' . $sale_items . ' or More Items and Save ' . $sale_percent . '% Sale'
no longer works because those variables have gone.
Rob
Offline
The logic you had, which I didn't change, would have resulted in any count over 6 getting the 10 percent. I switched the logic for you and added the other variable that is used in the $sale_textshow variable. This change should cover the discount "gap" I mentioned in an earlier post too.
<?php $cartids = $this->globals('ecom.checkout_cartids'); $cosess = $this->globals('ecom.checkout_cosess'); $count = 0; $subtotal = 0; foreach ($cartids as $cartid => $item) { $count = $count + $item['quantity']; $subtotal = $subtotal + $item['subtotal']; } // End of foreach statement. if ($count > 48) { $sale_items = 48; $sale_percent = 30; } elseif ($count <= 48 && $count >= 24) { $sale_items = 24; $sale_percent = 20; } elseif ($count >= 6) { $sale_items = 6; $sale_percent = 10; } else { $sale_percent = 0; } if ($sale_percent > 0) { $sale_textshow = 'Buy ' . $sale_items . ' or More Items and Save ' . $sale_percent . '% Sale'; $sale_amount = $subtotal * ($sale_percent / 100); $this->globals('ecom.total_customsale',$sale_amount); $this->globals('ecom.customsale_text',$sale_textshow); } // End of if statement. ?>
Offline
Perfect. Thanks Dave
Offline
Can I suggest that if the discount doesn't show in the shopping cart, that you add text to your shopping cart page to explain this?
Just a thought.. :-)
Offline
Hi
Yes, I have added it to the Product descriptions and shop cart display.
Thanks
Rob
Offline