Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Paypal IPN v0.97 and Product Attributes Option Type Feature


Guest

Recommended Posts

I'm wondering if anyone who installed the latest Paypal IPN contrib has the Product Attributes Option Type Feature v2.2 by Chandra Roukema (allows textbox options) also installed. I am having some trouble with them. Individually they work perfectly. Together, they break. It's a pretty big problem for me because I need both of them. ARGH!

 

Basically, the Order Process email that gets sent does not include the correct billing or shipping address. However, the billing and shipping address that get sent to the database are correct.

 

My bigger problem is that the textbox option information that gets sent in the Order Process email is also incorrect. Instead of saying the text value it says the word "TEXT". And the text value does not get sent to the database. Instead they just say the word "TEXT".

 

Could anyone explain to me why these text values would not get sent to the database when I use the Paypal IPN contrib? If I checkout by another method, say check/money order, it works perfectly

 

Below is a copy of a an Order Process email using IPN and one that does not. You'll see the difference:

 

Fireball Race Graphics

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

Order Number: 43

Detailed Invoice: http://yanta.pair.com/firebal/minicup/cata...php?order_id=43

Date Ordered: Saturday 08 February, 2003

 

Products

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

1 x Minicup 1-digit Basic 2-color Lettering Package (MINI-1B2) = $56.00

Color: White Secondary Color: Pastel Orange Number (1-digit): TEXT Driver's Name: TEXT Effect (2-color): Drop Shadow Left Font: Arbitrary Bold

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

Sub-Total: $56.00

Tax: $0.00

Standard Shipping (USPS) (FREE!): $0.00

Total: $56.00

 

Delivery Address

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

 

 

,

 

 

 

Billing Address

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

 

 

,

 

 

 

Payment Method

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

PayPal IPN

 

 

 

Fireball Race Graphics

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

Order Number: 38

Detailed Invoice: http://yanta.pair.com/firebal/minicup/cata...php?order_id=38

Date Ordered: Friday 07 February, 2003

 

Products

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

1 x Minicup 2-digit Deluxe 2-color Lettering Package (MINI-2D2) = $118.00

Font: Arbitrary Bold

Color: White

Secondary Color: White

Number (2-digit): 22

Driver's Name: Tony Hana

Pit Crew Name 1: Some Dude

Pit Crew Name 2: Dude

Pit Crew Name 3: Wheres

Pit Crew Name 4: My Car

Sponsor Logo: Blorf

Effect (2-color): Drop Shadow Right

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

Sub-Total: $118.00

Tax: $0.00

Standard Shipping (USPS) (FREE!): $0.00

Total: $118.00

 

Delivery Address

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

Sandra Short

1 Main Street

Boston, Massachusetts 02115

United States

 

 

Billing Address

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

Sandra Short

1 Main Street

Boston, Massachusetts 02115

United States

 

 

Payment Method

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

Check/Money Order

 

Make Payable To:

 

Fireball Race Graphics

155-M New Boston Street, Suite 130

Woburn, MA 01801

781-932-7888

 

Your order will not ship until we receive payment.

Link to comment
Share on other sites

  • 2 months later...

Hello,

 

I had the same problem with 'TEXT' showing up instead of the actual textbox attributes. The problem is that the file catalog/checkout_paypalipn.php is not compatible with Chandra's contribution. However, that is simple to correct. There are two changes made by Chandra's contribution to the catalog/checkout_process.php file. If you make those same 2 changes to the checkout_paypalipn.php file it will work.

 

If you need any assistance making those changes let me know.

 

Eric Stamper

Link to comment
Share on other sites

To clarify: My previous post was only in response to the the comment:

My bigger problem is that the textbox option information that gets sent in the Order Process email is also incorrect. Instead of saying the text value it says the word "TEXT". And the text value does not get sent to the database. Instead they just say the word "TEXT".

 

The information I posted is in regards to correcting that issue.

 

The issue of the missing addresses is not related to Chandra's contribution. I have seen some other forum posts regarding that issue, but I have not seen that it has been resolved. I will let you know if I come across a resolution for that issue.

 

Eric Stamper

Link to comment
Share on other sites

I hope someone figures it out. Even OSC team members have highly recommended IPN mod because of security holes in the regular PayPal module. Yet the IPN contribution has this bug and no one is trying to fix it. :?

 

With that said, it's working fine for me with Canadian Addresses. As soon as I tried a US address, I got the missing address bug as you see above. Possibly there is a connection?

Link to comment
Share on other sites

Grinch,

 

I just worked on it for a little while and I got it to work for me by changing two lines of code. I must go to bed now but I will test it some more in the morning and if all seems well I will post the changes. It does have to do with exactly what you mentioned, the address ID.

 

