Forum

Thread tagged as: Problem, Shop

Paypal error message

Hi, I'm having issues when it comes to the order confirmation in the shop app. I've had to revert to sandbox to find out what error is. Once you go through checkout and the payment gateway is completed, The page it redirects to appears with 'sorry' as though the transaction has not gone through and then the order does not appear in the control panel. However the money has been taken. I have used the below code. is there something I'm doing wrong?

Jade Marling

Jade Marling 0 points

  • 4 years ago
<?php
  perch_shop_complete_payment('paypal-express');

  if (perch_shop_order_successful()) {
      echo '<h1>Thank you for your order!</h1>';
    }else{
      echo '<h1>Sorry!</h1>';
    }

$order_id = perch_shop_successful_order_id();
perch_shop_order($order_id);

?>

this is the debug on the orders page in the control panel

SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='4d57aa0db5c5781bc89f0cf4ba455bed' LIMIT 1
UPDATE perch2_users SET userHash='4ee534897d8e18ec39676b0c3d445a89' WHERE userID='1'
[81] SELECT p.privKey FROM perch2_user_privileges p
[38] SELECT * FROM (SELECT DISTINCT settingID, settingValue, userID FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID, settingValue, userID
[1] SELECT statusKey FROM perch2_shop_order_statuses WHERE statusDeleted IS NULL ORDER BY statusIndex ASC
SELECT SQL_CALC_FOUND_ROWS DISTINCT o.*, c.*, CONCAT(customerFirstName, " ", customerLastName) AS customerName FROM perch2_shop_orders o, perch2_shop_customers c WHERE o.customerID=c.customerID AND o.orderDeleted IS NULL AND o.orderStatus IN () ORDER BY o.orderCreated DESC LIMIT 0, 24
Invalid query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY o.orderCreated DESC LIMIT 0, 24' at line 5
[1] SELECT FOUND_ROWS() AS `count` 

Debug on a successful payment page:

Debug Message
[1] SELECT * FROM perch2_members_sessions WHERE sessionID='4df505776cc68ff426931fcd2cf7ded8cb923e9b' AND sessionHttpFootprint='8017d1c42426ece2e5b619b299eb7a46e016f5c9' AND sessionExpires>'2017-03-15 10:21:48' LIMIT 1
User is logged in
[1] SELECT * FROM perch2_pages WHERE pagePath='/order-complete.php' LIMIT 1
[1] SELECT * FROM perch2_shop_cart WHERE cartID=480212
[1] SELECT * FROM perch2_shop_cart WHERE cartID=480212
[2] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/order-complete.php' OR regionPage='*' ORDER BY regionPage DESC
Using cart from cache.
[37] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1] Using template: /addons/apps/perch_shop/templates/shop/cart/mini-cart.html
Runtime complete_payment for paypal-express
[1] SELECT * FROM perch2_shop_orders WHERE orderGatewayRef='EC-4DB554230L7423044' AND orderDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID='1' LIMIT 1
Payment successful
UPDATE perch2_shop_orders SET orderGatewayRef='31U50378MP5195151', orderUpdated='2017-03-15 10:21:51' WHERE orderID='70'
No ids to log.

