View Single Post
  #12  
Old 12-20-2012, 09:22 AM
 
MAPerformance MAPerformance is offline
 

Senior Member
  
Join Date: Dec 2005
Posts: 145
 

Default Re: Excluding coupns

Quote:
Originally Posted by totaltec
Well I think it will require custom code, I haven't seen a module that allows you to exclude products from coupons.

I did this recently, here is my changelog:
Edit /include/func.cart.php
Edit /include/product_modify.php
ALTER TABLE `xcart_products` ADD `coupons_avail` CHAR( 1 ) NOT NULL DEFAULT 'Y' AFTER `discount_avail`
Edit /common_files/main/product_details.tpl

/include/product_modify.php look for:
'discount_avail' => $discount_avail,
After it add:
'coupons_avail' => $coupons_avail,

I am attaching my changed func.cart.php just search it for the word coupons, I believe everything is commented.

/common_files/main/product_details.tpl look for:
PHP Code:
<tr>
  {if 
$geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[discount_avail]" /></td>{/if}
  <
td class="FormButton" nowrap="nowrap">{$lng.lbl_apply_global_discounts}:</td>
  <
td class="ProductDetails">
  <
input type="checkbox" name="discount_avail" value="Y"{if $product.productid eq "" or $product.discount_avail eq "Y"checked="checked"{/if} />
  </
td>
</
tr
After it add:
PHP Code:
<tr>
  {if 
$geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[coupons_avail]" /></td>{/if}
  <
td class="FormButton" nowrap="nowrap">{$lng.lbl_apply_coupons}:</td>
  <
td class="ProductDetails">
  <
input type="checkbox" name="coupons_avail" value="Y"{if $product.productid eq "" or $product.coupons_avail eq "Y"checked="checked"{/if} />
  </
td>
</
tr

This should give you a checkbox on the product page and the ability to enable/disable coupons for that product. Don;t forget to run the SQL patch from my changeolg above. Be sure you are doing all of this on a dev site rather than your live store.

I can verify this works like a charm on my 4.4.3 Gold site. I searched Mike's func.cart.php file for "coupons_avail" to find the additional code and added into my file (located at include/func/func.cart.php, not include/func.cart.php as noted). You also need to add a language variable for "lbl_apply_coupons".
__________________
www.maperformance.com

X-Cart Version: 4.4.3 Gold
Reply With Quote