Jump to content

Get product in cart


Recommended Posts

Hi, is there a way to get a php array of all the products in the user cart after the payment succeed?


I need to send a request to place an order on a web service after the payment with either paypal or another module has gone through.


I was thinking to do it here in the paypal module:

function validateOrder($customer, $cart, $ppec)
	$amount_match = $ppec->rightPaymentProcess();
	$order_total = (float)$cart->getOrderTotal(true, Cart::BOTH);

	// Payment succeed
	if ($ppec->hasSucceedRequest() && !empty($ppec->token) && $amount_match)
		if ((bool)Configuration::get('PAYPAL_CAPTURE'))
			$payment_type = (int)Configuration::get('PS_OS_WS_PAYMENT');
			$payment_status = 'Pending_capture';
			$message = $ppec->l('Pending payment capture.').'<br />';
			if (isset($ppec->result['PAYMENTINFO_0_PAYMENTSTATUS']))
				$payment_status = $ppec->result['PAYMENTINFO_0_PAYMENTSTATUS'];
				$payment_status = 'Error';

			if (strcmp($payment_status, 'Completed') === 0)
				$payment_type = (int)Configuration::get('PS_OS_PAYMENT');
				$message = $ppec->l('Payment accepted.').'<br />';
                                // web service connection
			elseif (strcmp($payment_status, 'Pending') === 0)
				$payment_type = (int)Configuration::get('PS_OS_PAYPAL');
				$message = $ppec->l('Pending payment confirmation.').'<br />';
	// Payment error

Any idea how I can retrieve cart information in order to send them?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...