jchasick
Mar 29 2003, 08:15 PM
here is a mod to include into your PayPal module to you can see what the customer ordered on your PayPal payment notification (just in case they don't return to your site to complete the process and generate an invoice) -
BACK UP BACK UP BACK UP
change the following code:
function process_button() {
global $order, $currencies, $currency;
if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
$my_currency = $currency;
} else {
$my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
}
if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {
$my_currency = 'USD';
}
$xx = '';
for ($i=0; $i<sizeof($order->products); $i++) {
$xx .= $order->products[$i]['qty'] . '-' . ($order->products[$i]['name']) . '**';
}
$process_button_string = tep_draw_hidden_field('cmd', '_xclick') .
tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
tep_draw_hidden_field('item_name', STORE_NAME . ' ' . $xx) .
tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('currency_code', $my_currency) .
tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .
tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
return $process_button_string;
}
Dan1113
Mar 29 2003, 10:34 PM
Change that to what in what file? :oops:
jchasick
Mar 29 2003, 10:35 PM
the above code snippet replaces the code snippet in the catalog/includes/modules/payment/paypal.php file
look for
function process_button() {
and then copy and paste and replace that section of code with the code above
(sorry I forgot to add that when I posted above....) 8)
griffin
Mar 29 2003, 10:41 PM
Thank you so much.
That was exactly what I needed and so simple to fix.
This sends what they order along with thir payment.
Dee
wizardsandwars
Mar 30 2003, 05:44 AM
Keep in mind that if you are worried about customers mot returning to the shop, then you must not have the IPN module installed.
If you do not have the IPN module installed, there is a *major* security flaw whcich can allow customers to order from your site without paying, yet OSC will htink that they have.
IPN is the only way to resulve this issue.
griffin
Mar 30 2003, 05:53 AM
So we should install the IPN and use that. This week I have had 3 payments sent without the order. If I install IPN will it send me what they have ordered? I'm no worried about them returning to the site as long as I know what they have ordered.
jchasick
Mar 30 2003, 05:54 AM
if you use IPN you can incorporate the same change so that OSC passes the cart contents instead of just the store name
Dan1113
Mar 30 2003, 06:57 AM
Thanks.
chet
Mar 30 2003, 09:18 AM
I understand the post but Paypal IPN has a different code. What do we have to replace ?
prosto
Apr 1 2003, 07:56 PM
I there a way to get product options/attributes into paypal confirmation as well?
Appreciate the help
Thanks
jchasick
Apr 1 2003, 08:14 PM
i will have to look at these questions - i'm sure there is a way
prosto
Apr 1 2003, 09:45 PM
I tried this:
CODE
function process_button() {
global $order, $currencies, $currency;
if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
$my_currency = $currency;
} else {
$my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
}
if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {
$my_currency = 'USD';
}
$xx = '';
$attr = '';
for ($i=0; $i<sizeof($order->products); $i++) {
$xx = $order->products[$i]['qty'] . ' x ' . ($order->products[$i]['name']);
for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) {
$attr = $order->products[$i]['attributes'][$j]['option'] . ': ' . ($order->products[$i]['attributes'][$j]['value']) . '**';
echo $xx;
echo "<br>";
echo $attr;
echo "<br>";
}
}
$process_button_string = tep_draw_hidden_field('cmd', '_xclick') .
tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
tep_draw_hidden_field('item_name', STORE_NAME . ' ' . $xx . ' - ' . $attr) .
tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('currency_code', $my_currency) .
tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .
tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
return $process_button_string;
}
and here is what's happening:
I can get the info on the screen at Order Confirmation page (note few echos in the middle - just for testing purpose) but it transefers to paypal confirmation only the last product and its attributes.
Any suggestions?
Thanks a lot
prosto
Apr 2 2003, 05:23 PM
In code I posted above I missed couple of dots
should be:
$xx .= and $attr .=
Anyway, I just learned that the 'item_name' field is limited to 127 characters, so it cut off after that.... Oh well
Paypal has an option of passing individual items to Paypal - anybody tried that yet?
Thanks
eeprom
Apr 4 2003, 02:04 PM
This is an excellent mod, thank you very much but can you please help with the following as I have searched till my eyes bleed.
My store's default currency is in USD but I also offer CAD for Canadians but when they checkout, osCommerce and/or PayPal converts the currency to USD.
Is this a PayPal issue or can a modification be made to osCommerce in order to pass along the right currency to PayPal?
Thanks
prosto
Apr 4 2003, 04:43 PM
you need to go into modules - > payment in admin and make sure that in paypal module Transaction Currency is set to "Selected Currency".
eeprom
Apr 4 2003, 11:35 PM
Thank you so much prosto that sure did the trick.
Kudos to all osCommere developers and contributors!
hqsupply
Apr 8 2003, 02:57 AM
Im still just experimenting with my store, and had Paypal configured for sales. I replaced that block of code in the paypal.php and now any paypal order delivers this error:
Parse error: parse error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /hsphere/local/home/hqsupply/hometownquiltsupply.com/catalog/includes/modules/payment/paypal.php on line 101
Fatal error: Cannot instantiate non-existent class: paypal in /hsphere/local/home/hqsupply/hometownquiltsupply.com/catalog/includes/classes/payment.php on line 41
I just dabble a bit with PHP so I can't derive much meaning from this to fix it... Any ideas? thanks..
~Tom
harborsales
Apr 9 2003, 06:22 PM
This updated paypal code is great, is there anyway to include the actual product # for each product ordered too? Having the description of the products in the paypal email helps but would be great if the item # was there too.
Just a thought, if anyone can figure this out I would appreciate knowing about it.
Mike
harborsales
Apr 9 2003, 06:22 PM
This updated paypal code is great, is there anyway to include the actual product # for each product ordered too? Having the description of the products in the paypal email helps but would be great if the item # was there too.
Just a thought, if anyone can figure this out I would appreciate knowing about it.
Mike
harborsales
Apr 9 2003, 06:30 PM
This updated paypal code is great, is there anyway to include the actual product # for each product ordered too? Having the description of the products in the paypal email helps but would be great if the item # was there too.
Just a thought, if anyone can figure this out I would appreciate knowing about it.
Mike
jchasick
Apr 9 2003, 07:00 PM
you could either add or change which product value you want passed in this line of code:
$xx = $order->products[$i]['qty'] . ' x ' . ($order->products[$i]['name']);
so if you have a field products[$i]['number'], then either add it to the string being passed or replace another variable in the line
$xx = $order->products[$i]['qty'] . ' x ' . ($order->products[$i]['name']) . ' #' . $order->products[$i]['number']);
griffin
Apr 9 2003, 07:35 PM
The only problem I have found with this is if they order more than one of the same product and it doesn' tell you what shipping method they chose.
jchasick
Apr 9 2003, 07:42 PM
what version of OSC are you using?
this mod has nothing to do with shipping so it sounds like you have another problem going on there :?
griffin
Apr 9 2003, 07:50 PM
I am using MS1 it gives me the total shipping amount thru Paypal.
It just doesn't tell me if they chose USPS or UPS shipping.
jchasick
Apr 9 2003, 08:37 PM
i suppose you could pass the shipping carrier - i would have to take a look at it, but all it would be is grabbing the shipping carrier code from OSC and sending it to PayPal in a field that is not being used
hankfrid
Apr 17 2003, 06:12 AM
I am going to be using strictly PayPal for a site I'm deleloping with osCommerce. It may sound like a stupid question, but could someone tell me what "IPN" is and where I would have to get it and put it?
Thanks,
HankFrid
spoiledRHOtten
Apr 17 2003, 07:33 AM
is there a way to pass the tax too?
I need to include tax with all of my orders...
toolcrazy
Apr 20 2003, 09:00 PM
QUOTE
I am going to be using strictly PayPal for a site I'm deleloping with osCommerce. It may sound like a stupid question, but could someone tell me what "IPN" is and where I would have to get it and put it?
Thanks,
HankFrid
IPN stands for Instant Payment Notification and the IPN mod is in the Contrib section. For more info on IPN go to PayPals site for more info.
jchasick
Apr 21 2003, 01:00 AM
you can pass any information you want as long as you have a field to send it in
just look at the fields that paypal has available, which ones you are using, which ones you arent, get the variable name of the data you want to send from OSC and put it into an unused field (as long as the data type is valid) and pass pass pass
7thgencivic.com
Apr 26 2003, 12:53 PM
so, has anyone integrated this with IPN .97?
grantjm
Apr 26 2003, 08:37 PM
Hi,
"For more info on IPN go to PayPals site for more info."
Where is the PayPal site?
jchasick
Apr 26 2003, 08:54 PM
is that a serious question
paypal.com
grantjm
Apr 26 2003, 08:58 PM
I just thought there was another site on osC that deals with PayPal. and its configuration.
Dragonmom
May 4 2003, 03:09 AM
QUOTE
I there a way to get product options/attributes into paypal confirmation as well?
yeah, that's the problem!
7thgencivic.com
May 4 2003, 03:13 AM
i did that a few posts up
7thgencivic.com
May 4 2003, 03:24 AM
why can't I edit my posts?
anyway, my bad, it was in the PAypal ipn .97 thread.
D
PopTheTop
Oct 3 2004, 03:11 PM
How would I go about adding the order invoice number to the
tep_draw_hidden_field('item_name', STORE_NAME . ' ' . $xx) .
What is the code that I need to modify or add?
Remember, I am new here so I need help with this one.
PopTheTop
Oct 8 2004, 01:44 PM
Anyone???
How would I go about adding the order invoice number to the
tep_draw_hidden_field('item_name', STORE_NAME . ' ' . $xx) .
What is the code that I need to modify or add? I do not need the site name or anything here except for the invoice number.
Remember, I am new here so I need help with this one.
krislyn5559
Oct 27 2007, 07:18 PM
QUOTE (jchasick @ Mar 29 2003, 08:15 PM)

