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)
-   -   (if Total = $0) { still allow normal checkout process (https://forum.x-cart.com/showthread.php?t=21436)

gfiebich 04-28-2006 10:51 AM

(if Total = $0) { still allow normal checkout process
 
I have a site that offers most of its merchandise for free with free shipping. When a customer checks out with a $0 total, they go directly from the Cart View to the Order Confirmation - skipping the Payment Method and Order Review pages altogether. Where is the logic that causes this located? I'd like to disable it so that my customers can still review their ship-to information and enter order notes.
thanks,
Glen

p.s. This is in X-cart 4.0.16 gold

gfiebich 05-11-2006 06:40 AM

Here's the mod from X-cart tech support:

Code:

Please open cart.php and replace in the file

} elseif($mode=="checkout" && empty($paymentid) && !func_is_cart_empty($cart) && $cart["total_cost"] == 0) {
x_session_unregister('paypal_begin_express');
func_header_location($current_location."/payment/payment_offline.php");

with


#} elseif($mode=="checkout" && empty($paymentid) && !func_is_cart_empty($cart) && $cart["total_cost"] == 0) {
# x_session_unregister('paypal_begin_express');
# func_header_location($current_location."/payment/payment_offline.php");


The code is slightly different in 4.0.13, so just look for the elseif with ["total_cost"] == 0 and comment out that statement.

-Glen

shan 05-11-2006 06:43 AM

moved to custom mods

pauldodman 05-11-2006 06:59 AM

Thanks for sharing that, I have a client who uses his cart just for quoting and we had trouble with it missing out the payment step as of course there isn't any payment for a zero totalled order. Hopefully this will help solve it.

gfiebich 05-11-2006 08:57 PM

The mod above is really only half of what I want:

Quote:

If $0 total, Checkout button sends the customer directly to the Payment Details review screen WITH a default payment method automatically selected.

I've finally poked and prodded at cart.php long enough to sort out the solution (done in x-cart gold 4.0.13).

In /cart.php find:

Code:

  } elseif($mode=="checkout" && empty($paymentid) && !func_is_cart_empty($cart) && $cart["total_cost"] == 0) {
          func_header_location($current_location."/payment/payment_offline.php");


and comment it out like this:

Code:

#  } elseif($mode=="checkout" && empty($paymentid) && !func_is_cart_empty($cart) && $cart["total_cost"] == 0) {
#          func_header_location($current_location."/payment/payment_offline.php");


Next, find:

Code:

        if (count($payment_methods) == 1)
                func_header_location("cart.php?paymentid=".$payment_methods[0]["paymentid"]."&mode=checkout");


and paste this below it:

Code:

        if ($cart["total_cost"] == 0)
                func_header_location("cart.php?paymentid=8&mode=checkout");


EDIT BEGIN - code needed for x-cart 4.0.19

Finally, find:
Code:

    if (!$is_valid_paymentid)
and replace it with:
Code:

    if ((!$is_valid_paymentid) && ($paymentid != 8)) {
EDIT END

I've used paymentid=8 which is C.O.D. My store doesn't need C.O.D. so I've changed the language fields so it displays as "FREE". In the admin, make sure you have your C.O.D./FREE payment method unchecked - so that it doesn't display along with the other payment methods for $ purchases.

Here's a list of the other standard payment methods and IDs:
Quote:

1 = Credit Card
2 = Purchase Order
4 = Phone Ordering
5 = Personal Check
7 = Money Order
8 = C.O.D.
9 = Business Check
10 = Wire Transfer
11 = Government Check
12 = Traveler's Check
13 = Fax Ordering
14 = Gift Certificate
16 = Check


That's it! I hope this is useful to some of you.

-Glen

eastman 05-18-2006 09:22 AM

Thanks for the great post. I was hoping someone could help me out with a problem I am having expanding on this mod. I want to run the credit cards through authorize.net. It returns a failed process, but that's fine since we will be processing these numbers manually later. I want to bypass the cc_processing error for the customer and provide a short message instead. I decided to do this on error_message.php in the root directory.

I created a tmp file : skin1/main/error_ccprocessor_error1.tpl
It contains the message I want to post for the customer in the event of this particular error. Here"s how I'm going about it. This is the modified snippet from error_message.php.

Code:

$billmessage = $_GET['bill_message'];

if ($billmessage = "bill_message=Error%3A+A+valid+amount+is+required.+%28Reason+Code+5+%2F+Sub+1%29"){
          $error1 = $error . "1";
          $smarty->assign("main",$error1);
        }
else{
          if (!empty($error)){
              $smarty->assign("main",$error);
          }
      else{
              $smarty->assign("main",$QUERY_STRING);
          }
}


I'm getting a "Page Not Found or Do not have permission" message where the tmp file should show up when I try to run this page. Hope this is clear.
Thanks for any help you can offer.

careyst 10-19-2010 07:16 AM

Re: (if Total = $0) { still allow normal checkout process
 
Would anyone have code to allow having a downloadable item available for free in version 4.4.1? Want to have them register, but then just go to download page and skip credit card validation step.


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

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