Skip to content

Instantly share code, notes, and snippets.

@maxout
Created November 6, 2015 11:48
Show Gist options
  • Select an option

  • Save maxout/fa98a0cddbf8932d1a3e to your computer and use it in GitHub Desktop.

Select an option

Save maxout/fa98a0cddbf8932d1a3e to your computer and use it in GitHub Desktop.
Sprd:getCheckoutUrl
<?php
/**
* Retrieve Basket Checkout URL
* Returns the checkout URL for the current basket that will used in the iFrame on shop checkout.
* @param $basketUrl
* @param $namespaces
* @return string
*/
private function getCheckoutUrl($basketUrl, $namespaces)
{
$basketXml = simplexml_load_file($basketUrl);
foreach($basketXml->links->link as $link){
if((string)$link['type'] == 'shopCheckout')
$checkoutUrl = (string)$link->attributes($namespaces['xlink']);
}
return $checkoutUrl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment