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

One-Page Checkout [Support Thread]

Views: 629,524

Results 1,801 to 1,820 of 3,078
26 Oct 2020, 3:18 PM
#1801
lat9 avatar

lat9

Administrator

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

One-Page Checkout [Support Thread]

jeking:

Zen Cart 1.5.5f
Template is M o z e n (forum won't let me post that word without the spaces)
OPC 2.3.4

I did follow the steps for 1.5.5f on GitHub

When trying to checkout, I'm getting a 500 error:
[26-Oct-2020 09:29:39 America/Chicago] PHP Parse error: syntax error, unexpected ')', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /XXX/includes/modules/pages/checkout_one/header_php.php on line 355

Clearly this file is not the root cause. But if that's not the cause, where do I go looking for the real issue?
I don't know where that header_php.php file 'came from', but that file hasn't changed since November of 2019.

Line 355 of the as-shipped version of the file is highlighted below:

// -----
// Determine if there are any payment modules that are in the confirmation-required list.
//
// The generated list is used within the /includes/modules/pages/checkout_one/jscript_main.php module to determine what text to
// display for the order-submittal text/title.
//
$required_list = '';
[B]if (!empty(CHECKOUT_ONE_CONFIRMATION_REQUIRED)) {[/B]
    $confirmation_required = explode(',', CHECKOUT_ONE_CONFIRMATION_REQUIRED);
    $required_list = '"' . implode('", "', $confirmation_required) . '"';
}
26 Oct 2020, 3:24 PM
#1802
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

strelitzia:

I'm having problems with Payment form styling changing if a user makes a change to the default shipping method after OPC page has loaded.
After inspecting the page in both conditions I've discovered that on initial page load the form fields all have

class="form-control"

But as soon as a shipping method is changed that class is removed from the form fields, messing up the form style.

Is there a fix for this, or do I need to modify my forms so they look nice without the "form-control" class?
What version of Zen Cart and OPC is in use?
What template is in use? I'll note that the default OPC templating doesn't include any form-control classes.

26 Oct 2020, 3:25 PM
#1803
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

lat9:

I don't know where that header_php.php file 'came from', but that file hasn't changed since November of 2019.

Line 355 of the as-shipped version of the file is highlighted below:

// -----
// Determine if there are any payment modules that are in the confirmation-required list.
//
// The generated list is used within the /includes/modules/pages/checkout_one/jscript_main.php module to determine what text to
// display for the order-submittal text/title.
//
$required_list = '';
[B]if (!empty(CHECKOUT_ONE_CONFIRMATION_REQUIRED)) {[/B]
$confirmation_required = explode(',', CHECKOUT_ONE_CONFIRMATION_REQUIRED);
$required_list = '"' . implode('", "', $confirmation_required) . '"';
}


This is why I'm confused. That's what's in the file:  <https://prnt.sc/v76rm3>
26 Oct 2020, 3:31 PM
#1804
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

jeking:

This is why I'm confused. That's what's in the file: https://prnt.sc/v76rm3
Shoot me a copy of that file to my direct email address, please.

26 Oct 2020, 3:32 PM
#1805
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Re: One-Page Checkout [Support Thread]

lat9:

What version of Zen Cart and OPC is in use?
What template is in use?

OPC version: 2.3.4
ZC version: 1.5.7
Template is a heavily modified template default that has undergone many changes/upgrades since it was first used by the client way back on zc 1.5.1
All the form fields have class="form-control" to provide uniform styling.

26 Oct 2020, 3:37 PM
#1806
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

strelitzia:

OPC version: 2.3.4
ZC version: 1.5.7
Template is a heavily modified template default that has undergone many changes/upgrades since it was first used by the client way back on zc 1.5.1
All the form fields have class="form-control" to provide uniform styling.
Did this issue start 'recently'?

Was the template and OPC working together on a previous version of Zen Cart?

Have you applied all the patches identified for zc157 (https://www.zen-cart.com/showthread.php?226872-Known-bugs-%28and-fixes%29-for-v1-5-7-series%29?

26 Oct 2020, 3:49 PM
#1807
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

lat9:

Shoot me a copy of that file to my direct email address, please.
Copy received and, as indicated, it's a match for the as-distributed version. What version of PHP is in use?

26 Oct 2020, 4:04 PM
#1808
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

lat9:

Copy received and, as indicated, it's a match for the as-distributed version. What version of PHP is in use?

Interesting question. 5.4.45. Upgrading PHP is also on the task list. Tried last week but failed. So waiting on Hostgator support....

26 Oct 2020, 4:05 PM
#1809
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Re: One-Page Checkout [Support Thread]

lat9:

Did this issue start 'recently'?

Was the template and OPC working together on a previous version of Zen Cart?

Have you applied all the patches identified for zc157 (https://www.zen-cart.com/showthread.php?226872-Known-bugs-%28and-fixes%29-for-v1-5-7-series%29?

The site was using FEC up until the recent upgrade to 1.5.7, so no idea if OPC would have the same issues on an older version of zen cart.
Yes, all bug fixes listed in that thread have been implemented.

To be clear, I have no issue with the form at all when OPC page first loads. But as soon as a shipping method selection is changed, the class is removed from the payment method fields, breaking their layout. I can only assume something in the OPC code is doing this as it doesn't expect that class to exist. They still perform their task, just don't look pretty.

26 Oct 2020, 4:25 PM
#1810
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

jeking:

Interesting question. 5.4.45. Upgrading PHP is also on the task list. Tried last week but failed. So waiting on Hostgator support....
I haven't seen a site running that version of PHP for a long time, nor have I done any integration testing with OPC on that very old version.

26 Oct 2020, 4:27 PM
#1811
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

strelitzia:

The site was using FEC up until the recent upgrade to 1.5.7, so no idea if OPC would have the same issues on an older version of zen cart.
Yes, all bug fixes listed in that thread have been implemented.

To be clear, I have no issue with the form at all when OPC page first loads. But as soon as a shipping method selection is changed, the class is removed from the payment method fields, breaking their layout. I can only assume something in the OPC code is doing this as it doesn't expect that class to exist. They still perform their task, just don't look pretty.
OPC's AJAX handler (which comes into play when the shipping method is changed) loads the current template's version of the various tpl_modules_opc_*.php files.

Are there, perchance, some leftover FEC files that are coming into play?

26 Oct 2020, 4:30 PM
#1812
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

lat9:

I haven't seen a site running that version of PHP for a long time, nor have I done any integration testing with OPC on that very old version.

Fair enough. Seems like an odd error to be caused by PHP though. But we need to upgrade it anyway. Once that is done, we'll see were that leaves us.

26 Oct 2020, 4:40 PM
#1813
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

jeking:

Fair enough. Seems like an odd error to be caused by PHP though. But we need to upgrade it anyway. Once that is done, we'll see were that leaves us.
I agree about the oddness, but don't have enough information to provide any additional guidance.

26 Oct 2020, 5:20 PM
#1814
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Re: One-Page Checkout [Support Thread]

lat9:

OPC's AJAX handler (which comes into play when the shipping method is changed) loads the current template's version of the various tpl_modules_opc_*.php files.

Are there, perchance, some leftover FEC files that are coming into play?

Not that I'm aware of. I took a download of the FEC module and deleted any matching files that existed on the site.

Can you confirm that it's not expected and/or deliberate behaviour for the class names to be getting stripped of the form fields?

26 Oct 2020, 5:27 PM
#1815
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

strelitzia:

Not that I'm aware of. I took a download of the FEC module and deleted any matching files that existed on the site.

Can you confirm that it's not expected and/or deliberate behaviour for the class names to be getting stripped of the form fields?
Yes, I can confirm. OPC's AJAX processing uses the Zen Cart $template class to load the OPC sub-template modules to render its output.

Are there any debug-logs generated? How about browser's console-logs?

Update: Is the site publicly available for viewing? If so, send me a PM with the link.

26 Oct 2020, 7:51 PM
#1816
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Re: One-Page Checkout [Support Thread]

I did some digging into this and found that the "form-control" class is not hard coded onto fields, but added via js when the page is initially loaded.

$('input[type="text"], input[type="password"], input[type="email"], input[type="tel"], textarea, input#state').addClass('form-control');
$('select').addClass('select_caret_icon form-control');

My guess is I have to re add these after OPC's AJAX handler has been fired. Any pointer in which file this needs to take place?

27 Oct 2020, 12:23 AM
#1817
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Re: One-Page Checkout [Support Thread]

strelitzia:

My guess is I have to re add these after OPC's AJAX handler has been fired. Any pointer in which file this needs to take place?

I added some code at line 495 of includes/modules/pages/jquery.checkout_one.js to replace the classes.

It's working correctly now.

27 Oct 2020, 10:30 AM
#1818
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

strelitzia:

I added some code at line 495 of includes/modules/pages/jquery.checkout_one.js to replace the classes.

It's working correctly now.
I'll point out that that's one of the more volatile modules in the OPC distribution (like it's up for another change in v2.3.5). Just remember to mark your changes appropriately so that they're not wiped out on an update!

27 Oct 2020, 2:20 PM
#1819
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,955
Plugin Contributions:
8

Re: One-Page Checkout [Support Thread]

jeking:

Fair enough. Seems like an odd error to be caused by PHP though. But we need to upgrade it anyway. Once that is done, we'll see were that leaves us.

perhaps not that odd. from

https://www.php.net/manual/en/function.empty.php

Note:

Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error. In other words, the following will not work: empty(trim($name)). Instead, use trim($name) == false.

27 Oct 2020, 2:22 PM
#1820
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

carlwhat:

perhaps not that odd. from

https://www.php.net/manual/en/function.empty.php

Note:

Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error. In other words, the following will not work: empty(trim($name)). Instead, use trim($name) == false.
Nice one, @carlwhat! I'm guessing that that statement applies to constant definitions, too, since they're not variables.