1b.app
Link copied -

Integration with opencart 3+ does not work

Answers:

The developers of Opencart 3+ made a mistake in the API, because of this it does not work correctly.
To fix:
1) go to the file /catalog/controller/startup/session.php and look for the line
$this->db->query("DELETE FROM `" . DB_PREFIX . "api_session` WHERE TIMESTAMPADD(HOUR, 1, date_modified) < NOW()");
and before this line add:
if (!isset($this->request->get['api_token'])) { $this->request->get['api_token'] = ”; }
2. go to the catalog/model/account/api.php file and look for the line:
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "api` WHERE `username` = '" . $this->db->escape($username) . "' `key` = '" . $this->db->escape($key) . "' AND status = '1'");
this line also has an omitted AND error. Below I have indicated the correct line, just replace it with:
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "api` WHERE `username` = '" . $this->db->escape($username) . "' AND `key ` = '" . $this->db->escape($key) . "' AND status = '1'");
3. The last step and you can proceed. We go to the file /catalog/controller/api/login.php and look for the line there:
$session = new Session($config->get('session_engine'), $registry);
And here the developers are a bit confused. the correct syntax is:
$session = new Session($this->config->get('session_engine'), $this->registry);
That's all.
05.01.2021, 13:39
Original comment available on version: ru

Копылов Виталий Витальевич
Интернет Магазин openshop.ua
made according to this instruction https://evilcoder.ru/oshibki-v-opencart-api-ili-skaz-o-tom-pochemu-nuzhno-testir...
But the goods never shipped.
There was an error like this in the log
[2021-01-05 19:48:04]
point: /var/www/erpopenshopua/web1/web/cron/cron-minute.php
data: Array
(
[url] => https://new.openshop.ua/index.php?route=api/oneboxsync/getOrderValue/&token=...
[responce] => <b>Notice</b>: Undefined index: username in <b>/var/www/openshop/data/www/new.openshop.ua/catalog/controller/api/oneboxsync.php</ b> on line <b>15</b><b>Notice</b>: Undefined index: password in <b>/var/www/openshop/data/www/new.openshop.ua/catalog/controller/ api/oneboxsync.php</b> on line <b>15</b><b>Notice</b>: Undefined index: api_id in <b>/var/www/openshop/data/www/new.openshop .ua/catalog/controller/api/oneboxsync.php</b> on line <b>18</b>{"error":"error_permission"}
)
Removed here https://prnt.sc/wgx99h
API started, orders are imported https://erp.openshop.ua/admin/customorder/order/7006/edit/
But the products are not unloaded, only categories
05.01.2021, 20:43
Original comment available on version: ru

Please join the conversation. If you have something to say - please write a comment. You will need a mobile phone and an SMS code for identification to enter. Log in and comment