Page 1 of 1
Add product - failed error (not a ProInvoice module issue!)
Posted: Mon Jan 31, 2011 8:12 am
by kurieuo
Hi,
Tried search forums but can't find the following, which means I'm guessing it is a unique issue to me.
When trying to add an item to an order (pre-generated invoice) from within the administration, a JavaScript "failed" error appears (see screenshot below).
Running latest version (1.4.9.3) with two modules (ProInvoice & Multiple Payment Fee). Code also minor custom edited but no javascript and can't think of anything that would affect this area of the system.
Any one else have this issue, or know where I should look to fix?
Many thanks!
2011-01-31_1002.png (31.54 KiB) Viewed 4206 times
Re: Add product - failed error
Posted: Tue Feb 01, 2011 7:11 pm
by jefrey1983
have you tried using other browser?
Re: Add product - failed error
Posted: Wed Feb 02, 2011 8:50 am
by kurieuo
Just updating that this is not a bug with OpenCart, but rather an incompatibility with ProInvoice module.
Changes were made to /admin/controller/sale/order.php in v1.4.9.2/3 which causes the "Failed" error to appear when adding or removing products, if the ProInvoice module is installed.
Hopefully the developers of ProInvoice will release a patch soon. Otherwise, I'm wondering whether it is safe to copy the order.php file from v1.4.9.1 over v1.4.9.3?
Re: Add product - failed error
Posted: Wed Feb 02, 2011 10:49 am
by brrodes
I am also getting the 'Failed' message when deleting products and I do not have the ProInvoice module installed.
Re: Add product - failed error
Posted: Wed Feb 02, 2011 2:48 pm
by i2Paq
kurieuo wrote:Hopefully the developers of ProInvoice will release a patch soon.
What extension exactly and did you contact the developers?
Re: Add product - failed error (not a ProInvoice module issu
Posted: Thu Feb 03, 2011 11:09 am
by kurieuo
Given brrodes post, I did further testing.
I must apologise to ProInvoice developers for my initial conclusion. This is infact an OpenCart v1.4.9.3 issue. Some lines were commented out which I guess affect the addition of products.
The reason I thought it was ProInvoice is because I have merged the v1.4.9.2/3 order.php code with ProInvoice. Given noone else seemed to be experiencing this issue, I hastily concluded it was a ProInvoice extension issue.
When I copy the order.php from the original v1.4.9.3 over, the issue happens. So will need log a bug report.
Thanks to all who the replied.
Re: Add product - failed error (not a ProInvoice module issu
Posted: Sun Feb 06, 2011 3:44 am
by rip_pit
Hi i got the same JS error "failed" when adding/removing products when editing an order.
I'm using v1.9.4.3 r142 updated to latest revision (r142) found on
google code hosting
I investigate a little, i found that ajax calls when adding product produce PHP notices that could break the process.
ajax call :
domain.com/manage/index.php?route=sale/order/removeProduct&token=xxx&order_id=92&order_product_id=113
Responses start with :
Code: Select all
<b>Notice</b>: Undefined index: value in <b>xxx\upload\manage\model\sale\order.php</b> on line <b>85</b>...
I might be wrong. Let me know if you can confirm or find something new.
You can monitor ajax request/response using firefox + firebug
PS: this is not my main account on this forum, i had to create a new one at home
EDIT:
After i disabled the "Show errors" setting in the "system > parameters > server" tab the problem seems to be gone
can you confirm ?
Re: Add product - failed error (not a ProInvoice module issu
Posted: Tue Mar 01, 2011 10:26 pm
by kurieuo
No, disabling errors doesn't make the issue go away. But yes, it is obviously a javascript error.
Thanks for the thought.
Re: Add product - failed error (not a ProInvoice module issu
Posted: Tue Mar 08, 2011 9:48 pm
by kornovec
Same problem here

Have a clean install, no mods, no extensions. FAILED window appears when i try add or remove product in administration.
Tried in FF, MSIE, GCH...
Any ideas how to fix it???
Thanks,
K.
Re: Add product - failed error (not a ProInvoice module issu
Posted: Wed Mar 09, 2011 12:26 am
by rip_pit
ok, i started over with a fresh intall 1943 eng.
here's the error that appears in the ajax call, that can cause the "failed" error message, also visible from error log tab :
Code: Select all
- PHP Notice: Undefined index: description in D:\weblocal\www\Tests\e-commerce\opencart_v1.4.9.3_eng\upload\admin\model\sale\order.php on line 69
but it works fine simply after i disable the "Show errors" setting in the "system > parameters > server" tab.
@kornovec : try it and let us know
Re: Add product - failed error (not a ProInvoice module issu
Posted: Wed Mar 09, 2011 12:36 am
by kornovec
@rip_pit: Youre the man!!!
Thank you!
K.
Re: Add product - failed error (not a ProInvoice module issu
Posted: Wed Mar 09, 2011 5:55 am
by rip_pit
kornovec wrote:@rip_pit: Youre the man!!!
Thank you!
K.
ahah! i love when you talk like that !

You're welcome

Re: Add product - failed error (not a ProInvoice module issu
Posted: Thu Mar 24, 2011 2:54 am
by locktar
hi,
i disable the show errors but ... a empty field still shows after i add the products
how can i fix that?
Re: Add product - failed error (not a ProInvoice module issu
Posted: Mon Apr 11, 2011 7:47 am
by kurieuo
rip_pit wrote:kornovec wrote:@rip_pit: Youre the man!!!
Thank you!
K.
ahah! i love when you talk like that !

You're welcome

Hmm. My bad it seems.
I swear I turned off the right setting, but maybe I accidentally did error logging instead. Whatever the case, turn off the errors it now seems to work.
Thanks!
Re: Add product - failed error (not a ProInvoice module issu
Posted: Mon Mar 25, 2013 6:00 am
by frymi
In files "admin/controller/sale/order.php"
commented this code:
Code: Select all
// TU START
$query = $this->db->query("SELECT order_total_id, value FROM " . DB_PREFIX . "order_total WHERE sort_order = '" . (int)$data['tax']['sort_order'] . "' AND order_id = '" . (int)$order_id . "' LIMIT 1");
$tax_value = $query->row;
if($tax_value) {
$new_value = $tax_value['value'] + ($data['tax']['rate'] / 100) * $data['price'] * $data['quantity'];
$this->db->query("UPDATE " . DB_PREFIX . "order_total SET text = '" . $this->db->escape($this->currency->format($new_value, $data['currency'], $data['currency_value'], true)) . "', value = '" . (float)$this->currency->format($new_value, $data['currency'], $data['currency_value'], false) . "' WHERE order_total_id = '" . $tax_value['order_total_id'] . "'");
} else {
$new_value = ($data['tax']['rate'] / 100) * $data['price'] * $data['quantity'];
$this->db->query("INSERT INTO " . DB_PREFIX . "order_total (order_id, title, text, value, sort_order) VALUES ('" . (int)$order_id . "', '" . $this->db->escape($data['tax']['description'] . ':') . "', '" . $this->db->escape($this->currency->format($new_value, $data['currency'], $data['currency_value'], true)) . "', '" . (float)$this->currency->format($new_value, $data['currency'], $data['currency_value'], false) . "', '" . (int)$data['tax']['sort_order'] . "')");
}
// TU END
Re: Add product - failed error (not a ProInvoice module issu
Posted: Tue Dec 09, 2014 4:55 am
by inzula
I have version 1.5.6
Same problem as Kurieuo.
Listing log:
2014-12-08 21:23:54 - PHP Warning: Missing argument 4 for Cart::add(), called in /home/...../www/catalog/controller/checkout/manual.php on line 74 and defined in /home/...../www/system/library/cart.php on line 318
2014-12-08 21:23:54 - PHP Notice: Undefined variable: profile_id in /home/...../www/system/library/cart.php on line 327
2014-12-08 21:23:54 - PHP Warning: Missing argument 4 for Cart::add(), called in /home/...../www/catalog/controller/checkout/manual.php on line 104 and defined in /home/...../www/system/library/cart.php on line 318
2014-12-08 21:23:54 - PHP Notice: Undefined variable: profile_id in /home/...../www/system/library/cart.php on line 327
I added the missing 4th parameter to the function add ()
in the file:
catalog/controller/checkout/manual.php
at line 74 and 104
And now it works:-)
Code before:
Code: Select all
$this->cart->add($order_product['product_id'], $order_product['quantity'], $option_data);
$this->cart->add($this->request->post['product_id'], $quantity, $option);
Code after:
Code: Select all
$this->cart->add($order_product['product_id'], $order_product['quantity'], $option_data, '');
$this->cart->add($this->request->post['product_id'], $quantity, $option, '');