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

One-Page Checkout [Support Thread]

Views: 629,374

Results 1,941 to 1,960 of 3,077
18 Mar 2021, 5:38 PM
#1941
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

One-Page Checkout [Support Thread]

lat9:

A cr@p is enough so that someone familiar with this plugin (or any other chunk of code) can figure out what's going on if the person who made the change is no longer available!

I hear you about the code that has no comments at all! Way back, I was tasked with creating a simulation model of a Motorola 68000. I found another developer who had created one and asked for a copy of the code to use as a basis.

When I received the code (a humongous blob, BTW), there was not a single comment. When I asked the developer why, he said "Comments only indicate what the code's *intended *to do". I hit the delete button and started from scratch.

I used the term "######## load" the other day. Of course EVERYONE knows what that means...but my smart-alecky friends would not leave me alone. Do you remember the GOTO days with line numbers? OMG without comments it was all spaghetti!

well darn, I got spanked for a bad word. The replaced word starts with b...has four letters....geez!

18 Mar 2021, 5:40 PM
#1942
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

BTW, I really love the one page checkout. Nicely done.

3 Apr 2021, 11:26 AM
#1943
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: One-Page Checkout [Support Thread]

I'm not sure if I should post here, or at the bootstrap thread, in case I apologize.

That said by trying to make some changes to https://www.zen-cart.com/downloads.php?do=file&id=2305 (bootstrap template for OPC) I noticed there are differences in some of php snips, i.e. tpl_modules_opc_shopping_cart.php
My guess is I could use the "original" OPC template_default one, and need to be confirmed.

Also how would I add the price per unit to show in the tpl_modules_opc_shopping_cart.php

Thank you

3 Apr 2021, 11:46 AM
#1944
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

keneso:

I'm not sure if I should post here, or at the bootstrap thread, in case I apologize.

That said by trying to make some changes to https://www.zen-cart.com/downloads.php?do=file&id=2305 (bootstrap template for OPC) I noticed there are differences in some of php snips, i.e. tpl_modules_opc_shopping_cart.php
My guess is I could use the "original" OPC template_default one, and need to be confirmed.

Also how would I add the price per unit to show in the tpl_modules_opc_shopping_cart.php

Thank you
You're in the right support-thread!

The BS4/OPC makes changes to every one of OPC's template_default/template files (except for tpl_modules_checkout_one_shipping.php), so you'll want to make your subsequent changes to the tpl_modules_opc_shopping_cart.php that's now present in your clone of the bootstrap template's version.

I've got stuff going on this morning, but will try to get back later today to answer the part about adding the unit-price to that template.

9 Apr 2021, 1:00 PM
#1945
strelitzia avatar

strelitzia

Totally Zenned

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

Re: One-Page Checkout [Support Thread]

Zen Cart 1.5.7b
Advanced Shipper 6
OPC 2.3.7

I'm getting the following message after clicking the Confirm button for an order.
"Your order's details have changed. Please review the current values and re-submit."

No values have changed. Total is the sale before clicking Confirm Order as it is after clicking.

Do you have any suggestions on how I can resolve this?

9 Apr 2021, 1:26 PM
#1946
strelitzia avatar

strelitzia

Totally Zenned

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

Re: One-Page Checkout [Support Thread]

I took a look in the code to find what triggered this error message and saw the

$session_end_hash != $session_start_hash

check.

This led me to send the un hashed content of these two to error logs.

The output was

[09-Apr-2021 15:16:50 Europe/Paris] start total: £12.14
[09-Apr-2021 15:16:55 Europe/Paris] end total: £12.14

Clearly the use of £ vs £ is the issue here.

$session_end_hash is currently set like

$session_end_hash = $checkout_one->hashSession($currencies->format ($order->info['total']));

Can anyone suggest the correct way to resolve this?

9 Apr 2021, 2:01 PM
#1947
strelitzia avatar

strelitzia

Totally Zenned

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

Re: One-Page Checkout [Support Thread]

I tried to use html_entity_decode like this

$session_end_hash = $checkout_one->hashSession(html_entity_decode ($currencies->format ($order->info['total'])));

And while ```
error_log("end total: ".html_entity_decode ($currencies->format ($order->info['total'])));

gives me the same output as 

error_log("start total: ".$_POST['current_order_total']);


the hash values are still different.

[09-Apr-2021 15:56:48 Europe/Paris] session end hash: 35ee63b81d1bbd66ebe5a266291de4f6
[09-Apr-2021 15:56:48 Europe/Paris] session start hash: adc994f5f3b5a08bbada52c1c26ed16c

So clearly html_entity_decode is not the solution.
9 Apr 2021, 2:08 PM
#1948
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

What CHARSET is in use on the site? Noting that the OPC's observer class (where the hashSession method resides) attempts to convert those HTML entities into their character counterparts:

        // -----
        // Add the order's current total to the blob that's being hashed, so that changes in the total based on
        // payment-module selection can be properly detected (e.g. COD fee).
        //
        // Some currencies use a non-ASCII symbol for its symbol, e.g. £.  To ensure that we don't get into
        // a checkout-loop, make sure that the order's current total is scrubbed to convert any "HTML entities"
        // into their character representation.
        //
        // This is needed since the order's current total, as passed into the confirmation page, is created by
        // javascript that captures the character representation of any symbols.
        //
        // Note: Some templates also include carriage-returns within the total's display, so remove them from
        // the mix, too!
        //
        $current_order_total = str_replace(array("\n", "\r"), '', $current_order_total);
        $session_data['order_current_total'] = html_entity_decode($current_order_total, ENT_COMPAT, CHARSET);
9 Apr 2021, 2:16 PM
#1949
strelitzia avatar

strelitzia

Totally Zenned

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

Re: One-Page Checkout [Support Thread]

lat9:

What CHARSET is in use on the site?

define('CHARSET', 'utf-8');

9 Apr 2021, 3:12 PM
#1950
strelitzia avatar

strelitzia

Totally Zenned

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

Re: One-Page Checkout [Support Thread]

I've got this in the error logs.

PHP Warning: html_entity_decode(): charset `CHARSET' not supported, assuming utf-8 in /Users/steph/Sites/localhost/balloonmarket/includes/classes/observers/class.checkout_one_observer.php on line 732

