News:

Looking for documentation? Take a look on our wiki

Main Menu

how to show product name, qty in paypal payment page

Started by tancheng, January 19, 2009, 10:43:38 AM

Previous topic - Next topic

tancheng

hi everybody,

i have find all topic about my title, but there are always error from paypal payment.
i just want to show products name and qty in description of paypal payment page.

Joomla 1.5.8 and VM 1.1.2

below is my paypal code:
<?php
$ct 
$dbbt->f("country");
$db1 = new ps_DB();
$q "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$ct."' ORDER BY country_2_code ASC";
$db1->query($q);

// echo "debug".$dbbt->f("country").$db1->f('country_2_code');
$url "https://www.paypal.com/cgi-bin/webscr";
$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_xclick",
"upload" => "1",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": "$db->f("order_id"),
"order_id" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"amount" => round$db->f("order_subtotal")+$tax_total-$discount_total2),
"shipping" => sprintf("%.2f"$db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],
"address_override" => "1",
"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address1" => $dbbt->f('address_1'),
"address2" => $dbbt->f('address_2'),
"zip" => $dbbt->f('zip'),
"city" => $dbbt->f('city'),
"state" => $dbbt->f('state'),
"country" => $db1->f('country_2_code'),
"lc" => $db1->f('country_2_code'),
"email" => $dbbt->f('user_email'),
"night_phone_b" => $dbbt->f('phone_1'),
"cpp_header_image" => $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",
"undefined_quantity" => "0",

"test_ipn" => PAYPAL_DEBUG,
"pal" => "NRUBJXESJTY24",
"no_shipping" => "1",
"no_note" => "1"
);
if( 
$page == "checkout.thankyou" ) {
$query_string "?";
foreach( 
$post_variables as $name => $value ) {
$query_string .= $name"=" urlencode($value) ."&";
}
vmRedirect$url $query_string );
} else {
echo 
'<form action="'.$url.'" method="post" target="_blank">';
echo 
'<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" alt="Click to pay with PayPal - it is fast, free and secure!" />';

foreach( 
$post_variables as $name => $value ) {
echo 
'<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo 
'</form>';

}
?>


Please help and thanks in advance


carlosleon0615

I have a similar question. When a customer is directed to Paypal, the Paypal description ONLY SHOWS a colon and the Order Number but it does NOT show the product name. Example:

Paypal Description
:922

In previous versions of VM (undfortunatelly I don't remember which one), the order number and product name used to be correctly passed to Paypal.
I'm thinking it's just a matter of a variable not being passed to Paypal? If so, does anyone know which variable would that be and where is the correct location in the code where I should pass it in?

I am using Joomla 1.0.15 and VM 1.1.3

Thanks for any help!

Carlos

angek

try this:


<?php
$ct 
$dbbt->f("country");
$db1 = new ps_DB();
$q "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$ct."' ORDER BY country_2_code ASC";
$db1->query($q);
//get the item name.
$db2 = new ps_DB();
$q1 "SELECT order_item_name FROM #__vm_order_item WHERE order_id=".$db->f("order_id");
$db2->query($q1);
$item $db2->f("order_item_name");

// echo "debug".$dbbt->f("country").$db1->f('country_2_code');
$url "https://www.paypal.com/cgi-bin/webscr";
$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_xclick",
"upload" => "1",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
//"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": ". $db->f("order_id"),
"item_name" => $item." - ".$VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": "$db->f("order_id"),
"order_id" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"amount" => round$db->f("order_subtotal")+$tax_total-$discount_total2),
"shipping" => sprintf("%.2f"$db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],
"address_override" => "1",
"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address1" => $dbbt->f('address_1'),
"address2" => $dbbt->f('address_2'),
"zip" => $dbbt->f('zip'),
"city" => $dbbt->f('city'),
"state" => $dbbt->f('state'),
"country" => $db1->f('country_2_code'),
"lc" => $db1->f('country_2_code'),
"email" => $dbbt->f('user_email'),
"night_phone_b" => $dbbt->f('phone_1'),
"cpp_header_image" => $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",
"undefined_quantity" => "0",

"test_ipn" => PAYPAL_DEBUG,
"pal" => "NRUBJXESJTY24",
"no_shipping" => "1",
"no_note" => "1"
);
if( 
$page == "checkout.thankyou" ) {
$query_string "?";
foreach( 
$post_variables as $name => $value ) {
$query_string .= $name"=" urlencode($value) ."&";
}
vmRedirect$url $query_string );
} else {
echo 
'<form action="'.$url.'" method="post" target="_blank">';
echo 
'<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" alt="Click to pay with PayPal - it is fast, free and secure!" />';

foreach( 
$post_variables as $name => $value ) {
echo 
'<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo 
'</form>';

}
?>



this should add the item name (see attached image - additemname.jpg) as for the qnty this should already be there (see attached image - quntity.jpg).

[attachment cleanup by admin]

brandonjp

Quote from: angek on January 29, 2009, 01:35:09 AM
as for the qnty this should already be there (see attached image - quntity.jpg).

I think VM just passes a quantity of 1 regardless of the shopping cart contents.  I just did a test order for 3 different products all at qty 5 and PayPal page still displayed quantity 1.

[attachment cleanup by admin]

ajredding

RAW Media Group - Website design - http://www.rawmediagroup.com
Cubed Hosting - Website Hosting - http://www.cubedhosting.com