X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Third Party Add-Ons for X-Cart 4 (https://forum.x-cart.com/forumdisplay.php?f=45)
-   -   Excluding coupns (https://forum.x-cart.com/showthread.php?t=65013)

Dougrun 10-22-2012 03:43 PM

Re: Excluding coupns
 
fyi, upgrading from gold to gold plus does not effect this mod. even though the "on sale" module places a checkbox on the bottom of the product page, it didnt touch my "apply coupons" checkbox and it still works on the checkout page.

MAPerformance 12-20-2012 09:22 AM

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".

Dougrun 12-20-2012 03:05 PM

Re: Excluding coupns
 
just to confirm, this also works on AlteredCarts Onepage Checkout module which I switched to yesterday.

carpeperdiem 08-02-2013 06:14 AM

Re: Excluding coupns
 
I can verify that between Mike's post #2 and Doug's post #5 and #6 - works in 4.5.4.
This is a brilliant patch!

Especially useful if you make gift certificates a PRODUCT -- and you must exclude coupon codes from GC purchases.

Thanks guys!
J

PS - don't forget to run cleanup.php and/or purge your caches.

Dougrun 08-09-2013 02:42 PM

Re: Excluding coupns
 
still works in 4.6 too.

Dougrun 12-20-2013 08:44 AM

Re: Excluding coupns
 
I noticed that I can no longer change the coupon checkbox on the product page with this mod in 4.6.1. I have to manually go in the table and change it. It does stick, it just doesnt take the product pages changes. Any idea where I should look?

The other checkboxes work when i change them, just not this one since the upgrade..

mcanitano 07-30-2014 07:08 AM

Re: Excluding coupns
 
Amazing work! Thanks guys. I can confirm it works on v4.5.5. This is great, as we have a category for clearance items, and people have been "double dipping" by applying coupon codes to clearance items. Not anymore :)

Dougrun 07-31-2014 01:13 PM

Re: Excluding coupns
 
also works in 4.6.4

Dougrun 09-04-2015 12:04 PM

Re: Excluding coupns
 
upgraded to 4.7.2 and this no longer works, I cannot get the func.cart.php file working. It makes the entire store go blank.

mcanitano 09-04-2015 12:56 PM

Re: Excluding coupns
 
Doug, not sure (we don't use 4.7.x) but it may be due to 4.7 using Smarty3? Check into that and see what you can find out


All times are GMT -8. The time now is 07:05 AM.

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