Forum

Thread tagged as: Problem, Members, Shop

Address issues with shop and members

Hi Could you have a look through and see if you can tell whats happening here?

The following debug messages come after I deleted all orders and customers from the database and started fresh. I created a new user with my member register form (where I also take the address! important!) then i activated user from members app, then logged in as user, went to cart, picked some items, cart check qty, then confirm page where it should crete my address and give me options to pick, edit or add more.

Debug Message
[32]
SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate FROM perch2_pages p LEFT JOIN perch2_page_routes pr ON p.pageID=pr.pageID ORDER BY pr.routeOrder ASC, p.pagePath ASC
Matched page: /shop/confirm, so not using routes.
Using master page: /templates/pages/confirm.php
[1]
SELECT * FROM perch2_members_sessions WHERE sessionID='a1fcdf6c670c21d57ea00b57b5da0e5a9e3882d5' AND sessionHttpFootprint='1d17425e9d1cd11d5d857bd3d1b870de6e97430c' AND sessionExpires>'2016-08-18 10:15:09' LIMIT 1
User is logged in
[1]
SELECT * FROM perch2_pages WHERE pagePath='/shop/confirm' LIMIT 1
[1]
SELECT * FROM perch2_shop_cart WHERE cartID=190
[1]
SELECT * FROM perch2_shop_cart WHERE cartID=190
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
Using template: /templates/search/search-form.html
[3]
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
[1]
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/shop/confirm' LIMIT 1
[2]
SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-004-007', '000-004', '000') ORDER BY pageTreePosition DESC
[3]
Using template: /templates/navigation/head_item.html
Using cart from cache.
[28]
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[2]
Using template: /templates/shop/cart/cart_static.html
[1]
SELECT billingAddress, shippingAddress FROM perch2_shop_cart WHERE billingAddress IS NOT NULL AND cartID=190
[1]
SELECT * FROM perch2_shop_customers WHERE memberID=73
[1]
SELECT * FROM perch2_shop_customers WHERE customerEmail='name@email.co.uk' AND customerDeleted IS NULL LIMIT 1
INSERT INTO perch2_shop_customers(customerDynamicFields,memberID,customerCreated) VALUES('{\"first_name\":\"William\",\"last_name\":\"Chicken\",\"email\":\"name@email.co.uk\"}','73','2016-08-18 09:15:09')
[1]
SELECT * FROM perch2_shop_customers WHERE customerID='1' LIMIT 1
No ids to log.
UPDATE perch2_shop_customers SET customerDynamicFields='{\"first_name\":\"William\",\"last_name\":\"Chicken\",\"email\":\"name@email.co.uk\"}', memberID='73', customerCreated='2016-08-18 09:15:09', customerFirstName='William', customerLastName='Chicken', customerEmail='name@email.co.uk', customerUpdated='2016-08-18 10:15:09' WHERE customerID='1'
No ids to log.
[nil]
SELECT * FROM perch2_shop_addresses WHERE customerID='1' AND orderID IS NULL
Using template: /templates/shop/checkout/order_address_form.html
Using template: /templates/shop/checkout/confirm.html
[2]
SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/shop/confirm' OR regionPage='*' ORDER BY regionPage DESC
[1]
SELECT groupID FROM perch2_navigation WHERE groupSlug='Footer' LIMIT 1
[2]
SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID=3 AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
[0]
SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=3 AND p.pagePath='/shop/confirm' LIMIT 1
[2]
Using template: /templates/navigation/footlinks.html
Request time: 0.1767
Process time: 0.1756
Memory: 4.0004

This is the message when I confirm and checkout!

