Forums / All Other Contributions/Addons / One-Page Checkout [Support Thread]

One-Page Checkout [Support Thread]

Views: 632,622

Results 2,861 to 2,880 of 3,088
25 Jun 2024, 8:11 PM
#2861
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

One-Page Checkout [Support Thread]

i get this when trying to checkout
Your available shipping options have changed. Please re-select your desired shipping method.

25 Jun 2024, 9:14 PM
#2862
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

jimmie:

i get this when trying to checkout
Your available shipping options have changed. Please re-select your desired shipping method.

again I shouldnt play with things, added this to advanced shipper to not show when free shipping is enabled but didn't add a method
```
if (IS_ADMIN_FLAG !== true && $this->enabled == true && isset($GLOBALS['freeoptions']) && $GLOBALS['freeoptions']->enabled && $method == '') {
$this->enabled = false;
return false;
}

27 Jun 2024, 1:22 PM
#2863
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
374
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

zc 1.58a. php 8.1. opc 2.5.2.

I received the following warning.

Request URI: /ajax.php?act=ajaxOnePageCheckout&method=updateShippingSelection, IP address: xxxx, Language id 1
#0 /includes/classes/ajax/zcAjaxOnePageCheckout.php(115): zen_debug_error_handler()
#1 /includes/classes/ajax/zcAjaxOnePageCheckout.php(104): zcAjaxOnePageCheckout->formatOrderTotal()
#2 /ajax.php(85): zcAjaxOnePageCheckout->updateShippingSelection()
--> PHP Warning: Undefined array key "opc_saved_order_total" in /includes/classes/ajax/zcAjaxOnePageCheckout.php on line 115.

Line 115 is the following section:

    protected function formatOrderTotal()
    {
        return $_SESSION['opc_saved_order_total'];//line 115
    }

Does the following change work? $_SESSION['opc_saved_order_total'] should not be zero or null?

return $_SESSION['opc_saved_order_total'] ?? '';
27 Jun 2024, 2:06 PM
#2864
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,108
Plugin Contributions:
56

Re: One-Page Checkout [Support Thread]

njcyx:

zc 1.58a. php 8.1. opc 2.5.2.

I received the following warning.

Request URI: /ajax.php?act=ajaxOnePageCheckout&method=updateShippingSelection, IP address: xxxx, Language id 1
#0 /includes/classes/ajax/zcAjaxOnePageCheckout.php(115): zen_debug_error_handler()
#1 /includes/classes/ajax/zcAjaxOnePageCheckout.php(104): zcAjaxOnePageCheckout->formatOrderTotal()
#2 /ajax.php(85): zcAjaxOnePageCheckout->updateShippingSelection()
--> PHP Warning: Undefined array key "opc_saved_order_total" in /includes/classes/ajax/zcAjaxOnePageCheckout.php on line 115.

> 
> Line 115 is the following section:
> 
> ```
    protected function formatOrderTotal()
    {
        return $_SESSION['opc_saved_order_total'];//line 115
    }

Does the following change work? $_SESSION['opc_saved_order_total'] should not be zero or null?

return $_SESSION['opc_saved_order_total'] ?? '';


Hmm, that shouldn't happen.  Does the associated site, by any chance, have something like the "Remember Me" plugin installed?
27 Jun 2024, 2:17 PM
#2865
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
374
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

Hi @lat9,

No plug-in, but I added a php file to extend the session/shopping cart expiry time. Not sure if it is related.

<?php define('SESSION_TIMEOUT_CATALOG', 7200);

This file is under /includes/extra_configures/my_ultra_long_session_timeout.php file

Reference link:

https://www.zen-cart.com/showthread.php?221400-Keep-Shopping-Cart-From-Expiring-So-Fast&p=1321729#post1321729

27 Jun 2024, 2:36 PM
#2866
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,108
Plugin Contributions:
56

Re: One-Page Checkout [Support Thread]

Looks like that could happen if an error occurred in either initializeResponseStatus or there was an issue with the shipping selection.

I'll be changing that method to read

    // -----
    // Called to format methods' return of the order's current total,
    // rounding to the number of decimal digits in the session's active
    // currency.
    //
    protected function formatOrderTotal()
    {
       [B] global $currencies;[/B]

        return $_SESSION['opc_saved_order_total'][B] ?? $currencies->format(0)[/B];
    }
