plugins payment - Paypal (definied if Delivery cost > 0)

stormy

No avatar

2005-12-14 00:34

add file >>>templates/default/orders_payment.tpl

<table class='operation_table' cellspacing='0' align='center'>
<td class='ok'>
<br /><br /><br />
$lang[Order_finished]
<br /><br />
<a href='javascript:windowNew( "?p=ordersWindowPrint&amp;iOrder=$iOrder" );'><b>$lang[Order_print]</b></a>
<br /><br />
<form target="paypal" name="_$iOrder" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="xxxxx@xxxx.xxx">
<input type="hidden" name="item_name" value="OrderID $iOrder of http://xxxxx.xxxx.xxx">
<input type="hidden" name="item_number" value="$iOrder">
<input type="hidden" name="amount" value="$fTotal">
<input type="hidden" name="shipping" value="$fCourier">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" name="submit" alt="Paypal Payment Solutions - Secure and Reliable!">
</form>
<br /><br />
<a href='?p='>$lang[Homepage]</a>
<br /><br />
</td>
</table>

------------------------------------------------------------------------------ --
edit >>>>actions_client/orders.php

saveOrder( $iOrder, $_POST );
//---------add paypal star
$aOrder = throwOrder( $iOrder );
$aCourier = throwCourier( $aOrder['iCourier'] );
$fTotal = sprintf( '%01.2f', $aBasket['fSummary'] );
$fCourier = sprintf( '%01.2f', $aCourier['price'] );
if( $aCourier['price'] > 0 ){
$content .= $tpl->tHtml( 'orders_payment.tpl' );
}
else
//--------add paypal end
$content .= $tpl->tHtml( 'orders_saved.tpl' );

------------------------------------------------------------------------------

:-)

stormy

No avatar

2005-12-14 01:38

<input type="hidden" name="business" value="xxxxx@xxxx.xxx">
<input type="hidden" name="item_name" value="OrderID $iOrder of http://xxxxx.xxxx.xxx">

chage to

<input type="hidden" name="item_name" value="OrderID $iOrder">
<input type="hidden" name="item_number" value="$iOrder">

:-)

stormy

No avatar

2005-12-14 01:39

sorry))
<input type="hidden" name="business" value="xxxxx@xxxx.xxx">
<input type="hidden" name="item_name" value="OrderID $iOrder of http://xxxxx.xxxx.xxx">

chage to

<input type="hidden" name="business" value="$config[email]">
<input type="hidden" name="item_name" value="OrderID $iOrder">


:-)

stormy

No avatar

2005-12-14 01:44

<input type="hidden" name="currency_code" value="USD">

chage to

<input type="hidden" name="currency_code" value="$config[currency_symbol]">

:-)

dh_pmx

No avatar

2005-12-14 22:43

Error in version 0.3.1
I get the following error when confirming and order
Undefined variable: aBasket in /data/webdata/com/sinclairsmith/www/htdocs/cart/actions_client/orders.php on line 57

stormy

No avatar

2005-12-15 00:11

dh_pmx
------------------------------------------------------------------------------ --
edit >>>>actions_client/orders.php

saveOrder( $iOrder, $_POST );

//--------- paypal star

$aOrder = throwOrder( $iOrder );
listBasket( $iOrder);
$aCourier = throwCourier( $aOrder['iCourier'] );
$fTotal = sprintf( '%01.2f', $aBasket['fSummary'] );
$fCourier = sprintf( '%01.2f', $aCourier['price'] );
$fSummary = sprintf( '%01.2f', $aCourier['price'] + $aBasket['fSummary'] );

if( $aCourier['price'] > 0 ){
$content .= $tpl->tHtml( 'orders_payment.tpl' );
}
else
$content .= $tpl->tHtml( 'orders_saved.tpl' );
}

//-------- paypal end
else
$content .= $tpl->tbHtml( 'operations.tpl', 'FORM_ERROR' );

------------------------------------------------------------------------------ -------

:-)

gillweb

No avatar

2005-12-17 05:18

No totals are passed?

heres my 'view source' for the paypal form:
<input type="hidden" name="amount" value="">
<input type="hidden" name="shipping" value="">

Help?!

gillweb@gmail.com

stormy

No avatar

2005-12-17 11:30

1.0 r3 here :

edit >>>>actions_client/orders.php


    
if( isset( $_POST['sOption'] ) && $_POST['sOption'] == 'send' ){
      if( 
checkOrderFields$_POST ) === true && checkOrderProducts$iOrder ) === true ){
        
saveOrder$iOrder$_POST );
//--------- paypal star
        
