X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   different charge on differenet payment options (https://forum.x-cart.com/showthread.php?t=14877)

2019 06-29-2005 05:09 AM

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

balinor 08-15-2005 09:07 AM

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! :)

cherie 08-19-2005 05:33 PM

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. :)

Dongan 08-19-2005 08:09 PM

can the mod move this to completed mods forum?

balinor 08-20-2005 04:35 AM

Done :)

2019 08-22-2005 05:04 AM

thank you will try to implent and improve

WPOO 08-25-2005 10:32 AM

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.

cherie 08-25-2005 10:35 AM

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.

WPOO 08-25-2005 10:41 AM

Thanks for quick response
 
I thought it was not possible because of the requirement above. but I wil give it a try


All times are GMT -8. The time now is 02:27 AM.

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