X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Exclude Products from Percent Off Special Offers (https://forum.x-cart.com/showthread.php?t=44667)

KurtVeloc 01-07-2009 01:53 PM

Exclude Products from Percent Off Special Offers
 
We often run store wide sales but have to exclude certain products or categories. We have the xcart Special Offers module installed so I modified it to exclude the products that we don't want to have the sale applied to.

To do this open modules\Special_Offers\func.php and search for "case 'D':" and change it to:
Quote:


case 'D': # discount
if ($product_checked) {

if($product["discount_avail"] =="Y"){
if ($bonus['amount_type'] == '%') {
$discount = $product['price'] * $bonus['amount_min'] / 100.00;
$limit = price_format($bonus['amount_max']);
}
else {
$discount = price_format($bonus['amount_min']);
$limit = price_format($product['price'] * $bonus['amount_max'] / 100.00);
}
if ($discount > $limit && $limit !== '0.00') {
$discount = $limit;
}
if ($discount > $product['price']) {
$discount = $product['price'];
}
$apply['discount'] = max($apply['discount'], $discount);

}
}


Now any product that you want to exclude from a site wide sale in Special Offers just uncheck the "Apply Global Discounts" box in the Product Admin page.

If you have a ton of products from one company that you want to exclude and have access to php_myadim you can run the following script to update them (just add whatever your table prefix is and put in the company name
Quote:


update products set discount_avail = "N" where companyname = ""


RobinThor 02-03-2009 10:47 PM

Re: Exclude Products from Percent Off Special Offers
 
Hi KurtVeloc,

I'm trying to apply discount via Special Offers as well, but i want to limit the discount to only one category.

Supposing using your method above, if I were to change the discount_avail from "Y" to "N", meaning "if($product["discount_avail"] =="N"){", will it work?

This is because I have quite a few discounts happening altogether, like the global discount and discount coupon.. is there a way to mod this?


Thanks!


All times are GMT -8. The time now is 12:35 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.