$aData throwOrder$iOrder );
        
listBasket$iOrder);
        
$aData['fSummary'] = sprintf'%01.2f'$aData['fCourierPrice'] + $aList['fSummary'] );
      if( 
$aData['fCourierPrice'] > ){
        
$content .= $tpl->tbHtml'messages.tpl''ORDER_PAYPAL' );
      }
      else
//-------- paypal end
        
$content .= $tpl->tbHtml'messages.tpl''ORDER_SAVED' );
      }
      else
        
$content .= $tpl->tbHtml'messages.tpl''FORM_ERROR' );



------------------------------------------------------------------------------ ---------
add (ORDER_PAYPAL)>>>>templates/messages.tpl

<!-- BEGIN ORDER_PAYPAL -->
<div id="message">
<div id="ok">
<form target="paypal" name="_$iOrder" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="$config[email]">
<input type="hidden" name="item_name" value="Order ID $iOrder">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="$aList[fSummary]">
<input type="hidden" name="shipping" value="$aData[fCourierPrice]">
<input type="hidden" name="no_note" value="1">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but6.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form><br />
$lang[Order_finished]<br />
<a href="javascript:windowNew( '?p=ordersWindowPrint&amp;iOrder=$iOrder' );">&raquo; $lang[Order_print]</a><br />
<a href="?p=">$lang[Homepage]</a>
</div>
</div>
<!-- END ORDER_PAYPAL -->

:-)

diodo

No avatar

2005-12-29 19:38

hello!

i did it all but when i press on send in the page with all the personal details nothing happens.

by the way, messages.tpl must be in templates or in templates/default ?

isn't there a zipped version of this plugin somewhere?

please help!

thanks again!
diodo

Ganarel

No avatar

2005-12-29 20:11

I placed it in the orders_print.tpl instead of the message.tpl and have message.tpl redirect to orders_print.tpl it work for me.

Ganarel

MuellerLukas

No avatar

2006-01-05 18:49

Hello, could someone please put these codesnippets together?

Ryan

Avatar: Ryan

2006-01-06 05:01

Please, bump.

Ste707

No avatar

2006-01-13 11:09

Cheers Stormy,
Works a treat, just a couple of little things needed addressing but excellent. Here&#8217;s the full process I took for version 0.3.1

Step One

Create new file >>>templates/default/orders_payment.tpl

<table class='operation_table' cellspacing='0' align='center'>
<td class='ok'>
<br /><br /><br />
$lang[Order_finished]
<br /><br />
<a href='javascript:windowNew( "?p=ordersWindowPrint&amp;iOrder=$iOrder" );'><b>$lang[Order_print]</b></a>
<br /><br />
<form target="paypal" name="_$iOrder" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="$config[email]">
<input type="hidden" name="item_name" value="OrderID $iOrder">
<input type="hidden" name="item_number" value="$iOrder">
<input type="hidden" name="amount" value="$fTotal">
<input type="hidden" name="shipping" value="$fCourier">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value=" GBP ">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" name="submit" alt="Paypal Payment Solutions - Secure and Reliable!">
</form>
<br /><br />
<a href='?p='>$lang[Homepage]</a>
<br /><br />
</td>
</table>

Note: Remember to change the currency_code to your chosen Currency eg GBP,AUS, USD etc

Step Two

edit >>>>actions_client/orders.php


saveOrder( $iOrder, $_POST );

//--------- PayPal Start
$aOrder = throwOrder( $iOrder );
listBasket( $iOrder);
$aCourier = throwCourier( $aOrder['iCourier'] );
$fTotal = sprintf( '%01.2f', $aBasket['fSummary'] );
$fCourier = sprintf( '%01.2f', $aCourier['price'] );
$fSummary = sprintf( '%01.2f', $aCourier['price'] + $aBasket['fSummary'] );

if( $aCourier['price'] > 0 ){
$content .= $tpl->tHtml( 'orders_payment.tpl' );
}
else {
$content .= $tpl->tHtml( 'orders_saved.tpl' );
}
}
//--------- PayPal Finish

else
$content .= $tpl->tbHtml( 'operations.tpl', 'FORM_ERROR' );



That was it. Hope it helps.
Ste

JohnnHmd

No avatar

2006-01-30 12:53

What's going on?? I've tried this loads of times now, and there's absolutely no difference - no mention of PayPal anywhere!

