Få min form til at samle et total fra mit script op
Hej alle!Jeg håber det er ok at en del af mit indlæg er på engelsk. I må gerne skrive på dansk. :) Jeg har spurgt et par steder på nettet, men har ikke fundet en løsning på denne paypal-integrations udfordring endnu. Er der nogen der kan hjælpe her?
I've built a third party shopping cart, click here if you'd like to see it:
http://www.carlinart.net/shoppingcart/index.php
I want to integrate paypal so the aggregate cart amount is passed to paypal.
From the online guides at paypal I can read:
"If you wish, you may aggregate your entire shopping cart and pass the total amount into PayPal's Buy Now Button code (that is, you will need to post a single name for the entire cart and the total price of the cart's contents as though it were a purchase of a single item)."
Is it really the case that you cannot have a price that changes depending on the customers purchases in your shop?
I've used this code:
[IMG]http://img261.imageshack.us/img261/4329/billede1mc1.jpg[/IMG]
The field
<input type="hidden" name="amount_1" value="5.00"/>
is what seems interesting. How can I have the form read the total calculation of my cart, and not depend on, say, a 5 dollar price that's fixed?
Could I use a $_POST or $_GET variable in some sneaky fashion to have the form pick up on the calculated total?
I use a MySql database to describe my products. (right now they're only test books. :) ) If I have to find an alternate solution because the form can't somehow be made to read the total of the shopping cart, I'd choose the second method of passing individual items to payPal.
I need some help with this, though. It means my script will have to generate details about each product to upload to paypal? I use Dreamweaver and would greatly appreciate an example of this type of script. Here is what my original script for the shopping cart looks like:
[IMG]http://img261.imageshack.us/img261/209/billede2jv0.jpg[/IMG]
Also, do I need to edit my product details in the database? Right now they look like this:
[IMG]http://img518.imageshack.us/img518/6493/billede3xr9.jpg[/IMG]
Could someone give an example of which details need to be edited and what to?
Jeg har senere hen prøvet at få $total over i Paypals informationer ved at echoe det ind i inputtets value. Ala her:
<input type="hidden" name="amount_1" value="<?php echo $total; ?>"/>
Men når man skriver andet end et tal (fx 1.00) i valueen, generer paypal en fejl der siger shopping cart er tom.
Men jeg er overbevist om at der må være en måde at få min carts total over i paypal formen. Er der nogen der kender noget til det?
På forhånd tak for hjælpen!
