Need To Add A Paypal Button To This Script...
10-01-2008, 07:34 PM
|
Need To Add A Paypal Button To This Script...
|
Posts: 2,162
Name: ...
Location: ...
|
Hi,
I am trying to add a very simple paypal checkout button to a php script. The problem I am having is trying to get a variable from the php code to be included inside the paypal checkout code. In a nutshell, what the end result would be is the filename of the item that was clicked on would display in the paypal checkout automatically, instead of the persona having to type that in. So when I get the paypal order, I know what they have ordered. I believe: $display_name is the correct variable from the code below (I could figure that out, once I get the connection working). My question is how to implement the $display_name variable to the paypal checkout code.
I just tried pasting the code to the php script, but it was too much code to add...I was limited to 30,000 characters, and it was more than that.
Php Script Code:
Paypal Button Code:
Code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value=test@yahoo.com>
<input type="hidden" name="item_number" value=>
<input type="hidden" name="amount" value=10.50>
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value=USD>
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="buynow.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
Note: The paypal code above is something I found online, it's not modified to my needs. I am sure I don't need all those form types...Especially the no_note? I am not too sure about the rest, but I think you understand what I need.
__________________
Made2Own
Last edited by Brian07002; 10-01-2008 at 09:15 PM..
|
|
|
|
10-01-2008, 10:29 PM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 24
Name: RavanScripts
Location: Texas
|
Trying adding
<input type="hidden" name="Display Name" value=display_name>
Parameter type - variable
|
|
|
|
10-01-2008, 11:39 PM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 2,162
Name: ...
Location: ...
|
Quote:
Originally Posted by spid4r
Trying adding
<input type="hidden" name="Display Name" value=display_name>
Parameter type - variable
|
Ok,
I appreciate your help, but how about getting this working inside the php script? What I have done was just put the above paypal code just after the closing php tag...
end of php code...
?>
Paypal code below
.......
......
.....
I need to apply what you have given me into the php script link code...But my problem seems to be with so many different <a (anchor tags) and where to put the code?
Would you take a stab at it if I give you the code?
Thanks again!
__________________
Made2Own
|
|
|
|
10-02-2008, 07:28 PM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 2,162
Name: ...
Location: ...
|
I am stilll looking for help with this...Anyone?
Tia
__________________
Made2Own
|
|
|
|
10-02-2008, 10:41 PM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 29
Name: Dave
|
Not sure if I understand the problem... couldn't you just have php print your html code, that way you'll have access to that variable via the script and the paypal html code. If not, then maybe use a session or global type variable? Or are you trying to get that paypal code to run automatically at the end of the php script?
Last edited by davie_gravy; 10-02-2008 at 10:47 PM..
|
|
|
|
10-03-2008, 05:38 AM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 2,162
Name: ...
Location: ...
|
Quote:
Originally Posted by davie_gravy
Not sure if I understand the problem... couldn't you just have php print your html code, that way you'll have access to that variable via the script and the paypal html code. If not, then maybe use a session or global type variable? Or are you trying to get that paypal code to run automatically at the end of the php script?
|
I am trying to get it to run at the end of the script...
Just as long as when someone clicks on the image, paypal will show the filename and I will get that back in my mailbox...You know right below the thumbnail images and right above the fullsized images?
Tia
__________________
Made2Own
Last edited by Brian07002; 10-03-2008 at 08:24 AM..
|
|
|
|
10-03-2008, 09:47 AM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 219
Name: Rob
Location: UK
|
You need to look at Paypals developer guide. https://www.paypal.com/cgi-bin/websc...eckout-outside
The form element in question is item_name
HTML Code:
<input type="hidden" name="item_name" value="Name_of_filename_goes_here">
|
|
|
|
10-03-2008, 05:15 PM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 2,162
Name: ...
Location: ...
|
Quote:
Originally Posted by maxxximus
|
After reading that information, I found out that I need to know if the script in question supports paypal 'as is'...The script is freeware, and it's not a 'shopping cart' out right, it's just a gallery.
Btw, I haven't added which script I am using...Here's the site:
Code:
http://sye.dk/sfpg/index.php
Again, I'd appreciate it if someone could clear this up.
Thanks again
__________________
Made2Own
|
|
|
|
10-03-2008, 05:43 PM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 2
Name: Temitope
Location: Shuttle between cities
|
Why bother? You can use the button creation wizard inside your paypal account to create buttons for any item you want and it will generate the code by itself.
|
|
|
|
10-03-2008, 05:49 PM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 2,162
Name: ...
Location: ...
|
Quote:
Originally Posted by Vineyardhosting
Why bother? You can use the button creation wizard inside your paypal account to create buttons for any item you want and it will generate the code by itself.
|
I did forget about that, BUT I will be needing to do that for ALOT of buttons anyway.  Is there an automated way to do it for all images that will be in the gallery?
Thanks again!
__________________
Made2Own
|
|
|
|
10-03-2008, 06:32 PM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 2,162
Name: ...
Location: ...
|
Ok...I generated a paypal add to cart button, and a paypal view cart button...Problem is, how do I add it into the script itself...All I need it to do is when the add to cart button is clicked it will add 'that' image into the cart...Using the filename (shown above thumbnail & below fullsize image) as the item in the cart. Of course, the view cart should display what has been added into the cart.
I appreciate you help once again!
__________________
Made2Own
Last edited by Brian07002; 10-03-2008 at 06:34 PM..
|
|
|
|
10-03-2008, 10:03 PM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 2,162
Name: ...
Location: ...
|
Everybody still with me on this? Who ever is helping me on this, I'd appreciate a 'text link' rather than a button, I couldn't seem to find a text generator on paypal for that, even did the non encrypt thing and that still made a button, but overall, I am still stuck on this whole project. I'd appreciate the code from the beginning, if that is not too much to ask.
I appreciate it as always!
__________________
Made2Own
Last edited by Brian07002; 10-04-2008 at 01:07 AM..
|
|
|
|
10-04-2008, 01:49 AM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 29
Name: Dave
|
Wow... now I see the script. Just taking a gander through the code, I would imagine you want to intercept the code in the function sfpg() (starting on line 745) in the script where it's actually printing the html code for displaying the individual thumbnails. I would make a function that prints that paypal code and it looks like you could reference the individual image using the $images array as your data.
Last edited by davie_gravy; 10-04-2008 at 01:53 AM..
|
|
|
|
10-04-2008, 04:11 AM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 2,162
Name: ...
Location: ...
|
Quote:
Originally Posted by davie_gravy
Wow... now I see the script. Just taking a gander through the code, I would imagine you want to intercept the code in the function sfpg() (starting on line 745) in the script where it's actually printing the html code for displaying the individual thumbnails. I would make a function that prints that paypal code and it looks like you could reference the individual image using the $images array as your data.
|
could you share something I could work with?
thank you
__________________
Made2Own
|
|
|
|
10-04-2008, 06:15 AM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 29
Name: Dave
|
Alright,
I'll try my best considering I can't really test this so I'm going strictly off the demo and looking at the code. Your best bet for the link/button would be right after the closing div tag. That way it will look good within the table structure. Adding additional row/cols will prob mess things up visually in short and take a lil more time to figure out.
Check out line 900 and line 904. Put your paypal code in a function, let's say printPPBtn($item) where $item will be the image name like so...
Code:
function printPPBtn($item) {
print "<form action=www.paypal.com/etc/etc>";
print "<input type='hidden' name='Display Name' value=".$item.">";
print "<input type=...";
...
}
Make sure this is defined outside any other functions block ({ }) preferably around the top. Right around line 165 - 166 would be good.
Then in the statement
Code:
echo "<div>" . nl2br((DIR_DESC_HTML ? $dirdesc : htmlspecialchars($dirdesc))) . "</div>";
try changing to
Code:
echo "<div>" . nl2br((DIR_DESC_HTML ? $dirdesc : htmlspecialchars($dirdesc))) . "</div>".printPPBtn($dirs[$item]);
do the same thing to line 904 (concatenate the function at the end of the statement). Now I'm just taking a guess that the individual image names are in this $dirs array where $item is your index. You may try some print statements printing various structures to figure out where that image name is stored, then just pass that into your function. It's a start, if anything.
Last edited by davie_gravy; 10-04-2008 at 06:19 AM..
|
|
|
|
10-04-2008, 12:10 PM
|
Re: Need To Add A Paypal Button To This Script...
|
Posts: 2,162
Name: ...
Location: ...
|
Quote:
Originally Posted by davie_gravy
Alright,
I'll try my best considering I can't really test this so I'm going strictly off the demo and looking at the code. Your best bet for the link/button would be right after the closing div tag. That way it will look good within the table structure. Adding additional row/cols will prob mess things up visually in short and take a lil more time to figure out.
Check out line 900 and line 904. Put your paypal code in a function, let's say printPPBtn($item) where $item will be the image name like so...
Code:
function printPPBtn($item) {
print "<form action=www.paypal.com/etc/etc>";
print "<input type='hidden' name='Display Name' value=".$item.">";
print "<input type=...";
...
}
Make sure this is defined outside any other functions block ({ }) preferably around the top. Right around line 165 - 166 would be good.
Then in the statement
Code:
echo "<div>" . nl2br((DIR_DESC_HTML ? $dirdesc : htmlspecialchars($dirdesc))) . "</div>";
try changing to
Code:
echo "<div>" . nl2br((DIR_DESC_HTML ? $dirdesc : htmlspecialchars($dirdesc))) . "</div>".printPPBtn($dirs[$item]);
do the same thing to line 904 (concatenate the function at the end of the statement). Now I'm just taking a guess that the individual image names are in this $dirs array where $item is your index. You may try some print statements printing various structures to figure out where that image name is stored, then just pass that into your function. It's a start, if anything.
|
Thank you for the help, but still no luck with that code...I will prob. just go with putting a paypal button on my sites homepage and have them pay directly with that, instead of trying to code it...Seems to be a little too much work for me. 
__________________
Made2Own
|
|
|
|
|
« Reply to Need To Add A Paypal Button To This Script...
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|