8 Jul 2024, 5:14 PM
#2869
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

After upgrading to the new Square_webPay 1.2.1 I found a bug in (I think) OPC. While checking out and paying with Square_webPay, OR check/money order but NOT Paypal Restfull, If I change what's in the special Instructions or Comments field (or whatever 'TABLE_HEADING_COMMENTS' was defined to originally) I get the error "Your orders details have changed. Please review the current values and re-submit. I had had trouble with this previously with paypal, but not connected it to the comments field.
ZenCart - 1.5.8a
Bootstrap - 3.6.0
OPC - 2.5.1
Square_webPay (paid version) - 1.2.1
PayPal Checkout (RESTful) - 1.0.2

Hoping to upgrade OCP to 2.5.2 today, will post if it still happens in that version.

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

8 Jul 2024, 7:02 PM
#2870
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

Lol, NM, I should have just trusted in lat9! 2.5.2 DOES in fact fix that prob! Thank you Cindy!!!!

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

8 Jul 2024, 7:10 PM
#2871
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,108
Plugin Contributions:
56

Re: One-Page Checkout [Support Thread]

gothstone:

Lol, NM, I should have just trusted in lat9! 2.5.2 DOES in fact fix that prob! Thank you Cindy!!!!

:clap:Most excellent!

10 Jul 2024, 3:06 PM
#2872
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

Cindy,
I've been trying out OPC with guest checkout and it works great. But I'd like to apply the group discount to certain guests. I've set up an observer to check if a guest customer should get a discount when the guest enters their name and address. If so, I set the group_pricing field in the customers table for the special "do not remove" guest customers_id, expecting that during checkout, the group pricing order total module will calculate the discount and apply the discount. And although the table has been modified, the group pricing module is never called during guest checkout. The discount is applied to normal logged in customers in the group. Thoughts?
Thanks!
Dave

10 Jul 2024, 3:49 PM
#2873
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

Dave224:

Cindy,
I've been trying out OPC with guest checkout and it works great. But I'd like to apply the group discount to certain guests. I've set up an observer to check if a guest customer should get a discount when the guest enters their name and address. If so, I set the group_pricing field in the customers table for the special "do not remove" guest customers_id, expecting that during checkout, the group pricing order total module will calculate the discount and apply the discount. And although the table has been modified, the group pricing module is never called during guest checkout. The discount is applied to normal logged in customers in the group. Thoughts?
Thanks!
Dave

Ok, I see. ot_group_pricing excludes guests.

        if ($order->info['total'] == 0 || !zen_is_logged_in() || zen_in_guest_checkout()) {
            return;
        }

Dave

10 Jul 2024, 4:25 PM
#2874
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,108
Plugin Contributions:
56

Re: One-Page Checkout [Support Thread]

Dave224:

Cindy,
I've been trying out OPC with guest checkout and it works great. But I'd like to apply the group discount to certain guests. I've set up an observer to check if a guest customer should get a discount when the guest enters their name and address. If so, I set the group_pricing field in the customers table for the special "do not remove" guest customers_id, expecting that during checkout, the group pricing order total module will calculate the discount and apply the discount. And although the table has been modified, the group pricing module is never called during guest checkout. The discount is applied to normal logged in customers in the group. Thoughts?
Thanks!
Dave
What notification is the observer watching? I'll note that doing that on-customer update to the guest customer's database record could wind up giving the discount to the "wrong" person.

You might be better off adding a notification to ot_group_pricing's calculate_deductions method (in the check for guest-checkout, towards the top) and simply override the returned array there.

10 Jul 2024, 5:13 PM
#2875
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

lat9:

What notification is the observer watching? I'll note that doing that on-customer update to the guest customer's database record could wind up giving the discount to the "wrong" person.

You might be better off adding a notification to ot_group_pricing's calculate_deductions method (in the check for guest-checkout, towards the top) and simply override the returned array there.