Omnipay\PayPal\Message\Response Object
(
    [request:protected] => Omnipay\PayPal\Message\ExpressCompletePurchaseRequest Object
        (
            [liveEndpoint:protected] => https://api-3t.paypal.com/nvp
            [testEndpoint:protected] => https://api-3t.sandbox.paypal.com/nvp
            [parameters:protected] => Symfony\Component\HttpFoundation\ParameterBag Object
                (
                    [parameters:protected] => Array
                        (
                            [username] => website-merchant_api1.walesairambulance.com
                            [password] => CWG6HY8NXF6L3NF9
                            [signature] => AFcWxV21C7fd0v3bYYYRCpSSRl31Asn3PjLXs6fygn3aiQkYn0buJNYh
                            [testMode] => 1
                            [solutionType] => Sole
                            [landingPage] => Billing
                            [brandName] => 
                            [headerImageUrl] => 
                            [logoImageUrl] => 
                            [borderColor] => 
                            [token] => EC-4DB554230L7423044
                            [payerID] => NHMLZ65MA95GA
                            [amount] => 2.64
                            [currency] => GBP
                            [transactionReference] => 70
                        )

                )

            [httpClient:protected] => Guzzle\Http\Client Object
                (
                    [defaultHeaders:protected] => Guzzle\Common\Collection Object
                        (
                            [data:protected] => Array
                                (
                                )

                        )

                    [userAgent:protected] => Guzzle/3.9.3 curl/7.29.0 PHP/5.4.45
                    [config:Guzzle\Http\Client:private] => Guzzle\Common\Collection Object
                        (
                            [data:protected] => Array
                                (
                                    [curl.options] => Array
                                        (
                                            [78] => 60
                                            [10065] => /home/linweb34/w/walesairambulance.com/user/htdocs/admin/addons/apps/perch_shop/lib/vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem
                                            [64] => 1
                                            [81] => 2
                                        )

                                )

                        )

                    [baseUrl:Guzzle\Http\Client:private] => 
                    [curlMulti:Guzzle\Http\Client:private] => Guzzle\Http\Curl\CurlMultiProxy Object
                        (
                            [handles:protected] => Array
                                (
                                    [0] => Guzzle\Http\Curl\CurlMulti Object
                                        (
                                            [multiHandle:protected] => Resource id #174
                                            [requests:protected] => Array
                                                (
                                                )

                                            [handles:protected] => SplObjectStorage Object
                                                (
                                                    [storage:SplObjectStorage:private] => Array
                                                        (
                                                        )

                                                )

                                            [resourceHash:protected] => Array
                                                (
                                                )

                                            [exceptions:protected] => Array
                                                (
                                                )

                                            [successful:protected] => Array
                                                (
                                                )

                                            [multiErrors:protected] => Array
                                                (
                                                    [1] => Array
                                                        (
                                                            [0] => CURLM_BAD_HANDLE
                                                            [1] => The passed-in handle is not a valid CURLM handle.
                                                        )

                                                    [2] => Array
                                                        (
                                                            [0] => CURLM_BAD_EASY_HANDLE
                                                            [1] => An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle.
                                                        )

                                                    [3] => Array
                                                        (
                                                            [0] => CURLM_OUT_OF_MEMORY
                                                            [1] => You are doomed.
                                                        )

                                                    [4] => Array
                                                        (
                                                            [0] => CURLM_INTERNAL_ERROR
                                                            [1] => This can only be returned if libcurl bugs. Please report it to us!
                                                        )

                                                )

                                            [selectTimeout:protected] => 1
                                            [eventDispatcher:protected] => Symfony\Component\EventDispatcher\EventDispatcher Object
                                                (
                                                    [listeners:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                                        (
                                                        )

                                                    [sorted:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                                        (
                                                        )

                                                )

                                        )

                                )

                            [groups:protected] => Array
                                (
                                )

                            [queued:protected] => Array
                                (
                                )

                            [maxHandles:protected] => 3
                            [selectTimeout:protected] => 1
                            [eventDispatcher:protected] => Symfony\Component\EventDispatcher\EventDispatcher Object
                                (
                                    [listeners:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                        (
                                        )

                                    [sorted:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                        (
                                        )

                                )

                        )

                    [uriTemplate:Guzzle\Http\Client:private] => Guzzle\Parser\UriTemplate\UriTemplate Object
                        (
                            [template:Guzzle\Parser\UriTemplate\UriTemplate:private] => 
                            [variables:Guzzle\Parser\UriTemplate\UriTemplate:private] => 
                            [regex:Guzzle\Parser\UriTemplate\UriTemplate:private] => /\{([^\}]+)\}/
                        )

                    [requestFactory:protected] => Guzzle\Http\Message\RequestFactory Object
                        (
                            [methods:protected] => Array
                                (
                                    [getInstance] => 0
                                    [__construct] => 1
                                    [fromMessage] => 2
                                    [fromParts] => 3
                                    [create] => 4
                                    [cloneRequestWithMethod] => 5
                                    [applyOptions] => 6
                                    [visit_headers] => 7
                                    [visit_body] => 8
                                    [visit_allow_redirects] => 9
                                    [visit_auth] => 10
                                    [visit_query] => 11
                                    [visit_cookies] => 12
                                    [visit_events] => 13
                                    [visit_plugins] => 14
                                    [visit_exceptions] => 15
                                    [visit_save_to] => 16
                                    [visit_params] => 17
                                    [visit_timeout] => 18
                                    [visit_connect_timeout] => 19
                                    [visit_debug] => 20
                                    [visit_verify] => 21
                                    [visit_proxy] => 22
                                    [visit_cert] => 23
                                    [visit_ssl_key] => 24
                                )

                            [requestClass:protected] => Guzzle\Http\Message\Request
                            [entityEnclosingRequestClass:protected] => Guzzle\Http\Message\EntityEnclosingRequest
                        )

                    [eventDispatcher:protected] => Symfony\Component\EventDispatcher\EventDispatcher Object
                        (
                            [listeners:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                (
                                    [request.sent] => Array
                                        (
                                            [100] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [0] => Guzzle\Http\RedirectPlugin Object
                                                                (
                                                                    [defaultMaxRedirects:protected] => 5
                                                                )

                                                            [1] => onRequestSent
                                                        )

                                                )

                                        )

                                    [request.clone] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [0] => Guzzle\Http\RedirectPlugin Object
                                                                (
                                                                    [defaultMaxRedirects:protected] => 5
                                                                )

                                                            [1] => cleanupRequest
                                                        )

                                                )

                                        )

                                    [request.before_send] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [0] => Guzzle\Http\RedirectPlugin Object
                                                                (
                                                                    [defaultMaxRedirects:protected] => 5
                                                                )

                                                            [1] => cleanupRequest
                                                        )

                                                )

                                        )

                                )

                            [sorted:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                (
                                )

                        )

                )

            [httpRequest:protected] => Symfony\Component\HttpFoundation\Request Object
                (
                    [attributes] => Symfony\Component\HttpFoundation\ParameterBag Object
                        (
                            [parameters:protected] => Array
                                (
                                )

                        )

                    [request] => Symfony\Component\HttpFoundation\ParameterBag Object
                        (
                            [parameters:protected] => Array
                                (
                                )

                        )

                    [query] => Symfony\Component\HttpFoundation\ParameterBag Object
                        (
                            [parameters:protected] => Array
                                (
                                    [token] => EC-4DB554230L7423044
                                    [PayerID] => NHMLZ65MA95GA
                                )

                        )

                    [server] => Symfony\Component\HttpFoundation\ServerBag Object
                        (
                            [parameters:protected] => Array
                                (
                                    [PHP_FCGI_CHILDREN] => 0
                                    [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
                                    [PWD] => /var/www/fcgi
                                    [SHLVL] => 0
                                    [PHP_FCGI_MAX_REQUESTS] => 100
                                    [ORIG_SCRIPT_NAME] => /fcgi-bin/php54-cgi
                                    [ORIG_PATH_TRANSLATED] => /home/linweb34/w/walesairambulance.com/user/htdocs/order-complete.php
                                    [ORIG_PATH_INFO] => /order-complete.php
                                    [ORIG_SCRIPT_FILENAME] => /var/www/fcgi/php54-cgi
                                    [SCRIPT_NAME] => /order-complete.php
                                    [REQUEST_URI] => /order-complete.php?token=EC-4DB554230L7423044&PayerID=NHMLZ65MA95GA
                                    [QUERY_STRING] => token=EC-4DB554230L7423044&PayerID=NHMLZ65MA95GA
                                    [REQUEST_METHOD] => GET
                                    [SERVER_PROTOCOL] => HTTP/1.0
                                    [GATEWAY_INTERFACE] => CGI/1.1
                                    [REDIRECT_URL] => /order-complete.php
                                    [REDIRECT_QUERY_STRING] => token=EC-4DB554230L7423044&PayerID=NHMLZ65MA95GA
                                    [REMOTE_PORT] => 35008
                                    [SCRIPT_FILENAME] => /home/linweb34/w/walesairambulance.com/user/htdocs/order-complete.php
                                    [SERVER_ADMIN] => support@fasthosts.com
                                    [CONTEXT_DOCUMENT_ROOT] => /var/www/fcgi/
                                    [CONTEXT_PREFIX] => /fcgi-bin/
                                    [REQUEST_SCHEME] => http
                                    [DOCUMENT_ROOT] => /home/linweb34/w/walesairambulance.com/user/htdocs
                                    [REMOTE_ADDR] => 91.103.188.194
                                    [SERVER_PORT] => 80
                                    [SERVER_ADDR] => 127.0.0.1
                                    [SERVER_NAME] => www.walesairambulance.com
                                    [SERVER_SOFTWARE] => Apache
                                    [SERVER_SIGNATURE] => 
                                    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
                                    [HTTP_COOKIE] => _ga=GA1.2.1513402736.1486656328; cmsa=1; PHPSESSID=pupf22nn5urtjr749si1hjseg4; p_m=4df505776cc68ff426931fcd2cf7ded8cb923e9b
                                    [HTTP_ACCEPT_ENCODING] => gzip, deflate
                                    [HTTP_ACCEPT_LANGUAGE] => en-GB,en;q=0.5
                                    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
                                    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0
                                    [HTTP_CONNECTION] => close
                                    [HTTP_X_FORWARDED_FOR] => 91.103.188.194
                                    [HTTP_X_REAL_IP] => 91.103.188.194
                                    [HTTP_HOST] => www.walesairambulance.com
                                    [UNIQUE_ID] => WMkVvMAS8HCC08XR9mhYDQAAABI
                                    [on] => 127.0.0.1
                                    [REDIRECT_STATUS] => 200
                                    [REDIRECT_HANDLER] => application/x-httpd-php54
                                    [REDIRECT_UNIQUE_ID] => WMkVvMAS8HCC08XR9mhYDQAAABI
                                    [REDIRECT_on] => 127.0.0.1
                                    [FCGI_ROLE] => RESPONDER
                                    [PHP_SELF] => /order-complete.php
                                    [REQUEST_TIME_FLOAT] => 1489573308.1391
                                    [REQUEST_TIME] => 1489573308
                                )

                        )

                    [files] => Symfony\Component\HttpFoundation\FileBag Object
                        (
                            [parameters:protected] => Array
                                (
                                )

                        )

                    [cookies] => Symfony\Component\HttpFoundation\ParameterBag Object
                        (
                            [parameters:protected] => Array
                                (
                                    [_ga] => GA1.2.1513402736.1486656328
                                    [cmsa] => 1
                                    [PHPSESSID] => pupf22nn5urtjr749si1hjseg4
                                    [p_m] => 4df505776cc68ff426931fcd2cf7ded8cb923e9b
                                )

                        )

                    [headers] => Symfony\Component\HttpFoundation\HeaderBag Object
                        (
                            [headers:protected] => Array
                                (
                                    [upgrade-insecure-requests] => Array
                                        (
                                            [0] => 1
                                        )

                                    [cookie] => Array
                                        (
                                            [0] => _ga=GA1.2.1513402736.1486656328; cmsa=1; PHPSESSID=pupf22nn5urtjr749si1hjseg4; p_m=4df505776cc68ff426931fcd2cf7ded8cb923e9b
                                        )

                                    [accept-encoding] => Array
                                        (
                                            [0] => gzip, deflate
                                        )

                                    [accept-language] => Array
                                        (
                                            [0] => en-GB,en;q=0.5
                                        )

                                    [accept] => Array
                                        (
                                            [0] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
                                        )

                                    [user-agent] => Array
                                        (
                                            [0] => Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0
                                        )

                                    [connection] => Array
                                        (
                                            [0] => close
                                        )

                                    [x-forwarded-for] => Array
                                        (
                                            [0] => 91.103.188.194
                                        )

                                    [x-real-ip] => Array
                                        (
                                            [0] => 91.103.188.194
                                        )

                                    [host] => Array
                                        (
                                            [0] => www.walesairambulance.com
                                        )

                                )

                            [cacheControl:protected] => Array
                                (
                                )

                        )

                    [content:protected] => 
                    [languages:protected] => 
                    [charsets:protected] => 
                    [encodings:protected] => 
                    [acceptableContentTypes:protected] => 
                    [pathInfo:protected] => 
                    [requestUri:protected] => 
                    [baseUrl:protected] => 
                    [basePath:protected] => 
                    [method:protected] => 
                    [format:protected] => 
                    [session:protected] => 
                    [locale:protected] => 
                    [defaultLocale:protected] => en
                )

            [response:protected] => Omnipay\PayPal\Message\Response Object
 *RECURSION*
            [zeroAmountAllowed:protected] => 1
            [negativeAmountAllowed:protected] => 
        )

    [data:protected] => Array
        (
            [TOKEN] => EC-4DB554230L7423044
            [SUCCESSPAGEREDIRECTREQUESTED] => false
            [TIMESTAMP] => 2017-03-15T10:21:51Z
            [CORRELATIONID] => fefbd115c542
            [ACK] => Success
            [VERSION] => 119.0
            [BUILD] => 31129382
            [INSURANCEOPTIONSELECTED] => false
            [SHIPPINGOPTIONISDEFAULT] => false
            [PAYMENTINFO_0_TRANSACTIONID] => 31U50378MP5195151
            [PAYMENTINFO_0_TRANSACTIONTYPE] => expresscheckout
            [PAYMENTINFO_0_PAYMENTTYPE] => instant
            [PAYMENTINFO_0_ORDERTIME] => 2017-03-15T10:21:50Z
            [PAYMENTINFO_0_AMT] => 2.64
            [PAYMENTINFO_0_FEEAMT] => 0.29
            [PAYMENTINFO_0_TAXAMT] => 0.00
            [PAYMENTINFO_0_CURRENCYCODE] => GBP
            [PAYMENTINFO_0_PAYMENTSTATUS] => Completed
            [PAYMENTINFO_0_PENDINGREASON] => None
            [PAYMENTINFO_0_REASONCODE] => None
            [PAYMENTINFO_0_PROTECTIONELIGIBILITY] => Eligible
            [PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE] => ItemNotReceivedEligible,UnauthorizedPaymentEligible
            [PAYMENTINFO_0_SECUREMERCHANTACCOUNTID] => 68FSUKWGTXX44
            [PAYMENTINFO_0_ERRORCODE] => 0
            [PAYMENTINFO_0_ACK] => Success
        )

)

