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

Global Coupons for X-Cart Pro - Simple Mod

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #21  
Old 03-07-2005, 01:57 PM
 
Danielle Danielle is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 138
 

Default

OK well I found all the files in cpanel, so there is no way to get to them through x-cart admin? Just out of curiousity, I don't get how it breaks the code to edit in cpanel...can someone explain this? I don't doubt it's true, I'd just like to know why
__________________
Danielle
X-Cart Pro 4.0.10
X-Gift-Registry
X-AOM
Reply With Quote
  #22  
Old 03-07-2005, 02:00 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Nope, those are php...the admin area only works for .tpl files. From what I gather, Cpanel adds spaces, which can break a php file.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #23  
Old 03-07-2005, 02:21 PM
 
Danielle Danielle is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 138
 

Default

Darn, it didn't mess with anything, but it didn't work either
__________________
Danielle
X-Cart Pro 4.0.10
X-Gift-Registry
X-AOM
Reply With Quote
  #24  
Old 03-07-2005, 02:22 PM
 
Danielle Danielle is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 138
 

Default

The code that I changed was identical to what was posted above, so I guess that code hasn't changed in the last few versions...
__________________
Danielle
X-Cart Pro 4.0.10
X-Gift-Registry
X-AOM
Reply With Quote
  #25  
Old 03-07-2005, 02:23 PM
 
Danielle Danielle is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 138
 

Default

When I name the provider globaldiscount, that is the username right???
__________________
Danielle
X-Cart Pro 4.0.10
X-Gift-Registry
X-AOM
Reply With Quote
  #26  
Old 03-07-2005, 02:37 PM
 
Danielle Danielle is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 138
 

Default

Oh my goodness, OK. let me try naming my provider globalcoupon like I should have...duh...lol
__________________
Danielle
X-Cart Pro 4.0.10
X-Gift-Registry
X-AOM
Reply With Quote
  #27  
Old 03-07-2005, 02:42 PM
 
Danielle Danielle is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 138
 

Default

Yup it worked, no code modifications necessary, the line numbers are a bit different though, but make sure to name your new provider globalcoupon hehehe.
__________________
Danielle
X-Cart Pro 4.0.10
X-Gift-Registry
X-AOM
Reply With Quote
  #28  
Old 03-10-2005, 04:19 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

Global Coupons mod for X-cart PRO 4.x

If you want all providers to have coupons with the same name/number, just alter the sql table 'xcart_discount_coupons' as follows:

Code:
ALTER TABLE xcart_discount_coupons DROP PRIMARY KEY; ALTER TABLE xcart_discount_coupons ADD PRIMARY KEY (coupon,provider); DESC xcart_discount_coupons;

Then, replace <xcart_dir>/provider/coupons.php script:

