Kryptronic Software Support Forum

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.

#1 07-29-2008 08:51:07

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Custom Sale Methods - Am I missing something obvious??

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


Rob

Offline

 

#2 07-30-2008 04:39:49

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Custom Sale Methods - Am I missing something obvious??

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

 

#3 07-30-2008 05:10:03

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Custom Sale Methods - Am I missing something obvious??

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


Rob

Offline

 

#4 07-30-2008 05:20:16

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Custom Sale Methods - Am I missing something obvious??

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

 

#5 07-30-2008 06:17:24

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Custom Sale Methods - Am I missing something obvious??

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


Rob

Offline

 

#6 07-30-2008 06:29:57

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Custom Sale Methods - Am I missing something obvious??

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

 

#7 07-30-2008 07:34:18

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Custom Sale Methods - Am I missing something obvious??

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.

Code:

<?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


Rob

Offline

 

#8 07-30-2008 07:47:40

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Custom Sale Methods - Am I missing something obvious??

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

 

#9 07-30-2008 08:02:15

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Custom Sale Methods - Am I missing something obvious??

The original code was

Code:

$sale_percent   = 10;
$sale_items     = 3;

So I was just using those variables and changed it to:

Code:

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:

Code:

<?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)


Rob

Offline

 

#10 07-30-2008 08:31:50

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Custom Sale Methods - Am I missing something obvious??

Try this Rob (you do know that if someone buys between 25 and 48 items they won't get a discount using this logic):

Code:

<?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

 

#11 07-30-2008 08:50:10

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Custom Sale Methods - Am I missing something obvious??

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


Rob

Offline

 

#12 07-30-2008 09:02:38

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Custom Sale Methods - Am I missing something obvious??

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.

Code:

<?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

 

#13 07-30-2008 09:43:52

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Custom Sale Methods - Am I missing something obvious??

Perfect. Thanks Dave


Rob

Offline

 

#14 07-30-2008 11:04:34

makesachange
Member
From: UK
Registered: 02-24-2006
Posts: 253
Website

Re: Custom Sale Methods - Am I missing something obvious??

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.. :-)


The Organic and Fair Trade Baby Boutique

Offline

 

#15 07-30-2008 11:05:50

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Custom Sale Methods - Am I missing something obvious??

Hi

Yes, I have added it to the Product descriptions and shop cart display.

Thanks
Rob


Rob

Offline

 

Board footer