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.

#26 05-29-2009 15:18:36

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Exclude Catagory from Custom Sale Method

If the script your trying to update is what is posted in post #23, then it should look like this with the add code

Code:

<?php


$cartids = $this->globals('ecom.checkout_cartids');

$user          = $this->globals('khxc_user.id');
$group         = $this->globals('khxc_user.usergroup');
$subtotal      = 0;
$sale_amount   = 0;
$sale_textshow = '';

if ((!(empty($user))) && ($group == 'wholesale')) {

$excludeids = array('lfn1','lfn2');

foreach ($cartids as $cartid => $item) {

$productid = $item['id'];

if (!in_array($productid,$excludeids)) {

$subtotal = $subtotal + $item['subtotal'];  } 

} // End of if statement.

// End of foreach statement.

     if (($subtotal >= 60) && ($subtotal < 100)) {

          $sale_amount    = $subtotal * .20;
          $sale_textshow  = 'Wholesale Distributor Discount - 20% OFF';

     } elseif (($subtotal >= 100) && ($subtotal < 300)) {

          $sale_amount    = $subtotal * .30;
          $sale_textshow  = 'Wholesale Distributor Discount - 30% OFF';

     } elseif (($subtotal >= 300) && ($subtotal < 500)) {

          $sale_amount    = $subtotal * .40;
          $sale_textshow  = 'Wholesale Distributor Discount - 40% OFF';

     } elseif ($subtotal >= 500) {

          $sale_amount    = $subtotal * .45;
          $sale_textshow  = 'Wholesale Distributor Discount - 45% OFF';

     } // End of if statement.

} // End of if statement.

$this->globals('ecom.total_customsale',$sale_amount);
$this->globals('ecom.customsale_text',$sale_textshow);
?>

keep in mind that this still may not get what you need as when you exclude an item from something it is usually best to create an alternate way to treat that product, in this example it only keep the subtotal from being updated with the item subtotal.

John

Offline

 

#27 05-30-2009 09:33:45

rtringo
Member
Registered: 06-22-2005
Posts: 95

Re: Exclude Catagory from Custom Sale Method

Hi DH783,

This is just great.
I plugged in the code you suggested and it works!
Thanks a lot for your support and followup.

Looking forward to CCP7. Patience is a virtue when waiting for Xmas

Roger

Offline

 

Board footer