here is a mod to include into your PayPal module to you can see what the customer ordered on your PayPal payment notification (just in case they don't return to your site to complete the process and generate an invoice) -
BACK UP BACK UP BACK UP
change the following code:
function process_button() {
global $order, $currencies, $currency;
if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
$my_currency = $currency;
} else {
$my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
}
if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {
$my_currency = 'USD';
}
$xx = '';
for ($i=0; $i<sizeof($order->products); $i++) {
$xx .= $order->products[$i]['qty'] . '-' . ($order->products[$i]['name']) . '**';
}
$process_button_string = tep_draw_hidden_field('cmd', '_xclick') .
tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
tep_draw_hidden_field('item_name', STORE_NAME . ' ' . $xx) .
tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('currency_code', $my_currency) .
tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .
tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
return $process_button_string;
}
How do I use this with PayPal IPN Payment Module v2.3.2 ? also can I make it show the product attributes as well?
cvelardi
Apr 1 2008, 08:32 AM
QUOTE (prosto @ Apr 2 2003, 02:23 PM)

Anyway, I just learned that the 'item_name' field is limited to 127 characters, so it cut off after that....
Is there any way to extend the amount of characters allowed in that field?
Is there a way to put each item purchased on seperate lines with prices instead of it showing all purchased items on one line with a total?
Thanks,
Craig
RC Heli Pilot
Apr 7 2008, 04:50 AM
Okay,... Now this thread is 5 years old.
Has this been resolved with the Newer Releases of osC that have been released or is this still an issue?
Can people still place an order and not actually Pay for it?
Is there a place in time that I can pretty much see and say okay this no longer applies because the problems were resolved in newer releases or are there still problems that are 5 years old and still havent been fixed?
I'd like to think that in the past 5 years this problem has been resolved already.
RCHP
omarts
Jun 7 2008, 09:19 PM
QUOTE (cvelardi @ Apr 1 2008, 01:32 AM)

