wilson113311 Posted November 12, 2013 Share Posted November 12, 2013 Hi, I am looking for a little bit of help. I have bought the Sage Pay module from the prestashop addons and installed on my site I was told this module would work with my current version of prestashop which is 1.5.6. Unfortunately upon installing and enabling the module I have found when my customers gets to the page where they have to input there card details my site goes all out sync nothing is the correct place and just looks like a word document to be honest. Can anyone help on this do I just have to link a CSS sheet? Any help will be much appreciated. Regards Jack Link to comment Share on other sites More sharing options...
vekia Posted November 12, 2013 Share Posted November 12, 2013 you bought this modue: http://addons.prestashop.com/en/payments-gateways-prestashop-modules/1239-sage-pay-go.html?utm_source=adforum ? Link to comment Share on other sites More sharing options...
wilson113311 Posted November 12, 2013 Author Share Posted November 12, 2013 Hi, No it was this one http://addons.prestashop.com/en/payments-gateways-prestashop-modules/3610-sagepay-direct.html Regards Jack Link to comment Share on other sites More sharing options...
wilson113311 Posted November 12, 2013 Author Share Posted November 12, 2013 Are you able to help with this? Regards Jack Link to comment Share on other sites More sharing options...
wilson113311 Posted November 13, 2013 Author Share Posted November 13, 2013 Was you able to help at all? Link to comment Share on other sites More sharing options...
vekia Posted November 13, 2013 Share Posted November 13, 2013 unfortunately i don't know this module. problems like you've got are usually related to modules which are wrong coded. this module works with up to 1.5.3.1, and you've got 1.5.6.0 this probably causing problems. Link to comment Share on other sites More sharing options...
wilson113311 Posted November 13, 2013 Author Share Posted November 13, 2013 I thought that maybe the case the problem I have is I contacted the developer before I purchased the module and was told all would work I guess I will have to change all coding in my css or something Link to comment Share on other sites More sharing options...
vekia Posted November 13, 2013 Share Posted November 13, 2013 what is the url of this page: Link to comment Share on other sites More sharing options...
wilson113311 Posted November 13, 2013 Author Share Posted November 13, 2013 It is http://www.labelsexpress.co.uk/modules/sagepay/form.php Thank you for taking s look Link to comment Share on other sites More sharing options...
vekia Posted November 14, 2013 Share Posted November 14, 2013 can you show contents of this file please? btw. i created fake account and order Link to comment Share on other sites More sharing options...
wilson113311 Posted November 14, 2013 Author Share Posted November 14, 2013 Hi I see your test account the form.php file as below - <?phpfunction requestPost($url, $data){ set_time_limit(60); $output = array(); $curlSession = curl_init(); curl_setopt ($curlSession, CURLOPT_URL, $url); curl_setopt ($curlSession, CURLOPT_HEADER, 0); curl_setopt ($curlSession, CURLOPT_POST, 1); curl_setopt ($curlSession, CURLOPT_POSTFIELDS, $data); curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1); curl_setopt($curlSession, CURLOPT_TIMEOUT,30); curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 1); $rawresponse = curl_exec($curlSession); $response = split(chr(10), $rawresponse); if (curl_error($curlSession)) { $output['Status'] = "FAIL"; $output['StatusDetail'] = curl_error($curlSession); } curl_close ($curlSession); for ($i=0; $i<count($response); $i++) { $splitAt = strpos($response[$i], "="); $output[trim(substr($response[$i], 0, $splitAt))] = trim(substr($response[$i], ($splitAt+1))); } return $output; }$useSSL = true; include('../../config/config.inc.php');include('../../init.php');include('sagepay.php');if (!$cookie->isLogged()){ Tools::redirect('../../authentication.php');}if ($back = Tools::getValue('back')) $smarty->assign('back', Tools::safeOutput($back)); include('../../header.php'); $errors = array(); if(intval(Tools::getValue('submitForm'))>0){$SagePay = new SagePay(); $products = $cart->getProducts(); $cartArr = array(); foreach ($products as $key => $product) { $cartArr[] = htmlentities(utf8_decode($product['name'])).':'.$product['quantity'].':'.$product['price'].':'.$product['price']*($product['rate']/100).':'.$product['price_wt'].':'.$product['total_wt']; } $delivCost = number_format(Tools::convertPrice($cart->getOrderShippingCost(), $currency), 2, '.', ''); if($cart->getOrderShippingCost()>0) { $cartArr[] = 'Delivery:---:'.$delivCost.':0:'.$delivCost.':'.$delivCost; } $p['VPSProtocol'] = '2.23'; $p['Basket'] = count($cartArr).':'.implode(':',$cartArr); $p['GiftAidPayment'] = 0; $p['ApplyAVSCV2'] = Configuration::get('SAGEPAY_AVSCV2'); $p['Apply3DSecure'] = Configuration::get('SAGEPAY_ThreeDSecure'); $p['AccountType'] = 'E'; $p['Vendor'] = Configuration::get('SAGEPAY_VENDOR_NAME'); $p['VendorTxCode'] = $p['Vendor'] . '_'.uniqid().rand(0,32000)*rand(0,32000); $SagePay->txCode = $p['VendorTxCode']; $type = Configuration::get('SAGEPAY_TXTYPE'); if(strlen($type)<1) { $type = 'PAYMENT'; } $p['TxType'] = $type; $p['Amount'] = number_format($cart->getOrderTotal(),2,'.',''); $p['Currency'] = $currency->iso_code; $p['Description'] = 'Protx Direct order'; $p['CardHolder'] = Tools::getValue('card_holder_name'); $p['CardNumber'] = Tools::getValue('card_number'); $p['StartDate'] = Tools::getValue('card_start_date_m') . Tools::getValue('card_start_date_y'); $p['ExpiryDate'] = Tools::getValue('card_expiry_date_m') . Tools::getValue('card_expiry_date_y'); $p['IssueNumber'] = Tools::getValue('card_issue_number'); $p['CV2'] = Tools::getValue('card_cv2'); $p['CardType'] = Tools::getValue('card_type'); $address = new Address(intval($cart->id_address_invoice)); $countryISO = new Country($address->id_country); $p['BillingSurname'] = $address->lastname; $p['BillingFirstnames'] = $address->firstname; $p['BillingAddress1'] = $address->address1; if($address->address2) $p['BillingAddress2'] = $address->address2; $p['BillingCity'] = $address->city; if($address->id_state) { $state = mysql_query("SELECT `name` FROM `" . _DB_PREFIX_."state` WHERE `id_state` = '" . (int) $address->id_state . "'"); if(mysql_num_rows($state)>0) { $state = mysql_result($state,0,'name'); } $p['BillingState'] = $state; } $p['BillingCountry'] = $countryISO->iso_code; $p['BillingPostCode'] = $address->postcode; $delivery = new Address(intval($cart->id_address_delivery)); $countryISO = new Country($delivery->id_country); $p['DeliverySurname'] = $delivery->lastname; $p['DeliveryFirstnames'] = $delivery->firstname; $p['DeliveryAddress1'] = $delivery->address1; if($address->address2) $p['DeliveryAddress2'] = $delivery->address2; $p['DeliveryCity'] = $delivery->city; if($delivery->id_state) { $state = mysql_query("SELECT `name` FROM `" . _DB_PREFIX_."state` WHERE `id_state` = '" . (int) $delivery->id_state . "'"); if(mysql_num_rows($state)>0) { $state = mysql_result($state,0,'name'); } $p['DeliveryState'] = $state; } $p['DeliveryCountry'] = $countryISO->iso_code; $p['DeliveryPostCode'] = $delivery->postcode; $a = '';foreach($p as $key=>$value){ $a .= urlencode($key).'='.urlencode($value).'&';} $urls = $SagePay->getProtxUrl();$b = requestPost($urls['purchaseURL'], $a); if($b['Status'] == 'OK'){echo "Transaction was successful \n" . $b['StatusDetail']; $string = 'Status: '.$b['Status'];$string .= 'Status Detail: '.$b['StatusDetail'];$string .= 'VPSTxID: '.str_replace(array('{','}'),'',$b['VPSTxId']);$string .= 'AVSCV2: '.$b['AVSCV2'];$string .= 'AddressResult: '.$b['AddressResult'];$string .= 'PostCodeResult: '.$b['PostCodeResult'];$string .= 'CV2Result: '.$b['CV2Result']; $SagePay->validateOrder($cart->id, _PS_OS_PAYMENT_, $cart->getOrderTotal(), $SagePay->displayName, htmlentities($string, ENT_COMPAT, 'UTF-8')); $smarty->assign('success','true');$order = new Order($SagePay->currentOrder);Tools::redirectLink(__PS_BASE_URI__.'order-confirmation.php?id_cart='.$cart->id.'&id_module='.$SagePay->id.'&id_order='.$SagePay->currentOrder.'&key='.$order->secure_key); }elseif($b['Status'] == '3DAUTH'){ if($b['3DSecureStatus'] != 'OK'){ die('Your 3d authentification was unsuccessful. Please try again');}$cookie->__set('cart_id',$cart->id);$cookie->__set('MD',$b['MD']);?><script language="javascript"> function OnLoadEvent() { document.form.submit(); }</script><html><head><title>3D Secure Verification</title></head><body OnLoad="OnLoadEvent();"><form name="form" action="<?php echo $b['ACSURL']; ?>" method="post"><input type="hidden" name="PaReq" value="<?php echo $b['PAReq']; ?>"/><input type="hidden" name="MD" value="<?php echo $b['MD']; ?>"/><NOSCRIPT><center><p>Please click to the following button to Authenticate your card</p><input type="submit" value="Auth"/></p></center></NOSCRIPT></form></body></html></iframe> <noframes><form name="form" action="<?php echo $b['ACSURL']; ?>" method="post"><input type="hidden" name="PaReq" value="<?php echo $b['PAReq']; ?>"/><input type="hidden" name="MD" value="<? echo $b['MD']; ?>"/><NOSCRIPT><center><p>Please click to the following button to Authenticate your card</p><input type="submit" value="Auth"/></p></center></NOSCRIPT></form><script language="javascript"> document.form.submit(); </script></noframes><?php} else { $smarty->assign('vsperror',$b['StatusDetail']);} } $months = ''; for($i=1;$i<=12;$i++){ $months .= '<option value="'.str_pad($i,2,0,STR_PAD_LEFT).'">'.str_pad($i,2,0,STR_PAD_LEFT).'</option>'; } $startYears = '';$expiryYears = '';for($i=0;$i<=10;$i++){ $startYears .= '<option value="'.date("y",strtotime("-".$i." years",time())). '">'.date("y",strtotime("-".$i." years",time())).'</option>'; $expiryYears .= '<option value="'.date("y",strtotime("+".$i." years",time())). '">'.date("y",strtotime("+".$i." years",time())).'</option>'; } $smarty->assign('errors', $errors);$smarty->assign('token', Tools::getToken(false)); $smarty->assign('months',$months);$smarty->assign('startYears',$startYears);$smarty->assign('expiryYears',$expiryYears); Tools::safePostVars(); if(!isset($ || $b['Status'] != '3DAUTH'){ $smarty->display(dirname(__FILE__). '/form.tpl');} include('../../footer.php'); ?> Link to comment Share on other sites More sharing options...
vekia Posted November 15, 2013 Share Posted November 15, 2013 ohh this module use old coding method (for prestashop 1.4) can you add somewhere after include init.php $fc=new Frontcontroller(); $fc->setmedia(); Link to comment Share on other sites More sharing options...
wilson113311 Posted November 15, 2013 Author Share Posted November 15, 2013 Amazing this solved it!! Much appreciated many thanks for this!! Link to comment Share on other sites More sharing options...
vekia Posted November 15, 2013 Share Posted November 15, 2013 you're welcome i marked this thread as [solved] with regards, Milos Link to comment Share on other sites More sharing options...
Recommended Posts