![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
|
Hi, everyone! For those of you who remember my last thread on here, that site won first at my state competition, thanks to your help! :)
I'm going to Anaheim, California this summer for nationals. ![]() I can't thank you guys enough, you were awesome! <333 Unfortunately, the judges gave me some feedback that demanded a rather extensive addition to my site... Paypal integration. ![]() And, of course, I'm running into problems. ![]() Here's the extent of the damage. I have a form on my site's My Cart page (only displayable once you've ordered an item on another page) that goes through the following logic: 1. The form's action is a second php file called "fork.php," that determines whether to update the cart with any changes to item quantity or to proceed to checkout. 2. fork.php's logic is simple: If "Update Cart" was clicked, recheck all the forms and update the appropriate session variables. If "Checkout' was clicked, proceed to checkout. (Updating the cart is taken care of in fork.php, whereas checkout is taken care of by requiring "checkout1.php"). 3. Checkout USED to be a simple MySQL query that added the order to my database; however, now that I need to integrate Paypal, I need to have the checkout button activate a PHP form that calls a specific Paypal URL. (For those of you who have worked with Paypal before, you know what I mean - you need a button in a form whose action is "https://www.paypal.com/cgi-bin/webscr"). 4. Problem: The checkout button is already in a form whose action is "fork.php," along with the "Update Cart" button. Nested forms are not supported in HTML, and cause the button to not do anything except flicker (refresh?) the current page. How should I go about implementing this Paypal button? I don't need a shopping cart, as I've already coded my own, and Paypal's graphics clash horribly with my site; all I need to do is create a Paypal button for an arbitrary payment. The code for a Paypal purchase button is as follows: 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="seller@designerfotos.com"> <input type="hidden" name="item_name" value="Memorex 256MB Memory Stick"> <input type="hidden" name="item_number" value="MEM32507725"> <input type="hidden" name="amount" value="3"> <input type="hidden" name="tax" value="1"> <input type="hidden" name="quantity" value="1"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <!-- Enable override of payer’s stored PayPal address. --> <input type="hidden" name="address_override" value="1"> <!-- Set prepopulation variables to override stored address. --> <input type="hidden" name="first_name" value="John"> <input type="hidden" name="last_name" value="Doe"> <input type="hidden" name="address1" value="345 Lark Ave"> <input type="hidden" name="city" value="San Jose"> <input type="hidden" name="state" value="CA"> <input type="hidden" name="zip" value="95121"> <input type="hidden" name="country" value="US"> <input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online"> </form> ----- Here's fork.php, the page that handles the actions for the two buttons. PHP Code:
----- Here's MyCart.php, the page that actually contains the Checkout and Update Cart buttons. (Note: The actual form tag is way above where the buttons are in order to contain all the appropriate fields above the buttons.) HTML Code:
<?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > <title>FBLA Flowers</title> <link rel="stylesheet" href="styles.css"> </head> <body> <table class="navBar"> <tr> <th> </th> <td onMouseOver="this.style.color='white'; this.style.backgroundColor='#EB5E56'; this.style.cursor='pointer';" onMouseOut="this.style.color='gray';this.style.backgroundColor='white';" onClick="document.location.href='http://www.fblaflowers.org/flowers.php';"> flowers </td> <td onMouseOver="this.style.color='white'; this.style.backgroundColor='#749942'; this.style.cursor='pointer';" onMouseOut="this.style.color='gray';this.style.backgroundColor='white';" onClick="document.location.href='http://www.fblaflowers.org/plants.php';"> plants </td> <td onMouseOver="this.style.color='white'; this.style.backgroundColor='#FFC75E'; this.style.cursor='pointer';" onMouseOut="this.style.color='gray';this.style.backgroundColor='white';" onClick="document.location.href='http://www.fblaflowers.org/seeds.php';"> seeds </td> <td onMouseOver="this.style.color='white'; this.style.backgroundColor='#E38A4D'; this.style.cursor='pointer';" onMouseOut="this.style.color='gray';this.style.backgroundColor='white';" onClick="document.location.href='http://www.fblaflowers.org/gardensupplies.php';"> garden supplies </td> <td onMouseOver="this.style.color='white'; this.style.backgroundColor='#6B85A2'; this.style.cursor='pointer';" onMouseOut="this.style.color='gray';this.style.backgroundColor='white';" onClick="document.location.href='http://www.fblaflowers.org/specialoccasions.php';"> spec. occasions </td> <td class="selected" style="background-color:#858585"> my cart </td> </tr> </table> <table class="fpg"> <?php $i=0; $outputted=false; $subtotal=0; foreach($_SESSION['purchased'] as $value) ** if($value > 0) $outputted=true; } echo ' <form action="fork.php" method="post"> <tr> <td class="cartmenu"><b><u>Item</u></b></td> <td class="cartmenu"><b><u>Name</u></b></td> <td class="cartmenu"><b><u>Price</u></b></td> <td class="cartmenu"><b><u>Quantity</u></b></td> <td class="cartmenu"><b><u>Total</u></b></td> <td class="cartmenu"><b><u>Remove</u></b></td> </tr>'; foreach($_SESSION['purchased'] as $value) ** $i++; if($value > 0) ** if($i < 6) ** $total = $_SESSION['prices'][$i-1]*$_SESSION['purchased'][$i-1]; $subtotal += $total; echo ' <tr style="background-color:#E6BAB8"> <td class="cartthumbs" style="background-image:url(\'imgs/flowers'.$i.'thumb.jpg\')"> </td> <td class="cartname"><b>'.$_SESSION['names'][$i-1].'</td> <td class="cartprice"><b>$'.$_SESSION['prices'][$i-1].'/bud</b></td> <td class="cartquantity"><input type="text" name="Q'.($i-1).'" size="5" value="'.$_SESSION['purchased'][$i-1].'"></td> <td class="carttotal"><b>$'.$total.'</b></td> <td class="cartremove"><input type="checkbox" name="R'.($i-1).'" align="absmiddle"></td> </tr>'; } else if($i>5 && $i<11) ** $total = $_SESSION['prices'][$i-1]*$_SESSION['purchased'][$i-1]; $subtotal += $total; echo ' <tr style="background-color:#D2E6B8"> <td class="cartthumbs" style="background-image:url(\'imgs/plants'.($i-5).'thumb.jpg\')"> </td> <td class="cartname"><b>'.$_SESSION['names'][$i-1].'</td> <td class="cartprice"><b>$'.$_SESSION['prices'][$i-1].'/lb</b></td> <td class="cartquantity"><input type="text" name="Q'.($i-1).'" size="5" value="'.$_SESSION['purchased'][$i-1].'"></td> <td class="carttotal"><b>$'.$total.'</b></td> <td class="cartremove"><input type="checkbox" name="R'.($i-1).'" align="absmiddle"></td> </tr>'; } else if($i>10 && $i<16) ** $total = $_SESSION['prices'][$i-1]*$_SESSION['purchased'][$i-1]; $subtotal += $total; echo ' <tr style="background-color:#E6D5B8"> <td class="cartthumbs" style="background-image:url(\'imgs/seeds'.($i-10).'thumb.jpg\')"> </td> <td class="cartname"><b>'.$_SESSION['names'][$i-1].'</td> <td class="cartprice"><b>$'.$_SESSION['prices'][$i-1].'/packet</b></td> <td class="cartquantity"><input type="text" name="Q'.($i-1).'" size="5" value="'.$_SESSION['purchased'][$i-1].'"></td> <td class="carttotal"><b>$'.$total.'</b></td> <td class="cartremove"><input type="checkbox" name="R'.($i-1).'" align="absmiddle"></td> </tr>'; } else if($i>15 && $i<21) ** $total = $_SESSION['prices'][$i-1]*$_SESSION['purchased'][$i-1]; $subtotal += $total; echo ' <tr style="background-color:#E6CAB8"> <td class="cartthumbs" style="background-image:url(\'imgs/gardeningsupplies'.($i-15).'thumb.jpg\')"> </td> <td class="cartname"><b>'.$_SESSION['names'][$i-1].'</td> <td class="cartprice"><b>$'.$_SESSION['prices'][$i-1].'</b></td> <td class="cartquantity"><input type="text" name="Q'.($i-1).'" size="5" value="'.$_SESSION['purchased'][$i-1].'"></td> <td class="carttotal"><b>$'.$total.'</b></td> <td class="cartremove"><input type="checkbox" name="R'.($i-1).'" align="absmiddle"></td> </tr>'; } else if($i>20 && $i<26) ** $total = $_SESSION['prices'][$i-1]*$_SESSION['purchased'][$i-1]; $subtotal += $total; echo ' <tr style="background-color:#B8CDE6"> <td class="cartthumbs" style="background-image:url(\'imgs/specialoccasions'.($i-20).'thumb.jpg\')"> </td> <td class="cartname"><b>'.$_SESSION['names'][$i-1].'</td> <td class="cartprice"><b>$'.$_SESSION['prices'][$i-1].'</b></td> <td class="cartquantity"><input type="text" name="Q'.($i-1).'" size="5" value="'.$_SESSION['purchased'][$i-1].'"></td> <td class="carttotal"><b>$'.$total.'</b></td> <td class="cartremove"><input type="checkbox" name="R'.($i-1).'" align="absmiddle"></td> </tr>'; } } } if($outputted == false) ** echo ' <tr> <td class="cartmenu" colspan="6"> Your cart is currently empty because you haven\'t ordered anything yet; please visit the links above to order something!<p> Whatever items you order will be waiting here for you when you return. </td> </tr>'; } else ** echo ' <tr> <td></td> <td></td> <td></td> <td class="cartquantity"> <b><u>Subtotal:</u></b> </td> <td class="carttotal"> <b>$'.$subtotal.'</b> </td> <td rowspan="3"> <input type="image" name="in1" src="imgs/update.jpg" value="Update Cart"></input> <p> <input type="image" name="in2" src="imgs/checkout.jpg" value="Check Out"></input> </td> </tr> <tr> <td></td> <td></td> <td></td> <td class="cartquantity"> <b><u>Tax (7%):</u></b> </td> <td class="carttotal"> <b>$'.(round($subtotal*0.07*100)/100).'</b> </td> </tr> <tr> <td></td> <td></td> <td></td> <td class="cartquantity"> <b><u>Total:</u></b> </td> <td class="carttotal"> <b>$'.(round($subtotal*1.07*100)/100).'</b> </td> </tr> </form>'; } ?> </table> <?php include("footer.php"); ?> </body> </html> Thanks in advance to anyone who can help! These changes are due by the 28th of April, so that gives me plenty of time; however, I'd like to get it done ASAP, as I have college visits coming up and exams, too. :) Thank you all! (dm01, I wanna see you on this one )[Edit:] Oh and for some reason, all the open curly braces in my code keep showing up as two asterisks after I post the thread... be sure to do a find/replace for ** if you test the code.
__________________
I'm ridin' dirty. Oh baby, I'm yellow and nerdy. Last edited by maretard; 04-02-2009 at 07:27 PM. |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,884
OS: Vista, various linux distros
|
Re: PHP/Paypal Issues
Hey, first off congrats for getting 1st place in the state comp =] I definately remember the last post =]
I haven't worked with paypal before (i don't like the way their service operates)... Buut, i know enough about code+http requests to dynamically post the paypal form without completely ruining your own cart(or the design of it). From what i've read above (i did have to go over it a couple of times) i understand that the first form code you post is what you need to post using only your own cart's order button? Which redirects to checkout.php? (when checking out rather than updating).. What does checkout.php currently do? (can you post the code?) And the form you posted is an example of selling a memory stick(i think?)... Could you post what would need to be there to sell for example a rose? i can imagine it myself but it would be easier to visualise with that example... And when that form is posted what happens? (does it re-direct to a payment form? or a Paypal cart?) Anyway, i can see how i'd go about doing this right now but depending on the contents of checkout.php i'm unsure of whether to do it in fork.php/checkout.php... Basically i'd go about doing it using javascript to create a form object, fill in all the variables and then submit the form... It could be done using PHP but to my knowledge it would require extra libraries and a whole lot more work. Post back and i'll get down to showing you how i'd go about doing this. Cheers, Jamey p.s. As for posting code with curly braces in it... replace the left curly brace with { (The HTML entity of the left curly brace[i had to put something between the & and the rest or it would have evaluated so the bold tag did the job])... For some reason if you re-post/edit then the HTML entity gets converted back into **(i wonder why TSF don't just have it convert to HTML entities)? Last edited by jamiemac2005; 04-03-2009 at 07:54 AM. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
|
Re: PHP/Paypal Issues
Hey there, Jamie, nice to hear from you! :)
The first form code I posted last time, the one whose action was that paypal link, is the code that the "Checkout" button *should* implement. Currently, the Checkout button activates fork.php, which determines which button (Update Cart or Checkout) was pressed, and redirects to the appropriate page. I'll attach checkout.php at the end of this post. Here's a form example for selling stuff on my site. Note: I charge all sales as "FBLAFlowers Floral Order" since the products have already been listed in my custom shopping cart. The total order amount is represented by a PHP variable in mycart.php, and I set the amount of the purchase to reflect this. 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="maretard.at.gmail.com"> <input type="hidden" name="item_name" value="FBLAFlowers Floral Order"> <input type="hidden" name="amount" value="'.$total.'"> <input type="hidden" name="quantity" value="1"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="image" name="submit" border="0" src="http://www.fblaflowers.org/imgs/checkout.jpg" alt="PayPal - The safer, easier way to pay online"> </form> How exactly would you use Javascript to "send" a form? I thought forms were only activated by user input... If there's a convenient way to just force the sending of a form with Javascript, that would make everything a heck of a lot easier. :) Thanks for the tip with the curly braces. ![]() Here's checkout.php, as requested. It's a personal information collection form, although now that I have to implement Paypal, will that still be necessary? Code:
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>FBLA Flowers</title>
<link rel="stylesheet" href="styles.css">
<script type="text/javascript">
function formfocus() {
document.getElementById('first').focus();
}
window.onload = formfocus;
</script>
<script type="text/javascript">
function checkFields()
{
var firstname = document.forms["info"] .elements["firstname"] .value;
var lastname = document.forms["info"] .elements["lastname"] .value;
var address = document.forms["info"] .elements["address"] .value;
var city = document.forms["info"] .elements["city"] .value;
var state = document.forms["info"] .elements["state"] .value;
var zip = document.forms["info"] .elements["zip"] .value;
var email = document.forms["info"] .elements["email"] .value;
var phone = document.forms["info"] .elements["phone"] .value;
var priority = document.forms["info"] .elements["priority"] .value;
if(firstname == "" || lastname == "" || address == "" || city == "" || state == "" || zip == "" || email == "" || phone == "" || priority == "")
{
alert("Please fill out all of the fields on the page so we can identify your order.");
return false;
}
return true;
}
function validate(field)
{
with(field)
{
if (value==null||value=="")
{
return false;
}
else
{
return true;
}
}
}
function validate_form(thisform)
{
with(thisform)
{
if (validate(firstname) == false || validate(lastname) == false || validate(address) == false || validate(city) == false || validate(state) == false || validate(zip) == false || validate(email) == false || validate(phone) == false || validate(priority) == false)
{
alert("Please fill out all the fields on the page so we can identify your order.");
return false;
}
}
}
function numbersonly(myfield, e, dec)
{
var key;
var keychar;
if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
else
return true;
keychar = String.fromCharCode(key);
if ((key==null) || (key==0) || (key==8) ||
(key==9) || (key==13) || (key==27) )
return true;
else if ((("-.0123456789").indexOf(keychar) > -1))
return true;
else
return false;
}
function lettersonly(myfield, e, dec)
{
var key;
var keychar;
if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
else
return true;
keychar = String.fromCharCode(key);
if ((("-.0123456789").indexOf(keychar) > -1))
return false;
else
return true;
}
</script>
</head>
<body>
<table class="navBar">
<tr>
<th>
</th>
<td onMouseOver="this.style.color='white';
this.style.backgroundColor='#EB5E56';
this.style.cursor='pointer';"
onMouseOut="this.style.color='gray';this.style.backgroundColor='white';"
onClick="document.location.href='http://www.fblaflowers.org/flowers.php';">
flowers
</td>
<td onMouseOver="this.style.color='white';
this.style.backgroundColor='#749942';
this.style.cursor='pointer';"
onMouseOut="this.style.color='gray';this.style.backgroundColor='white';"
onClick="document.location.href='http://www.fblaflowers.org/plants.php';">
plants
</td>
<td onMouseOver="this.style.color='white';
this.style.backgroundColor='#FFC75E';
this.style.cursor='pointer';"
onMouseOut="this.style.color='gray';this.style.backgroundColor='white';"
onClick="document.location.href='http://www.fblaflowers.org/seeds.php';">
seeds
</td>
<td onMouseOver="this.style.color='white';
this.style.backgroundColor='#E38A4D';
this.style.cursor='pointer';"
onMouseOut="this.style.color='gray';this.style.backgroundColor='white';"
onClick="document.location.href='http://www.fblaflowers.org/gardensupplies.php';">
garden supplies
</td>
<td onMouseOver="this.style.color='white';
this.style.backgroundColor='#6B85A2';
this.style.cursor='pointer';"
onMouseOut="this.style.color='gray';this.style.backgroundColor='white';"
onClick="document.location.href='http://www.fblaflowers.org/specialoccasions.php';">
spec. occasions
</td>
<td onMouseOver="this.style.color='white';
this.style.backgroundColor='#858585';
this.style.cursor='pointer';"
onMouseOut="this.style.color='gray';this.style.backgroundColor='white';"
onClick="document.location.href='http://www.fblaflowers.org/mycart.php';">
my cart
</td>
</tr>
</table>
<table class="fpg">
<form name="info" method="post" action="checkout1.php" onSubmit="return validate_form(this)">
<tr>
<td class="cartmenu" colspan="2">
Please enter your personal information here so we can identify your order.
</td>
</tr>
<tr>
<td class="registerleft">First Name:</td>
<td class="registerright"><input id="first" type="text" name="firstname" size="20" onKeyPress="return lettersonly(this, event)"></td>
</tr>
<tr>
<td class="registerleft">Last Name:</td>
<td class="registerright"><input type="text" name="lastname" size="20" onKeyPress="return lettersonly(this, event)"></td>
</tr>
<tr>
<td class="registerleft">Mailing Address:</td>
<td class="registerright"><input type="text" name="address" size="25"></td>
</tr>
<tr>
<td class="registerleft">City:</td>
<td class="registerright"><input type="text" name="city" size="25" onKeyPress="return lettersonly(this, event)"></td>
</tr>
<tr>
<td class="registerleft">State:</td>
<td class="registerright">
<select name = "state" size = "1">
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AS">AS</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="DC">DC</option>
<option value="FM">FM</option>
<option value="FL">FL</option>
<option selected value="GA">GA</option>
<option value="GU">GU</option>
<option value="HI">HI</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="IA">IA</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="ME">ME</option>
<option value="MH">MH</option>
<option value="MD">MD</option>
<option value="MA">MA</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MS">MS</option>
<option value="MO">MO</option>
<option value="MT">MT</option>
<option value="NE">NE</option>
<option value="NV">NV</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NY">NY</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="MP">MP</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PW">PW</option>
<option value="PA">PA</option>
<option value="PR">PR</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VT">VT</option>
<option value="VI">VI</option>
<option value="VA">VA</option>
<option value="WA">WA</option>
<option value="WV">WV</option>
<option value="WI">WI</option>
<option value="WY">WY</option>
</select>
</td>
</tr>
<tr>
<td class="registerleft">Zip Code:</td>
<td class="registerright"><input type="text" name="zip" size="25" onKeyPress="return numbersonly(this, event)"></td>
</tr>
<tr>
<td class="registerleft">Email Address:</td>
<td class="registerright"><input type="text" name="email" size="25"></td>
</tr>
<tr>
<td class="registerleft">Phone Number:</td>
<td class="registerright"><input type="text" name="phone" size="25" onKeyPress="return numbersonly(this, event)"></td>
</tr>
<tr>
<td class="registerleft">Invoice Priority:</td>
<td class="registerright">
<input type="radio" name="priority" value="1" checked>1: Immediately - I need my orders filled ASAP.<br>
<input type="radio" name="priority" value="2">2: As soon as it's convenient, I don't mind that much.<br>
<input type="radio" name="priority" value="3">3: Whenever you feel like, I'm in no hurry whatsoever.
</td>
<tr>
<td class="cartmenu" colspan="2" style="text-align: center">
<center><input type="image" src="imgs/continue.jpg" name="submit" value="Continue" align="absmiddle">
</td>
</tr>
</form>
</table>
<?php
include("footer.php");
?>
</body>
</html>
__________________
I'm ridin' dirty. Oh baby, I'm yellow and nerdy. |
|
|
|
|
|
#4 (permalink) | |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,884
OS: Vista, various linux distros
|
Re: PHP/Paypal Issues
Hey =] sorry about the wait, i would have gotten back to you yesterday but it was my 18th and i was off the radar for a bit =]
Right down to it: Quote:
So i thought about how i'd do this as dynamically as possible and then remembered that it has probably been done before. And it had, and yesterday i found a brilliant one... Code:
function postwith (to,p) {
var myForm = document.createElement("form");
myForm.method="post" ;
myForm.action = to ;
for (var k in p) {
var myInput = document.createElement("input") ;
myInput.setAttribute("name", k) ;
myInput.setAttribute("value", p[k]);
myForm.appendChild(myInput) ;
}
document.body.appendChild(myForm) ;
myForm.submit() ;
document.body.removeChild(myForm) ;
}
Code:
postwith("https://www.paypal.com/cgi-bin/webscr", {cmd:"_xclick", business:"maretard.at.gmail.com", item_name:"FBLAFlowers Floral Order", amount:"'.$total.'", quantity:"1", no_note:"1", currency_code:"USD"});
so it would end up something like: PHP Code:
Cheers, Jamey |
|
|
|
|
|
|
#7 (permalink) |
|
Registered User
|
Re: PHP/Paypal Issues
I love you, Jamie, and happy 18th! Mine's coming up in about a month. xD
Right-o, if you'll check the site now, you'll see that Paypal is implemented as the "Checkout" button, with just the teensiest change to the JS function call. :) Now, there are only a few things left: 1. The Paypal-generated page has no "Back" or "Edit Purchase" button that takes the user back to my site. ***? I thought that came standard with all Paypal pages. o_O 2. The Paypal page's FBLA Flowers logo is a temp. 3. THERE IS NO BACK BUTTON. 4. THERE IS NO BACK BUTTON. And last but not least, 5. THERE IS NO BACK BUTTON. I'm annoyed at Paypal. I specified a "Checkout completed" and "Checkout canceled" page in my Paypal Profile explicitly for my buttons; however, Paypal doesn't seem to want to obey those settings. ![]() Whaddya think, Jamie? I know you haven't used Paypal extensively, but do you think that's something wrong with my form or something I should take up with Paypal's HR department?
__________________
I'm ridin' dirty. Oh baby, I'm yellow and nerdy. |
|
|
|
|
|
#8 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,884
OS: Vista, various linux distros
|
Re: PHP/Paypal Issues
Haha cheers =] have a good birthday yourself =].
Hmm. i see what you mean. That is quite annoying actually. Probably best to take it up with paypal, come to think of it i don't think i've ever used a back button on paypal so whether or not one exists is questionable. Glad it's working. The paypal side of it seems quite annoying (to code haha =])... Good luck is all i can say because i don't even know how i'd go about fixing this. Cheers, Jamey oh p.s. cheers for posting in the "please download these videos for me" thread (what the title should have been), i decided not not reply to them after that last post because it was basically going to end up in me explaining how to decompile flash and if the site doesn't want their stuff downloaded that badly i don't think i should help someone. (Especially if they aren't going to just e-mail the site first). |
|
|
|
|
|
#9 (permalink) |
|
Registered User
|
Re: PHP/Paypal Issues
Right-o, I'm giving up on the Paypal back button, apparently that's only for Paypal's third-party shopping cart, not for its purchase page. -_-"
Oh well, I guess I can always argue that I coded my own shopping cart already, so I'm assuming that a user checking out has already finalized his or her purchase. :P Anyway, I did a little more remodeling, graphics-wise; I added dynamic backgrounds for every page so that the background matches the color scheme of the page, swapped out the logo colors, and (obviously) added Paypal integration with a custom header. I guess this is going a tad off topic now, but shoot me some feedback if you'd like. :) I'll post this over in the design counsel forum as well. @PS: Yeah, that guy was annoying me. I really don't like people who are so single-minded in their objectives; it's like we're tools, and his objective outweighs all of our opinions. Like a "okay, I heard you, now shut up and get me what I want" attitude. I'm fairly certain that his email would get ignored, anyway. :)
__________________
I'm ridin' dirty. Oh baby, I'm yellow and nerdy. |
|
|
|
|
|
#10 (permalink) | ||
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,884
OS: Vista, various linux distros
|
Re: PHP/Paypal Issues
Quote:
Quote:
The Homepage: I like the design, it's minimalist, simplistic and easy to understand. I like the rolling flash gallery, it's very welcoming. And that flash isn't obtrusive so it doesn't stick out or draw away attention. The product pages are nicely layed out. the way you use a thumbnail to link to the larger picture is nice too, it beats a "Click thumb for bigger image"... It would be interesting to see how you'd handle a larger/smaller amount of products to thumb(Mainly whether you'd squash them in or have them scroll in some way) =]. The entering your own quantity is nice, it may also be worth using a dropdown box instead but that limits a user's amount of products and it's not as if dropdown boxes aren't annoying (they really are[in my view for quantity they're really not fitting]). The navigation is really easy to use and very intuitive (this one really annoys me usually, my work's Till system is IE based and the worse thing to get used to EVER)... The design in general is very clear, welcoming and simple. The content is drawn to, as it should be on what's primarily a shopping site. The dynamic background is actually really fitting, especially with the pictures presented, they really fit. I also think that everything is actually where it should be (nothing in a stupid place). Generally a very nice site, expecially having seen it grow =] My only query/quarrel is that when the cart is empty the page seems too small, it might be worth adding the min-height property to the content. And that's hardly a biggun... I like the images you use aswell. Very nice, are they stock or your own? (Just out of curiousity), all seem in the same style anyway =] Very Nice Site! =D and yeah it's worth posting it in the design counsel forum because i'm sure a few others will like the look of it =] haha and yes, for the life of me i can't work out why no matter how many times i politely say "i'm not helping you" that other users are still closed minded enough to think "i want them videos". Should have just e-mailed, their terms of use are suggestive enough that they could have been convinced haha =]. |
||
|
|
|
|
|
#11 (permalink) |
|
Registered User
|
Re: PHP/Paypal Issues
Oh heck yes, implementing Paypal's shopping cart with my dynamic buttons would've been absolute hell. -_-"
Plus I think Paypal's cart really clashes with our site's style; I hate how you can't style the cart yourself. =/ Wow, thanks for all the feedback! ![]() If we added more products, I'd probably widen the thumbnail column a bit and put two thumbnail columns in that space. In fact, I could totally do that with little to no hassle... meh, it might start looking too cramped then. I added that min-height specification to the empty MyCart page, although I'm not sure whether to center or top-align the notification text. I have it centered as of now. The images are all free stock off of Flickr, but I actually want to find some new ones for some of our products; some of the current ones, I'm less than satisfied with. I'm also swapping out some images on the frontpage Flash slideshow - especially the wedding picture (pudgy fingers + freckles + horrible angle, need I say more?). Done: 1. Optimized all pictures to 51% JPEG quality. Some of those were 150kb JPEGs, no wonder it was loading slow. -_-" 2. Added a background to the Help/Privacy/Copyright pages to match the page background; several people have told me that pure white pages look bland. I actually prefer the white, but I'd appreciate more feedback on this one, as it's a pretty visually contrasting change. :) 3. Changed logo color to green-blue instead of green-red. Looks more professional in my opinion. 4. Dynamic backgrounds (obviously). To do list: 1. Refine the PHP on the home page so I can link to it using the logo. Had a lot of input on this one. :) 2. Find new pics. I want them to match their page's theme (some of the flowers clash with the red theme of the flowers page, for example). Major changes planned: I want to make each thumbnail expand slightly as users mouse over them; however, I don't want the existing table layout to change. So I guess I want a slightly bigger overlaid image whenever the user hovers over a thumbnail. Any ideas? I'm thinking probably JS is my best bet, but I have yet to find a script that does what I'm talking about. (Probably because I haven't looked yet. :P) PS: No replies on the design forum yet, the mods haven't approved my thread yet. ![]() PPS: I especially love how they're more willing to be stubborn to us than to be stubborn to the owners of the media.
__________________
I'm ridin' dirty. Oh baby, I'm yellow and nerdy. |
|
|
|
|
|
#12 (permalink) | |||||||
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,884
OS: Vista, various linux distros
|
Re: PHP/Paypal Issues
Quote:
haha i could probably have gone on but it would have just been straight praise because that site really does work well. Quote:
Quote:
Quote:
Quote:
Quote:
with the thumbnails enlarging i'd probably: - Add a set of images to the page with an absolute position, slightly bigger width and height and the css attribute visibility:"hidden" and then - add the property onmouseover="this.style.visibility='visible';" and the opposite for onmouse out. Quote:
|
|||||||
|
|
|
![]() |
| Thread Tools | |
|
|