Post by straightlight » Mon Jun 27, 2016 7:41 pm

My fixes instructions above are accurate. By adding the guest fix, simply make sure to include the } at the end.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by platypuspuzzles » Mon Jun 27, 2016 8:04 pm

Ah sorry, I didn't explain myself properly.

I trust your and value your corrections.

I mean, the errors coming up catalog/model/account... files include completely different coding at the lines listed, compared to the ones we have fixed.
ERROR MESSAGE :
<b>Notice</b>: Undefined index: company in <b>/home/.../catalog/model/account/address.php</b> on line <b>4</b>
<b>Notice</b>: Undefined index: address_2 in <b>/home/.../catalog/model/account/address.php</b> on line <b>4</b>[]
line 4 is below and I don't know how to code this to fix it

Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "address SET customer_id = '" . (int)$this->customer->getId() . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', company = '" . $this->db->escape($data['company']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', city = '" . $this->db->escape($data['city']) . "', zone_id = '" . (int)$data['zone_id'] . "', country_id = '" . (int)$data['country_id'] . "', custom_field = '" . $this->db->escape(isset($data['custom_field']) ? json_encode($data['custom_field']) : '') . "'");
Last edited by straightlight on Thu Aug 04, 2016 6:55 am, edited 1 time in total.
Reason: Added quote tags.

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 8:22 pm

There is nothing wrong with this code. The reason why you're receiving an error message is because the controller (where you already posted the fix on the previous page) was the one needing the fix. ;)

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by platypuspuzzles » Mon Jun 27, 2016 8:33 pm

Ah, I see!
Thanks so much

So, I've made the changes to the catalog/controller/checkout/guest_shipping.php and /guest.php

So to make the errors go away for this same error, when a customer goes through 'registration' or áccount', I just need to make the same changes in these corresponding catalog/controller/checkout/[insertfilename].php

Is that right?

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 8:36 pm

platypuspuzzles wrote:Ah, I see!
Thanks so much

So, I've made the changes to the catalog/controller/checkout/guest_shipping.php and /guest.php

So to make the errors go away for this same error, when a customer goes through 'registration' or áccount', I just need to make the same changes in these corresponding catalog/controller/checkout/[insertfilename].php

Is that right?
That type of questioning cannot be accurate but the best methodology is always to read the lines on what the error handler provides with the filename and the line number either from the browser or from the error logs.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by platypuspuzzles » Mon Jun 27, 2016 8:51 pm

Ok, I'm learning a lot here.

I've updated the guest.php and guest_shipping.php controller files, but don't know what controller files to edit to fix the following errors

Below are my only errors that remain, that are triggered when a customer checkouts out through registering an account or logging in with an account and creating a new address.
Undefined index: company in <b>/home/.../catalog/model/account/address.php</b> on line <b>4</b>
Undefined index: address_2 in <b>/home/.../catalog/model/account/address.php</b> on line <b>4</b>[]

Undefined index: fax in <b>/home/.../catalog/model/account/customer.php</b> on line <b>14</b>
Undefined index: company in <b>/home/.../catalog/model/account/customer.php</b> on line <b>18</b>
Undefined index: address_2 in <b>/home/.../catalog/model/account/customer.php</b> on line <b>18</b>[]

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 9:08 pm

It seems the controller files that handles those model files also contains undefined and mentioned indexes. Instead of going to the model files to fix them, simply go to the controller files and apply the same type of fix you did on the previous page.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by platypuspuzzles » Mon Jun 27, 2016 9:19 pm

That's what I assumed, however I can't find the controller files I need to edit as they are named differently to those listed in the model/account/customer and model/account/address file errors
Last edited by platypuspuzzles on Tue Jun 28, 2016 12:03 am, edited 1 time in total.

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 9:32 pm

Looks like you found an unanticipated requested post but a confirmed bug. Good catch !

In catalog/controller/checkout/payment_address.php file,

find:

Code: Select all

$address_id = $this->model_account_address->addAddress($this->request->post);
add above:

Code: Select all