Eric Stamper

Link to comment
Share on other sites

After much toil, I believe I have found a solution for the PayPal IPN not sending the billing and shipping addresses on the confirmation email. It requires changes to several files. I will list the changes in a step by step order that will hopefully be easy to follow:

 

I recommend making a backup of your files before you make the changes. The changes will be made to these 4 files:

 

catalog/paypal_notify.php

catalog/includes/classes/order.php

catalog/checkout_process.php

catalog/checkout_paypalipn.php

 

Also a small change is made to the database

 

Here are the changes:

 

 

1. Changes to catalog/paypal_notify.php

 

A. Find this code (around line 242):

 

if ($order->content_type != 'virtual') {

 

and add this code directly below that line:

 

$shipping_query = tep_db_query("select address_book_id_bill, address_book_id_ship from " . TABLE_ORDERS . " where orders_id = '" . $item_number . "'");

   $ship_data = tep_db_fetch_array($shipping_query);

 

 

B. Find this line of code (around line 245):

 

tep_address_label($order->customer['id'], $order->delivery['format_id'], 0, '', "n");

 

and replace it with this code:

 

tep_address_label($order->customer['id'], $ship_data['address_book_id_ship'], 0, '', "n");

 

 

C. Find this code (around line 250):

 

tep_address_label($order->customer['id'], $order->billing['format_id'], 0, '', "n") . "n";

 

and replace it with this code:

 

tep_address_label($order->customer['id'], $ship_data['address_book_id_bill'], 0, '', "n") . "n";

 

 

 

2. Changes to catalog/includes/classes/order.php

 

A. Find this line of code (around line 14):

 

var $info, $totals, $products, $customer, $delivery, $content_type;

 

and change it to:

 

var $info, $totals, $products, $customer, $delivery, $content_type, $shipping_data;

 

B. Find this line of code (around line 20)

 

$this->delivery = array();

 

and add this line directly below it:

 

$this->shipping_data = array();

 

C. Find this line of code (around line 210):

 

 'format_id' => $billing_address['address_format_id']);

 

and add this code directly below it:

 

 

$this->shipping_data = array('billto' => $billing_address['address_book_id'],

            'shipto' => $shipping_address['address_book_id']);

 

 

3. Changes to catalog/checkout_process.php

 

Find this code (around line 97):

 

'currency_value' => $order->info['currency_value']);

 

Change the ending braket of that line and add two lines directly after this code, thus changing it to:

 

'currency_value' => $order->info['currency_value'],

 'address_book_id_bill' => $order->shipping_data['billto'],

 'address_book_id_ship' => $order->shipping_data['shipto']);

 

4. Changes to catalog/checkout_paypalipn.php (the same as step # 3)

 

Find this code (around line 97):

 

 'currency_value' => $order->info['currency_value']);

 

Change the ending braket of that line and add two lines directly after this code, thus changing it to:

 

 

'currency_value' => $order->info['currency_value'],

 'address_book_id_bill' => $order->shipping_data['billto'],

 'address_book_id_ship' => $order->shipping_data['shipto']);

 

5. Add two fields to the orders table in your database as follows:

 

ALTER TABLE orders

     ADD address_book_id_ship INT( 11 ) NOT NULL ,

     ADD address_book_id_bill INT( 11 ) NOT NULL;

 

Please try this code out and test it. I have tested it doing various orders through PayPal IPN using the Test Mode. If anybody can test it in live mode that would be great also.

 

If you find any issues or need any further assistance let me know and I will see what I can do.

 

Eric Stamper

Link to comment
Share on other sites

Eric,

I'm using paypal_notify.php,v 0.97 2003-05-02

 

I can't find

