This topic is locked

Paypal

1/18/2008 6:05:19 AM
PHPRunner General questions
E
enthusiast author

Hi.

Asked this before. when you buy item with Paypal, how do you set up PHP to allow continued shopping rather than just purchasing one item and how/where do you put in any shipping charges to add to total amount. Please help <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=7296&image=1&table=forumtopics' class='bbc_emoticon' alt=':(' />

Thanks if you can.

J
Jane 1/21/2008

Hi,
I recommend you to have a look at the Shopping Cart template for PHPRunner:

http://www.asprunner.com/forums/index.php?showtopic=6447

P
Peppa 2/12/2009

Hiya,
I got it to work by changing the Table Event syntax in ListOnLoad and ViewOnLoad as follows:
Change:
//paypal form

$info="<FORM name=xclick action=\"https://www.paypal.com/cgi-bin/webscr\"'>https://www.paypal.com/cgi-bin/webscr\"; method=post target=_blank>

<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">

<input type=\"hidden\" name=\"business\" value=\"".$dataInfo["PayPalEmailAddress"]."\">

<input type=\"hidden\" name=\"currency_code\" value=\"".$dataInfo["Currency"]."\">

<input type=\"hidden\" name=\"item_name\" value=\"\">

<input type=\"hidden\" name=\"amount\" value=\"\">

<input type=\"hidden\" name=\"cancel_return\" value=\"".$dataInfo["CancelPage"]."\">

<input type=\"hidden\" name=\"return\" value=\"".$dataInfo["SuccessPage"]."\">

<input type=\"hidden\" name=\"notify_url\" value=\"".$dataInfo["IPNPage"]."\">

<input type=\"hidden\" name=\"item_number\" value=\"\">

<input type=\"hidden\" name=\"image_url\" value=\"".$dataInfo["Logo"]."\">

</FORM>";

echo $info;
From the above to:........ (I have higlighted the changes in bold italics
//paypal form

$info="<FORM name=xclick action=\"https://www.paypal.com/cgi-bin/webscr\"'>https://www.paypal.com/cgi-bin/webscr\"; method=post target=_blank>

<input type=\"hidden\" name=\"cmd\" value=\"_cart\">

<input type=\"hidden\" name=\"upload\" value=\"1\">

<input type=\"hidden\" name=\"business\" value=\"".$dataInfo["PayPalEmailAddress"]."\">

<input type=\"hidden\" name=\"currency_code\" value=\"".$dataInfo["Currency"]."\">

<input type=\"hidden\" name=\"item_name\" value=\"\">

<input type=\"hidden\" name=\"amount\" value=\"\">

<input type=\"hidden\" name=\"cancel_return\" value=\"".$dataInfo["CancelPage"]."\">

<input type=\"hidden\" name=\"return\" value=\"".$dataInfo["SuccessPage"]."\">

<input type=\"hidden\" name=\"notify_url\" value=\"".$dataInfo["IPNPage"]."\">

<input type=\"hidden\" name=\"item_number\" value=\"\">

<input type=\"hidden\" name=\"image_url\" value=\"".$dataInfo["Logo"]."\">

<input type=\"hidden\" name=\"add\" value=\"1\">

</FORM>";

echo $info;
It permits the person ordering to change the quantity within the paypal system before proceeding.
Still working on the postage charge element.

P
Peppa 2/12/2009

Okay ... got the Postage and Tax down now....
Add the following fields to your ppmain table:
Shipping

Shipping2

Handling

Tax
Then amend the paypal button "but" from.....
global $strTableName;

if(!$table)

$table=$strTableName;

$value=$data[$field];

if($table=="ppmain" && $field=="but")

{

global $data;

$value = "<INPUT type=image alt=\"Make payments with PayPal - it's fast, free and secure!\"

src=\"https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=37713&image=1&table=forumreplies\";

align=right border=0 name=xclick

onclick=\"java script: document.forms.xclick.item_name.value='".$data["Title"]."';

document.forms.xclick.amount.value=".$data["Price"].";

document.forms.xclick.item_number.value=".$data["ID"]."; document.forms.xclick.submit();\">";

}

return $value;
to ................. Be sure to keep fieldname e.g. xclick.shipping.value=".$data["Shipping"]."; in lowercase (required by paypal)
global $strTableName;

if(!$table)

$table=$strTableName;

$value=$data[$field];

if($table=="ppmain" && $field=="but")

{

global $data;

$value = "<INPUT type=image alt=\"Make payments with PayPal - it's fast, free and secure!\"

src=\"https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=37713&image=2&table=forumreplies\";

align=right border=0 name=xclick

onclick=\"java script: document.forms.xclick.item_name.value='".$data["Title"]."';

document.forms.xclick.amount.value=".$data["Price"].";

document.forms.xclick.handling.value=".$data["Handling"].";

document.forms.xclick.shipping.value=".$data["Shipping"].";

document.forms.xclick.shipping2.value=".$data["Shipping2"].";

document.forms.xclick.tax.value=".$data["Tax"].";


document.forms.xclick.item_number.value=".$data["ID"]."; document.forms.xclick.submit();\">";

}

return $value;
Next............ amend the Event handler's again to include as shown below:
//paypal form

$info="<FORM name=xclick action=\"https://www.paypal.com/cgi-bin/webscr\"; method=post target=_blank>

<input type=\"hidden\" name=\"cmd\" value=\"_cart\">

<input type=\"hidden\" name=\"upload\" value=\"1\">

<input type=\"hidden\" name=\"business\" value=\"".$dataInfo["PayPalEmailAddress"]."\">

<input type=\"hidden\" name=\"currency_code\" value=\"".$dataInfo["Currency"]."\">

<input type=\"hidden\" name=\"item_name\" value=\"\">

<input type=\"hidden\" name=\"amount\" value=\"\">

<input type=\"hidden\" name=\"shipping\" value=\"\">

<input type=\"hidden\" name=\"shipping2\" value=\"\">

<input type=\"hidden\" name=\"handling\" value=\"\">

<input type=\"hidden\" name=\"tax\" value=\"\">


<input type=\"hidden\" name=\"cancel_return\" value=\"".$dataInfo["CancelPage"]."\">

<input type=\"hidden\" name=\"return\" value=\"".$dataInfo["SuccessPage"]."\">

<input type=\"hidden\" name=\"notify_url\" value=\"".$dataInfo["IPNPage"]."\">

<input type=\"hidden\" name=\"item_number\" value=\"\">

<input type=\"hidden\" name=\"image_url\" value=\"".$dataInfo["Logo"]."\">

<input type=\"hidden\" name=\"add\" value=\"1\">

</FORM>";

echo $info;
This will then carry the amounts you specify over into paypal
Be sure to set your paypal profile postage preferences to allow transaction-based postage values to override the profile postage settings (Checkbox at bottom of page)
That'll do it.
You should now have the option to update the cart quantity in paypal including Shipping cost for single item + additional item shipping cost + Handling + Tax etc.
Enjoy..............
Additional TIP.... Do not use quotations in any of your form fields e.g. inputing a measurement i.e 12" (12 inches) as this will stop it working.

P
Peppa 7/23/2009

Okay ... got the Postage and Tax down now....

Add the following fields to your ppmain table:
Shipping

Shipping2

Handling

Tax
Then amend the paypal button "but" from.....
global $strTableName;

if(!$table)

$table=$strTableName;

$value=$data[$field];

if($table=="ppmain" && $field=="but")

{

global $data;

$value = "<INPUT type=image alt=\"Make payments with PayPal - it's fast, free and secure!\"

src=\"https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=42935&image=1&table=forumreplies\";

align=right border=0 name=xclick

onclick=\"java script: document.forms.xclick.item_name.value='".$data["Title"]."';

document.forms.xclick.amount.value=".$data["Price"].";

document.forms.xclick.item_number.value=".$data["ID"]."; document.forms.xclick.submit();\">";

}

return $value;
to ................. Be sure to keep fieldname e.g. xclick.shipping.value=".$data["Shipping"]."; in lowercase (required by paypal)
global $strTableName;

if(!$table)

$table=$strTableName;

$value=$data[$field];

if($table=="ppmain" && $field=="but")

{

global $data;

$value = "<INPUT type=image alt=\"Make payments with PayPal - it's fast, free and secure!\"

src=\"https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=42935&image=2&table=forumreplies\";

align=right border=0 name=xclick

onclick=\"java script: document.forms.xclick.item_name.value='".$data["Title"]."';

document.forms.xclick.amount.value=".$data["Price"].";

document.forms.xclick.handling.value=".$data["Handling"].";

document.forms.xclick.shipping.value=".$data["Shipping"].";

document.forms.xclick.shipping2.value=".$data["Shipping2"].";

document.forms.xclick.tax.value=".$data["Tax"].";


document.forms.xclick.item_number.value=".$data["ID"]."; document.forms.xclick.submit();\">";

}

return $value;
Next............ amend the Event handler's again to include as shown below:
//paypal form

$info="<FORM name=xclick action=\"https://www.paypal.com/cgi-bin/webscr\"; method=post target=_blank>

<input type=\"hidden\" name=\"cmd\" value=\"_cart\">

<input type=\"hidden\" name=\"upload\" value=\"1\">

<input type=\"hidden\" name=\"business\" value=\"".$dataInfo["PayPalEmailAddress"]."\">

<input type=\"hidden\" name=\"currency_code\" value=\"".$dataInfo["Currency"]."\">

<input type=\"hidden\" name=\"item_name\" value=\"\">

<input type=\"hidden\" name=\"amount\" value=\"\">

<input type=\"hidden\" name=\"shipping\" value=\"\">

<input type=\"hidden\" name=\"shipping2\" value=\"\">

<input type=\"hidden\" name=\"handling\" value=\"\">

<input type=\"hidden\" name=\"tax\" value=\"\">


<input type=\"hidden\" name=\"cancel_return\" value=\"".$dataInfo["CancelPage"]."\">

<input type=\"hidden\" name=\"return\" value=\"".$dataInfo["SuccessPage"]."\">

<input type=\"hidden\" name=\"notify_url\" value=\"".$dataInfo["IPNPage"]."\">

<input type=\"hidden\" name=\"item_number\" value=\"\">

<input type=\"hidden\" name=\"image_url\" value=\"".$dataInfo["Logo"]."\">

<input type=\"hidden\" name=\"add\" value=\"1\">

</FORM>";

echo $info;
This will then carry the amounts you specify over into paypal
Be sure to set your paypal profile postage preferences to allow transaction-based postage values to override the profile postage settings (Checkbox at bottom of page)
That'll do it.
You should now have the option to update the cart quantity in paypal including Shipping cost for single item + additional item shipping cost + Handling + Tax etc.
Enjoy..............
Additional TIP.... Do not use quotations in any of your form fields e.g. inputing a measurement i.e 12" (12 inches) as this will stop it working.


LATEST UPDATE
There have been problems with using the syntax following paypal's recent updates.
To rectify - REMOVE THE LINE
<input type=\"hidden\" name=\"upload\" value=\"1\">