Using PHP 7.4

9 Apr 2021, 5:01 PM
#1951
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

strelitzia:

I've got this in the error logs.

PHP Warning: html_entity_decode(): charset `CHARSET' not supported, assuming utf-8 in /Users/steph/Sites/localhost/balloonmarket/includes/classes/observers/class.checkout_one_observer.php on line 732

Using PHP 7.4
Hmm, what file contains that CHARSET definition?

10 Apr 2021, 4:53 PM
#1952
brian70809 avatar

brian70809

New Zenner

Join Date:
Jun 2011
Posts:
85
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

Love the addon. I cannot get sales tax to work with the TaxCloud observer. I just have 0.00 as Sales Tax Result.. It does work with standard multipage checkout.

Not getting any error logs because of it.

Any suggestions as to where to poke around!

Thanks!

10 Apr 2021, 5:02 PM
#1953
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

Check to see which notifications the TaxCloud observer has attached to. If it's looking for notifications issued on the checkout_shipping or checkout_payment pages, it'll need to also be looking on the checkout_one page. Ditto if it's looking for checkout_confirmation notifications; those should be augmented with the similar ones from the checkout_one_confirmation page.

11 Apr 2021, 12:07 AM
#1954
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: One-Page Checkout [Support Thread]

1.5.7c
opc 2.3.7
bs4_opc-1.0.0

It works fine selecting English on site, but when switching to other language (Italian) it outputs the message on line 67 of
includes/languages/italian/checkout_one.php

Here the message in English
define('TEXT_NOSCRIPT_JS_ERROR', 'Sorry, but our expedited checkout process cannot be used. Click <a href="%s">here</a> to use our alternate checkout process.');

11 Apr 2021, 11:15 AM
#1955
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

keneso:

1.5.7c
opc 2.3.7
bs4_opc-1.0.0

It works fine selecting English on site, but when switching to other language (Italian) it outputs the message on line 67 of
includes/languages/italian/checkout_one.php

Here the message in English
define('TEXT_NOSCRIPT_JS_ERROR', 'Sorry, but our expedited checkout process cannot be used. Click <a href="%s">here</a> to use our alternate checkout process.');
Use your browser's Developers' Tools' Console tab to view the javascript/jQuery issues that are preventing One-Page Checkout's jQuery from properly running.

11 Apr 2021, 2:55 PM
#1956
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: One-Page Checkout [Support Thread]

Thank you

Uncaught ReferenceError: shippingChoiceAvailable is not defined

11 Apr 2021, 4:06 PM
#1957
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

keneso:

Thank you

Uncaught ReferenceError: shippingChoiceAvailable is not defined
Hmm, that value should be set by /includes/modules/pages/checkout_one/jscript_main.php

11 Apr 2021, 5:42 PM
#1958
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: One-Page Checkout [Support Thread]

Indeed what is puzzling is that it works fine in English.
I think it has to do that there is not a language define for it, but mine is just a guess.

var shippingChoiceAvailable = <?php echo (is_array($quotes) && count($quotes) > 0) ? 'true' : 'false'; ?>;

12 Apr 2021, 12:15 PM
#1959
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

keneso:

Indeed what is puzzling is that it works fine in English.
I think it has to do that there is not a language define for it, but mine is just a guess.

var shippingChoiceAvailable = <?php echo (is_array($quotes) && count($quotes) > 0) ? 'true' : 'false'; ?>;
It's the language-specific constant for JS_ERROR_AJAX_TIMEOUT, missing backslashes for the single-quote.

That definition should look like

define('JS_ERROR_AJAX_TIMEOUT', 'L\\\'aggiornamento delle spese di spedizione del tuo ordine sta prendendo più tempo del normale. Per favore chiudi questo messaggio e riprova.\n\nSe continui a ricevere questo messaggio per favore contattaci.');
12 Apr 2021, 12:43 PM
#1960
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

lat9:

It's the language-specific constant for JS_ERROR_AJAX_TIMEOUT, missing backslashes for the single-quote.<br>
<br>
That definition should look like<br>

<br> define('JS_ERROR_AJAX_TIMEOUT', 'L\\\'aggiornamento delle spese di spedizione del tuo ordine sta prendendo più tempo del normale. Per favore chiudi questo messaggio e riprova.\n\nSe continui a ricevere questo messaggio per favore contattaci.');<br> ```<br> There's a similar issue with the definition for ERROR_NO_SHIPPING_SELECTED; that should be<br> <div class="bbcode_container">
<pre class="bbcode_code" style="height:36px;">define('ERROR_NO_SHIPPING_SELECTED', 'Devi selezionare un metodo di spedizione per il tuo ordine prima che l<strong><font color="#FF0000">\\\</font></strong>'ordine possa essere confermato.');</pre>
</div><br>