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

One-Page Checkout [Support Thread]

Views: 629,530

Results 1,781 to 1,800 of 3,078
1 Oct 2020, 2:52 PM
#1781
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

One-Page Checkout [Support Thread]

@lat9
I am looking into your suggestion of class inheritance. First time to do, and I am confused as to where the new and old class are supposed to meet logically.

Firstly, I am not sure whether class override means overriding the whole class, or just a subset of its functions. I assume the latter for now in this example.

Let's say I create new file OnePageCheckoutJP.php and in it have a new class definition to extend your class:

OnePageCheckoutJP extends OnePageChekout

Then I put only the changed functions, with the same names as in the original OnePageCheckout class, into the new file.

Then in class autoloader file config.checkout_one.php I would (well, it would be a new file, but just to illustrate the point) add new definitions for loading (CP-1) and instantiation (CP-74):

autoLoadConfig[0][] = array(
    'autoType' => 'class',
    'loadFile' => 'OnePageCheckout.php'
);
// new CP-1 loading
autoLoadConfig[1][] = array(
    'autoType' => 'class',
    'loadFile' => 'OnePageCheckoutJP.php'
);
// new CP-74 instantiation
$autoLoadConfig[74][] = array(
    'autoType' => 'classInstantiate',
    'className' => 'OnePageCheckoutJP',
    'objectName' => 'opc',
    'checkInstantiated' => true,
    'classSession' => true
);

$autoLoadConfig[75][] = array(
    'autoType' => 'classInstantiate',
    'className' => 'OnePageCheckout',
    'objectName' => 'opc',
    'checkInstantiated' => true,
    'classSession' => true
);

In this class override, does the "objectName" remain "opc"? I am confused (easily I may add!).
You wrote "then the base OPC class will not be loaded", that seems to imply that actually I need to override the entire class rather than just certain functions within the class?

Any pointers much appreciated.

1 Oct 2020, 4:12 PM
#1782
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

@gernot, you're on the right track!

First, in the new auto_loader, you'll instantiate your class-override as the 'opc' session value. Since that will occur at CP-74, the instantiation of the base OPC at CP-75 won't occur, since the auto-loader won't overwrite that class if it's already there.

For the class-inheritance, you're correct ... you'll only provide the methods in your class that are being overridden, with the same names and inputs as the 'base' OPC methods. You might take a peek at my Database I/O Manager as its /admin/includes/classes/dbio/DbIo*Handler.php classes use class-inheritance to provide handler-specific actions while using common/base functions within the DbIoHandler.php class.

2 Oct 2020, 4:53 PM
#1783
keneso avatar

keneso

Totally Zenned

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

Re: One-Page Checkout [Support Thread]

On the download page I saw Stirpe mentioned at v1.0.7 and v1.0.8
Do I need to install the Stripe plugin as well?
Thank you.

2 Oct 2020, 5:37 PM
#1784
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

keneso:

On the download page I saw Stirpe mentioned at v1.0.7 and v1.0.8
Do I need to install the Stripe plugin as well?
Thank you.
Only if that's what you want to use for payments on your store. OPC doesn't include any additional payment modules in its zip-file.

22 Oct 2020, 4:29 PM
#1785
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]

shags38:

Hi again Cindy - on both sites that have been upgraded I am now repeatedly getting an PayPal error code 10730 - after checking out going through guest checkout / PayPal and getting to PayPal and clicking pay now I get returned to the guest checkout page (all details still completed) with this error at top of the page;
"Error 10730 Shipping Address Postal Code Empty - The field Shipping Address Postal Code is required"

The postcode is completed in the billing address section - the shipping address is same as billing address box is checked (default I assume) - even when I uncheck that box the details shown for shipping are as per billing and includes the postcode.

I get this error code;

[11-Nov-2019 09:09:29 Australia/Sydney] PHP Parse error: syntax error, unexpected ',' in /home/admin/public_html/includes/modules/payment/paypalwpp.php on line 2034

> 
> this is the line you modified - not sure if this is relevant but in the email received that line of code was represented as ;
> ```
$this->zcLog('ec_step2_finish - 2a*'*, *'*address-creation bypassed based on observer setting.');
      }

(possibly a character interpretation issue with the email program ??)

in the forum on the ZC site in the post above it is shown as;

if ($bypass_address_creation) {
$this->zcLog('ec_step2_finish - 2a', 'address-creation bypassed based on observer setting.');
}

> 
> 
> 
> I initially used the code in the email but it caused a blank page after clicking checkout - I am now using the code from your post above - resulting in that error.
> 
> For the life of me I cannot figure why it worked first time as I indicated in my post but now wants to throw this error. I have cleared cache and restarted browser.
> 
> cheers,
> Mike

Was there ever a fix for this? I have a client getting the 10730 error. It seems to be occurring only with guest checkout and when using a credit card to pay on PayPal.

Zen Cart 1.5.6
OPC 2.3.4
22 Oct 2020, 4:45 PM
#1786
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

jeking:

Was there ever a fix for this? I have a client getting the 10730 error. It seems to be occurring only with guest checkout and when using a credit card to pay on PayPal.

Zen Cart 1.5.6
OPC 2.3.4
Jim, since you're using a 'base' zc156 (no alpha-suffix), did you follow the installation/update instructions for that version: https://github.com/lat9/one_page_checkout/blob/master/pages/install_upgrade_v210_or_later.md#zen-cart-156-156a

That identifies additions/changes needed for the older Zen Cart 'core' modules, especially the addition of a notification within the paypalwpp.php module to enable an observer (like OPC's) to instruct the processing to bypass the customer-record creation.

22 Oct 2020, 4:55 PM
#1787
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:

Jim, since you're using a 'base' zc156 (no alpha-suffix), did you follow the installation/update instructions for that version: https://github.com/lat9/one_page_checkout/blob/master/pages/install_upgrade_v210_or_later.md#zen-cart-156-156a

That identifies additions/changes needed for the older Zen Cart 'core' modules, especially the addition of a notification within the paypalwpp.php module to enable an observer (like OPC's) to instruct the processing to bypass the customer-record creation.

Sorry, typo. ZC is 1.5.6c

22 Oct 2020, 5:21 PM
#1788
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

jeking:

Sorry, typo. ZC is 1.5.6c
Try enabling the paypalwpp debug mode. For those PayPal paid orders during guest checkout, you should be seeing

ec_step2_finish - 2a', 'address-creation bypassed based on observer setting.

in the PayPal-generated logs.

22 Oct 2020, 5:33 PM
#1789
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:

Try enabling the paypalwpp debug mode. For those PayPal paid orders during guest checkout, you should be seeing

ec_step2_finish - 2a', 'address-creation bypassed based on observer setting.

> in the PayPal-generated logs.

Dang, I just cleared them thinking it would be in one-page logs. I'll watch for more and report back.
22 Oct 2020, 5:45 PM
#1790
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

jeking:

Dang, I just cleared them thinking it would be in one-page logs. I'll watch for more and report back.
Actually, having both the PayPal and OPC logs will both help to "read the tea leaves"!

22 Oct 2020, 5:49 PM
#1791
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:

Actually, having both the PayPal and OPC logs will both help to "read the tea leaves"!

The OPC logs remained, so I've got those. I'll wait for a new error we can read all the leaves. :-)

23 Oct 2020, 2:55 PM
#1792
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]

jeking:

The OPC logs remained, so I've got those. I'll wait for a new error we can read all the leaves. :-)

Got another one. I've got one large one-page error log and 13 paypal error logs.

In the paypal logs, I do see the code you mentioned earlier in some of them https://prnt.sc/v5eavw

23 Oct 2020, 6:25 PM
#1793
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

Got the logs, James. I'll review today and in the morning.

24 Oct 2020, 11:20 AM
#1794
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

lat9:

Got the logs, James. I'll review today and in the morning.
I'm still working on the OPC change, but the following patch is required for all Zen Cart versions prior to the (not-yet-released) zc157a.

Edit (after making a copy) your store's /includes/modules/payment/paypalwpp.php, finding the following section:

  /**
   * Get Override Address (uses sendto if set, otherwise uses customer's primary address)
   */
  function getOverrideAddress() {
    global $db;

    // Only proceed IF *in* markflow mode AND logged-in (have to be logged in to get to markflow mode anyway)
    if (!empty($_GET['markflow']) && zen_is_logged_in()) {
      // From now on for this user we will edit addresses in Zen Cart, not by going to PayPal.
      $_SESSION['paypal_ec_markflow'] = 1;


      // debug
      $this->zcLog('getOverrideAddress - 1', 'Now in markflow mode.' . "\n" . 'SESSION[sendto] = ' . (int)$_SESSION['sendto']);


      // find the users default address id
      if (!empty($_SESSION['sendto'])) {
        $address_id = $_SESSION['sendto'];
      } else {
        $sql = "SELECT customers_default_address_id
                FROM " . TABLE_CUSTOMERS . "
                WHERE customers_id = :customerId";
        $sql = $db->bindVars($sql, ':customerId', $_SESSION['customer_id'], 'integer');
        $default_address_id_arr = $db->Execute($sql);
        if (!$default_address_id_arr->EOF) {
          $address_id = $default_address_id_arr->fields['customers_default_address_id'];
        } else {
          // couldn't find an address.
          return false;
        }
      }

and adding the following notification for OPC's (and other plugins') use:

  /**
   * Get Override Address (uses sendto if set, otherwise uses customer's primary address)
   */
  function getOverrideAddress() {
    global $db;

    // Only proceed IF *in* markflow mode AND logged-in (have to be logged in to get to markflow mode anyway)
    if (!empty($_GET['markflow']) && zen_is_logged_in()) {
      // From now on for this user we will edit addresses in Zen Cart, not by going to PayPal.
      $_SESSION['paypal_ec_markflow'] = 1;


      // debug
      $this->zcLog('getOverrideAddress - 1', 'Now in markflow mode.' . "\n" . 'SESSION[sendto] = ' . (int)$_SESSION['sendto']);


      // find the users default address id
      if (!empty($_SESSION['sendto'])) {
        $address_id = $_SESSION['sendto'];
      } else {
        $sql = "SELECT customers_default_address_id
                FROM " . TABLE_CUSTOMERS . "
                WHERE customers_id = :customerId";
        $sql = $db->bindVars($sql, ':customerId', $_SESSION['customer_id'], 'integer');
        $default_address_id_arr = $db->Execute($sql);
        if (!$default_address_id_arr->EOF) {
          $address_id = $default_address_id_arr->fields['customers_default_address_id'];
        } else {
          // couldn't find an address.
          return false;
        }
      }
      
[B]      // -----
      // Give a watching observer the opportunity to bypass this address-override.  An observer
      // can disable the address-override processing by setting the $disable_address_override
      // parameter to specifically (bool)true.
      //
      $disable_address_override = false;
      $this->notify('NOTIFY_PAYPALWPP_DISABLE_GET_OVERRIDE_ADDRESS', $address_id, $disable_address_override);
      if ($disable_address_override === true) {
        $this->zcLog('getOverrideAddress - 1a', "Override disabled by observer request.\n");
        return false;
      }[/B]

That change was submitted (and accepted) for the zc157a 'core' yesterday.

24 Oct 2020, 6:47 PM
#1795
jeff_mash avatar

jeff_mash

Totally Zenned

Join Date:
Aug 2004
Posts:
732
Plugin Contributions:
0

Re: One-Page Checkout [Support Thread]

Hi Cindy - I too am starting to get these PayPal 10730 errors. We are on 1.5.7 and using OPC 2.3.3. Didn't upgrade to 2.3.4 yet, so if you think that addresses the issue, I can do that.

Whenever I see this error, the one common denominator I see in the PayPal_CURL error log is that it never lists a customer ZIP code. Here is what I see from the recent customer failure:

Request Parameters: {DoExpressCheckoutPayment} 
Array
(
    [PAYMENTREQUEST_0_AMT] => 15.9
    [PAYMENTREQUEST_0_ITEMAMT] => 9.95
    [PAYMENTREQUEST_0_SHIPPINGAMT] => 5.95
    [L_PAYMENTREQUEST_0_NUMBER0] => LOOPSNEWGEN
    [L_PAYMENTREQUEST_0_NAME0] => Loops New Generation by Yigal Mesika - Trick [22071]
    [L_PAYMENTREQUEST_0_QTY0] => 1
    [L_PAYMENTREQUEST_0_AMT0] => 9.95
    [PAYMENTREQUEST_0_PAYMENTACTION] => Sale
    [ALLOWEDPAYMENTMETHOD] => InstantPaymentOnly
    [PAYMENTREQUEST_0_SHIPTONAME] => Guest Customer, **do not remove**
    [PAYMENTREQUEST_0_SHIPTOSTREET] => Default billing address
    [PAYMENTREQUEST_0_SHIPTOCITY] => 
    [PAYMENTREQUEST_0_SHIPTOSTATE] => CA
    [PAYMENTREQUEST_0_SHIPTOZIP] => 
    [PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE] => US
    [BUTTONSOURCE] => ZenCart-EC_us
    [ADDROVERRIDE] => 1
    [RETURNFMFDETAILS] => 0
    [PAYMENTREQUEST_0_CUSTOM] => EC-30972-1603506358
    [PAYMENTREQUEST_0_INVNUM] => 30972-1603506358-[MJMMagic]
    [PAYMENTREQUEST_0_CURRENCYCODE] => USD
    [TOKEN] => EC-83T582732X054240A
    [PAYERID] => FVMURM2NX3KC2
    [NOTIFYURL] => https://www.domain.com/store/ipn_main_handler.php
    [METHOD] => DoExpressCheckoutPayment
    [USER] => customerservice_api1.domain.com
    [PWD] => ****************
    [VERSION] => 124.0
    [SIGNATURE] => ****************************************************vHb3
)


Response: 
Array
(
    [TOKEN] => EC-83T582732X054240A
    [SUCCESSPAGEREDIRECTREQUESTED] => false
    [TIMESTAMP] => 2020-10-24T02:25:58Z
    [CORRELATIONID] => 3ea9da404272b
    [ACK] => Failure
    [VERSION] => 124.0
    [BUILD] => 55009056
    [L_ERRORCODE0] => 10730
    [L_SHORTMESSAGE0] => Shipping Address Postal Code Empty
    [L_LONGMESSAGE0] => The field Shipping Address Postal Code is required
    [L_SEVERITYCODE0] => Error
    [CURL_ERRORS] => 
)

As you can see, there is no zip, no city, and the street address says "Default billing address".

KEEPING IN MIND - This all seems to work fine for the most part. We still see a ton of orders come in using the Guest Account, both with PayPaldp and Paypalwpp. So it's not like the module isn't working. But I have seen these 10730 errors now once per day and can't figure out why it's not happening for everyone.

I just added that new block of code you mentioned above to see if that helps, but wanted to document here that this issue is also happening to us as well.

24 Oct 2020, 8:15 PM
#1796
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]

Jeff_Mash:

KEEPING IN MIND - This all seems to work fine for the most part. We still see a ton of orders come in using the Guest Account, both with PayPaldp and Paypalwpp. So it's not like the module isn't working. But I have seen these 10730 errors now once per day and can't figure out why it's not happening for everyone.

For my client it was only guest's checking out and paying with a credit card on PayPal. Cindy sent two changes I implemented today. It's not been long enough to know if it's worked or not, yet

25 Oct 2020, 10:55 AM
#1797
lat9 avatar

lat9

Administrator

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

Re: One-Page Checkout [Support Thread]

Jeff_Mash:

Hi Cindy - I too am starting to get these PayPal 10730 errors. We are on 1.5.7 and using OPC 2.3.3. Didn't upgrade to 2.3.4 yet, so if you think that addresses the issue, I can do that.

Whenever I see this error, the one common denominator I see in the PayPal_CURL error log is that it never lists a customer ZIP code. Here is what I see from the recent customer failure:

Request Parameters: {DoExpressCheckoutPayment}
Array
(
[PAYMENTREQUEST_0_AMT] => 15.9
[PAYMENTREQUEST_0_ITEMAMT] => 9.95
[PAYMENTREQUEST_0_SHIPPINGAMT] => 5.95
[L_PAYMENTREQUEST_0_NUMBER0] => LOOPSNEWGEN
[L_PAYMENTREQUEST_0_NAME0] => Loops New Generation by Yigal Mesika - Trick [22071]
[L_PAYMENTREQUEST_0_QTY0] => 1
[L_PAYMENTREQUEST_0_AMT0] => 9.95
[PAYMENTREQUEST_0_PAYMENTACTION] => Sale
[ALLOWEDPAYMENTMETHOD] => InstantPaymentOnly
[PAYMENTREQUEST_0_SHIPTONAME] => Guest Customer, do not remove
[PAYMENTREQUEST_0_SHIPTOSTREET] => Default billing address
[PAYMENTREQUEST_0_SHIPTOCITY] =>
[PAYMENTREQUEST_0_SHIPTOSTATE] => CA
[PAYMENTREQUEST_0_SHIPTOZIP] =>
[PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE] => US
[BUTTONSOURCE] => ZenCart-EC_us
[ADDROVERRIDE] => 1
[RETURNFMFDETAILS] => 0
[PAYMENTREQUEST_0_CUSTOM] => EC-30972-1603506358
[PAYMENTREQUEST_0_INVNUM] => 30972-1603506358-[MJMMagic]
[PAYMENTREQUEST_0_CURRENCYCODE] => USD
[TOKEN] => EC-83T582732X054240A
[PAYERID] => FVMURM2NX3KC2
[NOTIFYURL] => https://www.domain.com/store/ipn_main_handler.php
[METHOD] => DoExpressCheckoutPayment
[USER] => customerservice_api1.domain.com
[PWD] => ****************
[VERSION] => 124.0
[SIGNATURE] => ****************************************************vHb3
)

Response:
Array
(
[TOKEN] => EC-83T582732X054240A
[SUCCESSPAGEREDIRECTREQUESTED] => false
[TIMESTAMP] => 2020-10-24T02:25:58Z
[CORRELATIONID] => 3ea9da404272b
[ACK] => Failure
[VERSION] => 124.0
[BUILD] => 55009056
[L_ERRORCODE0] => 10730
[L_SHORTMESSAGE0] => Shipping Address Postal Code Empty
[L_LONGMESSAGE0] => The field Shipping Address Postal Code is required
[L_SEVERITYCODE0] => Error
[CURL_ERRORS] =>
)

> 
> As you can see, there is no zip, no city, and the street address says "Default billing address".
> 
> KEEPING IN MIND - This all seems to work fine for the most part.  We still see a ton of orders come in using the Guest Account, both with PayPaldp and Paypalwpp.  So it's not like the module isn't working.  But I have seen these 10730 errors now once per day and can't figure out why it's not happening for everyone.
> 
> I just added that new block of code you mentioned above to see if that helps, but wanted to document here that this issue is also happening to us as well.
Jeff, you'll need the 'other side' of the change, too.  See this One-Page Checkout Github [commit ](https://github.com/lat9/one_page_checkout/commit/4d7ffe7a685477cc203492f9d017cbe0f8166ec3#diff-190ca09d4ba869f8492df3adbd807f35c557aee3075e984d87b7e0637b2f6370)for details.  That change to OPC's observer-class grabs that new notification and instructs paypalwpp to bypass its address-override creation when the site's processing a guest checkout.
26 Oct 2020, 2:43 PM
#1798
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]

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?

26 Oct 2020, 3:08 PM
#1799
strelitzia avatar

strelitzia

Totally Zenned

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

Re: One-Page Checkout [Support Thread]

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?

26 Oct 2020, 3:13 PM
#1800
carlwhat avatar

carlwhat

zennedOut

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

Re: 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?

look for a double colon , ie ::

T_PAAMAYIM_NEKUDOTAYIM: It’s a name for the :: operator in PHP. It literally means "double colon". For some reason they named it in Hebrew. Check your code syntax, and put a :: where appropriate.

best.