if (empty($this->request->post['company'])) {
						$this->request->post['company'] = '';
					}
					
					if (empty($this->request->post['address_2'])) {
						$this->request->post['address_2'] = '';
					}
					
					if (empty($this->request->post['fax'])) {
						$this->request->post['fax'] = '';
					}
Note: The same needs to be applied to the shipping_address.php on the same folder.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by platypuspuzzles » Mon Jun 27, 2016 10:19 pm

Thanks so much for all your help with this!

I've made the changes to the catalog/controller/checkout/payment_address.php and shipping_address.php files but continue to get the following errors

**checkout - register new account**
<b>Notice</b>: Undefined index: fax in <b>/home/.../catalog/model/account/customer.php</b> on line <b>14</b>
<b>Notice</b>: Undefined index: company in <b>/home/.../catalog/model/account/customer.php</b> on line <b>18</b>
<b>Notice</b>: Undefined index: address_2 in <b>/home/.../catalog/model/account/customer.php</b> on line <b>18</b>[]

**checkout - log in to account - change of address**
<b>Notice</b>: Undefined variable: address_id in <b>/home/.../catalog/controller/checkout/payment_address.php</b> on line <b>170</b>[]
This is the code at 170

Code: Select all

$this->session->data['payment_address'] = $this->model_account_address->getAddress($address_id);
Last edited by straightlight on Thu Aug 04, 2016 6:57 am, edited 1 time in total.
Reason: Added quote tags.

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 10:47 pm

In your catalog/controller/checkout/register.php file,

find:

Code: Select all

$customer_id = $this->model_account_customer->addCustomer($this->request->post);
apply the same integration as my previous post right above; add the codes above this line this time.

As for this one:
**checkout - log in to account - change of address**

<b>Notice</b>: Undefined variable: address_id in <b>/home/.../catalog/controller/checkout/payment_address.php</b> on line <b>170</b>[]
This is the code at 170
What does your error log states regarding new added address that tries to get added on the database? A database error message would be needed on this one.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by platypuspuzzles » Mon Jun 27, 2016 11:10 pm

I dont know where to find the error log - nothing is listed in the admin/settings error log screen

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 11:21 pm

Let's troubleshoot this issue. In your catalog/controller/checkout/payment_address.php , shipping_address.php and register.php file,

add above each instances of:

Code: Select all

$address_id = $this->model_account_address->addAddress($this->request->post);
this code:

Code: Select all

$this->log->write(__FILE__ . ': ' . print_r($this->request->post));
Then, try the entire checkout action again. Then, go to your admin - > systems - > tools - > error log page and see if the last actions reveals one or all of those three PHP files in the logs from a few minutes from now.

If so, without full server path, please paste the results on your next reply.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by platypuspuzzles » Mon Jun 27, 2016 11:34 pm

O0 O0 O0 O0 HAPPY DANCE O0 O0 O0 O0

Thank you so much!!! The continued errors were because I didn't read your last guidance post properly and instead of adding the code ABOVE the line, I replaced it.

I've just tested all the different checkout options and they all work 100%

Thank you so much!

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 11:42 pm

Here we go, problem solved. :)

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by platypuspuzzles » Mon Jun 27, 2016 11:45 pm

For future reference or for anyone else who comes across these issues, I've attached the edited catalog/controller/checkout files that contain the appropriate changes

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by platypuspuzzles » Mon Jun 27, 2016 11:47 pm

files are for 2.2.0.0 upgrade changes for catalog/controller/checkout to fix JSON errors at checkout

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by platypuspuzzles » Mon Jun 27, 2016 11:48 pm

straightlight wrote:Here we go, problem solved. :)
Couldn't have done it without you. Thanks again.

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 11:58 pm

Take note that if extensions are involved to edit those files not to download and use those files but rather the follow the instructions for v2.2.0.0 to avoid altering installed contributions that may rely on those specific lines especially when multiple file changes are involved.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by gopani@gmail.com » Thu Jul 21, 2016 12:12 pm

Hi

I am getting same error "admin_controller_sale_order.php on line 2313"

Can somebody please help


Posts

Joined
Thu Jul 21, 2016 12:07 pm
Who is online

Users browsing this forum: No registered users and 195 guests