Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Commit

Permalink
added opencart3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ikenfin committed May 27, 2019
1 parent 492d0d0 commit bb5d6c1
Show file tree
Hide file tree
Showing 5 changed files with 425 additions and 14 deletions.
10 changes: 8 additions & 2 deletions pack.sh
@@ -1,6 +1,12 @@
#!/bin/bash
out=foc_carousel.ocmod.zip
out=foc_carousel_oc3.ocmod.zip
out2=foc_carousel_oc2.ocmod.zip
if [[ -f "$out" ]]; then
rm $out
fi
zip -r9 --exclude=*.git* --exclude=*.DS_Store* $out ./upload ./install.xml
if [[ -f "$out2" ]]; then
rm $out2
fi

zip -r9 --exclude=*.git* --exclude=*.DS_Store* --exclude=*.tpl $out ./upload ./install.xml
zip -r9 --exclude=*.git* --exclude=*.DS_Store* --exclude=*.twig $out2 ./upload ./install.xml
32 changes: 22 additions & 10 deletions upload/admin/controller/extension/module/foc_carousel.php
Expand Up @@ -32,7 +32,16 @@ private function createUrl ($url) {
public function index () {
$this->load->language('extension/module/foc_carousel');
$this->load->model('localisation/language');
$this->load->model('extension/module');

if ($this->isOpencart3()) {
$this->load->model('setting/module');
$moduleModel = $this->model_setting_module;
}
else {
$this->load->model('extension/module');
$moduleModel = $this->model_extension_module;
}

$this->load->model('tool/image');

$this->document->addStyle('view/javascript/jquery/jquery-ui/jquery-ui.min.css');
Expand All @@ -51,24 +60,29 @@ public function index () {
$post['foc_carousel'] = $carousel;

if (!isset($this->request->get['module_id'])) {
$this->model_extension_module->addModule('foc_carousel', $post);
$moduleModel->addModule('foc_carousel', $post);
} else {
$this->model_extension_module->editModule($this->request->get['module_id'], $post);
$moduleModel->editModule($this->request->get['module_id'], $post);
}

$this->session->data['success'] = $this->language->get('text_success');

$this->response->redirect($this->url->link('extension/extension', 'token=' . $this->session->data['token'] . '&type=module', true));
if ($this->isOpencart3()) {
$this->response->redirect($this->url->link('marketplace/extension', $this->getTokenParam() . '&type=module', true));
}
else {
$this->response->redirect($this->url->link('extension/extension', $this->getTokenParam() . '&type=module', true));
}
}

if (!isset($this->request->get['module_id'])) {
$data['action'] = $this->url->link('extension/module/carousel', 'token=' . $this->session->data['token'], true);
$data['action'] = $this->url->link('extension/module/foc_carousel', $this->getTokenParam(), true);
} else {
$data['action'] = $this->url->link('extension/module/carousel', 'token=' . $this->session->data['token'] . '&module_id=' . $this->request->get['module_id'], true);
$data['action'] = $this->url->link('extension/module/foc_carousel', $this->getTokenParam() . '&module_id=' . $this->request->get['module_id'], true);
}

if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
$module_info = $this->model_extension_module->getModule($this->request->get['module_id']);
$module_info = $moduleModel->getModule($this->request->get['module_id']);
}

if (isset($this->request->post['name'])) {
Expand Down Expand Up @@ -147,8 +161,6 @@ public function index () {
}
}



$data['heading_title'] = $this->language->get('heading_title');
$data['breadcrumbs'] = $this->breadcrumbs();
$data['header'] = $this->load->controller('common/header');
Expand Down Expand Up @@ -198,7 +210,7 @@ private function breadcrumbs () {
);
$breadcrumbs[] = array(
'text' => $this->language->get('text_extension'),
'href' => $this->createUrl('extension/extension'),
'href' => $this->isOpencart3() ? $this->createUrl('marketplace/extension') : $this->createUrl('extension/extension'),
'separator' => ' :: '
);
$breadcrumbs[] = array(
Expand Down

0 comments on commit bb5d6c1

Please sign in to comment.