if ($order->content_type != 'virtual') {

in catalog/paypal_notify.php

 

This is the block of code around line 242

 

if (is_object($$payment)) {

         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "n" . 

                         EMAIL_SEPARATOR . "n";

         $payment_class = $$payment;

         $email_order .= $payment_class->title . "nn";

         if ($payment_class->email_footer) { 

           $email_order .= $payment_class->email_footer . "nn";

         }

       }



       tep_mail($order->customer['name'],$order->customer['email_address'], EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');



       tep_db_query("delete from " .TABLE_CUSTOMERS_BASKET. " where customers_id=".$order->customer['id']);

       tep_db_query("delete from " .TABLE_CUSTOMERS_BASKET_ATTRIBUTES. " where customers_id=".$order->customer['id']);

:?: :?: :?:

Link to comment
Share on other sites

Deskdirect,

 

I am sorry I did not mention this before. The changes I made are changes to the PayPal IPN v0.971 for Milestone 1.

 

I have not looked at the code in the older versions in much detail, but it has several differences, such as the one you pointed out. Unfortunately, this means my changes will not work on the older versions, as is.

 

If someone is willing to test some changes on the earlier versions, I would be willing to suggest some changes. It is possible that not many changes would be needed. I, however, have no way of testing the older versions since I am not using them.

 

Eric Stamper

Link to comment
Share on other sites

:? nope, did not work. Also, look like it added another order that I placed sometime earlier into the picture. Here is what I received for the "order confirmation" email.

 

Products

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

1 x Candle in bamboo decorated with rubber leaf (30161411) = $8.95 (old order)

1 x Frangipani flower shape candle (20014013) = $0.01

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

Sub-Total: $8.95 (old order)

Sub-Total: $0.01

United States Postal Service (Priority Mail): $3.85 (old order)

Flat Rate (Best Way): $0.00

GA TAX 6.0%: $0.54 (old order)

GA TAX 6.0%: $0.00

Total: $13.34 (old order)

Total: $0.01

 

Delivery Address

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

 

 

,

 

 

Billing Address

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

 

 

,

 

 

Payment Method

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

PayPal IPN

 

The strange thing is, paypal received the correct total of ($0.01). But in my catalog/admin/orders, it shows the total of both items. I'm stuck!!!

Any ideas??? Any help is appreciated. Thanks again Eric.

 

-Linh

Link to comment
Share on other sites

As way of an update, I am using an April 20, 2003 CVS snapshot and the PayPal IPN v0.971 for Milestone 1. The changes that were posted have now been tested under both the IPN Test Mode and the Live Mode with successful results.

 

Has anybody else tested this successfully?

 

Eric Stamper

Link to comment
Share on other sites

I noticed that the email send to the customer by paypal showed the company's name where "Item Title" suppose to be. The 'Item Title' should display the name of the item not the company's name.

 

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

Payment Details:

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

 

Total Amount: $0.01

Currency: U.S. Dollars

Transaction ID: xxxxxxxxxxxxxxxxxxxx

 

Quantity: 1

Item Title: "Company's name"

 

Item Number: 12

 

Anyone know if there is a fix or know how I can fix this? Thanks.

 

-Linh

Link to comment
Share on other sites

Here is an update regarding the fix for the missing billing and shipping addresses in the confirmation emails. Note: This fix is for the PayPal IPN v0.971 for Milestone 1 version.

 

Thanks to Linh for being so patient in testing this for me. Unfortunately, I mistakingly left off one of the steps to take in the instructions I posted before. With these additional instructions, it is now working for Linh as well.

 

The missing step should be step 2-D ( in the catalog/includes/classes/order.php file). The changes are as follows:

 

Around line 142 find this code:

 

$shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . $customer_id . "' and ab.address_book_id = '" . $sendto . "'");

 

 

and replace it with:

 

$shipping_address_query = tep_db_query("select ab.address_book_id, ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . $customer_id . "' and ab.address_book_id = '" . $sendto . "'");

 

 

Then, find this code around line 145:

 

$billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . $customer_id . "' and ab.address_book_id = '" . $billto . "'");  

 

 

and replace it with:

 

$billing_address_query = tep_db_query("select ab.address_book_id, ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . $customer_id . "' and ab.address_book_id = '" . $billto . "'");

 

 

 

That is it. Please make sure you make all of the changes in my previous post as well as the above listed changes and that should fix the missing addresses.

 

Let me know if you have any questions, and once again, sorry for the oversight.

 

Eric Stamper

Link to comment
Share on other sites

  • 4 months later...

hi eric

i have chandras attribute type contribution

and i was wondering if you know why i don't get any email when i use live paypal.

it works when i use the test but when i use paypal my cart don't empty and no email and it stays at paypal processing.

also when i made the changes i get this when i try to pay with paypal ipn.

 

 

1054 - Unknown column 'address_book_id_bill' in 'field list'

 

insert into orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value, address_book_id_bill, address_book_id_ship) values ('2', 'frank joe', 'first', '31 mkoiun', 'aaaaaa', 'nyc', '10021', 'Baden-W?rttemberg', 'Germany', '212254', '[email protected]', '5', 'frank joe', 'first', '31 mkoiun', 'aaaaaa', 'nyc', '10021', 'Baden-W?rttemberg', 'Germany', '5', 'frank ', 'first', '31 mkoiun', 'aaaaaa', 'nyc', '10021', 'Baden-W?rttemberg', 'Germany', '5', 'PayPal IPN', '', '', '', '', now(), '99999', 'USD', '1.00000000', '1', '1')

thx frank :huh:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...