mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-25 14:46:06 +03:00
commit
d54e5e8c19
@ -1,3 +1,6 @@
|
|||||||
|
## v.3.1.6
|
||||||
|
* Исправлено получение событий из БД для OC 3.0
|
||||||
|
|
||||||
## v.3.1.5
|
## v.3.1.5
|
||||||
* Исправление ошибок
|
* Исправление ошибок
|
||||||
|
|
||||||
|
@ -860,11 +860,16 @@ class ControllerExtensionModuleRetailcrm extends Controller
|
|||||||
*/
|
*/
|
||||||
private function checkEvents()
|
private function checkEvents()
|
||||||
{
|
{
|
||||||
$events = $this->{'model_' . $this->modelEvent}->getEvent(
|
if (version_compare(VERSION, '3.0', '<')) {
|
||||||
$this->moduleTitle,
|
$events = $this->{'model_' . $this->modelEvent}->getEvent(
|
||||||
'catalog/model/checkout/order/addOrder/after',
|
$this->moduleTitle,
|
||||||
'extension/module/retailcrm/order_create'
|
'catalog/model/checkout/order/addOrder/after',
|
||||||
);
|
'extension/module/retailcrm/order_create'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->load->model('extension/retailcrm/event');
|
||||||
|
$events = $this->model_extension_retailcrm_event->getEventByCode($this->moduleTitle);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($events)) {
|
if (!empty($events)) {
|
||||||
return true;
|
return true;
|
||||||
|
8
src/upload/admin/model/extension/retailcrm/event.php
Normal file
8
src/upload/admin/model/extension/retailcrm/event.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class ModelExtensionRetailcrmEvent extends Model{
|
||||||
|
public function getEventByCode($code) {
|
||||||
|
$query = $this->db->query("SELECT DISTINCT * FROM `" . DB_PREFIX . "event` WHERE `code` = '" . $this->db->escape($code) . "' LIMIT 1");
|
||||||
|
return $query->row;
|
||||||
|
}
|
||||||
|
}
|
25
tests/admin/ModelRetailcrmEventAdminTest.php
Normal file
25
tests/admin/ModelRetailcrmEventAdminTest.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class ModelRetailcrmEventAdminTest extends OpenCartTest
|
||||||
|
{
|
||||||
|
const CODE = 'test';
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$eventModel = $this->loadModel('extension/event');
|
||||||
|
$eventModel->addEvent(self::CODE, 'test', 'test');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetEvent()
|
||||||
|
{
|
||||||
|
$eventModel = $this->loadModel('extension/retailcrm/event');
|
||||||
|
$event = $eventModel->getEventByCode(self::CODE);
|
||||||
|
|
||||||
|
$this->assertNotEmpty($event);
|
||||||
|
$this->assertEquals(self::CODE, $event['code']);
|
||||||
|
$this->assertEquals('test', $event['trigger']);
|
||||||
|
$this->assertEquals('test', $event['action']);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user