Forum
Broken cart
Hello,
I'm stuck with broken cart. I've set up all about taxes trough the wizard. This is on an empty card with default template and perch_shop_cart();
Fatal error: Call to a member function groupTaxRate() on a non-object in /var/www/virtuals/perch/cz.rebella/admin/addons/apps/perch_shop/lib/PerchShop_Product.class.php on line 325
Please post your Diagnostics Report.
Since the previous post, I've deleted everything in admin -> tax and added the very same values again and there's a new error:
Catchable fatal error: Argument 4 passed to PerchShop_Product::get_prices() must be an instance of PerchShop_TaxLocation, boolean given, called in /var/www/virtuals/perch/cz.rebella/admin/addons/apps/perch_shop/lib/PerchShop_Cart.class.php on line 713 and defined in /var/www/virtuals/perch/cz.rebella/admin/addons/apps/perch_shop/lib/PerchShop_Product.class.php on line 278
Can you describe how your shop is configured?
You mean this? :)
I've just tried to clear cookies and when I go to /cart it shows empty cart. When I add a product with this snippet I get a 500 error.
And then when I go directly to /cart (without the POST) I get the PHP error above.
I've found this unresolved thread with the very same problem: https://forum.grabaperch.com/forum/08-17-2016-error-when-selecting-add-to-cart
Yes, I posted the above thread Jiri and I still haven't been able to figure out a resolution :(
Which is exactly why I'm asking for more information, so I can help figure it out.
When you get a 500 status, what error message is logged with that?
I've found a temporary workaround:
in /addons/apps/perch_shop/lib/PerchShop_Product.class.php
change line 278 from:
to:
and it throws a new error: PHP Fatal error: Call to a member function id() on a non-object in /var/www/virtuals/perch/cz.rebella/admin/addons/apps/perch_shop/lib/PerchShop_Product.class.php on line 332, referer: https://rebella-cz.test.pixelpromo.cz/kabaty/k4b4t1-k4b4t1-tmave-modry/
so then changing line 332 from:
to:
(2 and 2 are ids of my tax group and tax location in DB)
profit!
We don't advise doing that and do not offer support to anyone who has hacked at the application.
Drew, hacking the application is not my pleasure nor intention, but untill you fix the error or provide a solution, it is my only option, since the shop has to be live in 5 days and the products won't sell without working cart. Of course I've backed the original file and I can't wait to put it back.
Thanks for understanding
I'd prefer not to hack at the application either - Drew what other information do you need to help with this error?
I'm going to have to set something up to see if I can reproduce the issue. That won't be until next week.
Hey guys, so after some digging around on the forums and looking at solutions to other problems, I've cleared out my perch2_shop_tax_groups, perch2_shop_tax_groups_rates, perch2_shop_tax_locations and perch2_shop_tax_rates databases, and it seems to have fixed the issue. I'll let you know if it comes up again though. It looks like I had some old data in there. I don't know if the old data was the issue or something else was causing it, but thought I'd let you know where to look anyway.
Hello, I've done little digging now and here's the result:
this error (first post) happens, when at least one product's tax_group doesn't match the working locationID of the shop:
this error (second post) happens, when the shop uses the first locationID in DB which has locationDeleted flag set (and sets it to cart):
When there's just one Tax Location, one Tax Group, one Tax Rate and the all the products are set to this Tax Rate, everything works fine.
I'm going to kill myself now :)