Jump to content

Error in checkout: Call to a member function attr() on null in PadloperProcessOrder.php


Recommended Posts

Checkout shows me this error. After doing a bit of research, it turns out the reason is, that line 819

$field = $this->getInputfieldForCustomerForm($inputfield);

returns null for the field shippingAdressCountry. This field  is of type select which seems not handled correctly. In PadloperInputfieldHelpers.php getInputFieldSelect() returns without result, when $options['select_options'] is empty (which is true in my case).
Somebody knows what to do here? Is there something wrong in my configuration?

Link to comment
Share on other sites

Posted (edited)
33 minutes ago, Kholja said:

This field  is of type select which seems not handled correctly.

You are right in this respect. If you look at line #600 in  PadloperInputfieldHelpers.php I have comments (to myself) and TODO whether to return a different error or handle this in a different way. I left it as it is for now so that developers could pick on the error early on, instead of silently failing. I'll look into it.

33 minutes ago, Kholja said:

when $options['select_options'] is empty (which is true in my case).

This tells me you haven't added shipping countries to your shop, perhaps? Or, you did not select a shipping address country during checkout? email and shippingAddressCountry are required fields in customer checkout. Are they not being shown as required during checkout? The checkout form should have not submitted without a required field completed. Is this a custom form you are using or the inbuilt Padloper one?

Edited by kongondo
  • Like 2
Link to comment
Share on other sites

4 hours ago, kongondo said:

This tells me you haven't added shipping countries to your shop, perhaps?

Thanks that was the reason.  I lost this setting after some experimenting with shipping settings. But I got another related problem which brought me to that state. If I try to enter countries into the field Shipping Zone Countries it does not accept other entries than Germany. A view times it worked and I could enter i.e. Austria. But after saving padloper message said that the entry is not valid and deleted all entries. After some tries I now can only enter Germany. Any other entry does not work. Is there a place where I should set valid countries?

Link to comment
Share on other sites

10 hours ago, Kholja said:

Is there a place where I should set valid countries?

First, ensure that you have these countries set up in shop > tax-rates. You get there via the menu Taxes > Tax Rates. If you already added a country, it will be listed in the table there.  Ensure the country is not unpublished. It will show 'unpublished' below the name of the country if it is unpublished.

If your countries are not yet added, you will need to add them by clicking on 'add new country'. Then, select your countries and save or save + publish.

You can then add the countries to the shipping zones as needed.  

  • Like 1
Link to comment
Share on other sites

I am getting a similar error at checkout:

Call to a member function find() on null in site/modules/Padloper/includes/helper/PadloperUtilities.php:1505

I created my setup according to the documentation. I have countries with tax rates, shipping zones with countries, one digital product. Handling fee is none and shipping fee is 0. I use the built in checkout form.

The order is saved, but it is empty – no product, no customer email, no shipping country.

Any idea where I can look into this?

Link to comment
Share on other sites

On 5/17/2022 at 9:31 PM, Jan Fromm said:

I created my setup according to the documentation. I have countries with tax rates, shipping zones with countries, one digital product. Handling fee is none and shipping fee is 0. I use the built in checkout form.

The order is saved, but it is empty – no product, no customer email, no shipping country.

Hi @Jan Fromm,

I haven't been able to replicate this unfortunately. My testing:

  1. I have tested with the in-built checkout form.
  2. I have tested with invoice, Stripe and PayPal and they all work.
  3. I have tested with different countries.
  4. I have also tested with and without handling and shipping maximum fees.
  5. I have also tested with a single flat shipping rate = 0. This is a shipping zone with only this one shipping rate.

 

The only difference is I am testing on ProcessWire 3.0.187 but I don't think that makes a difference. My questions:

  1. Is this site online somewhere I can look at?
  2. If no to #1, are you able to please share some screenshots of your setup? You can send this to my email or via  PM. I'd like to see your General Settings > Standards Tab; Tax Settings; Tax Rates list showing your (shipping) Country (i.e., the customer country you are testing with in checkout); Your Country in tax rate edit mode; Countries Tab for the shipping zone for your Country + the Fees tab; The Rates tab for this shipping zone.

Thanks.

 

Link to comment
Share on other sites

Hi @Jan Fromm,

Thanks for the details. I have now identified what the problem is. It is Rest of the World feature. I should have been clearer in the docs that it is not yet fully functional. It is high on my priority list since I decided to include it in the production release. I hope to finish work on this by this weekend. Apologies for the inconvenience.

Link to comment
Share on other sites

Thanks for checking it out, @kongondo! Then I sit back and wait patiently for the update.

One question to be sure: Is the ROW shipping zone mandatory? I just removed that zone for a moment, and I get the same error.

Link to comment
Share on other sites

1 hour ago, Jan Fromm said:

One question to be sure: Is the ROW shipping zone mandatory? I just removed that zone for a moment, and I get the same error.

No, it is not mandatory. I think you are still getting the error perhaps because you still have it in your General Settings > Shipping?

Link to comment
Share on other sites

6 hours ago, Jan Fromm said:

Just checked again, it works. You were right, the ROW shipping zone is to blame. Thanks for finding out!

Hmm. This is confusing since I also checked (on your test site) when it was still available and I was getting a different error related to product images. I am just curious how this resolved itself. Happy to hear the errors have gone away. Anyway, please let me know if you continue to receive other errors. If that happens, please open a separate thread for it in this forum, thanks.

Link to comment
Share on other sites

15 hours ago, kongondo said:

Hmm. This is confusing since I also checked (on your test site) when it was still available and I was getting a different error related to product images. I am just curious how this resolved itself.

I have also seen that error, but can’t reproduce it. I deleted the cookies in the meantime, and the error was gone.

 

15 hours ago, kongondo said:

Anyway, please let me know if you continue to receive other errors. If that happens, please open a separate thread for it in this forum, thanks.

Will do!

Link to comment
Share on other sites

  • 2 weeks later...
On 5/24/2022 at 6:39 PM, kongondo said:

Hmm. This is confusing since I also checked (on your test site) when it was still available and I was getting a different error related to product images. I am just curious how this resolved itself. Happy to hear the errors have gone away. Anyway, please let me know if you continue to receive other errors. If that happens, please open a separate thread for it in this forum, thanks.

Sorry @kongondo,

the error came up again after I re-enabled TracyDebugger. With TracyDebugger disabled, everything is fine.

Calling a member function count() on null

It is this function in .../site/modules/Padloper/includes/order/PadloperCart.php:108

private function getProductThumb(page $product) {
    $thumb = null;
    if ($product->padloper_images->count()) {
        // Get common ProcessWire thumb
        $thumb = $product->padloper_images->first()->height(260);
    }
    return $thumb;
}

 

Link to comment
Share on other sites

8 hours ago, Jan Fromm said:

Calling a member function count() on null

Glad you manage to catch it again! However, I am not sure what is going on there since $product->padloper_images should return a Pageimages object. I am wondering what your $product is in this case. I have not been able to reproduce this locally. I am wondering if we could again arrange a temporary access to your site for me to have a peek?

Thanks.

Link to comment
Share on other sites

Hi @Jan Fromm,

I have now fixed this directly in the files on your site. I'll update the project Padloper files as well and upload the updated files for download, as usual.

The issue was a NullPage was getting returned from a find; a non-existent page ID in the session. Maybe confirm that the products you render actually have their product->id rendered correctly.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...