I'm using v1.0, as there doesn't seem to be one for v1.1.

John

Margus

No avatar

2006-01-31 10:52

Sorry, I don't know much about PHP. I'm using QC Loaded 1.2, where should I put the code in step two (/actions_client/orders.php)? My current orders.php is as follows:

<?php
include DIR_CORE.'couriers-'.$config['db_type'].'.php';
include DIR_CORE.'couriers.php';

include DIR_CORE.'orders-'.$config['db_type'].'.php';
include DIR_CORE.'orders.php';

include DIR_CORE.'products-'.$config['db_type'].'.php';
include DIR_CORE.'products.php';


if( $a == 'Basket' ){

if( isset( $sOption ) ){
if( $sOption == 'add' ){
if( isset( $iProduct ) && is_numeric( $iProduct ) && isset( $iQuantity ) && is_numeric( $iQuantity ) && $iQuantity > 0 ){
addBasketProduct( $iProduct, $iQuantity );
}
}
elseif( $sOption == 'del' ){
$iOrder = throwOrdersIdTemp( $_SESSION['iCustomer'], null );
if( isset( $iElement ) && is_numeric( $iElement ) )
delBasketElement( $iOrder, $iElement );
}
elseif( $sOption == 'save' ){
extract( $_POST );
if( isset( $aQuantity ) && is_array( $aQuantity ) ){
$iCount = count( $aQuantity );
for( $i = 0; $i < $iCount; $i++ )
if( $aQuantity[$i] != $aQuantityBefore[$i] && is_numeric( $aQuantity[$i] ) && $aQuantity[$i] > 0 )
addBasketProduct( $aProduct[$i], $aQuantity[$i] - $aQuantityBefore[$i] );
}

if( isset( $save ) ){
header( 'Location: '.$_SERVER['PHP_SELF'].'?p=ordersDelivery' );
exit;
}
}
}

$iOrder = throwOrdersIdTemp( $_SESSION['iCustomer'], null );

if( isset( $iOrder ) && is_numeric( $iOrder ) )
$content .= listBasket( $iOrder );
else
$content .= $tpl->tbHtml( 'orders_basket.tpl', 'NOT_FOUND' );
}
elseif( $a == 'Delivery' ){
$iOrder = throwOrdersIdTemp( $_SESSION['iCustomer'], null );
if( isset( $iOrder ) && is_numeric( $iOrder ) ){

if( isset( $_POST['option'] ) && $_POST['option'] == 'send' ){
if( checkOrderFields( $_POST ) ){
saveOrder( $iOrder, $_POST );
$content .= $tpl->tHtml( 'orders_saved.tpl' );
}
else
$content .= $tpl->tbHtml( 'operations.tpl', 'FORM_ERROR' );
}
else{
if( countBasketProducts( $iOrder ) > 0 ){
$sSelectCourier = listCouriers( 'couriers_select.tpl' );
$content .= $tpl->tbHtml( 'orders_delivery.tpl', 'FORM' );
$content .= listBasket( $iOrder, 'orders_delivery.tpl' );
$content .= $tpl->tbHtml( 'orders_delivery.tpl', 'COURIER' );
}
else
$content .= $tpl->tbHtml( 'operations.tpl', 'NOT_EXISTS' );
}
}
else{
$content .= $tpl->tbHtml( 'orders_basket.tpl', 'NOT_FOUND' );
}
}
elseif( $a == 'WindowPrint' && isset( $iOrder ) && is_numeric( $iOrder ) ){
$aOrder = throwOrder( $iOrder );
if( isset( $aOrder ) && is_array( $aOrder ) && $aOrder['iKlient'] == $_SESSION['iCustomer'] ){
$content .= $tpl->tbHtml( 'orders_print.tpl', 'SHOW' );
$content .= listBasket( $iOrder, 'orders_print.tpl' );
$aCourier = throwCourier( $aOrder['iCourier'] );
$fSummary = sprintf( '%01.2f', $aCourier['price'] + $aBasket['fSummary'] );
$content .= $tpl->tbHtml( 'orders_print.tpl', 'COURIER' );
}
else{
$content .= $tpl->tbHtml( 'operations.tpl', 'ERROR' );
}
}
?>

Thanks in advance!

stormy

No avatar

2006-12-16 22:30

http://opensolution.org/Quick.Cart/forum/?p=readTopic&nr=3454

:-)

Back to top
about us | contact