News:

Support the VirtueMart project and become a member

Main Menu

Send Product Name and Attributes to Paypal

Started by kontrolfreek, December 20, 2008, 08:12:49 AM

Previous topic - Next topic

stinga

If PayPal works, then so should that URL, it just changes the the destination so that you can see what is being sent to PayPal. Did you gat an error message?
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

nirajlama

Sorry Stinga...had forgotten to add "http://" before the url. I have pasted the required info below. But just to recap my issue before that: Shipping & Handling cost is reflected in the Paypal checkout page, but not in the Paypal payment notification.


Information passed to this script
Environment

SCRIPT_NAME=/cgi-bin/data_dump.pl
SERVER_NAME=www.recovery-cd-disk.com
HTTP_REFERER=http://localhost/joomla15/index.php?page=checkout.index&payment_method_id=4&ship_to_info_id=8d8d84e6406b49fce2a37c5733992e3f&shipping_rate_id=standard_shipping%257CFedEx%257C1%2Bweek%252C%2BZoneG%257C29.00%257C24&checkout_stage=4&option=com_virtuemart&Itemid=1
SERVER_ADMIN=domain@squangle.net
HTTP_ACCEPT_ENCODING=gzip,deflate
HTTP_CONNECTION=keep-alive
REQUEST_METHOD=GET
HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
SCRIPT_URI=http://www.recovery-cd-disk.com/cgi-bin/data_dump.pl
SCRIPT_FILENAME=/home/www/recovery-cd-disk.com/cgi-bin/data_dump.pl
SERVER_SOFTWARE=Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4.3 with Suhosin-Patch proxy_html/3.1.2 mod_perl/2.0.4 Perl/v5.10.0
HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7
QUERY_STRING=cmd=_cart&redirect_cmd=_ext-enter&upload=1&business=whereismary%40hotmail.com&receiver_email=whereismary%40hotmail.com&invoice=65_304d207020db88ab39cb8741ee0b6&amount=280&shipping_1=29.00&currency_code=USD&address_override=0&first_name=niraj&last_name=lama&address1=234+howell&address2=&zip=14103&city=medina&state=NY&country=US&email=niraj%40darjeelingteaexclusive.com&night_phone_b=5354678&return=%2Fjoomla15%2Findex.php%3Foption%3Dcom_virtuemart%26page%3Dcheckout.result%26order_id%3D139&notify_url=%2Fjoomla15%2Fadministrator%2Fcomponents%2Fcom_virtuemart%2Fnotify.php&cancel_return=%2Fjoomla15%2Findex.php%3Foption%3Dcom_virtuemart%26page%3Dcheckout.result%26order_id%3D139&undefined_quantity=0&test_ipn=0&pal=%3F%3F%3F%3F&no_shipping=1&no_note=1&item_name_1=Order+%23139%3A+Moonbeam&on1_1=-&os1_1=1kg%2C+2.2lb%3B&item_number_1=FF10_4a&quantity_1=1&amount_1=280&
REMOTE_PORT=1184
HTTP_USER_AGENT=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.1
SERVER_PORT=80
SERVER_SIGNATURE=
Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4.3 with Suhosin-Patch proxy_html/3.1.2 mod_perl/2.0.4 Perl/v5.10.0 Server at www.recovery-cd-disk.com Port 80


HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5
REMOTE_ADDR=72.75.195.73
HTTP_KEEP_ALIVE=115
SERVER_PROTOCOL=HTTP/1.1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
REQUEST_URI=/cgi-bin/data_dump.pl?cmd=_cart&redirect_cmd=_ext-enter&upload=1&business=whereismary%40hotmail.com&receiver_email=whereismary%40hotmail.com&invoice=65_304d207020db88ab39cb8741ee0b6&amount=280&shipping_1=29.00&currency_code=USD&address_override=0&first_name=niraj&last_name=lama&address1=234+howell&address2=&zip=14103&city=medina&state=NY&country=US&email=niraj%40darjeelingteaexclusive.com&night_phone_b=5354678&return=%2Fjoomla15%2Findex.php%3Foption%3Dcom_virtuemart%26page%3Dcheckout.result%26order_id%3D139&notify_url=%2Fjoomla15%2Fadministrator%2Fcomponents%2Fcom_virtuemart%2Fnotify.php&cancel_return=%2Fjoomla15%2Findex.php%3Foption%3Dcom_virtuemart%26page%3Dcheckout.result%26order_id%3D139&undefined_quantity=0&test_ipn=0&pal=%3F%3F%3F%3F&no_shipping=1&no_note=1&item_name_1=Order+%23139%3A+Moonbeam&on1_1=-&os1_1=1kg%2C+2.2lb%3B&item_number_1=FF10_4a&quantity_1=1&amount_1=280&
GATEWAY_INTERFACE=CGI/1.1
SERVER_ADDR=91.197.33.52
HTTP_AUTHORIZATION=
SCRIPT_URL=/cgi-bin/data_dump.pl
DOCUMENT_ROOT=/home/www/recovery-cd-disk.com
HTTP_HOST=www.recovery-cd-disk.com

These Form-variables exists

redirect_cmd=_ext-enter
shipping_1=29.00
state=NY
night_phone_b=5354678
email=niraj@darjeelingteaexclusive.com
receiver_email=whereismary@hotmail.com
os1_1=1kg, 2.2lb;
business=whereismary@hotmail.com
item_number_1=FF10_4a
cmd=_cart
currency_code=USD
test_ipn=0
zip=14103
invoice=65_304d207020db88ab39cb8741ee0b6
address1=234 howell
no_shipping=1
last_name=lama
city=medina
address_override=0
no_note=1
on1_1=-
upload=1
pal=????
quantity_1=1
country=US
item_name_1=Order #139: Moonbeam
cancel_return=/joomla15/index.php?option=com_virtuemart&page=checkout.result&order_id=139
notify_url=/joomla15/administrator/components/com_virtuemart/notify.php
address2=
return=/joomla15/index.php?option=com_virtuemart&page=checkout.result&order_id=139
undefined_quantity=0
amount=280
amount_1=280
first_name=niraj





stinga

#77
G'day,
I will need to have a look and see what is wrong with shipping, but I can see that the cancel_return, return and notify_url are not going to work. They need http://<domain name>/

Have you got your PP account setup correctly. I think you can tell PP to apply it's shipping charges, in which case it might be ignoring what you send.

There is also something wrong with on_1 and os_1 these are related (somehow)
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

nirajlama

Hi Stinga,
Thanks for the suggestions.
However, even without the domain my cancel_return url works fine. To be sure is this not the Paypal button that says "Cancel Order and Return to Store"?
I have looked around in my Paypal account. As far as I can see I have not activated Paypal Shipping. For my default Shipping Carrier in Paypal I have "no preference."
I am very grateful for your time.

joepr

Hello everyone,
I have been looking for this modification however my site site do not required to have the item shipped. Does this script is able to process and transfer all the required info except the shipping option?

Thanks in advance

stinga

Paypal does not care if ship or not.
If you don't have shipping then the shipping will be zero.
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

joepr

#81
Hello Stinga,
Thanks for the reply hope you can help me with my problem. Im using Joomla Version 1.5.18 and VM 1.1.4 . I disable the shipping option on the site since My products don't need to be shipped. (Screen shot attached) how ever after adding the item to the cart and proceeding to the checkout option I got the following paypal (using sandbox for the moment) error

Unable to process payment. Please contact the merchant as the shipping address provided by the merchant is invalid, and the merchant has requested that your order must be shipped to that address. (see image for more details)

Do you or anyone have an idea how this could be solved?

Note: I'm using the code PayPal_payment_extra_info.php provided by seiko at page 4 Thanks!!

-UPDATE-
To solve my issue I change the option on the code
"address_override" => "1", to "address_override" => "0",

[attachment cleanup by admin]

consolecustoms

#82
First off a huge thank you to kontrolfreek and ajredding. I have been looking for this for a while and with a little modification is exactly what I needed.

