Jump to content

Archived

This topic is now archived and is closed to further replies.

jchasick

Here is how to see your order contents on Paypal

Recommended Posts

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;

}


Reading is beneficial - Searching is enlightening

find answers at wiki.oscommerce.com/top

Share this post


Link to post
Share on other sites

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)


Reading is beneficial - Searching is enlightening

find answers at wiki.oscommerce.com/top

Share this post


Link to post
Share on other sites

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


I got grey hair with osCommerce.

Share this post


Link to post
Share on other sites

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.


-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Share this post


Link to post
Share on other sites

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.


I got grey hair with osCommerce.

Share this post


Link to post
Share on other sites

I understand the post but Paypal IPN has a different code. What do we have to replace ?

Share this post


Link to post
Share on other sites

I there a way to get product options/attributes into paypal confirmation as well?

 

Appreciate the help

 

Thanks

Share this post


Link to post
Share on other sites

I tried this:

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

you need to go into modules - > payment in admin and make sure that in paypal module Transaction Currency is set to "Selected Currency".

Share this post


Link to post
Share on other sites

Thank you so much prosto that sure did the trick.

 

Kudos to all osCommere developers and contributors!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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']);


Reading is beneficial - Searching is enlightening

find answers at wiki.oscommerce.com/top

Share this post


Link to post
Share on other sites

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.


I got grey hair with osCommerce.

Share this post


Link to post
Share on other sites

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 :?


Reading is beneficial - Searching is enlightening

find answers at wiki.oscommerce.com/top

Share this post


Link to post
Share on other sites

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.


I got grey hair with osCommerce.

Share this post


Link to post
Share on other sites

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


Reading is beneficial - Searching is enlightening

find answers at wiki.oscommerce.com/top

Share this post


Link to post
Share on other sites

×