Forum
Shop Error
Hey guys,
I am getting a bit of an error when adding a product to cart and don't seem to be able to figure out why :( Any help would be appreciated!
Diagnostics:
Perch: 2.8.32, PHP: 7.0.12, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), perch_shop_orders (PERCH_SHOP_VERSION), perch_shop_products (1.0.9), perch_shop (1.0.9), perch_members (1.5)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_shop' ); ?>
PERCH_LOGINPATH: /perch
PERCH_PATH: /customers/e/a/0/aatelierengland.co.uk/httpd.www/perch
PERCH_CORE: /customers/e/a/0/aatelierengland.co.uk/httpd.www/perch/core
PERCH_RESFILEPATH: /customers/e/a/0/aatelierengland.co.uk/httpd.www/perch/resources
Image manipulation: GD
PHP limits: Max upload 96M, Max POST 96M, Memory: 536870912M, Total max file upload: 96M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
HTTP_HOST: www.aatelierengland.co.uk
DOCUMENT_ROOT: /customers/e/a/0/aatelierengland.co.uk/httpd.www
Cart code:
<div><p><i class="fa fa-shopping-cart" aria-hidden="true"></i> <perch:shop id="product_count" /> item(s) in your cart // <perch:shop id="total_items_formatted" /></p></div>
<div><a href="/cart">Checkout</a></div>
Add to cart code:
<perch:form id="add_to_cart" app="perch_shop">
<perch:input id="product" type="hidden" value="<perch:shop id="productID" type="hidden" />" />
<perch:input type="submit" value="Add to cart" />
</perch:form>
Error:
Fatal error: Uncaught TypeError: Argument 4 passed to PerchShop_Product::get_prices() must be an instance of PerchShop_TaxLocation, boolean given, called in /customers/e/a/0/aatelierengland.co.uk/httpd.www/perch/addons/apps/perch_shop/lib/PerchShop_Cart.class.php on line 713 and defined in /customers/e/a/0/aatelierengland.co.uk/httpd.www/perch/addons/apps/perch_shop/lib/PerchShop_Product.class.php:278 Stack trace: #0 /customers/e/a/0/aatelierengland.co.uk/httpd.www/perch/addons/apps/perch_shop/lib/PerchShop_Cart.class.php(713): PerchShop_Product->get_prices('1', 'standard', 'exc', false, false, Object(PerchShop_Currency), Object(PerchShop_CartTotaliser), true) #1 /customers/e/a/0/aatelierengland.co.uk/httpd.www/perch/addons/apps/perch_shop/lib/PerchShop_Cart.class.php(283): PerchShop_Cart->calculate_cart() #2 /customers/e/a/0/aatelierengland.co.uk/httpd.www/perch/addons/apps/perch_shop/lib/PerchShop_Runtime.class.php(390): PerchShop_Cart->get_cart(Array, Object(PerchShop_Cache)) #3 /customers/e/a/0/aatelierengland.co.uk/h in /customers/e/a/0/aatelierengland.co.uk/httpd.www/perch/addons/apps/perch_shop/lib/PerchShop_Product.class.php on line 278
Do you have tax locations configured, including a home and default location?
Hi Drew,
Yes I have set up all the config stuff that was required. Want me to screenshot it?
This looks like a live server - was it working in dev before you deployed?
This is the first time / place we have had the shop app running so haven't had anything working anywhere else yet.
Ok. Can you turn debug on for the page?
My screenshot didn't work :/ Does this help?
Also is it anything to do with the form action? I didn't want the page to redirect anywhere, I just wanted to add a product tot he cart and for the page to stay where it was so I didn't add an action.
That's fine- without an action it will just resubmit back to the same page. The forms can point to any page as long as it contains the Perch runtime.
Okay that's what I presumed.
However still getting these error messages. Do you think it is something to do with the way I have setup the shop settings? Can't get any output for cart now. Get the errors when 'adding to cart' and trying to view the cart.
How many products do you have configured?
I only have a few test products configured at the moment. Was reading another thread that was saying something about the tax locations? I deleted the data from the database tables as someone mentioned that had fixed things for them but no joy still not working when adding products to cart and still getting the errors :(
When I've run into errors like this during development... (changing product templates, etc.), If I go clear the cookies for the browser, that sometimes helps get me back on track as far as cart issues go.
Thanks for the reply! To me it doesn't really seem to be a template thing. The templates were working fine before I added a product. Once I added a product this is when I hit the errors.
Seems to be a tax thing, possibly the way I have set them up. However I did follow the docs when doing this so I can't see what I have done wrong.
Well I have no idea why but I configured some more tax locations and groups and now it seems to work?
This now seems to be resolved.