Forum

Thread tagged as: Problem, Error, Shop

Error on checkout

Hi Guys

I have my shop setup pretty much now, I'm able to register on checkout but when going to final stage the page says:

Warning: PDO::quote() expects parameter 1 to be string, array given in /perch/core/lib/PerchDB_MySQL.class.php on line 382

I've looked at that file and line 382 is:

$escape = $link->quote($value);

No idea really what this means as I'm not a PHP Dev, any help would be much appreciated! :)

David Clarke

David Clarke 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is there any more context around that message?

Hi Drew, no there isn't, after registering I'm forwarded to the checkout page which loads and it outputs that message as html onto the page and that's it. The PHP on my checkout page is:

<?php 
   $path = $_SERVER['DOCUMENT_ROOT'];
   $path .= "/perch/runtime.php";
   include_once($path);
?>
<?php
    perch_shop_checkout([
    'return_url' => '/payment/success',
    'cancel_url' => '/payment/failure',
]);
?>

Screenshot below:

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's all that's on the page?

Yup. nothing else that's it. it's my checkout.php page which a user gets forwarded to after going through the cart and registering. A new member does get added to the admin area when this page loads up.

I have the PayPal API details in the config file and i'm guessing that's supposed to take over at this point? The domain is password protected at the moment if that makes any difference.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does it work with the manual gateway?

What's in the cart?

Ah I seem to have fixed it.. I changed my checkout.php page to:

<?php 
   $path = $_SERVER['DOCUMENT_ROOT'];
   $path .= "/perch/runtime.php";
   include_once($path);
?>
<?php
if (perch_member_logged_in()) {

  // your 'success' return URL
  $return_url = 'https://www.cichlidsandtropicals.co.uk/shop/success/';
  $cancel_url = 'https://www.cichlidsandtropicals.co.uk';

  perch_shop_checkout('paypal-express', [
    'return_url' => $return_url,
    'cancel_url' => $cancel_url,
  ]);
}
?>

I'm not sure which bits I was missing but it seems to be working now :). Thanks for the replies though Drew! The support for Perch is really first class, I don't know when you get the time to actually work on Perch itself!

Drew McLellan

Drew McLellan 2638 points
Perch Support

Oh, of course. You weren't specifying which gateway to check out with - you were missing the first argument.

Sometimes it's hard to see the wood for the trees!