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

different charge on differenet payment options

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 06-29-2005, 05:09 AM
  2019's Avatar 
2019 2019 is offline
 

Advanced Member
  
Join Date: Dec 2004
Posts: 76
 

Default different charge on differenet payment options

Dear friends,

We are running a live store, we are accepting 2 types of payments.
1 is cc other is money order. with cc it is ok.

but we need that when a customer selects, money order, we want to make %4 discount and show on invoice, in admin and ... is it possbile?

charge total amount % 4 so the customer will see how much he has to transfer to our bank accounts

any help is welcome.

sincerely,

Onur Caki
__________________
// x-cart 4.1.9

X-CART CSS SKIN
XC SEO
IP Addresses in Users Online for all users
Color coded order status
Reply With Quote
  #2  
Old 08-15-2005, 09:07 AM
 
balinor balinor is offline
 

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

Default

Just cleaning up the forum and wanted to know if this request was fulfilled yet? If not, please let me know and I will keep the thread. Thanks!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 08-19-2005, 05:33 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default

Here's what we just implemented. This is with 4.0.14. Our conditions are payment method "Checks/Money Orders" and non-Wholesale customers.

1. Pass the paymentid by changing cart.php around line 587 from:
Code:
# # Calculate all prices # $cart = func_array_merge ($cart, func_calculate($cart, $products, $login, $current_area));
to:
Code:
# # Calculate all prices # $cart = func_array_merge ($cart, func_calculate($cart, $products, $login, $current_area, $paymentid));

2. Accept the paymentid by changing include/func.php around line 1007 from:
Code:
function func_calculate($cart, $products, $login, $login_type) {
to:
Code:
function func_calculate($cart, $products, $login, $login_type, $paymentid="") {

3. In the same file and function, pass the paymentid again by changing the following around line 1019:
Code:
$result = func_calculate_single ($cart, $products, $login, $login_type);
to:
Code:
$result = func_calculate_single ($cart, $products, $login, $login_type, "", $paymentid);
and around line 1034 from:
Code:
$result = func_calculate_single ($cart, $_products, $login, $login_type, $provider_for);
to:
Code:
$result = func_calculate_single ($cart, $_products, $login, $login_type, $provider_for, $paymentid);
and around line 1074 from:
Code:
$result = func_calculate_single ($cart, $_products, $login, $login_type);
to:
Code:
$result = func_calculate_single ($cart, $_products, $login, $login_type, "", $paymentid);
These last two changes may not be necessary.

4. In the same file, adjust function func_calculate_single to accept the paymentid by changing:
Code:
function func_calculate_single($cart, $products, $login, $login_type, $provider_for="") {
to:
Code:
function func_calculate_single($cart, $products, $login, $login_type, $provider_for="", $paymentid) {

5. In the same file and function, add the following towards the end of the function:
Code:
if ( ($customer_info[membership] != "Wholesale") && ($paymentid == 5) ) { $discounted_subtotal -= ($subtotal * .05); $display_discounted_subtotal = $discounted_subtotal; }
just above:
Code:
# # Calculate Gift Certificates cost (purchased giftcerts) #
Your paymentid may be different as well as the exact membership name.

6. Adjust skin1/customer/main/cart_totals.tpl by adding the following after the if block for "if $cart.discount gt 0":
Code:
{if ( ($userinfo.membership ne "Wholesale") and ($smarty.get.paymentid eq 5) )} {math equation="x*.05" assign="payment_discount" x=$cart.subtotal} <tr> <td nowrap><font class="FormButton">Payment Discount:</font></td> <td>[img]{$ImagesDir}/null.gif[/img]</td> <td nowrap align="right"><font class="ProductPriceSmall">{include file="currency.tpl" value=$payment_discount}</font></td> <td nowrap align="right">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$payment_discount}</td> </tr> {/if}


To also display this information in the order history and invoice:

7. Add the following to function func_order_data in include/func.php towards the bottom just above the return:
Code:
if ( ($order[membership] != "Wholesale") && ($order[payment_method] == "Checks/Money Orders") ) { $order[discounted_subtotal] -= ($order[subtotal] * .05); $order[display_discounted_subtotal] = $order[discounted_subtotal]; }

8. Add the following to skin1/mail/html/order_data.tpl after the if block for "if $order.discount gt 0":
Code:
{if ( ($order.membership ne "Wholesale") and ($order.payment_method eq "Checks/Money Orders") )} {math equation="x*.05" assign="payment_discount" x=$order.subtotal} <tr> <td align="right" height="20">Payment Discount:</TD> <td align="right">{include file="currency.tpl" value=$payment_discount}</td> </tr> {/if}
Your exact payment method name may be different.

If anyone has any improvements to this, please post.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #4  
Old 08-19-2005, 08:09 PM
  Dongan's Avatar 
Dongan Dongan is offline
 

X-Wizard
  
Join Date: Jul 2005
Location: www.mercuryminds.com
Posts: 1,531
 

Default

can the mod move this to completed mods forum?
Reply With Quote
  #5  
Old 08-20-2005, 04:35 AM
 
balinor balinor is offline
 

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

Default

Done
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #6  
Old 08-22-2005, 05:04 AM
  2019's Avatar 
2019 2019 is offline
 

Advanced Member
  
Join Date: Dec 2004
Posts: 76
 

Default

thank you will try to implent and improve
__________________
// x-cart 4.1.9

X-CART CSS SKIN
XC SEO
IP Addresses in Users Online for all users
Color coded order status
Reply With Quote
  #7  
Old 08-25-2005, 10:32 AM
 
WPOO WPOO is offline
 

Advanced Member
  
Join Date: May 2004
Location: Delft - Netherlands -
Posts: 31
 

Default why wil this not work for wholesale

Why wont this work voor wholesale?

I have two types of customers. one which pays the normal price. The other are the wholesale and they get 5% discount.

Thanks for anyhelp.
__________________
X-Cart Gold 4.13
X-Configurator
X-ROM
Easy Checkout
Reply With Quote
  #8  
Old 08-25-2005, 10:35 AM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: why wil this not work for wholesale

Quote:
Originally Posted by WPOO
Why wont this work voor wholesale?

I have two types of customers. one which pays the normal price. The other are the wholesale and they get 5% discount.
I don't see why it wouldn't work for wholesale. Just change the condition at step 5 to whatever you need.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #9  
Old 08-25-2005, 10:41 AM
 
WPOO WPOO is offline
 

Advanced Member
  
Join Date: May 2004
Location: Delft - Netherlands -
Posts: 31
 

Default Thanks for quick response

I thought it was not possible because of the requirement above. but I wil give it a try
__________________
X-Cart Gold 4.13
X-Configurator
X-ROM
Easy Checkout
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 03:10 PM.

   

 
X-Cart forums © 2001-2020