UPDATE perch2_shop_orders_meta SET metaValue=last_insert_id(metaValue+1) WHERE id='last_invoice_number'
[1] SELECT last_insert_id()
UPDATE perch2_shop_orders SET orderInvoiceNumber='Invoice0', orderUpdated='2017-03-15 10:21:51' WHERE orderID='70'
No ids to log.
Setting order status to paid
UPDATE perch2_shop_orders SET orderDynamicFields='{\"status\":\"paid\"}', orderStatus='paid', orderUpdated='2017-03-15 10:21:51' WHERE orderID='70'
No ids to log.

Array
(
    [country] => GB
)

[1] SELECT * FROM perch2_shop_countries WHERE iso2='GB' LIMIT 1
INSERT INTO perch2_shop_tax_exhibits(orderID,exhibitType,exhibitDetail,exhibitSource,locationID,countryID,exhibitDate) VALUES(70,'CARD_ADDRESS','GB','PayPal_Express',NULL,NULL,'2017-03-15 10:21:53')
[1] SELECT * FROM perch2_shop_tax_exhibits WHERE exhibitID='164' LIMIT 1
No ids to log.
UPDATE perch2_shop_tax_exhibits SET orderID=70, exhibitType='CARD_ADDRESS', exhibitDetail='GB', exhibitSource='PayPal_Express', locationID=NULL, countryID=NULL, exhibitDate='2017-03-15 10:21:53' WHERE exhibitID='164'
No ids to log.
[1] SELECT * FROM perch2_shop_addresses WHERE addressID='226' AND addressDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationDeleted IS NULL AND ((countryID=0 AND regionID IS NULL) OR locationIsDefault=1) ORDER BY locationIsDefault ASC LIMIT 1
Looking up missing property address_1
[1] SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
Looking up missing property address_2
[1] SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
Looking up missing property city
[1] SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
Looking up missing property county
[1] SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
Looking up missing property postcode
[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
INSERT INTO perch2_shop_tax_exhibits(orderID,exhibitType,exhibitDetail,exhibitSource,locationID,countryID,exhibitDate) VALUES(70,'BILL_ADDRESS','test, test, test, sa15th','Customer','1','0','2017-03-15 10:21:53')
[1] SELECT * FROM perch2_shop_tax_exhibits WHERE exhibitID='165' LIMIT 1
No ids to log.
UPDATE perch2_shop_tax_exhibits SET orderID=70, exhibitType='BILL_ADDRESS', exhibitDetail='test, test, test, sa15th', exhibitSource='Customer', locationID='1', countryID='0', exhibitDate='2017-03-15 10:21:53' WHERE exhibitID='165'
No ids to log.
[1] SELECT * FROM perch2_shop_addresses WHERE addressID='227' AND addressDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationDeleted IS NULL AND ((countryID=0 AND regionID IS NULL) OR locationIsDefault=1) ORDER BY locationIsDefault ASC LIMIT 1
Looking up missing property address_1
[1] SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
Looking up missing property address_2
[1] SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
Looking up missing property city
[1] SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
Looking up missing property county
[1] SELECT * FROM perch2_shop_countries WHERE countryID='0' LIMIT 1
No country set for address
Looking up missing property postcode
[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
INSERT INTO perch2_shop_tax_exhibits(orderID,exhibitType,exhibitDetail,exhibitSource,locationID,countryID,exhibitDate) VALUES(70,'SHIP_ADDRESS','test, test, test, sa15th','Customer','1','0','2017-03-15 10:21:53')
[1] SELECT * FROM perch2_shop_tax_exhibits WHERE exhibitID='166' LIMIT 1
No ids to log.
UPDATE perch2_shop_tax_exhibits SET orderID=70, exhibitType='SHIP_ADDRESS', exhibitDetail='test, test, test, sa15th', exhibitSource='Customer', locationID='1', countryID='0', exhibitDate='2017-03-15 10:21:53' WHERE exhibitID='166'
No ids to log.
[1] SELECT * FROM perch2_shop_order_statuses WHERE statusKey='paid' AND statusActive=1 AND statusDeleted IS NULL
[1] SELECT p.*, oi.itemQty FROM perch2_shop_order_items oi, perch2_shop_products p WHERE oi.productID = p.productID AND oi.orderID='70'
[1] SELECT * FROM perch2_shop_customers WHERE customerID='1' AND customerDeleted IS NULL LIMIT 1
UPDATE perch2_shop_products SET stock_level=13, productUpdated='2017-03-15 10:21:53' WHERE productID='5'
No ids to log.
[nil] SELECT * FROM perch2_shop_product_tags WHERE productID=5 AND tagDeleted IS NULL ORDER BY tagOrder ASC
[1] SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 AND currencyID=1
UPDATE perch2_shop_orders SET orderExchangeRate=1, orderUpdated='2017-03-15 10:21:53' WHERE orderID='70'
No ids to log.
[1] SELECT * FROM perch2_shop_orders WHERE orderID=70 AND orderDeleted IS NULL LIMIT 1
Is paid?
[1] SELECT * FROM perch2_shop_orders WHERE orderID=70 AND orderDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_customers WHERE memberID=171
[1] SELECT statusKey FROM perch2_shop_order_statuses WHERE statusDeleted IS NULL ORDER BY statusIndex ASC
SELECT * FROM perch2_shop_orders WHERE customerID=1 AND orderID=70 AND orderStatus IN ()
Invalid query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4
Drew McLellan

Drew McLellan 2638 points
Perch Support

What do you have listed under Shop > Statuses?

New Order with the index of 1

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's all? None of the defaults? There should be 9 defaults from Created to Refunded.

What are they? I didn't see that in the docs

Drew McLellan

Drew McLellan 2638 points
Perch Support

They're part of the app, they wouldn't appear in the docs because they should be there. Run this.

INSERT INTO `perch2_shop_order_statuses` (`statusID`, `statusKey`, `statusTitle`, `statusEditable`, `statusIndex`, `statusDynamicFields`, `statusCreated`, `statusUpdated`, `statusDeleted`, `statusActive`)
VALUES
    (1,'created','Created',0,0,'[]','2016-01-01 00:00:00','2016-02-26 04:42:44',NULL,1),
    (2,'payment_failed','Payment failed',0,50,NULL,'2016-01-01 00:00:00','2016-02-26 04:39:44',NULL,1),
    (3,'paid','Paid',0,100,'[]','2016-01-01 00:00:00','2016-02-26 12:42:00',NULL,1),
    (4,'processing','Processing',0,150,NULL,'2016-01-01 00:00:00','2016-02-26 04:39:45',NULL,1),
    (5,'cancelled','Cancelled',0,200,NULL,'2016-01-01 00:00:00','2016-02-26 04:39:45',NULL,1),
    (6,'dispatched','Dispatched',0,250,NULL,'2016-01-01 00:00:00','2016-02-26 04:39:45',NULL,1),
    (7,'returned','Returned',0,300,NULL,'2016-01-01 00:00:00','2016-02-26 04:39:46',NULL,1),
    (8,'partial_refund','Partial refund',0,350,NULL,'2016-01-01 00:00:00','2016-02-26 04:39:46',NULL,1),
    (9,'refunded','Refunded',0,400,NULL,'2016-01-01 00:00:00','2016-02-26 04:39:47',NULL,1);

Where and how do I run it?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's SQL, so you'd run it as a query against your database.

That worked, thanks Drew!

The only issue that I have now is that the variants are not showing on the orders? I have included it in the cart but it doesn't appear. Code below

<div class="wrapper cols2-nav-right">   
    <div class="primary-content">

<perch:if id="product_count" match="gt" value="0">
    <h1>Your cart (<perch:shop id="item_count" />)</h1>
    <perch:form id="cart" app="perch_shop">

        <perch:input type="submit" value="Update" hidden="true" aria-hidden="true" />

        <table class="cart">
            <tr>
                <th></th>
                <th>Code</th>
                <th>Item</th>
                <th>Quantity</th>
                <th>Price</th>
                <th>Total</th>
            </tr>
            <perch:cartitems>
                <tr>
                    <td><perch:cartitem id="image" type="image" width="80" height="80" density="1.6" crop="true" output="tag" /></td>
                    <td><perch:cartitem id="sku" /></td>
                    <td>
                        <b><perch:cartitem id="title" /></b>
                        <p><i><perch:cartitem id="variant_desc" /></i></p>
                        <div class="desc">
                            <perch:cartitem id="description" type="textarea" markdown="true" />
                        </div>
                        <button type="submit" class="remove_cart" name="del:<perch:cartitem id="identifier" />" value="1">
                            Remove from cart
                        </button>
                    </td>
                    <td><perch:input id="qty:<perch:cartitem id="identifier" />" value="<perch:cartitem id="quantity" />" type="number" min="0" /></td>
                    <td class="money"><perch:cartitem id="price_without_tax" /></td>
                    <td class="money"><perch:cartitem id="total_without_tax_formatted" /></td>
                </tr>
            </perch:cartitems>

            <perch:if id="total_discounts" match="gt" value="0.00">
                <tr class="total">
                    <th colspan="5">
                        Discount (<perch:shop id="discount_code" />)
                    </th>
                    <td class="money">
                        <perch:shop id="total_discounts_formatted" />
                    </td>
                </tr>
                <tr class="total">
                    <th colspan="5">
                        Total
                    </th>
                    <td class="money">
                        <perch:shop id="total_items_discounted_formatted" />
                    </td>
                </tr>
            <perch:else />
                <tr class="total">
                    <th colspan="5">
                        Total
                    </th>
                    <td class="money">
                        <perch:shop id="total_items_formatted" />
                    </td>
                </tr>
            </perch:if>
            <tr class="total">
                <th colspan="5">
                    Tax
                </th>
                <td class="money">
                    <perch:shop id="total_tax_formatted" />
                </td>
            </tr>
            <tr class="total">
                <th colspan="5">
                    Grand total
                </th>
                <td class="money">
                    <perch:shop id="grand_total_formatted" />
                </td>
            </tr>
        </table>

        <div class="discount">
            <perch:label for="discount">
                Discount code
                <perch:input type="text" id="discount_code" />
            </perch:label>
        </div>

        <perch:input type="submit" value="Update" />

    </perch:form>

    <p>
        <a href="checkout.php">Checkout now</a>
    </p>

<perch:else />
<h1>Your cart</h1>

<p>Your cart is empty.</p>
</perch:if>





</div>
</div>





<style>
.cart {
    width: 100%;
    border-collapse: collapse;
}

.cart th {
    font-weight: 600;
}

.cart td,
.cart th {
    border: 1px solid #efefef;
    vertical-align: top;
    padding: 3px;
}

.cart .total,
.cart .money {
    text-align: right;
}

.discount {
    max-width: 300px;
}

.desc {
    font-size: small;
}

b {
    font-weight: 600;
    color: rgba(0, 0, 0, 0.6);
}

i {
    font-style: italic;
    font-size: small;
    color: rgba(0, 0, 0, 0.6);
}

.remove_cart {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    text-decoration: underline;
}

input[type=number] {
    width: 35px;
}
</style>
Drew McLellan

Drew McLellan 2638 points
Perch Support

On the order or in the cart? Which page function ate you using at which point of the process?

In the cart and on the order. I'm using the <?php perch_shop_cart();?> on the cart page, And I have included the product variant in the cart template but it doesn't appear. I'm guessing that because it's not pulled through the the orders because it's not on the cart?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you adding a variant or a parent product to the cart?

If it's not in the cart it'll never be in the order.

I'm not really sure. I think it's the parent product. See below

 <h5><perch:shop id="stock_status" type="shop_stock_status" label="Stock status" divider-before="Stock" required="true"/></h5>
                                    <div class="product-price"><perch:shop id="price" type="shop_currency_value" label="Price" divider-before="Pricing" size="m" min="0" step="any" />
</div><!-- Product Single - Price End -->



                                    <div class="clear"></div>
                                    <div class="line"></div>

                                    <!-- Product Single - Quantity & Cart Button
                                    ============================================= -->

                                     <perch:form id="add_to_cart" app="perch_shop" action="cart.php">
    <perch:if exists="has_variants">
      <perch:productopts>
        <h5 style="margin-bottom: 10px;"><perch:productopt id="title" /></h5>
        <perch:productvalues>
          <perch:before><select class="form-control" style="margin-bottom: 20px;" name="opt-<perch:productvalue id="optionID />[]"></perch:before>
            <li>
              <label>
                <option
                  value="<perch:productvalue id="valueID" />" type="select" required="required" />
                <perch:productvalue id="valueTitle" />
                  </option>
              </label>
            </li>
          <perch:after></select></perch:after>
        </perch:productvalues>
      </perch:productopts>
    </perch:if>

    <perch:input id="product" type="hidden" value="<perch:shop id="productID" type="hidden" env-autofill="false" />" />
    <perch:input type="submit" value="Add to cart"   class="add-to-cart button nomargin"/>
  </perch:form>
Drew McLellan

Drew McLellan 2638 points
Perch Support

That looks like it's ok. What does the line entry in the cart say? Does it list the variant details?

<perch:cartitems>
                <tr>
                    <td><perch:cartitem id="image" type="image" width="80" height="80" density="1.6" crop="true" output="tag" /></td>
                    <td><perch:cartitem id="sku" /></td>
                    <td>
                        <b><perch:cartitem id="title" /></b>
                        <p><perch:cartitem id="valueTitle" /></p>
                        <div class="desc">
                            <perch:cartitem id="description" type="textarea" markdown="true" />
                        </div>
                        <button type="submit" class="remove_cart" name="del:<perch:cartitem id="identifier" />" value="1">
                            Remove from cart
                        </button>
                    </td>
                    <td><perch:input id="qty:<perch:cartitem id="identifier" />" value="<perch:cartitem id="quantity" />" type="number" min="0" /></td>
                    <td class="money"><perch:cartitem id="price_without_tax" /></td>
                    <td class="money"><perch:cartitem id="total_without_tax_formatted" /></td>
                </tr>
            </perch:cartitems>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Make sure you include <perch:cartitem id="variant_desc" /> else you won't see that it's a variant.

It still doesn't seem to be showing