Is there any way to extend the amount of characters allowed in that field?
Is there a way to put each item purchased on seperate lines with prices instead of it showing all purchased items on one line with a total?
Thanks,
Craig
HI,
I updated the code in the paypal.php to include the details of each item in the paypal receipt. The mode has to change from _xclick to _cart. Here is the code. Hope this help.
-Abhay
****************************
CODE
function process_button() {
global $order, $currencies, $currency;
if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
$my_currency = $currency;
} else {
$my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
}
if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {
$my_currency = 'USD';
}
/* Old code
$process_button_string = tep_draw_hidden_field('cmd', '_xclick') .
tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
tep_draw_hidden_field('item_name', STORE_NAME) .
tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('currency_code', $my_currency) .
tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .
tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
*/
// new parameters to the $process_button_string
$process_button_string = tep_draw_hidden_field('cmd', '_cart') .
tep_draw_hidden_field('upload', '1') .
tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
tep_draw_hidden_field('currency_code', $my_currency) .
tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .
tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')) .
tep_draw_hidden_field('shipping_1', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('tax_cart', number_format($order->info['tax'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)));
for ($i=0; $i<sizeof($order->products); $i++) {
$j = $i+1;
$process_button_string .= tep_draw_hidden_field('item_name_' . $j, $order->products[$i]['name']) .
tep_draw_hidden_field('item_number_' . $j, $order->products[$i]['model']) .
tep_draw_hidden_field('quantity_' . $j, $order->products[$i]['qty']) .
tep_draw_hidden_field('amount_' . $j, $order->products[$i]['final_price']);
}
// end changes
return $process_button_string;
}
clutcher
Jun 10 2008, 05:20 AM
QUOTE (omarts @ Jun 7 2008, 05:19 PM)