(The mod is the area that references $coupon_exists, but just replace the whole file after backing up the original)
Code:
<?php /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2004 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2004 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: coupons.php,v 1.27.2.1 2005/01/12 07:43:15 svowl Exp $ # require "./auth.php"; require $xcart_dir."/include/security.php"; $location[] = array(func_get_langvar_by_name("lbl_coupons"), ""); include $xcart_dir."/include/categories.php"; # # Use this condition when single mode is disabled # $provider_condition = ($single_mode ? "" : "AND provider='$login'"); if ($REQUEST_METHOD == "POST") { if ($mode=="delete") { # # Delete selected coupons # if (is_array($posted_data)) { $deleted = false; foreach ($posted_data as $coupon=>$v) { if (empty($v["to_delete"])) continue; db_query("delete from $sql_tbl[discount_coupons] where coupon='$coupon' $provider_condition"); $deleted = true; } if ($deleted) $top_message["content"] = func_get_langvar_by_name("msg_discount_coupons_del"); } } if ($mode == "update") { # # Update discount table # if (is_array($posted_data)) { foreach ($posted_data as $coupon=>$v) { db_query("UPDATE $sql_tbl[discount_coupons] SET status='$v[status]' WHERE coupon='$coupon'"); } $top_message["content"] = func_get_langvar_by_name("msg_discount_coupons_upd"); } } if ($mode == "add") { # # Add new coupon # # Generate timestamp $expire_new = mktime(0,0,0,$new_Month,$new_Day,$new_Year); $recursive = ($recursive ? "Y" : "N"); switch ($apply_to) { case '': case 'any': $productid_new=0; $categoryid_new=0; break; case 'product': $categoryid_new=0; break; case 'category': $productid_new=0; break; } if (empty($coupon_new) or ($discount_new <= 0 and $coupon_type_new != 'free_ship') or array_pop(func_query_first("SELECT COUNT(*) FROM $sql_tbl[discount_coupons] WHERE coupon='$coupon_new' $provider_condition")) > 0) { $coupon_data = $HTTP_POST_VARS; $coupon_data["expire_new"] = $expire_new; x_session_register("coupon_data"); $top_message["content"] = func_get_langvar_by_name("msg_err_discount_coupons_add"); $top_message["type"] = "E"; } else { $coupon_exists = func_query_first("SELECT * FROM $sql_tbl[discount_coupons] WHERE coupon='$coupon_new'"); if (empty($coupon_exists)) { db_query("INSERT INTO $sql_tbl[discount_coupons] (coupon, discount, coupon_type, minimum, times, expire, status, provider, productid, categoryid, recursive) VALUES ('$coupon_new', '$discount_new', '$coupon_type_new', '$minimum_new', '$times_new', '$expire_new', '$status_new', '$login', '$productid_new', '$categoryid_new', '$recursive')"); $top_message["content"] = func_get_langvar_by_name("msg_discount_coupons_add"); } else { if (empty($coupon_exists["productid"])) $productid_new = ""; db_query("INSERT INTO $sql_tbl[discount_coupons] (coupon, discount, coupon_type, minimum, times, times_used, expire, status, provider, productid, categoryid, recursive) VALUES ('$coupon_new', '".$coupon_exists["discount"]."', '".$coupon_exists["coupon_type"]."', '".$coupon_exists["minimum"]."', '".$coupon_exists["times"]."', '".$coupon_exists["times_used"]."', '".$coupon_exists["expire"]."', '".$coupon_exists["status"]."', '$login', '$productid_new', '".$coupon_exists["categoryid"]."', '".$coupon_exists["recursive"]."')"); $top_message["content"] = func_get_langvar_by_name("msg_global_discount_coupons_add"); } } } func_header_location("coupons.php"); } $coupons = func_query("select * from $sql_tbl[discount_coupons] where 1 $provider_condition"); if (x_session_is_registered("coupon_data")) { x_session_register("coupon_data"); $smarty->assign("coupon_data", $coupon_data); x_session_unregister("coupon_data"); } $smarty->assign("coupons", $coupons); $smarty->assign("main","coupons"); # Assign the current location line $smarty->assign("location", $location); @include $xcart_dir."/modules/gold_display.php"; func_display("provider/home.tpl",$smarty); ?>
After you replace the coupons.php, you can create the exact same coupon for each provider. Thus, a "free shipping" coupon for orders over $100 say, could be used globally for all providers w/ the same name/number. Just change your current file to a new name and replace it with the one above ...

- Mike
__________________
4.1.9
Reply With Quote
  #29  
Old 05-02-2005, 01:47 PM
 
Danielle Danielle is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 138
 

Default

Uhoh...there is a problem with this...it's not passing the discount to my credit card payment module. It passes to Paypal fine, but not the credit card module. Anyone know how I could maybe fix this???

Thanks!
Danielle
__________________
Danielle
X-Cart Pro 4.0.10
X-Gift-Registry
X-AOM
Reply With Quote
  #30  
Old 05-02-2005, 01:55 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

This doesn't affect payment. Check your coupons.php and make sure only the changed items are in there, you may have a different coupons.php for a different XC version.

- Mike
__________________
4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:37 PM.

   

 
X-Cart forums © 2001-2020