Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Excluding coupns
 
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4
 
Thread Tools
  #11  
Old 10-22-2012, 03:43 PM
 
Dougrun Dougrun is online now
 

X-Adept
  
Join Date: Apr 2012
Posts: 639
 

Default 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.
__________________
4.7.x xcart store
Business 5.4xx
Reply With Quote

The following user thanks Dougrun for this useful post:
totaltec (10-23-2012)
  #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
  #13  
Old 12-20-2012, 03:05 PM
 
Dougrun Dougrun is online now
 

X-Adept
  
Join Date: Apr 2012
Posts: 639
 

Default Re: Excluding coupns

just to confirm, this also works on AlteredCarts Onepage Checkout module which I switched to yesterday.
__________________
4.7.x xcart store
Business 5.4xx
Reply With Quote
  #14  
Old 08-02-2013, 06:14 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #15  
Old 08-09-2013, 02:42 PM
 
Dougrun Dougrun is online now
 

X-Adept
  
Join Date: Apr 2012
Posts: 639
 

Default Re: Excluding coupns

still works in 4.6 too.
__________________
4.7.x xcart store
Business 5.4xx
Reply With Quote
  #16  
Old 12-20-2013, 08:44 AM
 
Dougrun Dougrun is online now
 

X-Adept
  
Join Date: Apr 2012
Posts: 639
 

Default 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..
__________________
4.7.x xcart store
Business 5.4xx
Reply With Quote
  #17  
Old 07-30-2014, 07:08 AM
  mcanitano's Avatar 
mcanitano mcanitano is offline
 

eXpert
  
Join Date: Feb 2006
Location: Melbourne, FL
Posts: 216
 

Default 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
__________________
Marcello Canitano
New Site: X-Cart v4.5.5 GOLD
X-Cart Mobile v1.4.3
X-Payments v1.0.6
CDSEO Pro v2
Total Server Solutions xCDN

www.silverhorseracing.com
Reply With Quote
  #18  
Old 07-31-2014, 01:13 PM
 
Dougrun Dougrun is online now
 

X-Adept
  
Join Date: Apr 2012
Posts: 639
 

Default Re: Excluding coupns

also works in 4.6.4
__________________
4.7.x xcart store
Business 5.4xx
Reply With Quote
  #19  
Old 09-04-2015, 12:04 PM
 
Dougrun Dougrun is online now
 

X-Adept
  
Join Date: Apr 2012
Posts: 639
 

Default 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.
__________________
4.7.x xcart store
Business 5.4xx
Reply With Quote
  #20  
Old 09-04-2015, 12:56 PM
  mcanitano's Avatar 
mcanitano mcanitano is offline
 

eXpert
  
Join Date: Feb 2006
Location: Melbourne, FL
Posts: 216
 

Default 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
__________________
Marcello Canitano
New Site: X-Cart v4.5.5 GOLD
X-Cart Mobile v1.4.3
X-Payments v1.0.6
CDSEO Pro v2
Total Server Solutions xCDN

www.silverhorseracing.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:40 PM.

   

 
X-Cart forums © 2001-2018