Debug Message
[32]
SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate FROM perch2_pages p LEFT JOIN perch2_page_routes pr ON p.pageID=pr.pageID ORDER BY pr.routeOrder ASC, p.pagePath ASC
Matched page: /shop/result, so not using routes.
Using master page: /templates/pages/result.php
[1]
SELECT * FROM perch2_members_sessions WHERE sessionID='a1fcdf6c670c21d57ea00b57b5da0e5a9e3882d5' AND sessionHttpFootprint='1d17425e9d1cd11d5d857bd3d1b870de6e97430c' AND sessionExpires>'2016-08-18 11:58:44' LIMIT 1
User is logged in
[1]
SELECT * FROM perch2_pages WHERE pagePath='/shop/result' LIMIT 1
[1]
SELECT * FROM perch2_shop_cart WHERE cartID=190
[1]
SELECT * FROM perch2_shop_cart WHERE cartID=190
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
Using template: /templates/search/search-form.html
[3]
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
[1]
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/shop/result' LIMIT 1
[2]
SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-004-006', '000-004', '000') ORDER BY pageTreePosition DESC
[3]
Using template: /templates/navigation/head_item.html
DELETE FROM perch2_shop_cart WHERE cartID='190'
------------------------------ Calculating cart ------------------------------
[1]
SELECT * FROM perch2_shop_cart WHERE cartID=0
[1]
SELECT * FROM perch2_shop_cart WHERE cartID=0
[1]
SELECT * FROM perch2_shop_tax_locations WHERE locationID=0 AND locationDeleted IS NULL LIMIT 1
[1]
SELECT locationID FROM perch2_shop_tax_locations WHERE locationIsHome=1 LIMIT 1
[1]
SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
[1]
SELECT * FROM perch2_shop_currencies WHERE currencyID=0 LIMIT 1
[28]
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1]
SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 AND currencyID=47
[1]
SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch2_shop_cart_items WHERE cartID=0
Tax mode: inc
[nil]
SELECT * FROM perch2_shop_cart_items WHERE cartID=0 ORDER BY itemID ASC
[4]
SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/shop/result' OR regionPage='*' ORDER BY regionPage DESC
[1]
SELECT groupID FROM perch2_navigation WHERE groupSlug='Footer' LIMIT 1
[2]
SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID=3 AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
[0]
SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=3 AND p.pagePath='/shop/result' LIMIT 1
[2]
Using template: /templates/navigation/footlinks.html
Request time: 0.1749
Process time: 0.1734
Memory: 4.0676

Then next time I arrive at my confirm page

Debug Message
[32]
SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate FROM perch2_pages p LEFT JOIN perch2_page_routes pr ON p.pageID=pr.pageID ORDER BY pr.routeOrder ASC, p.pagePath ASC
Matched page: /shop/confirm, so not using routes.
Using master page: /templates/pages/confirm.php
[1]
SELECT * FROM perch2_members_sessions WHERE sessionID='a1fcdf6c670c21d57ea00b57b5da0e5a9e3882d5' AND sessionHttpFootprint='1d17425e9d1cd11d5d857bd3d1b870de6e97430c' AND sessionExpires>'2016-08-18 12:00:08' LIMIT 1
User is logged in
[1]
SELECT * FROM perch2_pages WHERE pagePath='/shop/confirm' LIMIT 1
[1]
SELECT * FROM perch2_shop_cart WHERE cartID=191
[1]
SELECT * FROM perch2_shop_cart WHERE cartID=191
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
Using template: /templates/search/search-form.html
[3]
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
[1]
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/shop/confirm' LIMIT 1
[2]
SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-004-007', '000-004', '000') ORDER BY pageTreePosition DESC
[3]
Using template: /templates/navigation/head_item.html
Using cart from cache.
[28]
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1]
Using template: /templates/shop/cart/cart_static.html
[1]
SELECT billingAddress, shippingAddress FROM perch2_shop_cart WHERE billingAddress IS NOT NULL AND cartID=191
[1]
SELECT * FROM perch2_shop_customers WHERE memberID=73
[2]
SELECT * FROM perch2_shop_addresses WHERE customerID='1' AND orderID IS NULL
[2]
Using template: /templates/shop/checkout/order_address_form.html
[1]
SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
[1]
SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
[2]
No country set for address
[1]
SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
[1]
SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
Using template: /templates/shop/checkout/confirm.html
[2]
SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/shop/confirm' OR regionPage='*' ORDER BY regionPage DESC
[1]
SELECT groupID FROM perch2_navigation WHERE groupSlug='Footer' LIMIT 1
[2]
SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID=3 AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
[0]
SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=3 AND p.pagePath='/shop/confirm' LIMIT 1
[2]
Using template: /templates/navigation/footlinks.html
Request time: 0.1921
Process time: 0.1905
Memory: 3.9829

I now get two addresses (the same) and that country issue. ?

William Chicken

William Chicken 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to use the Shop address management for your addresses. Shop doesn't know anything about addresses added to Members.

A Ha! Ok, I'll have to implement that into my checkout flow then.
When a member signs up with us, we need their information first before allowing sales due to being wholesale. This is how come we all ready have addresses. It would be good if you could implement it to work as I can envisage quite a few trade only / wholesale websites being made with this due to the flexibility of perch and the bespoke nature of such sites.
Thanks )

I've tried a few things but am losing the will now. Is there a way to set address for shop whilst all ready being logged in as a member e.g. member.app member? Or is this not possible at all?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you'd use the address functions for that. It doesn't need to be in your checkout flow, but you do need to have created the customer by that point.

https://docs.grabaperch.com/addons/shop/customers/functions/

Hi Drew I really have tried.. all week actually! so I ask, which of those functions will do the trick?
Because I either get extra addresses that are all the same or a new user gets created which is no good as it is not even linked to the order or member that is logged in.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me the code that's not working?

William - I want to do the same! Did you figure this out? I am going around in circles!