Incase it will be usefull to others I modified the last entry from ajredding to better suit my needs but also to mainly allow it tow work properly with Coupons and tax. using the last posted code would produce incorrect values in paypal when using coupons and when tax was added.

Therefore I made the following changes:

changed
$supp_var['amount_' . $i] = round(($dboi->f("product_item_price") - $disc_perItem),2);

to

$supp_var['amount_' . $i] = round($dboi->f("product_item_price"),2);

This removes the per item discouting. later I add in sending the total discount from VM to Paypal.



changes to information sent to paypal

// Builds array for the form
$post_variables = Array(
"cmd" => "_cart",
"upload" => "1",
//"page_style" => "paypal",
"business" => PAYPAL_EMAIL,
"currency_code" => $_SESSION['vendor_currency'],
//"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"amount" => round( $db->f("order_subtotal"), 2),
//"handling_cart" => sprintf("%.2f", $db->f("order_shipping")),
"shipping_1" => sprintf("%.2f", $db->f("order_shipping")),
//"tax" => $tax_total,
"tax_cart" => $tax_total,
"discount_amount_cart" => $discount_total,
"invoice" => $db->f("order_number"),
//"image_url" => $vendor_image_url,
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php",
"no_shipping" => "1",
//"no_note" => "1",


In here I have commented out the page style because I just a page style in paypal. even if you don't use one it iwll still default to the "paypal" style.

Commented the original "amount line" this is what causes issues with coupons and tax because it is taking a pre-calculated amount to paypal and then paypal tries to do its own calculations. the new amount value right below it only send the original product subtotal no tax, no discounts, no shipping.

commented out "handling_cart" and added in "shipping_1" this allows paypal to add in and display the shipping amount from VM correctly.

commented out the "tax" line as right below is is "tax_cart" and this is the one that is used by paypal when sending "cmd" => "_cart".

Added "discount_amount_cart" this will send paypal the total discount from VM.

Changed "invoice" from Order_id to order_number to resolve IPN coming back with "Order ID not found" error.

Also commented out "no_note" because I like for people to be able to leave a note.


by removing the per item discount calculations, changing the "amount" line, adding the "shipping_1" and "discount_amount_cart" it is sending all the raw order information to paypal and allowing paypal to do all the adding and subtracting. It will also show fields in paypal for the discount amount, tax and shipping just like in Virtuemart.

Here is the full code:

<?php
$url 
"https://www.paypal.com/cgi-bin/webscr";
$order_id $db->f("order_id");
$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");  

// Query for Order Items
$dboi = new ps_DB;
$q_oi "SELECT * FROM #__vm_order_item ";
$q_oi .= "WHERE #__vm_order_item.order_id='$order_id'";
$dboi->query($q_oi);

$row_num $dboi->num_rows();

//New code Getting Cart Items
$auth $_SESSION['auth'];
$cart $_SESSION['cart'];
$t_quantity 0;
$disc_perItem 0;
$i=1;

// Query to get User Info
$dbb = new ps_DB;
$q "SELECT * FROM #__vm_user_info ";
$q .= "WHERE user_id ='".$my->id."' ";
$dbb->setQuery($q);
$dbb->query();

//New Code
$discount_totalCP $db->f("coupon_discount") + $db->f("order_discount");

while(
$dboi->next_record()) {
  
$t_quantity $t_quantity intval($dboi->f("product_quantity"));
}

$dboi null;
$dboi = new ps_DB;
$dboi->query($q_oi);

if(
$t_quantity 0)
{
  if(
$discount_totalCP 0) {
    
$disc_perItem round($discount_totalCP $t_quantity2);
  }
  else {
    
$disc_perItem 0;
  }
}
else {
  
$disc_perItem 0;
}

while(
$dboi->next_record()) {

  
$prod_attrib $dboi->f("product_attribute");
  
$supp_var['item_name_' $i] = strip_tags($dboi->f("order_item_name"));
  
  if(
$prod_attrib ''){
    
$attributes_array explode('<br/>',$prod_attrib);
    
$v 0;
    
$z 1;
    foreach ( 
$attributes_array as $attributes_value){
      
$attrib_name trim(substr($attributes_value0strpos($attributes_value':')), " ");
      
$supp_var['on' $z '_' $i] = $attrib_name;
      
$attrib_sel trim(substr_replace(substr_replace($attributes_value""0strrpos($attributes_value':')), ""02));
      
$supp_var['os' $z '_' $i] = $attrib_sel;
      
$v++;
      
$z++;
      unset(
$attributes_value);
    }
  }

//  $supp_var['item_number_' . $i] = $dboi->f("order_item_sku");
  
$supp_var['quantity_' $i] = $dboi->f("product_quantity");
  
$supp_var['amount_' $i] = round($dboi->f("product_item_price"),2);
  
$i++;
}
//End New Code


//Start New Code - Ship to Address Versus Bill To Address

//Query used to compare Bill to versus Shipp to address
$dboui = new ps_DB;
$q_oui "SELECT * FROM #__vm_order_user_info ";
$q_oui .= "WHERE #__vm_order_user_info.order_id='$order_id' ORDER BY #__vm_order_user_info.order_info_id DESC";
$dboui->query($q_oui);

$oui_id $dboui->f("order_info_id");

if(
$oui_id == $order_id){
  
$first_name $dbb->f("first_name");
  
$last_name $dbb->f("last_name");
  
$address1 $dbb->f("address_1");
  
$address2 $dbb->f("address_2");
  
$city $dbb->f("city");
  
$state $dbb->f("state");
  
$address_country $dbbt->f("country");
  
$zip $dbb->f("zip");
  
$H_PhoneNumber $dbb->f("phone_1");
}
else {
  
$first_name $dboui->f("first_name");
  
$last_name $dboui->f("last_name");
  
$address1 $dboui->f("address_1");
  
$address2 $dboui->f("address_2");
  
$city $dboui->f("city");
  
$state $dboui->f("state");
  
$address_country $dboui->f("country");
  
$zip $dboui->f("zip");
  
$H_PhoneNumber $dboui->f("phone_1");
}
//End New Code

// Builds array for the form
$post_variables = Array(
"cmd" => "_cart",
"upload" => "1",
//"page_style" => "primary",
"business" => PAYPAL_EMAIL,
"currency_code" => $_SESSION['vendor_currency'],
//"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"amount" => round$db->f("order_subtotal"), 2),
//"handling_cart" => sprintf("%.2f", $db->f("order_shipping")),
"shipping_1" => sprintf("%.2f"$db->f("order_shipping")),
//"tax" => $tax_total,
"tax_cart" => $tax_total,
"discount_amount_cart" => $discount_total,
"invoice" => $db->f("order_number"),
//"image_url" => $vendor_image_url,
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php",
"no_shipping" => "1",
//"no_note" => "1",
"email" => $dbb->f("user_email"),
"address_override" => "1",
"first_name" => $first_name,
"last_name" => $last_name,
"address1" => $address1,
"address2" => $address2,
"city" => $city,
"state" => $state,
"address_country" => $address_country,
"zip" => $zip,
"night_phone_b" => $H_PhoneNumber
);

if( 
$page == "checkout.thankyou" ) {
  
$query_string "?";

  foreach( 
$post_variables as $name => $value ) {
    
$query_string .= $name"=" urlencode($value) ."&";
  }

  if(
is_array($supp_var) && count($supp_var)) {
    foreach(
$supp_var as $name => $value) {
      
$query_string .= $name"=" urlencode($value) ."&";
    }
  }

  
vmRedirect$url $query_string );

else {
  echo 
'<form action="'.$url.'" method="post" target="_blank">';

  foreach( 
$post_variables as $name => $value ) {
    echo 
'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
  }
  
  if(
is_array($supp_var) && count($supp_var)) {
    foreach(
$supp_var as $name => $value) {
      echo 
'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
    }
  }
  echo 
'<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" alt="Make payments with PayPal, it is fast, free, and secure!">';
  echo 
'</form>';
}
?>



I hope this can help others out there as well.

Chris
www.consolecustoms.com - Xbox 360 and PlayStation 3 Rapid Fire controllers, LEDs and more.

Foothill Web Design

Hi, just want to say thanks to everyone who contributed. This definitely needs to be part of the module itself, perhaps using a drop-down box to choose from several layout configurations.

MacAcer

Thank you for the PayPal extra info. It fixed the coupon discount problem I had and it also come out nicely on the receipt on PayPal with all the products, tax, discount and shipping listed. I used the code that Chris posted here with the additional line provided by seiko to determine country_2_code for PayPal.

I have encountered one problem though. Now when the extra info seem to leave the tax calculation to PayPal it does not round off the amount to always match the amount in Virtuemart. This is both slightly disturbing and problematic as after payment, the order status will stay in "Pending" instead of "Payed".

In my test order which should have been 105,00 SEK, PayPal calculated it as 104,99 SEK. Is there a way to set it to round off the amount to nearest whole number - no decimals.

Provided the complete PayPal Exta info that I'm using.

<?php
$url 
"https://www.paypal.com/cgi-bin/webscr";
$order_id $db->f("order_id");
$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");  

// Query for Order Items
$dboi = new ps_DB;
$q_oi "SELECT * FROM #__vm_order_item ";
$q_oi .= "WHERE #__vm_order_item.order_id='$order_id'";
$dboi->query($q_oi);

$row_num $dboi->num_rows();

//New code Getting Cart Items
$auth $_SESSION['auth'];
$cart $_SESSION['cart'];
$t_quantity 0;
$disc_perItem 0;
$i=1;

// Query to get User Info
$dbb = new ps_DB;
$q "SELECT * FROM #__vm_user_info ";
$q .= "WHERE user_id ='".$my->id."' ";
$dbb->setQuery($q);
$dbb->query();

//New Code
$discount_totalCP $db->f("coupon_discount") + $db->f("order_discount");

while(
$dboi->next_record()) {
  
$t_quantity $t_quantity intval($dboi->f("product_quantity"));
}

$dboi null;
$dboi = new ps_DB;
$dboi->query($q_oi);

if(
$t_quantity 0)
{
  if(
$discount_totalCP 0) {
    
$disc_perItem round($discount_totalCP $t_quantity2);
  }
  else {
    
$disc_perItem 0;
  }
}
else {
  
$disc_perItem 0;
}

while(
$dboi->next_record()) {

  
$prod_attrib $dboi->f("product_attribute");
  
$supp_var['item_name_' $i] = strip_tags($dboi->f("order_item_name"));
  
  if(
$prod_attrib ''){
    
$attributes_array explode('<br/>',$prod_attrib);
    
$v 0;
    
$z 1;
    foreach ( 
$attributes_array as $attributes_value){
      
$attrib_name trim(substr($attributes_value0strpos($attributes_value':')), " ");
      
$supp_var['on' $z '_' $i] = $attrib_name;
      
$attrib_sel trim(substr_replace(substr_replace($attributes_value""0strrpos($attributes_value':')), ""02));
      
$supp_var['os' $z '_' $i] = $attrib_sel;
      
$v++;
      
$z++;
      unset(
$attributes_value);
    }
  }

//  $supp_var['item_number_' . $i] = $dboi->f("order_item_sku");
  
$supp_var['quantity_' $i] = $dboi->f("product_quantity");
  
$supp_var['amount_' $i] = round($dboi->f("product_item_price"),2);
  
$i++;
}
//End New Code


//Start New Code - Ship to Address Versus Bill To Address

//Query used to compare Bill to versus Shipp to address
$dboui = new ps_DB;
$q_oui "SELECT * FROM #__vm_order_user_info ";
$q_oui .= "WHERE #__vm_order_user_info.order_id='$order_id' ORDER BY #__vm_order_user_info.order_info_id DESC";
$dboui->query($q_oui);

$oui_id $dboui->f("order_info_id");

if(
$oui_id == $order_id){
  
$first_name $dbb->f("first_name");
  
$last_name $dbb->f("last_name");
  
$address1 $dbb->f("address_1");
  
$address2 $dbb->f("address_2");
  
$city $dbb->f("city");
  
$state $dbb->f("state");
  
$address_country $dbbt->f("country");
  
$zip $dbb->f("zip");
  
$H_PhoneNumber $dbb->f("phone_1");
}
else {
  
$first_name $dboui->f("first_name");
  
$last_name $dboui->f("last_name");
  
$address1 $dboui->f("address_1");
  
$address2 $dboui->f("address_2");
  
$city $dboui->f("city");
  
$state $dboui->f("state");
  
$address_country $dboui->f("country");
  
$zip $dboui->f("zip");
  
$H_PhoneNumber $dboui->f("phone_1");
}
//End New Code

// seiko - adding to determine country_2_code for PayPal
$db1 = new ps_DB();
$q "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$address_country."' ORDER BY country_2_code ASC";
$db1->query($q);
$country2code $db1->f('country_2_code');
//End New Code

// Builds array for the form
$post_variables = Array(
"cmd" => "_cart",
"upload" => "1",
//"page_style" => "paypal",
"business" => PAYPAL_EMAIL,
"currency_code" => $_SESSION['vendor_currency'],
//"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"amount" => round$db->f("order_subtotal"), 2),
//"handling_cart" => sprintf("%.2f", $db->f("order_shipping")),
"shipping_1" => sprintf("%.2f"$db->f("order_shipping")),
//"tax" => $tax_total,
"tax_cart" => $tax_total,
"discount_amount_cart" => $discount_total,
"invoice" => $db->f("order_number"),
//"image_url" => $vendor_image_url,
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php",
"no_shipping" => "1",
//"no_note" => "1",
"email" => $dbb->f("user_email"),
"address_override" => "1",
"first_name" => $first_name,
"last_name" => $last_name,
"address1" => $address1,
"address2" => $address2,
"city" => $city,
"state" => $state,
"address_country" => $address_country,
"zip" => $zip,
"night_phone_b" => $H_PhoneNumber,
"cpp_header_image" => $vendor_image_url,
);

if( 
$page == "checkout.thankyou" ) {
  
$query_string "?";

  foreach( 
$post_variables as $name => $value ) {
    
$query_string .= $name"=" urlencode($value) ."&";
  }

  if(
is_array($supp_var) && count($supp_var)) {
    foreach(
$supp_var as $name => $value) {
      
$query_string .= $name"=" urlencode($value) ."&";
    }
  }

  
vmRedirect$url $query_string );

else {
  echo 
'<form action="'.$url.'" method="post" target="_blank">';

  foreach( 
$post_variables as $name => $value ) {
    echo 
'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
  }
  
  if(
is_array($supp_var) && count($supp_var)) {
    foreach(
$supp_var as $name => $value) {
      echo 
'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
    }
  }
  echo 
'<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" alt="Make payments with PayPal, it is fast, free, and secure!">';
  echo 
'</form>';
}
?>


Your help is much appreciated.


Shibumi

Quote from: kontrolfreek on December 20, 2008, 08:12:49 AM
Now, that is how I set mine up, you might do yours different so I dont know if it will work the same or not.  Now for the code.

Go to store and list payment methods, click on the word paypal then on the configuration tab.  Here is my full code for the page and i will put a small clip under it and explain the 2 - from the attributes....

I take it this mod is only for the old PayPal setup? Does anyone know or has anyone tried this with the new PayPal API?
Jeff
=================================================
Scionergy.com - www.Scionergy.com
Scion Owners Club of Ottawa - www.ScionOwnersClubOttawa.ca
Capital Door Service - www.CapitalDoorService.com - VM2.0.20b, Joomla 2.5.11 PHP5.2.11 powered site

Shibumi

Has anyone discovered if there are any extra variables that can be passed through the paypal API?
Jeff
=================================================
Scionergy.com - www.Scionergy.com
Scion Owners Club of Ottawa - www.ScionOwnersClubOttawa.ca
Capital Door Service - www.CapitalDoorService.com - VM2.0.20b, Joomla 2.5.11 PHP5.2.11 powered site