HI,
I updated the code in the paypal.php to include the details of each item in the paypal receipt. The mode has to change from _xclick to _cart. Here is the code. Hope this help.
-Abhay
****************************
CODE
function process_button() {
global $order, $currencies, $currency;
if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
$my_currency = $currency;
} else {
$my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
}
if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {
$my_currency = 'USD';
}
/* Old code
$process_button_string = tep_draw_hidden_field('cmd', '_xclick') .
tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
tep_draw_hidden_field('item_name', STORE_NAME) .
tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('currency_code', $my_currency) .
tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .
tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
*/
// new parameters to the $process_button_string
$process_button_string = tep_draw_hidden_field('cmd', '_cart') .
tep_draw_hidden_field('upload', '1') .
tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
tep_draw_hidden_field('currency_code', $my_currency) .
tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .
tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')) .
tep_draw_hidden_field('shipping_1', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('tax_cart', number_format($order->info['tax'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)));
for ($i=0; $i<sizeof($order->products); $i++) {
$j = $i+1;
$process_button_string .= tep_draw_hidden_field('item_name_' . $j, $order->products[$i]['name']) .
tep_draw_hidden_field('item_number_' . $j, $order->products[$i]['model']) .
tep_draw_hidden_field('quantity_' . $j, $order->products[$i]['qty']) .
tep_draw_hidden_field('amount_' . $j, $order->products[$i]['final_price']);
}
// end changes
return $process_button_string;
}
I was getting the following error below:
Parse error: parse error, unexpected T_IF, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /svc2/data/d1/web/abuttonaway.com/www/includes/modules/payment/paypal_standard.php on line 320
Please can anyone point out what I might be doing wrong?
Thanks in advance
mick-uk
Jun 11 2008, 04:08 PM
Thanks omarts, Works a ttrreet.
Mik.
cn01133531
Jun 12 2008, 03:34 AM
Thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.