The notifier I'm using is NOTIFIER_CART_GET_PRODUCTS_START with checks on presence of $_SESSION['opc'], $_SESSION['opc']->isGuestCheckout() === true, and $_SESSION['opc']->getAddressLabelFields for the guest billing address. All this to get the first notifier occurrence after the guest's name and address is entered. This is followed by checks on the name and address against a separate table of customers who get discounts. Then the guest customer entry in table customers is updated with the guests pricing group. Finally, there's some code to set a $_SESSION variable to check to prevent repeating the processing for subsequent notifications because I couldn't get the detach notifier method to work. If the guest does not get a discount, the guest entry in table customers is returned to it's default. Not the easiest notifier, but it's the only one I could find to work with.

I think I see what you're suggesting. Basically, set the guest entry in the customer table to any pricing group so that ot_group_pricing calculates the discount, followed by checks there to see if the discount is valid for the current customer or guest and override if not valid. I would still have to eliminate the check on zen_in_guest_checkout() in method process in ot_group_pricing. Am I correct in understanding your suggestion?

Dave

11 Jul 2024, 12:01 PM
#2876
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,108
Plugin Contributions:
56

Re: One-Page Checkout [Support Thread]

Dave224:

The notifier I'm using is NOTIFIER_CART_GET_PRODUCTS_START with checks on presence of $_SESSION['opc'], $_SESSION['opc']->isGuestCheckout() === true, and $_SESSION['opc']->getAddressLabelFields for the guest billing address. All this to get the first notifier occurrence after the guest's name and address is entered. This is followed by checks on the name and address against a separate table of customers who get discounts. Then the guest customer entry in table customers is updated with the guests pricing group. Finally, there's some code to set a $_SESSION variable to check to prevent repeating the processing for subsequent notifications because I couldn't get the detach notifier method to work. If the guest does not get a discount, the guest entry in table customers is returned to it's default. Not the easiest notifier, but it's the only one I could find to work with.

I think I see what you're suggesting. Basically, set the guest entry in the customer table to any pricing group so that ot_group_pricing calculates the discount, followed by checks there to see if the discount is valid for the current customer or guest and override if not valid. I would still have to eliminate the check on zen_in_guest_checkout() in method process in ot_group_pricing. Am I correct in understanding your suggestion?

Dave
What I'm suggesting is to add a notification in /includes/modules/order_total/ot_group_pricing.php's calculate_deductions method:

    if ($order_total == 0 || !zen_is_logged_in() || zen_in_guest_checkout()) {
        [B]global $zco_notifier;
        $zco_notifier->notify('NOTIFY_OT_GROUP_PRICING_DEDUCTION_OVERRIDE', ['order_total' => $order_total], $od_amount);[/B]
        return $od_amount;
    }

Your observer would watch for that notification and, if the 'order_total' isn't 0 and zen_in_guest_checkout() returns (bool)true, would check for the guest customer that you're looking to provide the deduction for and 'fill in' the $od_amount array with the discount information.

11 Jul 2024, 1:39 PM
#2877
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

Got it. Thanks Cindy!
Dave

22 Jul 2024, 5:04 PM
#2878
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
374
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

php 8.1. zc 1.58a

I received the following intermittent warning over the weekend. It is my first time to receive this warning.

[21-Jul-2024 22:04:59 America/New_York] Request URI: /ajax.php?act=ajaxOnePageCheckout&method=updatePaymentMethod, IP address: xxxx, Language id 1
#0 /includes/classes/ajax/zcAjaxOnePageCheckout.php(435): zen_debug_error_handler()
#1 /includes/classes/ajax/zcAjaxOnePageCheckout.php(370): zcAjaxOnePageCheckout->createOrderTotalHtml()
#2 /ajax.php(85): zcAjaxOnePageCheckout->updatePaymentMethod()
--> PHP Warning: Undefined array key "shipping" in /includes/classes/ajax/zcAjaxOnePageCheckout.php on line 434.

The lines near line 434 is the following:

$checkout_one->debug_message(
            "Returning:\n" .
            json_encode($order->info, JSON_PRETTY_PRINT) . "\n" .
            json_encode($_SESSION['shipping']) . "\n" .
            ($_SESSION['payment'] ?? '[not set]'),
            false,
            'zcAjaxOnePageCheckout::createOrderTotalHtml'
        );