Page 1 of 1

adding fields to shipping_address

Posted: Mon Jul 13, 2015 5:30 pm
by sandraolt
Hello,
I am working from a clean install of OpenCart 2.0.3.1 and the VQMod 2.5.1.6
Please help. I am having a problem finishing a vqmod that I am creating (my first time ever) to add 3 fields to the shipping address. (I did this successfully (hacking individual pages) in OC 1.5+ but we are upgrading our servers, and the office likes the new backend.)

I have these fields added to the order table (shipping_stelephone, shipping_semail, and shipping_plaintext), and to the address table (stelephone, semail, plaintext) in the database. I mostly succeeded in the catalog. - when making a purchase the fields appear, and react as expected. (I am still getting errors in catalog when reviewing orders).

I am now working on the admin section. I have the fields appearing in both the orders and the customer/address sections, but when I attempt to edit an order, I get this error message:

Code: Select all

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: shipping_stelephone in <b>/home/floridaschool/public_html/shoppingcart/system/modification/catalog/model/checkout/order.php</b> on line <b>58</b><b>Notice</b>: Undefined index: shipping_semail in <b>/home/floridaschool/public_html/shoppingcart/system/modification/catalog/model/checkout/order.php</b> on line <b>58</b><b>Notice</b>: Undefined index: shipping_plaintext in <b>/home/floridaschool/public_html/shoppingcart/system/modification/catalog/model/checkout/order.php</b> on line <b>58</b>{"success":"Success: You have modified orders!"}
and if I check the database after trying to edit the order I discover that the 3 fields are now empty.

This is the reported area of the model that is being modified by this vqmod operation:

Code: Select all

		  <operation error="log">
	 
      
      <search position="replace"><![CDATA[ shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', ]]></search>
 

      <add><![CDATA[ shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_stelephone = '" . $this->db->escape($data['shipping_stelephone']) . "',shipping_semail = '" . $this->db->escape($data['shipping_semail']) . "',shipping_plaintext = '" . $this->db->escape($data['shipping_plaintext']) . "', 
	]]></add>
    </operation>
If I change that code i start getting errors when I place an order. I am attaching my vqmod files (one for catalog one for admin). Please help me find the problem. The controller files for this version of Open Cart are very different from the earlier version and I wonder if I am missing something there.

Sandra King.

Re: adding fields to shipping_address

Posted: Tue Jul 14, 2015 12:27 am
by sandraolt
Hello,
I am posting my partial solution... I created a vqmod file for the api language and controller files...

I can now edit the order in the admin section.

I still get errors when I try to view the order as a student (I had modified the view to try to show the 3 new fields in the shipping address, and I still get an error when I try to edit a customer address tab.

Warning: Please check the form carefully for errors!

Code: Select all

Notice: Undefined index: stelephone in /home/floridaschool/public_html/shoppingcart/system/modification/admin/controller/sale/customer.php on line 1027Notice: Undefined index: semail in /home/floridaschool/public_html/shoppingcart/system/modification/admin/controller/sale/customer.php on line 1030Notice: Undefined index: semail in /home/floridaschool/public_html/shoppingcart/system/modification/admin/controller/sale/customer.php on line 1030Notice: Undefined index: plaintext in /home/floridaschool/public_html/shoppingcart/system/modification/admin/controller/sale/customer.php on line 1033
I know there is probably a simple solution that I am missing, but I will keep working on it until I figure it out. Any help would be appreciated.