update .gitignore and add changes on modules cartsguru and mailjet + 2 png in theme
This commit is contained in:
parent
7d537c8080
commit
6eeb127e64
5
.gitignore
vendored
5
.gitignore
vendored
@ -102,7 +102,8 @@ modules/psblog/sitemap-blog.xml
|
||||
modules/privatesales/img/*
|
||||
themes/site/img/slider/*
|
||||
!modules/ant_export_privatesales_newsletter/mails/*
|
||||
|
||||
modules/__MACOSX/*
|
||||
adm.php
|
||||
|
||||
##PERSO
|
||||
test.php
|
||||
test.php
|
||||
|
12
modules/cartsguru/Readme.md
Normal file
12
modules/cartsguru/Readme.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Carts Guru
|
||||
|
||||
## About
|
||||
|
||||
The first targeted and automated follow-up solution for abandoned carts through phone and text message !
|
||||
|
||||
### Author
|
||||
LINKT IT
|
||||
|
||||
### Licence
|
||||
|
||||
Commercial license
|
347
modules/cartsguru/backward_compatibility/Context.php
Normal file
347
modules/cartsguru/backward_compatibility/Context.php
Normal file
@ -0,0 +1,347 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if ((bool)Configuration::get('PS_MOBILE_DEVICE'))
|
||||
require_once(_PS_MODULE_DIR_ . '/mobile_theme/Mobile_Detect.php');
|
||||
|
||||
// Retro 1.3, 'class_exists' cause problem with autoload...
|
||||
if (version_compare(_PS_VERSION_, '1.4', '<'))
|
||||
{
|
||||
// Not exist for 1.3
|
||||
class Shop extends ObjectModel
|
||||
{
|
||||
public $id = 1;
|
||||
public $id_shop_group = 1;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public static function getShops()
|
||||
{
|
||||
return array(
|
||||
array('id_shop' => 1, 'name' => 'Default shop')
|
||||
);
|
||||
}
|
||||
|
||||
public static function getCurrentShop()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
class Logger
|
||||
{
|
||||
public static function AddLog($message, $severity = 2)
|
||||
{
|
||||
$fp = fopen(dirname(__FILE__).'/../logs.txt', 'a+');
|
||||
fwrite($fp, '['.(int)$severity.'] '.Tools::safeOutput($message));
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Not exist for 1.3 and 1.4
|
||||
class Context
|
||||
{
|
||||
/**
|
||||
* @var Context
|
||||
*/
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* @var Cart
|
||||
*/
|
||||
public $cart;
|
||||
|
||||
/**
|
||||
* @var Customer
|
||||
*/
|
||||
public $customer;
|
||||
|
||||
/**
|
||||
* @var Cookie
|
||||
*/
|
||||
public $cookie;
|
||||
|
||||
/**
|
||||
* @var Link
|
||||
*/
|
||||
public $link;
|
||||
|
||||
/**
|
||||
* @var Country
|
||||
*/
|
||||
public $country;
|
||||
|
||||
/**
|
||||
* @var Employee
|
||||
*/
|
||||
public $employee;
|
||||
|
||||
/**
|
||||
* @var Controller
|
||||
*/
|
||||
public $controller;
|
||||
|
||||
/**
|
||||
* @var Language
|
||||
*/
|
||||
public $language;
|
||||
|
||||
/**
|
||||
* @var Currency
|
||||
*/
|
||||
public $currency;
|
||||
|
||||
/**
|
||||
* @var AdminTab
|
||||
*/
|
||||
public $tab;
|
||||
|
||||
/**
|
||||
* @var Shop
|
||||
*/
|
||||
public $shop;
|
||||
|
||||
/**
|
||||
* @var Smarty
|
||||
*/
|
||||
public $smarty;
|
||||
|
||||
/**
|
||||
* @ var Mobile Detect
|
||||
*/
|
||||
public $mobile_detect;
|
||||
|
||||
/**
|
||||
* @var boolean|string mobile device of the customer
|
||||
*/
|
||||
protected $mobile_device;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie, $cart, $smarty, $link;
|
||||
|
||||
$this->tab = null;
|
||||
|
||||
$this->cookie = $cookie;
|
||||
$this->cart = $cart;
|
||||
$this->smarty = $smarty;
|
||||
$this->link = $link;
|
||||
|
||||
$this->controller = new ControllerBackwardModule();
|
||||
if (is_object($cookie))
|
||||
{
|
||||
$this->currency = new Currency((int)$cookie->id_currency);
|
||||
$this->language = new Language((int)$cookie->id_lang);
|
||||
$this->country = new Country((int)$cookie->id_country);
|
||||
$this->customer = new CustomerBackwardModule((int)$cookie->id_customer);
|
||||
$this->employee = new Employee((int)$cookie->id_employee);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->currency = null;
|
||||
$this->language = null;
|
||||
$this->country = null;
|
||||
$this->customer = null;
|
||||
$this->employee = null;
|
||||
}
|
||||
|
||||
$this->shop = new ShopBackwardModule();
|
||||
|
||||
if ((bool)Configuration::get('PS_MOBILE_DEVICE'))
|
||||
$this->mobile_detect = new Mobile_Detect();
|
||||
}
|
||||
|
||||
public function getMobileDevice()
|
||||
{
|
||||
if (is_null($this->mobile_device))
|
||||
{
|
||||
$this->mobile_device = false;
|
||||
if ($this->checkMobileContext())
|
||||
{
|
||||
switch ((int)Configuration::get('PS_MOBILE_DEVICE'))
|
||||
{
|
||||
case 0: // Only for mobile device
|
||||
if ($this->mobile_detect->isMobile() && !$this->mobile_detect->isTablet())
|
||||
$this->mobile_device = true;
|
||||
break;
|
||||
case 1: // Only for touchpads
|
||||
if ($this->mobile_detect->isTablet() && !$this->mobile_detect->isMobile())
|
||||
$this->mobile_device = true;
|
||||
break;
|
||||
case 2: // For touchpad or mobile devices
|
||||
if ($this->mobile_detect->isMobile() || $this->mobile_detect->isTablet())
|
||||
$this->mobile_device = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->mobile_device;
|
||||
}
|
||||
|
||||
protected function checkMobileContext()
|
||||
{
|
||||
return isset($_SERVER['HTTP_USER_AGENT'])
|
||||
&& (bool)Configuration::get('PS_MOBILE_DEVICE')
|
||||
&& !Context::getContext()->cookie->no_mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a singleton context
|
||||
*
|
||||
* @return Context
|
||||
*/
|
||||
public static function getContext()
|
||||
{
|
||||
if (!isset(self::$instance))
|
||||
self::$instance = new Context();
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone current context
|
||||
*
|
||||
* @return Context
|
||||
*/
|
||||
public function cloneContext()
|
||||
{
|
||||
return clone $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int Shop context type (Shop::CONTEXT_ALL, etc.)
|
||||
*/
|
||||
public static function shop()
|
||||
{
|
||||
if (!self::$instance->shop->getContextType())
|
||||
return ShopBackwardModule::CONTEXT_ALL;
|
||||
return self::$instance->shop->getContextType();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Shop for Backward compatibility
|
||||
*/
|
||||
class ShopBackwardModule extends Shop
|
||||
{
|
||||
const CONTEXT_ALL = 1;
|
||||
|
||||
public $id = 1;
|
||||
public $id_shop_group = 1;
|
||||
|
||||
|
||||
public function getContextType()
|
||||
{
|
||||
return ShopBackwardModule::CONTEXT_ALL;
|
||||
}
|
||||
|
||||
// Simulate shop for 1.3 / 1.4
|
||||
public function getID()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get shop theme name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTheme()
|
||||
{
|
||||
return _THEME_NAME_;
|
||||
}
|
||||
|
||||
public function isFeatureActive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Controller for a Backward compatibility
|
||||
* Allow to use method declared in 1.5
|
||||
*/
|
||||
class ControllerBackwardModule
|
||||
{
|
||||
/**
|
||||
* @param $js_uri
|
||||
* @return void
|
||||
*/
|
||||
public function addJS($js_uri)
|
||||
{
|
||||
Tools::addJS($js_uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $css_uri
|
||||
* @param string $css_media_type
|
||||
* @return void
|
||||
*/
|
||||
public function addCSS($css_uri, $css_media_type = 'all')
|
||||
{
|
||||
Tools::addCSS($css_uri, $css_media_type);
|
||||
}
|
||||
|
||||
public function addJquery()
|
||||
{
|
||||
if (_PS_VERSION_ < '1.5')
|
||||
$this->addJS(_PS_JS_DIR_.'jquery/jquery-1.4.4.min.js');
|
||||
elseif (_PS_VERSION_ >= '1.5')
|
||||
$this->addJS(_PS_JS_DIR_.'jquery/jquery-1.7.2.min.js');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Customer for a Backward compatibility
|
||||
* Allow to use method declared in 1.5
|
||||
*/
|
||||
class CustomerBackwardModule extends Customer
|
||||
{
|
||||
public $logged = false;
|
||||
/**
|
||||
* Check customer informations and return customer validity
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @param boolean $with_guest
|
||||
* @return boolean customer validity
|
||||
*/
|
||||
public function isLogged($with_guest = false)
|
||||
{
|
||||
if (!$with_guest && $this->is_guest == 1)
|
||||
return false;
|
||||
|
||||
/* Customer is valid only if it can be load and if object password is the same as database one */
|
||||
if ($this->logged == 1 && $this->id && Validate::isUnsignedId($this->id) && Customer::checkPassword($this->id, $this->passwd))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
48
modules/cartsguru/backward_compatibility/Display.php
Normal file
48
modules/cartsguru/backward_compatibility/Display.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class allow to display tpl on the FO
|
||||
*/
|
||||
class BWDisplay extends FrontController
|
||||
{
|
||||
// Assign template, on 1.4 create it else assign for 1.5
|
||||
public function setTemplate($template)
|
||||
{
|
||||
if (_PS_VERSION_ >= '1.5')
|
||||
parent::setTemplate($template);
|
||||
else
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
// Overload displayContent for 1.4
|
||||
public function displayContent()
|
||||
{
|
||||
parent::displayContent();
|
||||
|
||||
echo Context::getContext()->smarty->fetch($this->template);
|
||||
}
|
||||
}
|
1
modules/cartsguru/backward_compatibility/backward.ini
Normal file
1
modules/cartsguru/backward_compatibility/backward.ini
Normal file
@ -0,0 +1 @@
|
||||
version = 0.4
|
55
modules/cartsguru/backward_compatibility/backward.php
Normal file
55
modules/cartsguru/backward_compatibility/backward.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Backward function compatibility
|
||||
* Need to be called for each module in 1.4
|
||||
*/
|
||||
|
||||
// Get out if the context is already defined
|
||||
if (!in_array('Context', get_declared_classes()))
|
||||
require_once(dirname(__FILE__).'/Context.php');
|
||||
|
||||
// Get out if the Display (BWDisplay to avoid any conflict)) is already defined
|
||||
if (!in_array('BWDisplay', get_declared_classes()))
|
||||
require_once(dirname(__FILE__).'/Display.php');
|
||||
|
||||
// If not under an object we don't have to set the context
|
||||
if (!isset($this))
|
||||
return;
|
||||
else if (isset($this->context))
|
||||
{
|
||||
// If we are under an 1.5 version and backoffice, we have to set some backward variable
|
||||
if (_PS_VERSION_ >= '1.5' && isset($this->context->employee->id) && $this->context->employee->id && isset(AdminController::$currentIndex) && !empty(AdminController::$currentIndex))
|
||||
{
|
||||
global $currentIndex;
|
||||
$currentIndex = AdminController::$currentIndex;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$this->context = Context::getContext();
|
||||
$this->smarty = $this->context->smarty;
|
27
modules/cartsguru/backward_compatibility/index.php
Normal file
27
modules/cartsguru/backward_compatibility/index.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.0.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.0.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
993
modules/cartsguru/cartsguru.php
Normal file
993
modules/cartsguru/cartsguru.php
Normal file
@ -0,0 +1,993 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.1 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
if (! defined('_PS_VERSION_')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
define('_CARTSGURU_API_URL_', 'https://api.carts.guru');
|
||||
define('_CARTSGURU_ONLY_GROUP_', null);
|
||||
define('_CARTSGURU_VERSION_', '1.1.1');
|
||||
require_once (_PS_ROOT_DIR_.'/modules/cartsguru/classes/RAPI.php');
|
||||
require_once (_PS_ROOT_DIR_.'/modules/cartsguru/classes/RAPIException.php');
|
||||
require_once (_PS_ROOT_DIR_.'/modules/cartsguru/classes/AbstractMapper.php');
|
||||
require_once (_PS_ROOT_DIR_.'/modules/cartsguru/classes/MapperFactory.php');
|
||||
require_once (_PS_ROOT_DIR_.'/modules/cartsguru/classes/AccountMapper.php');
|
||||
require_once (_PS_ROOT_DIR_.'/modules/cartsguru/classes/ProductMapper.php');
|
||||
require_once (_PS_ROOT_DIR_.'/modules/cartsguru/classes/CartMapper.php');
|
||||
require_once (_PS_ROOT_DIR_.'/modules/cartsguru/classes/OrderMapper.php');
|
||||
|
||||
class CartsGuru extends Module
|
||||
{
|
||||
|
||||
/**
|
||||
* use for setting & concatenate the smarty fetch for all part
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $html_return = '';
|
||||
/**
|
||||
* Indicate if the api is in debug or not
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $cg_debug = false;
|
||||
|
||||
/**
|
||||
* setting errors for all process
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $post_errors = array();
|
||||
/**
|
||||
* cache request
|
||||
* @var array
|
||||
*/
|
||||
public static $c_calls = array();
|
||||
|
||||
/**
|
||||
* base url use for admin setting
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $base_url;
|
||||
|
||||
public $max_execution_time = 7200;
|
||||
|
||||
/**
|
||||
*
|
||||
* @see Module __construct()
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'cartsguru';
|
||||
$this->tab = 'advertising_marketing';
|
||||
$this->version = '1.1.1';
|
||||
$this->author = 'LINKT IT';
|
||||
$this->module_key = 'f841e8edc4514a141082e10c797c7c57';
|
||||
$this->bootstrap = true;
|
||||
$this->img_url = __PS_BASE_URI__ . basename(_PS_MODULE_DIR_) . '/' . $this->name . '/views/img/';
|
||||
parent::__construct();
|
||||
$this->displayName = $this->l('Carts Guru');
|
||||
$this->description = $this->l('The first targeted and automated follow-up solution for abandoned carts through phone and text message !');
|
||||
if (! function_exists('curl_version')) {
|
||||
$this->warning = $this->l('cURL librairy is not available.');
|
||||
}
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
require(_PS_MODULE_DIR_.$this->name.'/backward_compatibility/backward.php');
|
||||
}
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
if (!(int)Configuration::get('CARTSG_API_SUCCESS')) {
|
||||
$this->warning = $this->l('The module is not configured');
|
||||
}
|
||||
} else {
|
||||
if ((! Shop::isFeatureActive() ||
|
||||
Shop::getContext() == Shop::CONTEXT_SHOP) &&
|
||||
!(int)Configuration::get('CARTSG_API_SUCCESS')
|
||||
) {
|
||||
$this->warning = $this->l('The module is not configured');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->cg_debug) {
|
||||
$this->logger = new FileLogger(0);
|
||||
$this->logger->setFilename(_PS_ROOT_DIR_.'/log/debug_cartguru_'.date('Ymd').'.log');
|
||||
}
|
||||
}
|
||||
|
||||
private function logDebug($message)
|
||||
{
|
||||
if ($this->cg_debug && $this->logger) {
|
||||
$this->logger->logDebug($message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Module installation
|
||||
*
|
||||
* @see Module->install
|
||||
* @param bool|true $delete_params
|
||||
* use for reinitialisation data
|
||||
* @return bool
|
||||
*/
|
||||
public function install($delete_params = true)
|
||||
{
|
||||
if ($delete_params) {
|
||||
if (! Configuration::updateValue('CARTSG_TOKEN', $this->generateCode('', 15)) ||
|
||||
! Configuration::updateValue('CARTSG_IMAGE_GENERATE', 0)) {
|
||||
return false;
|
||||
}
|
||||
$image_type = new ImageType();
|
||||
$image_type->name = 'cartsguru';
|
||||
$image_type->width = '120';
|
||||
$image_type->height = '120';
|
||||
$image_type->products = 1;
|
||||
$image_type->categories = 0;
|
||||
$image_type->manufacturers = 0;
|
||||
$image_type->suppliers = 0;
|
||||
$image_type->scenes = 0;
|
||||
$image_type->stores = 0;
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$image_type->store = 0;
|
||||
}
|
||||
$image_type->add();
|
||||
Configuration::updateValue('CARTSG_IMAGE_TYPE_ID', $image_type->id);
|
||||
}
|
||||
if (parent::install() == false) {
|
||||
return false;
|
||||
}
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
if (! $this->registerHook('newOrder') ||
|
||||
! $this->registerHook('postUpdateOrderStatus') ||
|
||||
! $this->registerHook('cart') ||
|
||||
! $this->registerHook('header') ||
|
||||
! $this->registerHook('createAccount')) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (! $this->registerHook('actionValidateOrder') ||
|
||||
! $this->registerHook('actionObjectOrderUpdateAfter') ||
|
||||
! $this->registerHook('actionCartSave') ||
|
||||
! $this->registerHook('actionCustomerAccountAdd') ||
|
||||
! $this->registerHook('actionObjectCustomerUpdateAfter') ||
|
||||
! $this->registerHook('actionObjectAddressAddAfter') ||
|
||||
! $this->registerHook('actionObjectAddressUpdateAfter')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall the module
|
||||
*
|
||||
* @see
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param bool|true $delete_params
|
||||
* is use for delete all data in db
|
||||
* @return bool
|
||||
*/
|
||||
public function uninstall($delete_params = true)
|
||||
{
|
||||
if (! parent::uninstall()) {
|
||||
return false;
|
||||
}
|
||||
if ($delete_params && (! Configuration::deleteByName('CARTSG_TOKEN') ||
|
||||
! Configuration::deleteByName('CARTSG_API_AUTH_KEY') ||
|
||||
! Configuration::deleteByName('CARTSG_SITE_ID') ||
|
||||
! Configuration::deleteByName('CARTSG_API_SUCCESS') ||
|
||||
! Configuration::deleteByName('CARTSG_IMAGE_GENERATE'))) {
|
||||
return false;
|
||||
} elseif ($delete_params) {
|
||||
$image_type = new ImageType((int)Configuration::get('CARTSG_IMAGE_TYPE_ID'));
|
||||
if (Validate::isLoadedObject($image_type)) {
|
||||
$this->deleteProductImageCG();
|
||||
$image_type->delete();
|
||||
}
|
||||
if (!Configuration::deleteByName('CARTSG_IMAGE_TYPE_ID')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* reset the module, no data is deleted
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
if (! $this->uninstall(false)) {
|
||||
return false;
|
||||
}
|
||||
if (! $this->install(false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
$this->_html = '';
|
||||
$this->postProcess();
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<') ||
|
||||
! Shop::isFeatureActive() ||
|
||||
Shop::getContext() == Shop::CONTEXT_SHOP) {
|
||||
$configs = $this->getConfigFieldsValues();
|
||||
if (! empty($configs['CARTSG_API_AUTH_KEY']) && ! empty($configs['CARTSG_SITE_ID'])) {
|
||||
$api = new CartGuruRAPI($configs['CARTSG_SITE_ID'], $configs['CARTSG_API_AUTH_KEY']);
|
||||
$result = $api->checkAccess();
|
||||
$access_cg = ($result ? ($result->info->http_code == 200) : false);
|
||||
if ($access_cg) {
|
||||
Configuration::updateValue('CARTSG_API_SUCCESS', 1);
|
||||
$this->_html .= $this->displayConfirmation($this->l('Success connexion..'));
|
||||
|
||||
$response = $result->decodeResponse();
|
||||
if ($response->isNew) {
|
||||
$this->importCarts($configs['CARTSG_SITE_ID']);
|
||||
$this->importOrders($configs['CARTSG_SITE_ID']);
|
||||
}
|
||||
|
||||
if (!(int)Configuration::get('CARTSG_IMAGE_GENERATE')) {
|
||||
$img_generated = $this->generateProductImageCG();
|
||||
if ($img_generated === true) {
|
||||
$this->_html .= $this->displayConfirmation($this->l('Image product for Cart Guru were successfully regenerated.'));
|
||||
Configuration::updateValue('CARTSG_IMAGE_GENERATE', 1);
|
||||
} elseif ($img_generated == 'timeout') {
|
||||
$this->_html .= $this->displayWarn(
|
||||
$this->l('Only part of the images have been regenerated. The server timed out before finishing.').
|
||||
$this->l('Use Image Generation form with option erase to false and click to the button generate.')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
Configuration::updateValue('CARTSG_API_SUCCESS', 0);
|
||||
$this->_html .= $this->displayWarn($this->l('Impossible to connect with this credential.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_html .= $this->renderConfigForm();
|
||||
|
||||
if ((int)Configuration::get('CARTSG_API_SUCCESS')) {
|
||||
if (version_compare(_PS_VERSION_, '1.6') < 0) {
|
||||
$this->_html .= '<br/>';
|
||||
}
|
||||
$this->_html .= $this->renderImageForm();
|
||||
}
|
||||
return $this->_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration update settings
|
||||
*/
|
||||
protected function postProcess()
|
||||
{
|
||||
$errorval = '';
|
||||
if (Tools::isSubmit('submitSettings')) {
|
||||
$api_auth_key = Tools::getValue('CARTSG_API_AUTH_KEY');
|
||||
if (empty($api_auth_key)) {
|
||||
$errorval .= $this->displayError(sprintf($this->l('Field \'%1$s\' is required'), $this->l('API auth key')));
|
||||
} else {
|
||||
Configuration::updateValue('CARTSG_API_AUTH_KEY', $api_auth_key);
|
||||
}
|
||||
$site_id = Tools::getValue('CARTSG_SITE_ID');
|
||||
if (empty($site_id)) {
|
||||
$errorval .= $this->displayError(sprintf($this->l('Field \'%1$s\' is required'), $this->l('Site Id')));
|
||||
} else {
|
||||
Configuration::updateValue('CARTSG_SITE_ID', $site_id);
|
||||
}
|
||||
if (! empty($errorval)) {
|
||||
$this->_html .= $errorval;
|
||||
} else {
|
||||
$this->_html .= $this->displayConfirmation($this->l('Settings updated'));
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('submitGenerateImage')) {
|
||||
$erase = (int)Tools::getValue('erase', 0);
|
||||
if ($erase) {
|
||||
$this->deleteProductImageCG();
|
||||
}
|
||||
$img_generated = $this->generateProductImageCG();
|
||||
if ($img_generated === true) {
|
||||
$this->_html .= $this->displayConfirmation($this->l('Image product for Cart Guru were successfully regenerated.'));
|
||||
Configuration::updateValue('CARTSG_IMAGE_GENERATE', 1);
|
||||
} elseif ($img_generated == 'timeout') {
|
||||
$this->_html .= $this->displayWarn(
|
||||
$this->l('Only part of the images have been regenerated. The server timed out before finishing.').'<br/>'.
|
||||
$this->l('To resume the operation, select no for "Erase previous images", and click "Generate".')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Generate configuration form
|
||||
*/
|
||||
public function renderConfigForm()
|
||||
{
|
||||
$conf_form_html = '';
|
||||
$can_configure = (version_compare(_PS_VERSION_, '1.5.0', '<') ||
|
||||
! Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP);
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'request_uri' => Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI'])
|
||||
)
|
||||
);
|
||||
$conf_form_html = $this->context->smarty->fetch(
|
||||
_PS_ROOT_DIR_.'/modules/cartsguru/views/templates/admin/cg_conf_form14.tpl'
|
||||
);
|
||||
} else {
|
||||
$fields_form = array();
|
||||
$fields_form[0]['form'] = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Carts Guru authentification'),
|
||||
'icon' => 'icon-user'
|
||||
)
|
||||
);
|
||||
if (! $can_configure) {
|
||||
$fields_form[0]['form']['description'] = $this->l('The multistore option is enabled. If you want configure the module, you must select store.');
|
||||
} else {
|
||||
$fields_form[0]['form']['input'] = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('API auth key'),
|
||||
'name' => 'CARTSG_API_AUTH_KEY',
|
||||
'hint' => $this->l('Provided by Carts Guru')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Site Id'),
|
||||
'name' => 'CARTSG_SITE_ID',
|
||||
'hint' => $this->l('Provided by Carts Guru')
|
||||
)
|
||||
);
|
||||
$fields_form[0]['form']['submit'] = array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'btn btn-default pull-right',
|
||||
'name' => 'submitSettings'
|
||||
);
|
||||
}
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->name;
|
||||
$lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->module = $this;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ?
|
||||
Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$helper->identifier = $this->identifier;
|
||||
//$helper->submit_action = 'submitSettings';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) .
|
||||
'&configure=' . $this->name . '&module_name=' . $this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
Tools::substr(Tools::encrypt('cartsguru/index'), 0, 10),
|
||||
'currencies' => Currency::getCurrencies(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
$conf_form_html = $helper->generateForm($fields_form);
|
||||
}
|
||||
return ($conf_form_html);
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function renderImageForm()
|
||||
{
|
||||
$img_form_html = '';
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'request_uri' => Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI'])
|
||||
)
|
||||
);
|
||||
$img_form_html = $this->context->smarty->fetch(
|
||||
_PS_ROOT_DIR_.'/modules/cartsguru/views/templates/admin/cg_img_form14.tpl'
|
||||
);
|
||||
} else {
|
||||
$fields_form = array();
|
||||
$fields_form[0]['form'] = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Product Image Generation for Carts Guru'),
|
||||
'icon' => 'icon-image'
|
||||
),
|
||||
'description' => $this->l('The operation is required only if you not see your product image in Carts Guru')
|
||||
);
|
||||
$fields_form[0]['form']['input'] = array(
|
||||
array(
|
||||
'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ?'radio' :'switch',
|
||||
'is_bool' => true, // retro compat 1.5
|
||||
'class' => 't',
|
||||
'label' => $this->l('Erase previous images'),
|
||||
'name' => 'erase',
|
||||
'hint' => $this->l('Select "No" if your server timed out and you need to resume the regeneration.'),
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'erase_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Yes')
|
||||
),
|
||||
array(
|
||||
'id' => 'erase_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('No')
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$fields_form[0]['form']['submit'] = array(
|
||||
'title' => $this->l('Generate'),
|
||||
'class' => 'btn btn-default pull-right',
|
||||
'name' => 'submitGenerateImage'
|
||||
);
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->name;
|
||||
$lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->module = $this;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ?
|
||||
Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$helper->identifier = $this->identifier;
|
||||
//$helper->submit_action = 'submitGenerateImage';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) .
|
||||
'&configure=' . $this->name . '&module_name=' . $this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
Tools::substr(Tools::encrypt('cartsguru/index'), 0, 10),
|
||||
'currencies' => Currency::getCurrencies(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
$img_form_html = $helper->generateForm($fields_form);
|
||||
}
|
||||
return $img_form_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all configuration
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'CARTSG_SITE_ID' => Tools::getValue('CARTSG_SITE_ID', Configuration::get('CARTSG_SITE_ID')),
|
||||
'erase' => 0,
|
||||
'CARTSG_API_AUTH_KEY' => Tools::getValue('CARTSG_API_AUTH_KEY', Configuration::get('CARTSG_API_AUTH_KEY'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* generate a uniq code for token
|
||||
*
|
||||
* @param string $prefix
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
public static function generateCode($prefix = '', $length = 8)
|
||||
{
|
||||
$code = '';
|
||||
$possible = '123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$maxlength = Tools::strlen($possible);
|
||||
if ($length > $maxlength) {
|
||||
$length = $maxlength;
|
||||
}
|
||||
$i = 0;
|
||||
while ($i < $length) {
|
||||
$char = Tools::substr($possible, mt_rand(0, $maxlength - 1), 1);
|
||||
if (! strstr($code, $char)) {
|
||||
$code .= $char;
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
return $prefix . $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used for 1.4
|
||||
* @param $params
|
||||
*/
|
||||
public function hookNewOrder($params)
|
||||
{
|
||||
return $this->hookActionValidateOrder($params);
|
||||
}
|
||||
/**
|
||||
* Only used for 1.4
|
||||
* @param $params
|
||||
*/
|
||||
public function hookPostUpdateOrderStatus($params)
|
||||
{
|
||||
if ((int)$params['id_order']) {
|
||||
$order = new Order((int)$params['id_order']);
|
||||
$params['object'] = $order;
|
||||
return $this->hookActionObjectOrderUpdateAfter($params);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* When order is validate, indicate it is the reminder permit
|
||||
* journal is close
|
||||
*
|
||||
* @param
|
||||
* $params
|
||||
*/
|
||||
public function hookActionValidateOrder($params)
|
||||
{
|
||||
$order = $params['order'];
|
||||
$params['object'] = $order;
|
||||
return $this->hookActionObjectOrderUpdateAfter($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order update
|
||||
*
|
||||
* @param array $params
|
||||
* @return boolean
|
||||
*/
|
||||
public function hookActionObjectOrderUpdateAfter($params)
|
||||
{
|
||||
$order = $params['object'];
|
||||
if (! Validate::isLoadedObject($order)) {
|
||||
return false;
|
||||
}
|
||||
if (isset($order) && (int) $order->id && (int) $order->id_customer) {
|
||||
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$this->callCG(
|
||||
CartGuruRAPI::API_PATH_ORDERS,
|
||||
'order',
|
||||
$order,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
$params
|
||||
);
|
||||
} else {
|
||||
$this->callCG(
|
||||
CartGuruRAPI::API_PATH_ORDERS,
|
||||
'order',
|
||||
$order,
|
||||
(int) $order->id_shop_group,
|
||||
(int) $order->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customer add address
|
||||
*
|
||||
* @param array $params
|
||||
* @return boolean
|
||||
*/
|
||||
public function hookActionObjectAddressAddAfter($params)
|
||||
{
|
||||
return $this->hookActionObjectAddressUpdateAfter($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Customer update address
|
||||
*
|
||||
* @param array $params
|
||||
* @return boolean
|
||||
*/
|
||||
public function hookActionObjectAddressUpdateAfter($params)
|
||||
{
|
||||
$address = $params['object'];
|
||||
if (! Validate::isLoadedObject($address)) {
|
||||
return false;
|
||||
}
|
||||
if (isset($address) && (int) $address->id) {
|
||||
if ((int) $address->id_customer) {
|
||||
$customer = new Customer((int) $address->id_customer);
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$this->callCG(
|
||||
CartGuruRAPI::API_PATH_ACCOUNTS,
|
||||
'customer',
|
||||
$customer
|
||||
);
|
||||
} else {
|
||||
$this->callCG(
|
||||
CartGuruRAPI::API_PATH_ACCOUNTS,
|
||||
'customer',
|
||||
$customer,
|
||||
(int) $customer->id_shop_group,
|
||||
(int) $customer->id_shop
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customer update information
|
||||
*
|
||||
* @param array $params
|
||||
* @return boolean
|
||||
*/
|
||||
public function hookActionObjectCustomerUpdateAfter($params)
|
||||
{
|
||||
$customer = $params['object'];
|
||||
if (! Validate::isLoadedObject($customer)) {
|
||||
return false;
|
||||
}
|
||||
if (isset($customer) && (int) $customer->id) {
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$this->callCG(
|
||||
CartGuruRAPI::API_PATH_ACCOUNTS,
|
||||
'customer',
|
||||
$customer
|
||||
);
|
||||
} else {
|
||||
$this->callCG(
|
||||
CartGuruRAPI::API_PATH_ACCOUNTS,
|
||||
'customer',
|
||||
$customer,
|
||||
(int) $customer->id_shop_group,
|
||||
(int) $customer->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* hookHeader only used for 1.4
|
||||
* @param $params
|
||||
* @return boolean
|
||||
*/
|
||||
public function hookHeader($params)
|
||||
{
|
||||
/* Test view controller*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used for 1.4
|
||||
* @param $params
|
||||
*/
|
||||
public function hookCreateAccount($params)
|
||||
{
|
||||
return ($this->hookActionCartSave($params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Successful create account
|
||||
*
|
||||
* @param array $params
|
||||
* @return boolean
|
||||
*/
|
||||
public function hookActionCustomerAccountAdd($params)
|
||||
{
|
||||
$new_customer = $params['newCustomer'];
|
||||
$params['object'] = $new_customer;
|
||||
return ($this->hookActionObjectCustomerUpdateAfter($params));
|
||||
}
|
||||
/**
|
||||
* Only used for Prestashop 1.4
|
||||
* @param $params
|
||||
* @return void|boolean
|
||||
*/
|
||||
public function hookCart($params)
|
||||
{
|
||||
if (!$params['cart']->id) {
|
||||
return;
|
||||
}
|
||||
return ($this->hookActionCartSave($params));
|
||||
}
|
||||
|
||||
/**
|
||||
* this hook is call many times update the cart
|
||||
* The module catch only cart have customer logged
|
||||
*/
|
||||
public function hookActionCartSave($params)
|
||||
{
|
||||
$cart = $params['cart'];
|
||||
if (! Validate::isLoadedObject($cart)) {
|
||||
return false;
|
||||
}
|
||||
if (isset($cart) && (int) $cart->id && (int) $cart->id_customer) {
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$this->callCG(
|
||||
CartGuruRAPI::API_PATH_CARTS,
|
||||
'cart',
|
||||
$cart
|
||||
);
|
||||
} else {
|
||||
$this->callCG(
|
||||
CartGuruRAPI::API_PATH_CARTS,
|
||||
'cart',
|
||||
$cart,
|
||||
(int) $cart->id_shop_group,
|
||||
(int) $cart->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map and send data to api
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $mapper_name
|
||||
* @param Object $object
|
||||
* @param int $id_shop_group
|
||||
* @param int $id_shop
|
||||
* @param string $sync
|
||||
* @return boolean
|
||||
*/
|
||||
public function callCG($path, $mapper_name, $object, $id_shop_group = 0, $id_shop = 0, $sync = false, $params = array())
|
||||
{
|
||||
$success = 0;
|
||||
$site_id = '';
|
||||
$auth_key = '';
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$success = Configuration::get('CARTSG_API_SUCCESS');
|
||||
$site_id = Configuration::get('CARTSG_SITE_ID');
|
||||
$auth_key = Configuration::get('CARTSG_API_AUTH_KEY');
|
||||
} else {
|
||||
$success = Configuration::get('CARTSG_API_SUCCESS', null, $id_shop_group, $id_shop);
|
||||
$site_id = Configuration::get('CARTSG_SITE_ID', null, $id_shop_group, $id_shop);
|
||||
$auth_key = Configuration::get('CARTSG_API_AUTH_KEY', null, $id_shop_group, $id_shop);
|
||||
}
|
||||
|
||||
if ($success && ! empty($site_id) && ! empty($auth_key)) {
|
||||
|
||||
if ($mapper_name) {
|
||||
$id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
|
||||
$mapper = CartGuruMapperFactory::getMapper(
|
||||
$mapper_name,
|
||||
$id_lang_default,
|
||||
(int) $id_shop_group,
|
||||
(int) $id_shop
|
||||
);
|
||||
|
||||
$object = $mapper->create($object, $params);
|
||||
|
||||
if ($object == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$object['siteId'] = $site_id;
|
||||
}
|
||||
|
||||
$call_uid = $path.'_'.self::getUniqueVar($object);
|
||||
//Is already call in same request
|
||||
$this->logDebug('UID :'.$call_uid);
|
||||
|
||||
if (!isset(self::$c_calls[$call_uid])) {
|
||||
try {
|
||||
$api = new CartGuruRAPI($site_id, $auth_key);
|
||||
$this->logDebug('UID:'.$call_uid.' / START CALL API');
|
||||
|
||||
$api->post($path, $object, $sync);
|
||||
|
||||
$this->logDebug('UID:'.$call_uid.' / END CALL API');
|
||||
|
||||
self::$c_calls[$call_uid] = 1;
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
} else {
|
||||
$this->logDebug('UID:'.$call_uid.' / NO CALL NEED');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getUniqueVar($data)
|
||||
{
|
||||
if (!isset($data)) {
|
||||
return '';
|
||||
}
|
||||
return md5(serialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Compatibility with all PS Version
|
||||
*
|
||||
* @param array/string $warning
|
||||
* @return string
|
||||
*/
|
||||
public function displayWarn($warning)
|
||||
{
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'warning' => $warning,
|
||||
'ps_version' => _PS_VERSION_
|
||||
)
|
||||
);
|
||||
$output = $this->context->smarty->fetch(
|
||||
_PS_ROOT_DIR_.'/modules/cartsguru/views/templates/admin/helper_warning.tpl'
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function generateProductImageCG()
|
||||
{
|
||||
$start_time = time();
|
||||
ini_set('max_execution_time', $this->max_execution_time); // ini_set may be disabled, we need the real value
|
||||
$this->max_execution_time = (int)ini_get('max_execution_time');
|
||||
$img_cg_type = new ImageType((int)Configuration::get('CARTSG_IMAGE_TYPE_ID'));
|
||||
$dir = _PS_PROD_IMG_DIR_;
|
||||
foreach (Image::getAllImages() as $image) {
|
||||
$imageObj = new Image($image['id_image']);
|
||||
$existing_img = '';
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$existing_img = $dir.$image['id_product'].'-'.$image['id_image'].'.jpg';
|
||||
} else {
|
||||
$existing_img = $dir.$imageObj->getExistingImgPath().'.jpg';
|
||||
}
|
||||
if (file_exists($existing_img) && filesize($existing_img)) {
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$to_img_file_cg = $dir.$image['id_product'].'-'.$image['id_image'].'-'.Tools::stripslashes($img_cg_type->name).'.jpg';
|
||||
} else {
|
||||
$to_img_file_cg = $dir.$imageObj->getExistingImgPath().'-'.Tools::stripslashes($img_cg_type->name).'.jpg';
|
||||
}
|
||||
if (!file_exists($to_img_file_cg)) {
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
if (!imageResize(
|
||||
$existing_img,
|
||||
$to_img_file_cg,
|
||||
(int)$img_cg_type->width,
|
||||
(int)$img_cg_type->height
|
||||
)
|
||||
) {
|
||||
$this->post_errors[] = sprintf(
|
||||
'Original image is corrupt (%s) for product ID %2$d or bad permission on folder',
|
||||
$existing_img,
|
||||
(int)$imageObj->id_product
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (!ImageManager::resize(
|
||||
$existing_img,
|
||||
$to_img_file_cg,
|
||||
(int)$img_cg_type->width,
|
||||
(int)$img_cg_type->height
|
||||
)) {
|
||||
$this->post_errors[] = sprintf(
|
||||
Tools::displayError('Original image is corrupt (%s) for product ID %2$d or bad permission on folder'),
|
||||
$existing_img,
|
||||
(int)$imageObj->id_product
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
$this->post_errors[] = sprintf(
|
||||
'Original image is missing or empty (%1$s) for product ID %2$d',
|
||||
$existing_img,
|
||||
(int)$imageObj->id_product
|
||||
);
|
||||
}
|
||||
if (time() - $start_time > $this->max_execution_time - 4) {
|
||||
return 'timeout';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deleteProductImageCG()
|
||||
{
|
||||
$productsImages = Image::getAllImages();
|
||||
$dir = _PS_PROD_IMG_DIR_;
|
||||
foreach ($productsImages as $image) {
|
||||
$imageObj = new Image($image['id_image']);
|
||||
$imageObj->id_product = $image['id_product'];
|
||||
$img_cg_type = new ImageType((int) Configuration::get('CARTSG_IMAGE_TYPE_ID'));
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$img_folder = $dir.$image['id_product'].'-'.$image['id_image'];
|
||||
} else {
|
||||
$img_folder = $dir.$imageObj->getImgFolder();
|
||||
}
|
||||
if (file_exists($img_folder)) {
|
||||
$toDel = scandir($img_folder);
|
||||
foreach ($toDel as $d) {
|
||||
if (preg_match('/^[0-9]+\-' . $img_cg_type->name . '\.jpg$/', $d)) {
|
||||
if (file_exists($img_folder . $d)) {
|
||||
unlink($img_folder . $d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function import($siteId, $type, $api_path)
|
||||
{
|
||||
$isMultiStoreSupported = version_compare(_PS_VERSION_, '1.5.0', '>=');
|
||||
|
||||
$sql = 'SELECT id_' . $type . ' AS id FROM ' . _DB_PREFIX_ . $type;
|
||||
|
||||
if ($type === 'order') {
|
||||
$sql .= 's';
|
||||
}
|
||||
|
||||
//Need filter on the good shop
|
||||
if ($isMultiStoreSupported) {
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
|
||||
$sql .= ' WHERE id_shop = ' . $id_shop;
|
||||
}
|
||||
|
||||
$sql .= ' ORDER BY date_add DESC LIMIT 250';
|
||||
|
||||
if ($results = Db::getInstance()->ExecuteS($sql)) {
|
||||
$id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
|
||||
$items = array();
|
||||
foreach ($results as $row) {
|
||||
$item = $type === 'order' ? new Order($row['id']) : new Cart($row['id']);
|
||||
|
||||
|
||||
$mapper = CartGuruMapperFactory::getMapper(
|
||||
$type,
|
||||
$id_lang_default,
|
||||
$isMultiStoreSupported ? $item->id_shop_group : 0,
|
||||
$isMultiStoreSupported ? $item->id_shop : 0
|
||||
);
|
||||
|
||||
$cart_guru_data = $mapper->create($item);
|
||||
if ($cart_guru_data) {
|
||||
$cart_guru_data['siteId'] = $siteId;
|
||||
$items[] = $cart_guru_data;
|
||||
}
|
||||
}
|
||||
|
||||
$this->callCG(
|
||||
$api_path,
|
||||
null,
|
||||
$items
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function importCarts($siteId)
|
||||
{
|
||||
$this->import($siteId, 'cart', CartGuruRAPI::API_PATH_IMPORT_CARTS);
|
||||
}
|
||||
|
||||
private function importOrders($siteId)
|
||||
{
|
||||
$this->import($siteId, 'order', CartGuruRAPI::API_PATH_IMPORT_ORDERS);
|
||||
}
|
||||
}
|
97
modules/cartsguru/classes/AbstractMapper.php
Normal file
97
modules/cartsguru/classes/AbstractMapper.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
abstract class CartGuruMapperAbstract
|
||||
{
|
||||
|
||||
public $id_lang;
|
||||
|
||||
public $id_shop_group;
|
||||
|
||||
public $id_shop;
|
||||
|
||||
public $link;
|
||||
|
||||
public function __construct($id_lang, $id_shop_group, $id_shop)
|
||||
{
|
||||
$this->id_lang = $id_lang;
|
||||
$this->id_shop_group = (int) $id_shop_group;
|
||||
$this->id_shop = (int) $id_shop;
|
||||
$protocol_link = Configuration::get(
|
||||
'PS_SSL_ENABLED',
|
||||
null,
|
||||
$this->id_shop_group,
|
||||
$this->id_shop
|
||||
) ? 'https://' : 'http://';
|
||||
$use_ssl = Configuration::get('PS_SSL_ENABLED') ? true : false;
|
||||
$protocol_content = ($use_ssl) ? 'https://' : 'http://';
|
||||
$this->link = new Link($protocol_link, $protocol_content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate ps object to cart guru array
|
||||
*
|
||||
* @param Object $obj
|
||||
* @return array data
|
||||
*/
|
||||
public function create($obj, $params = array())
|
||||
{
|
||||
$cart_guru_mapped = array();
|
||||
if ($obj) {
|
||||
$cart_guru_mapped = $this->mappObject($obj, $params);
|
||||
}
|
||||
return $cart_guru_mapped;
|
||||
}
|
||||
|
||||
/**
|
||||
* If value is empty return ''
|
||||
*
|
||||
* @param
|
||||
* $value
|
||||
* @return string
|
||||
*/
|
||||
protected function notEmpty($value)
|
||||
{
|
||||
return ($value) ? $value : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* This method format date in json format
|
||||
*
|
||||
* @param
|
||||
* $date
|
||||
* @return bool string
|
||||
*/
|
||||
protected function formatDate($date)
|
||||
{
|
||||
return date('Y-m-d\TH:i:sP', strtotime($date));
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the Carts Guru Data from PS object
|
||||
*
|
||||
* To be implemented by the concrete mapper class
|
||||
*
|
||||
* @param Object $psobj
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
abstract public function mappObject($obj, $params);
|
||||
}
|
91
modules/cartsguru/classes/AccountMapper.php
Normal file
91
modules/cartsguru/classes/AccountMapper.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
class CartGuruAccountMapper extends CartGuruMapperAbstract
|
||||
{
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see CartGuruMapperAbstract::mappObject()
|
||||
*/
|
||||
public function mappObject($customer, $params)
|
||||
{
|
||||
$gender = $this->getGender($customer);
|
||||
$lastname = $customer->lastname;
|
||||
$firstname = $customer->firstname;
|
||||
$homePhoneNumber = '';
|
||||
$mobilePhoneNumber = '';
|
||||
$country_iso_code = '';
|
||||
$address = $this->getLastAddress($customer->id);
|
||||
if ($address) {
|
||||
$homePhoneNumber = $address['phone'];
|
||||
$mobilePhoneNumber = $address['phone_mobile'];
|
||||
$country_iso_code = $address['country_iso_code'];
|
||||
}
|
||||
return array(
|
||||
'accountId' => (string) $customer->id, // Account id of the customer
|
||||
'civility' => $gender, // Use string in this list : 'mister','madam'
|
||||
'lastname' => $this->notEmpty($lastname), // Lastname of the buyer
|
||||
'firstname' => $this->notEmpty($firstname), // Firstname of the buyer
|
||||
'email' => $this->notEmpty($customer->email), // Email of the customer
|
||||
'homePhoneNumber' => $homePhoneNumber,
|
||||
'mobilePhoneNumber' => $mobilePhoneNumber,
|
||||
'countryCode' => $this->notEmpty($country_iso_code)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* get customer gender and format it
|
||||
*
|
||||
* @param $customer
|
||||
* @return string
|
||||
*/
|
||||
public function getGender($customer)
|
||||
{
|
||||
$gender_name = 'mister';
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '>=') && (int) $customer->id_gender) {
|
||||
$gender = new Gender((int) $customer->id_gender, $this->id_lang);
|
||||
if ((int) $gender->type == 2) {
|
||||
$gender_name = 'madam';
|
||||
}
|
||||
}
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<') && (int) $customer->id_gender) {
|
||||
if ((int) $customer->id_gender == 2) {
|
||||
$gender_name = 'madam';
|
||||
}
|
||||
}
|
||||
return ($gender_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last address saved
|
||||
*/
|
||||
public function getLastAddress($id_customer)
|
||||
{
|
||||
$last_address = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT a.`phone`, a.`phone_mobile`, cl.`name` as country_name, c.`iso_code` as country_iso_code
|
||||
FROM `' . _DB_PREFIX_ . 'address` a
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'country` c ON c.`id_country` = a.`id_country`
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'country_lang` cl ON c.`id_country` = cl.`id_country`
|
||||
AND cl.`id_lang` = ' . (int) $this->id_lang . '
|
||||
WHERE a.id_customer=' . (int) $id_customer . '
|
||||
ORDER BY a.`id_address` DESC');
|
||||
return $last_address;
|
||||
}
|
||||
}
|
100
modules/cartsguru/classes/CartMapper.php
Normal file
100
modules/cartsguru/classes/CartMapper.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
class CartGuruCartMapper extends CartGuruMapperAbstract
|
||||
{
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see CartGuruMapperAbstract::mappObject()
|
||||
*/
|
||||
public function mappObject($cart, $params)
|
||||
{
|
||||
$customerGroups = Customer::getGroupsStatic((int) $cart->id_customer);
|
||||
if (defined(_CARTSGURU_ONLY_GROUP_) && !in_array(_CARTSGURU_ONLY_GROUP_, $customerGroups)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$cart_items = $cart->getProducts();
|
||||
$items = array();
|
||||
$product_mapper = new CartGuruProductMapper($this->id_lang, $this->id_shop_group, $this->id_shop);
|
||||
foreach ($cart_items as $cart_item) {
|
||||
$params = array('id_product_attribute' => (int)$cart_item['id_product_attribute']);
|
||||
$product = new Product($cart_item['id_product'], false, $this->id_lang);
|
||||
$product_mapped = $product_mapper->create($product, $params);
|
||||
$product_mapped['quantity'] = (int) $cart_item['cart_quantity'];
|
||||
$product_mapped['totalET'] = (float) $cart_item['total'];
|
||||
$product_mapped['totalATI'] = (float) $cart_item['total_wt'];
|
||||
$items[] = $product_mapped;
|
||||
}
|
||||
$customer = new Customer((int) $cart->id_customer);
|
||||
$account_mapper = new CartGuruAccountMapper($this->id_lang, $this->id_shop_group, $this->id_shop);
|
||||
$account_mapped = $account_mapper->create($customer);
|
||||
|
||||
$currency = new Currency((int)$cart->id_currency);
|
||||
|
||||
$cart_mapped = array(
|
||||
'id' => (string) $cart->id,
|
||||
'ip' => isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ?
|
||||
$_SERVER["HTTP_CF_CONNECTING_IP"] : Tools::getRemoteAddr(), // Required for the API lock IP Address
|
||||
'creationDate' => $this->formatDate($cart->date_add), // Date of the order as string in json format
|
||||
'totalET' => (float) $cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), // without taxes & shipping
|
||||
'totalATI' => (float) $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS), // with taxes only product
|
||||
'currency' => (string) $currency->iso_code,
|
||||
'recoverUrl' => (version_compare(_PS_VERSION_, '1.5.0', '>=')?$this->getCartRecoverUrl($cart):''),
|
||||
'items' => $items
|
||||
);
|
||||
$cart_mapped = array_merge($cart_mapped, $account_mapped);
|
||||
|
||||
//Accound id is mandatory
|
||||
if ($cart_mapped['accountId'] == '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $cart_mapped;
|
||||
}
|
||||
|
||||
public function getCartRecoverUrl($cart, $step = 1)
|
||||
{
|
||||
$order_process = Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order';
|
||||
$url = '';
|
||||
if ($step > 1) {
|
||||
$url = $this->link->getPageLink(
|
||||
$order_process,
|
||||
true,
|
||||
(int)$cart->id_lang,
|
||||
'step='.$step.'&recover_cart='.(int)$cart->id.'&token_cart='.
|
||||
md5(_COOKIE_KEY_.'recover_cart_'.(int)$cart->id),
|
||||
null,
|
||||
(int)$cart->id_shop
|
||||
);
|
||||
} else {
|
||||
$url = $this->link->getPageLink(
|
||||
$order_process,
|
||||
true,
|
||||
(int)$cart->id_lang,
|
||||
'recover_cart='.(int)$cart->id.'&token_cart='.
|
||||
md5(_COOKIE_KEY_.'recover_cart_'.(int)$cart->id),
|
||||
null,
|
||||
(int)$cart->id_shop
|
||||
);
|
||||
}
|
||||
return ($url);
|
||||
}
|
||||
}
|
48
modules/cartsguru/classes/MapperFactory.php
Normal file
48
modules/cartsguru/classes/MapperFactory.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
class CartGuruMapperFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* Return good initialize mapper depending name
|
||||
* @param string $mapper_name
|
||||
* @param int $id_lang_default
|
||||
* @param int $id_shop_group
|
||||
* @param int $id_shop
|
||||
* @throws InvalidArgumentException
|
||||
* @return AbstractCartGuruMapper
|
||||
*/
|
||||
public static function getMapper($mapper_name, $id_lang_default, $id_shop_group, $id_shop)
|
||||
{
|
||||
switch ($mapper_name) {
|
||||
case 'cart':
|
||||
return new CartGuruCartMapper($id_lang_default, (int) $id_shop_group, (int) $id_shop);
|
||||
case 'order':
|
||||
return new CartGuruOrderMapper($id_lang_default, (int) $id_shop_group, (int) $id_shop);
|
||||
case 'product':
|
||||
return new CartGuruProductMapper($id_lang_default, (int) $id_shop_group, (int) $id_shop);
|
||||
case 'customer':
|
||||
return new CartGuruAccountMapper($id_lang_default, (int) $id_shop_group, (int) $id_shop);
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException();
|
||||
}
|
||||
}
|
138
modules/cartsguru/classes/OrderMapper.php
Normal file
138
modules/cartsguru/classes/OrderMapper.php
Normal file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
class CartGuruOrderMapper extends CartGuruMapperAbstract
|
||||
{
|
||||
/**
|
||||
* @see CartGuruMapperAbstract::mappObject()
|
||||
*/
|
||||
public function mappObject($order, $params)
|
||||
{
|
||||
$customerGroups = Customer::getGroupsStatic((int) $order->id_customer);
|
||||
if (defined(_CARTSGURU_ONLY_GROUP_) && !in_array(_CARTSGURU_ONLY_GROUP_, $customerGroups)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$order_items = $order->getProducts();
|
||||
$items = array();
|
||||
$product_mapper = new CartGuruProductMapper($this->id_lang, $this->id_shop_group, $this->id_shop);
|
||||
foreach ($order_items as $order_item) {
|
||||
$pmap_params = array('id_product_attribute' => $order_item['product_attribute_id']);
|
||||
$product = new Product($order_item['product_id'], false, $this->id_lang);
|
||||
$product_mapped = $product_mapper->create($product, $pmap_params);
|
||||
$product_mapped['label'] = $order_item['product_name'];
|
||||
$product_mapped['quantity'] = (int) $order_item['product_quantity'];
|
||||
//Even if we have backward compatibility, be sure it will continue to work on > 1.6
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
$product_mapped['totalET'] = (float) $order_item['total_price'];
|
||||
$product_mapped['totalATI'] = (float) $order_item['total_wt'];
|
||||
} else {
|
||||
$product_mapped['totalET'] = (float) $order_item['total_price_tax_excl'];
|
||||
$product_mapped['totalATI'] = (float) $order_item['total_price_tax_incl'];
|
||||
}
|
||||
$items[] = $product_mapped;
|
||||
}
|
||||
|
||||
$customer = new Customer((int) $order->id_customer);
|
||||
$account_mapper = new CartGuruAccountMapper($this->id_lang, $this->id_shop_group, $this->id_shop);
|
||||
$account_mapped = $account_mapper->create($customer, $params);
|
||||
$status_cg_name = 'Undefined';
|
||||
$order_state_id = 0;
|
||||
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
|
||||
if (isset($params['newOrderStatus'])) {
|
||||
$order_state_id = (int) $params['newOrderStatus']->id;
|
||||
} else {
|
||||
$order_state_id = (int) $order->getCurrentState();
|
||||
}
|
||||
} else {
|
||||
$order_state_id = (int) $order->current_state;
|
||||
}
|
||||
if ((int) $order_state_id) {
|
||||
$current_status = new OrderState((int) $order_state_id, $this->id_lang);
|
||||
$status_cg_name = $current_status->name;
|
||||
}
|
||||
|
||||
$currency = new Currency((int)$order->id_currency);
|
||||
|
||||
$order_mapped = array(
|
||||
'id' => (string) $order->id,
|
||||
'cartId' => (string) $order->id_cart,
|
||||
'state' => $status_cg_name,
|
||||
'creationDate' => $this->formatDate($order->date_add), // Date of the order as string in json format
|
||||
'totalET' => (float) $order->getTotalProductsWithoutTaxes(), // Amount excluded taxes and excluded shipping
|
||||
'totalATI' => (float) $order->total_paid, // Total ttc
|
||||
'paymentMethod' => (string)$order->payment,
|
||||
'currency' => (string) $currency->iso_code,
|
||||
'items' => $items
|
||||
);
|
||||
$order_mapped = array_merge($order_mapped, $account_mapped);
|
||||
return $order_mapped;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method map prestashop status to api status
|
||||
* priority
|
||||
* 1 status paid/logable => 'confirmed'
|
||||
* 2 status is error => 'error'
|
||||
* 3 status is canceled or refunded => 'cancelled'
|
||||
* 4 status is cheque or bankwirer => 'wait'
|
||||
* 5 other return the prestatshop status name
|
||||
*
|
||||
* @param $status
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus($status)
|
||||
{
|
||||
if ((int) $status->paid || (int) $status->logable) {
|
||||
return 'confirmed';
|
||||
}
|
||||
$ps_os_error_id = (int) Configuration::get('PS_OS_ERROR');
|
||||
if ((int) $status->id == (int) $ps_os_error_id) {
|
||||
return 'error';
|
||||
}
|
||||
$ps_os_canceld_id = (int) Configuration::get('PS_OS_CANCELED');
|
||||
$ps_os_refund_id = (int) Configuration::get('PS_OS_REFUND');
|
||||
if ((int) $status->id == (int) $ps_os_canceld_id || (int) $status->id == (int) $ps_os_refund_id) {
|
||||
return 'cancelled';
|
||||
}
|
||||
$ps_os_cheque_id = (int) Configuration::get('PS_OS_CHEQUE');
|
||||
$ps_os_bankwire_id = (int) Configuration::get('PS_OS_BANKWIRE');
|
||||
if ((int) $status->id == (int) $ps_os_cheque_id || (int) $status->id == (int) $ps_os_bankwire_id) {
|
||||
return 'waiting';
|
||||
}
|
||||
return $status->name;
|
||||
}
|
||||
/*
|
||||
* $ps_os_payment_id = (int)Configuration::get('PS_OS_PAYMENT');
|
||||
* $ps_os_preparation_id = (int)Configuration::get('PS_OS_PREPARATION');
|
||||
* $ps_os_shipping_id = (int)Configuration::get('PS_OS_SHIPPING');
|
||||
* $ps_os_delivered_id = (int)Configuration::get('PS_OS_DELIVERED');
|
||||
* $ps_os_canceld_id = (int)Configuration::get('PS_OS_CANCELED');
|
||||
* $ps_os_refund_id = (int)Configuration::get('PS_OS_REFUND');
|
||||
* $ps_os_error_id = (int)Configuration::get('PS_OS_ERROR');
|
||||
* $ps_os_outofstock_id = (int)Configuration::get('PS_OS_OUTOFSTOCK');
|
||||
* $ps_os_cheque_id = (int)Configuration::get('PS_OS_CHEQUE');
|
||||
* $ps_os_bankwire_id = (int)Configuration::get('PS_OS_BANKWIRE');
|
||||
* $ps_os_paypal_id = (int)Configuration::get('PS_OS_PAYPAL');
|
||||
* $ps_os_ws_payment_id = (int)Configuration::get('PS_OS_WS_PAYMENT');
|
||||
* $ps_os_outofstock_paid_id = (int)Configuration::get('PS_OS_OUTOFSTOCK_PAID');
|
||||
* $ps_os_outofstock_unpaid_id = (int)Configuration::get('PS_OS_OUTOFSTOCK_UNPAID');
|
||||
*/
|
||||
}
|
84
modules/cartsguru/classes/ProductMapper.php
Normal file
84
modules/cartsguru/classes/ProductMapper.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
class CartGuruProductMapper extends CartGuruMapperAbstract
|
||||
{
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see CartGuruMapperAbstract::mappObject()
|
||||
*/
|
||||
public function mappObject($product, $params)
|
||||
{
|
||||
$id_product_attribute = 0;
|
||||
if (isset($params['id_product_attribute'])) {
|
||||
$id_product_attribute = (int)$params['id_product_attribute'];
|
||||
}
|
||||
$category = new Category($product->id_category_default, $this->id_lang);
|
||||
$universe_name = '';
|
||||
$category_name = '';
|
||||
if ($category && (int) $category->id) {
|
||||
$category_name = $category->name;
|
||||
$categories = $category->getParentsCategories();
|
||||
if (count($categories) > 0) {
|
||||
$universe_name = $categories[count($categories) - 1]['name'];
|
||||
foreach ($categories as $cat) {
|
||||
// prefer level depth 2 for universe 0 : root, 1 : accueil
|
||||
if ((int) $cat['level_depth'] == 2) {
|
||||
$universe_name = $cat['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$image_cover_url = '';
|
||||
$best_image = $this->getBestImageProduct($product->id, $id_product_attribute);
|
||||
if ($best_image && (int)$best_image['id_image']) {
|
||||
$ids = $product->id.'-'.$best_image['id_image'];
|
||||
$image_cover_url = $this->link->getImageLink($product->link_rewrite, $ids, 'cartsguru');
|
||||
}
|
||||
return (array(
|
||||
'id' => (string) $product->id, // SKU or product id
|
||||
'label' => (string) $product->name, // Designation
|
||||
'url' => $this->link->getProductLink($product),
|
||||
'imageUrl' => $image_cover_url,
|
||||
'universe' => $universe_name,
|
||||
'category' => $category_name
|
||||
));
|
||||
}
|
||||
private function getBestImageProduct($id_product, $id_product_attribute = 0)
|
||||
{
|
||||
$image = array();
|
||||
if ((int) $id_product_attribute) {
|
||||
$image = Db::getInstance()->getRow(
|
||||
'SELECT pai.id_image FROM `' . _DB_PREFIX_ . 'product_attribute_image` pai
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON i.`id_image` = pai.`id_image`
|
||||
WHERE pai.`id_product_attribute` = ' . (int) $id_product_attribute.
|
||||
' ORDER BY i.`cover` DESC, i.`position` ASC '
|
||||
);
|
||||
}
|
||||
if (! isset($image['id_image'])) {
|
||||
$image = Db::getInstance()->getRow(
|
||||
'SELECT i.`id_image` FROM `' . _DB_PREFIX_ . 'image` i
|
||||
WHERE i.`id_product` = ' . (int) $id_product . ' AND i.`cover` = 1
|
||||
ORDER BY i.`cover` DESC, i.`position` ASC '
|
||||
);
|
||||
}
|
||||
return $image;
|
||||
}
|
||||
}
|
357
modules/cartsguru/classes/RAPI.php
Normal file
357
modules/cartsguru/classes/RAPI.php
Normal file
@ -0,0 +1,357 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
class CartGuruRAPI implements Iterator, ArrayAccess
|
||||
{
|
||||
|
||||
private $site_id;
|
||||
|
||||
private $auth_key;
|
||||
|
||||
public $options;
|
||||
|
||||
public $handle; // cURL resource handle.
|
||||
|
||||
// Populated after execution:
|
||||
public $response; // Response body.
|
||||
public $headers; // Parsed reponse header object.
|
||||
public $info; // Response info object.
|
||||
public $error; // Response error string.
|
||||
|
||||
// Populated as-needed.
|
||||
public $decoded_response; // Decoded response body.
|
||||
private $iterator_positon;
|
||||
|
||||
const API_PATH_ACCOUNTS = '/accounts';
|
||||
|
||||
const API_PATH_ORDERS = '/orders';
|
||||
|
||||
const API_PATH_CARTS = '/carts';
|
||||
|
||||
const API_PATH_REGISTER = '/sites/:siteId/register-plugin';
|
||||
|
||||
const API_PATH_IMPORT_ORDERS = '/import/orders';
|
||||
|
||||
const API_PATH_IMPORT_CARTS = '/import/carts';
|
||||
|
||||
public function __construct($site_id, $auth_key, $options = array())
|
||||
{
|
||||
$this->site_id = $site_id;
|
||||
$this->auth_key = $auth_key;
|
||||
$default_options = array(
|
||||
'headers' => array(
|
||||
'x-auth-key' => $auth_key,
|
||||
'x-plugin-version' => _CARTSGURU_VERSION_,
|
||||
'Content-Type' => 'application/json'
|
||||
),
|
||||
'parameters' => array(),
|
||||
'curl_options' => array(),
|
||||
'user_agent' => "PHP RestClient/0.1.4",
|
||||
'base_url' => null,
|
||||
'format' => null,
|
||||
'format_regex' => "/(\w+)\/(\w+)(;[.+])?/",
|
||||
'decoders' => array(
|
||||
'json' => 'json_decode',
|
||||
'php' => 'unserialize'
|
||||
),
|
||||
'username' => null,
|
||||
'password' => null
|
||||
);
|
||||
$this->options = array_merge($default_options, $options);
|
||||
if (array_key_exists('decoders', $options)) {
|
||||
$this->options['decoders'] = array_merge($default_options['decoders'], $options['decoders']);
|
||||
}
|
||||
}
|
||||
|
||||
public function setOption($key, $value)
|
||||
{
|
||||
$this->options[$key] = $value;
|
||||
}
|
||||
|
||||
public function registerDecoder($format, $method)
|
||||
{
|
||||
// Decoder callbacks must adhere to the following pattern:
|
||||
// array my_decoder(string $data)
|
||||
$this->options['decoders'][$format] = $method;
|
||||
}
|
||||
|
||||
// Iterable methods:
|
||||
public function rewind()
|
||||
{
|
||||
$this->decodeResponse();
|
||||
return reset($this->decoded_response);
|
||||
}
|
||||
|
||||
public function current()
|
||||
{
|
||||
return current($this->decoded_response);
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
return key($this->decoded_response);
|
||||
}
|
||||
|
||||
public function next()
|
||||
{
|
||||
return next($this->decoded_response);
|
||||
}
|
||||
|
||||
public function valid()
|
||||
{
|
||||
return is_array($this->decoded_response) && (key($this->decoded_response) !== null);
|
||||
}
|
||||
|
||||
// ArrayAccess methods:
|
||||
public function offsetExists($key)
|
||||
{
|
||||
$this->decodeResponse();
|
||||
return is_array($this->decoded_response) ?
|
||||
isset($this->decoded_response[$key]) :
|
||||
isset($this->decoded_response->{$key});
|
||||
}
|
||||
|
||||
public function offsetGet($key)
|
||||
{
|
||||
$this->decodeResponse();
|
||||
if (! $this->offsetExists($key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return is_array($this->decoded_response) ? $this->decoded_response[$key] : $this->decoded_response->{$key};
|
||||
}
|
||||
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
throw new CartGuruRAPIException("Decoded response data is immutable.");
|
||||
}
|
||||
|
||||
public function offsetUnset($key)
|
||||
{
|
||||
throw new CartGuruRAPIException("Decoded response data is immutable.");
|
||||
}
|
||||
|
||||
// Request methods:
|
||||
public function get($path, $parameters = array(), $sync = true, $headers = array())
|
||||
{
|
||||
return $this->execute($path, 'GET', $parameters, $headers, $sync);
|
||||
}
|
||||
|
||||
public function post($path, $parameters = array(), $sync = true, $headers = array())
|
||||
{
|
||||
return $this->execute($path, 'POST', $parameters, $headers, $sync);
|
||||
}
|
||||
|
||||
public function put($path, $parameters = array(), $sync = true, $headers = array())
|
||||
{
|
||||
return $this->execute($path, 'PUT', $parameters, $headers, $sync);
|
||||
}
|
||||
|
||||
public function delete($path, $parameters = array(), $sync = true, $headers = array())
|
||||
{
|
||||
return $this->execute($path, 'DELETE', $parameters, $headers, $sync);
|
||||
}
|
||||
/**
|
||||
* Call Carts Guru api
|
||||
* @param string $path eg /orders,/carts
|
||||
* @param string $method eg POST,PUT,DELETE
|
||||
* @param array $parameters override parameter
|
||||
* @param array $headers
|
||||
* @param string $sync
|
||||
* @return CartGuruRAPI with initialization (result)
|
||||
*/
|
||||
public function execute($path, $method = 'GET', $parameters = array(), $headers = array(), $sync = true)
|
||||
{
|
||||
$path = str_replace(':siteId', $this->site_id, $path);
|
||||
$client = clone $this;
|
||||
$client->url = _CARTSGURU_API_URL_ . $path;
|
||||
$client->handle = curl_init();
|
||||
$curlopt = array(
|
||||
CURLOPT_HEADER => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_USERAGENT => $client->options['user_agent'],
|
||||
CURLOPT_SSL_VERIFYPEER => false
|
||||
);
|
||||
if (! $sync) {
|
||||
/*
|
||||
$curlopt[CURLOPT_NOSIGNAL] = 1;
|
||||
$curlopt[CURLOPT_TIMEOUT_MS] = 50;
|
||||
*/
|
||||
/* BIS SOLUTION */
|
||||
$curlopt[CURLOPT_FRESH_CONNECT] = true;
|
||||
$curlopt[CURLOPT_TIMEOUT] = 1;
|
||||
}
|
||||
if ($client->options['username'] && $client->options['password']) {
|
||||
$curlopt[CURLOPT_USERPWD] = sprintf("%s:%s", $client->options['username'], $client->options['password']);
|
||||
}
|
||||
|
||||
if (is_array($parameters)) {
|
||||
$parameters = array_merge($client->options['parameters'], $parameters);
|
||||
$parameters_string = Tools::jsonEncode($parameters);
|
||||
$headers['Content-Length'] = Tools::strlen($parameters_string);
|
||||
} else {
|
||||
$parameters_string = (string) $parameters;
|
||||
}
|
||||
|
||||
if (count($client->options['headers']) || count($headers)) {
|
||||
$curlopt[CURLOPT_HTTPHEADER] = array();
|
||||
$headers = array_merge($client->options['headers'], $headers);
|
||||
foreach ($headers as $key => $value) {
|
||||
$curlopt[CURLOPT_HTTPHEADER][] = sprintf("%s:%s", $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
if ($client->options['format']) {
|
||||
$client->url .= '.' . $client->options['format'];
|
||||
}
|
||||
|
||||
// Allow passing parameters as a pre-encoded string (or something that
|
||||
// allows casting to a string). Parameters passed as strings will not be
|
||||
// merged with parameters specified in the default options.
|
||||
|
||||
$methode_upper = Tools::strtoupper($method);
|
||||
if ($methode_upper == 'POST') {
|
||||
$curlopt[CURLOPT_POST] = true;
|
||||
$curlopt[CURLOPT_POSTFIELDS] = $parameters_string;
|
||||
} elseif ($methode_upper != 'GET') {
|
||||
$curlopt[CURLOPT_CUSTOMREQUEST] = $methode_upper;
|
||||
$curlopt[CURLOPT_POSTFIELDS] = $parameters_string;
|
||||
} elseif ($parameters_string) {
|
||||
$client->url .= strpos($client->url, '?') ? '&' : '?';
|
||||
$client->url .= $parameters_string;
|
||||
}
|
||||
|
||||
if ($client->options['base_url']) {
|
||||
$option_base_url_sub = Tools::substr($client->options['base_url'], - 1);
|
||||
if ($client->url[0] != '/' && $option_base_url_sub != '/') {
|
||||
$client->url = '/' . $client->url;
|
||||
}
|
||||
$client->url = $client->options['base_url'] . $client->url;
|
||||
}
|
||||
$curlopt[CURLOPT_URL] = $client->url;
|
||||
|
||||
if ($client->options['curl_options']) {
|
||||
// array_merge would reset our numeric keys.
|
||||
foreach ($client->options['curl_options'] as $key => $value) {
|
||||
$curlopt[$key] = $value;
|
||||
}
|
||||
}
|
||||
curl_setopt_array($client->handle, $curlopt);
|
||||
$client->parseResponse(curl_exec($client->handle));
|
||||
$client->info = (object) curl_getinfo($client->handle);
|
||||
$client->error = curl_error($client->handle);
|
||||
|
||||
curl_close($client->handle);
|
||||
return $client;
|
||||
}
|
||||
|
||||
public function formatQuery($parameters, $primary = '=', $secondary = '&')
|
||||
{
|
||||
$query = "";
|
||||
foreach ($parameters as $key => $value) {
|
||||
$pair = array(
|
||||
urlencode($key),
|
||||
urlencode($value)
|
||||
);
|
||||
$query .= implode($primary, $pair) . $secondary;
|
||||
}
|
||||
return rtrim($query, $secondary);
|
||||
}
|
||||
|
||||
public function parseResponse($response)
|
||||
{
|
||||
$headers = array();
|
||||
$http_ver = strtok($response, "\n");
|
||||
|
||||
while ($line = strtok("\n")) {
|
||||
if (Tools::strlen(trim($line)) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
list ($key, $value) = explode(':', $line, 2);
|
||||
$key = trim(Tools::strtolower(str_replace('-', '_', $key)));
|
||||
$value = trim($value);
|
||||
if (empty($headers[$key])) {
|
||||
$headers[$key] = $value;
|
||||
} elseif (is_array($headers[$key])) {
|
||||
$headers[$key][] = $value;
|
||||
} else {
|
||||
$headers[$key] = array(
|
||||
$headers[$key],
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->headers = (object) $headers;
|
||||
$this->response = strtok("");
|
||||
}
|
||||
|
||||
public function getResponseFormat()
|
||||
{
|
||||
if (! $this->response) {
|
||||
throw new CartGuruRAPIException("A response must exist before it can be decoded.");
|
||||
}
|
||||
|
||||
// User-defined format.
|
||||
if (! empty($this->options['format'])) {
|
||||
return $this->options['format'];
|
||||
}
|
||||
|
||||
// Extract format from response content-type header.
|
||||
if (! empty($this->headers->content_type)) {
|
||||
if (preg_match($this->options['format_regex'], $this->headers->content_type, $matches)) {
|
||||
return $matches[2];
|
||||
}
|
||||
}
|
||||
|
||||
throw new CartGuruRAPIException("Response format could not be determined.");
|
||||
}
|
||||
|
||||
public function decodeResponse()
|
||||
{
|
||||
if (empty($this->decoded_response)) {
|
||||
$format = $this->getResponseFormat();
|
||||
if (! array_key_exists($format, $this->options['decoders'])) {
|
||||
throw new CartGuruRAPIException($format.' is not a supported ' . 'format');
|
||||
}
|
||||
|
||||
$this->decoded_response = call_user_func($this->options['decoders'][$format], $this->response);
|
||||
}
|
||||
|
||||
return $this->decoded_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method return true if connect to server is ok
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkAccess()
|
||||
{
|
||||
$fields = array(
|
||||
'plugin' => 'prestashop',
|
||||
'pluginVersion' => _CARTSGURU_VERSION_,
|
||||
'storeVersion' => _PS_VERSION_
|
||||
);
|
||||
$result = $this->post(self::API_PATH_REGISTER, $fields);
|
||||
return $result;
|
||||
}
|
||||
}
|
23
modules/cartsguru/classes/RAPIException.php
Normal file
23
modules/cartsguru/classes/RAPIException.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
class CartGuruRAPIException extends Exception
|
||||
{
|
||||
}
|
27
modules/cartsguru/classes/index.php
Normal file
27
modules/cartsguru/classes/index.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
27
modules/cartsguru/index.php
Normal file
27
modules/cartsguru/index.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
BIN
modules/cartsguru/logo.gif
Normal file
BIN
modules/cartsguru/logo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 654 B |
BIN
modules/cartsguru/logo.png
Normal file
BIN
modules/cartsguru/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
29
modules/cartsguru/translations/en.php
Normal file
29
modules/cartsguru/translations/en.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_2052043f39909e620bd65573706463f6'] = 'Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_dfc39a358ca340a9846a2a8c162de1b9'] = 'The first targeted and automated follow-up solution for abandoned carts through phone and text message !';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_a12b6c219f12145e967c09ea898a7fbd'] = 'cURL librairy is not available.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_aade6fe424276a463381d738d31d04dd'] = 'The module is not configured';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_62ce11347fffa067e1ebb94e019ce31c'] = 'Your store is properly linked with Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_83e4eef9715a6044ffd2165cc3bf9152'] = 'Product images for Cart Guru were successfully regenerated';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_d4f225ec09e4b0eba6558753f4bd8edd'] = 'Only part of the images have been regenerated. The server timed out before finishing.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_632cd307bc981033384b4f42b7a52d34'] = 'Use \"Product image generation\" form with option erase to false and click to the button generate.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_60a5980f8b948d9ad23af03206a11620'] = 'Impossible to connect with this credential.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_d63e8b98064ce2cd9f753412cc53cde1'] = 'Field \'%1$s\' is required';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_f76cf338d1c364144e7bc74edc5ae195'] = 'Auth key';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_305fe996f5b22c6230470bcfabe112ad'] = 'Site ID';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_c888438d14855d7d96a2724ee9c306bd'] = 'Settings updated ';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_54eebac864cda3659a446e61c111b28e'] = 'To resume the operation, select no for \"Erase previous images\", and click \"Generate\".';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_112afb3cda4a3d63415b4156737b6894'] = 'Carts Guru authentification';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_eea26af48ce417a70acc5eb96a8f3592'] = 'The multistore option is enabled. If you want configure the module, you must select store.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_414dfa338951d9eca8a2acd2b361300f'] = 'Provided by Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_c9cc8cce247e49bae79f15173ce97354'] = 'Save';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_d795a8d004d37e375541d838c0c84f15'] = 'Product images generation for Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_fb6df7abfeaae40427dac2b8a4a423dc'] = 'The operation is required only if you not see your product images in Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_d379cadd41b68efe7c945b4d85c72085'] = 'Erase previous images';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_62275efff59edb02173db8524943db89'] = 'Select \"No\" if your server timed out and you need to resume the regeneration.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_93cba07454f06a4a960172bbd6e2a435'] = 'Yes';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_bafd7322c6e97d25b6299b5d6fe8920b'] = 'No';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_32b919d18cfaca89383f6000dcc9c031'] = 'Generate';
|
41
modules/cartsguru/translations/fr.php
Normal file
41
modules/cartsguru/translations/fr.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_2052043f39909e620bd65573706463f6'] = 'Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_dfc39a358ca340a9846a2a8c162de1b9'] = 'La première solution de ciblage et de relance automatisée des paniers abandonnés et des échecs de paiement par téléphone et SMS';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_a12b6c219f12145e967c09ea898a7fbd'] = 'La librairie cURL n\'est pas disponible';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_543c108a7f01cd8df3d8ea24d60fd6e0'] = 'Le module n\'est pas configuré';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_62ce11347fffa067e1ebb94e019ce31c'] = 'Votre boutique est connectée à Carts Guru.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_83e4eef9715a6044ffd2165cc3bf9152'] = 'Les images produits pour Carts Guru ont été générées avec succès.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_d4f225ec09e4b0eba6558753f4bd8edd'] = 'Seulement une partit des images ont été régénérées. Le serveur a mis trop de temps pour finaliser le processus.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_632cd307bc981033384b4f42b7a52d34'] = 'Relancer la génération avec l\'option supprimer à non et cliquer sur le bouton générer';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_60a5980f8b948d9ad23af03206a11620'] = 'Impossible de se connecter avec ces identifiants';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_d63e8b98064ce2cd9f753412cc53cde1'] = 'Champs \'%1$s\' est requis';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_f76cf338d1c364144e7bc74edc5ae195'] = 'Clef d\'authentification';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_305fe996f5b22c6230470bcfabe112ad'] = 'Identifiant du site';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_c888438d14855d7d96a2724ee9c306bd'] = 'Configuration modifiée';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_54eebac864cda3659a446e61c111b28e'] = 'Pour continuer l\'opération, sélectionnez non pour \"Effacer les images précédentes\" et cliquer sur \"Générer\".';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_112afb3cda4a3d63415b4156737b6894'] = 'Carts Guru identification';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_eea26af48ce417a70acc5eb96a8f3592'] = 'L\'option multi-boutique est activée. Si vous voulez configurer le module, vous devez sélectionner une boutique.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_414dfa338951d9eca8a2acd2b361300f'] = 'Fournit par Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_c9cc8cce247e49bae79f15173ce97354'] = 'Sauvegarder';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_d795a8d004d37e375541d838c0c84f15'] = 'Génération des images produits pour Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_fb6df7abfeaae40427dac2b8a4a423dc'] = 'L\'opération est nécessaire si vous ne visualisez pas vos images produits sur votre interface Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_d379cadd41b68efe7c945b4d85c72085'] = 'Effacer les images précédentes';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_62275efff59edb02173db8524943db89'] = 'Sélectionnez \"Non\" si le serveur a mis trop de temps pour finaliser le processus et que vous voulez continuer l\'opération.';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_93cba07454f06a4a960172bbd6e2a435'] = 'Oui';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Non';
|
||||
$_MODULE['<{cartsguru}prestashop>cartsguru_32b919d18cfaca89383f6000dcc9c031'] = 'Générer';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_conf_form14_112afb3cda4a3d63415b4156737b6894'] = 'Carts Guru identification';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_conf_form14_f76cf338d1c364144e7bc74edc5ae195'] = 'Clef d\'authentification';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_conf_form14_305fe996f5b22c6230470bcfabe112ad'] = 'Identifiant du site';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_conf_form14_c9cc8cce247e49bae79f15173ce97354'] = 'Sauvegarder';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_conf_form14_19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_img_form14_d795a8d004d37e375541d838c0c84f15'] = 'Génération des images produits pour Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_img_form14_fb6df7abfeaae40427dac2b8a4a423dc'] = 'L\'opération est nécessaire si vous ne visualisez pas vos images produits sur votre interface Carts Guru';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_img_form14_d379cadd41b68efe7c945b4d85c72085'] = 'Effacer les images précédentes';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_img_form14_93cba07454f06a4a960172bbd6e2a435'] = 'Oui';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_img_form14_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Non';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_img_form14_62275efff59edb02173db8524943db89'] = 'Sélectionnez \"Non\" si le serveur a mis trop de temps pour finaliser le processus et que vous voulez continuer l\'opération.';
|
||||
$_MODULE['<{cartsguru}prestashop>cg_img_form14_c9cc8cce247e49bae79f15173ce97354'] = 'Sauvegarder';
|
27
modules/cartsguru/translations/index.php
Normal file
27
modules/cartsguru/translations/index.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
27
modules/cartsguru/views/index.php
Normal file
27
modules/cartsguru/views/index.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
39
modules/cartsguru/views/templates/admin/cg_conf_form14.tpl
Normal file
39
modules/cartsguru/views/templates/admin/cg_conf_form14.tpl
Normal file
@ -0,0 +1,39 @@
|
||||
{*
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.0.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*}
|
||||
<form action="{$request_uri|escape:'quotes':'UTF-8'}" method="post" autocomplete="off" id="cartsguru_form">
|
||||
<fieldset>
|
||||
<legend>{l s='Carts Guru authentification' mod='cartsguru'}</legend>
|
||||
<label>{l s='API auth key' mod='cartsguru'}:</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="CARTSG_API_AUTH_KEY" value="{if isset($fields_value['CARTSG_API_AUTH_KEY'])}{$fields_value['CARTSG_API_AUTH_KEY']|escape:'html':'UTF-8'}{/if}"/>
|
||||
<sup>*</sup>
|
||||
<p>{l s='Provided by Carts Guru' mod='cartsguru'}</p>
|
||||
</div>
|
||||
<label>{l s='Site Id' mod='cartsguru'}:</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="CARTSG_SITE_ID" value="{if isset($fields_value['CARTSG_SITE_ID'])}{$fields_value['CARTSG_SITE_ID']|escape:'html':'UTF-8'}{/if}"/>
|
||||
<sup>*</sup>
|
||||
<p>{l s='Provided by Carts Guru' mod='cartsguru'}</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="{l s='Save' mod='cartsguru'}" name="submitSettings" class="button">
|
||||
</div>
|
||||
<div class="small"><sup>*</sup>{l s='Required field' mod='cartsguru'}</div>
|
||||
</fieldset>
|
||||
</form>
|
32
modules/cartsguru/views/templates/admin/cg_img_form14.tpl
Normal file
32
modules/cartsguru/views/templates/admin/cg_img_form14.tpl
Normal file
@ -0,0 +1,32 @@
|
||||
{*
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.0.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*}
|
||||
<form action="{$request_uri|escape:'quotes':'UTF-8'}" method="post" autocomplete="off" id="cartsguru_form">
|
||||
<fieldset>
|
||||
<legend>{l s='Product Image Generation for Carts Guru' mod='cartsguru'}</legend>
|
||||
<p>{l s='The operation is required only if you not see your product image in Carts Guru' mod='cartsguru'}</p>
|
||||
<label>{l s='Erase previous images' mod='cartsguru'}:</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="erase" value="1">{l s='Yes' mod='cartsguru'}<input type="radio" name="erase" value="0" checked>{l s='No' mod='cartsguru'}
|
||||
<p>{l s='Select "No" if your server timed out and you need to resume the regeneration.' mod='cartsguru'}</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="{l s='Save' mod='cartsguru'}" name="submitGenerateImage" class="button">
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
39
modules/cartsguru/views/templates/admin/helper_warning.tpl
Normal file
39
modules/cartsguru/views/templates/admin/helper_warning.tpl
Normal file
@ -0,0 +1,39 @@
|
||||
{*
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.0.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.0.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*}
|
||||
{if $ps_version < "1.6"}
|
||||
<div class="warn">
|
||||
{else}
|
||||
<div class="bootstrap">
|
||||
<div class="module_warning alert alert-warning" >
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
{/if}
|
||||
{if $warning|is_array}
|
||||
<ul>
|
||||
{foreach from=warning item="warnmessage"}
|
||||
<li>{$warnmessage|escape:'html':'UTF-8'}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{else}
|
||||
{$warning|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
{if $ps_version < "1.6"}
|
||||
</div></div>
|
||||
{else}
|
||||
</div>
|
||||
{/if}
|
27
modules/cartsguru/views/templates/admin/index.php
Normal file
27
modules/cartsguru/views/templates/admin/index.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
27
modules/cartsguru/views/templates/index.php
Normal file
27
modules/cartsguru/views/templates/index.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Carts Guru
|
||||
*
|
||||
* @category advertising_marketing
|
||||
* @author LINKT IT
|
||||
* @copyright Copyright (c) LINKT IT 2016
|
||||
* @version 1.1.0
|
||||
* @license Commercial license
|
||||
*
|
||||
*************************************
|
||||
** CARTS GURU *
|
||||
** V 1.1.0 *
|
||||
*************************************
|
||||
* +
|
||||
* + Languages: EN, FR
|
||||
* + PS version: 1.4,1.5,1.6
|
||||
* + Cloud compatible & tested
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
4
modules/mailjet/.gitignore
vendored
Normal file
4
modules/mailjet/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.idea
|
||||
translations/translation_*
|
||||
config_*.xml
|
||||
backward_compatibility
|
BIN
themes/site/img/banner/bandeau_superieur_VUutj.png
Normal file
BIN
themes/site/img/banner/bandeau_superieur_VUutj.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
BIN
themes/site/img/banner/bandeau_superieur_mobile_D7Zcw.png
Normal file
BIN
themes/site/img/banner/bandeau_superieur_mobile_D7Zcw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
Loading…
Reference in New Issue
Block a user