Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot choose carrier on checkout page #550

Closed
dosbiner opened this issue Jul 10, 2018 · 13 comments
Closed

Cannot choose carrier on checkout page #550

dosbiner opened this issue Jul 10, 2018 · 13 comments

Comments

@dosbiner
Copy link
Contributor

hi, after upgrade to 1.0.5 I can't choose carrier on checkout page. I make gif for showing it https://prnt.sc/k4ua56

debug mode on showing this error:
Notice: Undefined variable: delivery_option in /home/dev/webapps/dev11/classes/Cart.php on line 1039

I replace Cart.php from 1.0.4 and then the problem gone, but I think its just temporary solution for me.

I've tried both on production site and fresh tb 1.0.5.
Nginx
PHP 7.2.5
MariaDB

@dosbiner dosbiner changed the title Checkout cannot choose carrier Cannot choose carrier on checkout page Jul 10, 2018
@Traumflug
Copy link
Contributor

First, thanks for reporting!

Hmm. There is only one commit changing this file between 1.0.4 and 1.0.5: e7095a7

Traumflug added a commit that referenced this issue Jul 10, 2018
This should fix issue #550. The typo prevented selecting a carrier.
@Traumflug
Copy link
Contributor

I think I caught it: 05997b6

Would you be kind enough to test this version of Cart.php? https://raw.githubusercontent.com/thirtybees/thirtybees/05997b6feea465031d639fe1ac006105298d03f8/classes/Cart.php

@dosbiner
Copy link
Contributor Author

error not showing anymore, but still cannot choose the carrier. have tried to switch php 7.0, 7.1, and switch to apache+nginx, still cannot choose the carrier

@Traumflug
Copy link
Contributor

Then there's another problem :-) I'll experiment a bit myself.

@Traumflug
Copy link
Contributor

Hmm. It works fine in my local installation, the radio buttons stick.

As these buttons jump back immediately, it might be some JavaScript problem. Can you enable the web console (Firefox: hit F12) and look for messages there?

Traumflug added a commit that referenced this issue Jul 10, 2018
This partially fixes issue #550.
@dosbiner
Copy link
Contributor Author

there are no error logs in console, I have tried Firefox and Chrome.
I send you message on TB forum the url site, BO Access, and FTP access if you need to check the problem

@Traumflug
Copy link
Contributor

Thanks for the credentials.

  • Went to the front office page.
  • Clicked on product Coffee.
  • Clicked "Add to cart"
  • Clicked "Proceed to checkout"
  • Scrolled down to Delivery methods, ignoring all the login and address stuff.
  • Clicked on various radio buttons, each one sticks.

Then I uploaded classes/Cart.php from Git tag 1.0.5, reloaded the page and did see the selection jumping back.

Then I uploaded classes/Cart.php from current 1.0.x (which matches that of branch carrier of yesterday), reloaded the web page and the problem no longer happened. Carriers stick again.

Conclusion: your shop works just fine.

If it still doesn't for you, I'd simply put this aside for a week. There are certainly other things to do. Internet stuff has sometimes self healing magic.

@getdatakick
Copy link
Contributor

I can reproduce this issue as well. This is an injection from commit e7095a7

The problem is on line 1037

json_decode($this->delivery_option);

returns object instead of array (which is expected in code later )

Fix is fairy simple:

json_decode($this->delivery_option, true);

@dosbiner
Copy link
Contributor Author

wow you right, its working now, thank you datakick 👍
this issue solved now @Traumflug

Traumflug added a commit that referenced this issue Jul 18, 2018
Following code expects such an array.

Solution found by @getdatakick, thank you very much!

This solves part 2 of issue #550.
Traumflug added a commit that referenced this issue Jul 18, 2018
This audit was triggered by the solution found for issue #550.

Goal: prefer decoding into an array (second parameter True),
      unless the result is explicitely used as an object.

As most decoded JSON is used as an array, this resulted in quite
some edits.
@Traumflug
Copy link
Contributor

Excellent!

As you can see by the commits mentioned above, I extended this finding to an audit of all json_decode() usages. Which resulted in quite a few edits.

Closing, as the issue is solved. If there's anything left, don't hesitate to reopen it.

@drudesign
Copy link

Having same issue with up to date Cart.php file - any ideas?

@getdatakick
Copy link
Contributor

@drudesign I believe that's already fixed by cf7adb2

@drood89
Copy link

drood89 commented Jul 30, 2018

Hello. I have the same problem. I checked the solution:
cf7adb2

Did not help. I still had:

Notice: Undefined variable: delivery_option in /home/modwork-io/web/as1.modwork.io/public_html/classes/Cart.php on line 1039

I checked the file:

https://raw.githubusercontent.com/thirtybees/thirtybees/05997b6feea465031d639fe1ac006105298d03f8/classes/Cart.php

And that solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants