first commit

This commit is contained in:
2025-01-06 20:47:25 +01:00
commit 3bdbd78c2f
25591 changed files with 3586440 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Action;
/**
* Class Attributes
* @package Emarketing\Action
*/
class Attributes
{
/**
* @param $postData
* @return array
*/
public function fetchAttributes($postData)
{
$idLang = $this->getIdLanguage($postData);
$serviceAttributes = new \Emarketing\Service\Attributes;
return $serviceAttributes->buildAttributeInformation($idLang);
}
/**
* @param $postData
* @return mixed
*/
private function getIdLanguage($postData)
{
if (!isset($postData['id_language']) || !is_numeric($postData['id_language'])) {
return \Context::getContext()->language->id;
}
return $postData['id_language'];
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Action;
use Emarketing\ClientError;
/**
* Class Categories
* @package Emarketing\Action
*/
class Categories
{
/**
* @param $postData
* @return array
* @throws ClientError
*/
public function fetchCategory($postData)
{
$idCategory = $this->getIdCategory($postData);
$idLang = $this->getIdLanguage($postData);
$serviceCategory = new \Emarketing\Service\Category;
return $serviceCategory->buildCategoryInformation($idCategory, $idLang);
}
/**
* @param $postData
* @return string
* @throws ClientError
*/
private function getIdCategory($postData)
{
if (!isset($postData['id_category']) || !is_numeric($postData['id_category'])) {
throw new ClientError('Invalid Category ID');
}
if ($postData['id_category'] === 0) {
return \Configuration::get('PS_HOME_CATEGORY');
}
return $postData['id_category'];
}
/**
* @param $postData
* @return mixed
*/
private function getIdLanguage($postData)
{
if (!isset($postData['id_language']) || !is_numeric($postData['id_language'])) {
return \Context::getContext()->language->id;
}
return $postData['id_language'];
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Action;
/**
* Class Countries
* @package Emarketing\Action
*/
class Countries
{
/**
* @return array
*/
public function fetchCountries()
{
$serviceCountries = new \Emarketing\Service\Countries;
return $serviceCountries->buildCountryInformation();
}
}

View File

@@ -0,0 +1,87 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Action;
use Emarketing\ClientError;
/**
* Class Products
* @package Emarketing\Action
*/
class Products
{
/**
* @param $postData
* @return array
* @throws ClientError
* @throws \Exception
*/
public function fetchProducts($postData)
{
$offset = $this->checkValidParam($postData, 'offset');
$limit = $this->checkValidParam($postData, 'limit');
$idLang = $this->getIdLanguage($postData);
$idCountry = $this->getIdCountry($postData);
$serviceProducts = new \Emarketing\Service\Products;
$productData = $serviceProducts->buildProductsInformation($offset, $limit, $idLang, $idCountry);
return $productData;
}
/**
* @param $postData
* @param $param
* @return mixed
* @throws ClientError
*/
private function checkValidParam($postData, $param)
{
if (!isset($postData[$param]) || !is_numeric($postData[$param]) || $postData[$param] < 0) {
throw new ClientError('Invalid ' . $param);
}
return $postData[$param];
}
/**
* @param $postData
* @return mixed
*/
private function getIdLanguage($postData)
{
if (!isset($postData['id_language']) || !is_numeric($postData['id_language'])) {
return \Context::getContext()->language->id;
}
return $postData['id_language'];
}
/**
* @param $postData
* @return string
*/
private function getIdCountry($postData)
{
if (!isset($postData['id_country']) || !is_numeric($postData['id_country'])) {
return \Configuration::get('PS_COUNTRY_DEFAULT');
}
return $postData['id_country'];
}
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Action;
/**
* Class Tracker
* @package Emarketing\Action
*/
class Tracker
{
/**
* @param $postData
* @return bool|array
* @throws \Exception
*/
public function receiveTracker($postData)
{
$serviceTracker = new \Emarketing\Service\Tracker;
$globalSiteTracker = $this->getCode($postData, 'global_site_tracker');
$conversionTracker = $this->getCode($postData, 'conversion_tracker');
$leadTracker = $this->getCode($postData, 'lead_tracker');
return $serviceTracker->saveTracker($globalSiteTracker, $conversionTracker, $leadTracker);
}
/**
* @param $postData
* @param $name
* @return string|null
*/
private function getCode($postData, $name)
{
if (!isset($postData[$name])) {
return null;
}
return $postData[$name];
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Action;
use Emarketing\ClientError;
/**
* Class Verification
* @package Emarketing\Action
*/
class Verification
{
/**
* @param $postData
* @return bool
* @throws \Exception
*/
public function receiveTag($postData)
{
$serviceVerification = new \Emarketing\Service\Verification;
if (!isset($postData['tag'])) {
throw new ClientError('Missing tag');
}
return $serviceVerification->saveTag($postData['tag']);
}
}

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,23 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing;
/**
* Class ClientError
* @package Emarketing
*/
class ClientError extends \ErrorException
{
}

View File

@@ -0,0 +1,71 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing;
/**
* Class CurlRequest
* @package Emarketing
*/
class CurlRequest
{
/**
* @var false|resource|null
*/
private $handle = null;
/**
* CurlRequest constructor.
* @param $url
*/
public function __construct($url)
{
$this->handle = curl_init($url);
curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, true);
}
/**
* @param $name
* @param $value
*/
public function setOption($name, $value)
{
curl_setopt($this->handle, $name, $value);
}
/**
* @return bool|string
*/
public function execute()
{
return curl_exec($this->handle);
}
/**
* @param $name
* @return mixed
*/
public function getInfo($name)
{
return curl_getinfo($this->handle, $name);
}
/**
*
*/
public function close()
{
curl_close($this->handle);
}
}

View File

@@ -0,0 +1,94 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing;
/**
* Class ErrorHandler
* @package Emarketing
*/
class ErrorHandler
{
/**
* @var array
*/
private $phpErrors = array();
/**
* @param \Exception $exception
* @return bool
*/
public function handleExceptions($exception)
{
$response = array(
'message' => $exception->getMessage(),
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'trace' => $exception->getTrace()
);
// Catch PrestaShopException
if (!is_null($exception->getPrevious())) {
$response['trace'] = $exception->getPrevious()->getTrace();
}
if (get_class($exception) == 'Emarketing\ClientError') {
return $this->outputError(422, $response);
}
return $this->outputError(520, $response);
}
/**
* @param $errno
* @param $errstr
* @param $errfile
* @param $errline
*
* @throws \ErrorException
*/
public function handleErrors($errno, $errstr, $errfile, $errline)
{
if ($errno == E_ERROR || $errno == E_USER_ERROR) {
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
}
$this->phpErrors[] = array(
'message' => $errstr,
'file' => $errfile,
'line' => $errline,
'errno' => $errno
);
}
/**
* @return array
*/
public function getErrors()
{
return $this->phpErrors;
}
/**
* @param $httpCode
* @param $response
* @return bool
*/
public function outputError($httpCode, $response)
{
header('X-PHP-Response-Code: ' . $httpCode, true, $httpCode);
echo json_encode($response);
return true;
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service;
/**
* Class Attributes
* @package Emarketing\Service
*/
class Attributes
{
/**
* @param $idLang
* @return array
*/
public function buildAttributeInformation($idLang)
{
$attrGroups = \AttributeGroup::getAttributesGroups($idLang);
$features = \Feature::getFeatures($idLang);
$mapData = array(
'attributes' => $attrGroups,
'features' => $features
);
return $mapData;
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service;
use Emarketing\ClientError;
/**
* Class Category
* @package Emarketing\Service
*/
class Category
{
/**
* @param $idCategory
* @param $idLang
* @return array
* @throws ClientError
*/
public function buildCategoryInformation($idCategory, $idLang)
{
$category = new \Category($idCategory);
if (empty($category) || empty($category->id_category)) {
throw new ClientError('No category with this ID');
}
$categoryData = get_object_vars($category);
$categoryData['url'] = $category->getLink(null, $idLang);
$categoryData['children'] = $category->getSubCategories($idLang, true);
return $categoryData;
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service;
/**
* Class Countries
* @package Emarketing\Service
*/
class Countries
{
/**
* @return array
*/
public function buildCountryInformation()
{
$context = \Context::getContext();
$countryData = array(
'default' => array(
'id_country' => \Configuration::get('PS_COUNTRY_DEFAULT'),
'id_language' => \Configuration::get('PS_LANG_DEFAULT'),
'id_currency' => \Configuration::get('PS_CURRENCY_DEFAULT')
),
'active' => array(
'countries' => \Country::getCountries($context->language->id, true, false, false),
'languages' => \Language::getLanguages(true, $context->shop->id),
'currencies' => $this->getCurrencies($context->shop->id)
)
);
return $countryData;
}
/**
* @param $shopId
* @return array
*/
private function getCurrencies($shopId)
{
$currencyData = array();
$currencies = \Currency::getCurrenciesByIdShop($shopId);
foreach ($currencies as $currency) {
$currencyData[] = array(
'id_currency' => (string)$currency['id_currency'],
'name' => $currency['name'],
'iso_code' => $currency['iso_code'],
'conversion_rate' => $currency['conversion_rate'],
'active' => $currency['active'],
'deleted' => $currency['deleted'],
'sign' => $currency['sign'],
'iso_code_num' => $currency['iso_code_num'],
'format' => $currency['format']
);
}
return $currencyData;
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service;
/**
* Class FrontendHeader
* @package Emarketing\Service
*/
class FrontendHeader
{
/**
* @return string
* @throws \Exception
*/
public function buildHtml()
{
$currentPage = \Context::getContext()->controller->php_self;
$html = "<!-- emarketing start -->\n";
$serviceVerification = new Verification;
$html .= $serviceVerification->getTag() . "\n";
$serviceTracker = new Tracker;
$html .= $serviceTracker->getGlobalSiteTracker() . "\n";
if ($currentPage == 'order-confirmation') {
$html .= $serviceTracker->getConversionTracker() . "\n";
}
$html .= "<!-- emarketing end -->";
return $html;
}
}

View File

@@ -0,0 +1,206 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service;
use Emarketing\CurlRequest;
/**
* Class Gateway
* @package Emarketing\Service
*/
class Gateway
{
/**
* @var string
*/
private $ecomConnectUrl = "https://app.emarketing.com/shopsystem-auth/connect?connect-jwt=";
/**
* @var string
*/
private $ecomSignInUrl = "https://app.emarketing.com/?jwt=";
/**
* @var string
*/
private $gatewayUrl = "https://gateway.emarketing.com/gateway_api/sso";
/**
* @return string
*/
public function getEcomUrl()
{
$token = $this->getToken();
$url = $this->ecomSignInUrl;
if (empty($token)) {
$token = $this->register();
$url = $this->ecomConnectUrl;
if (empty($token)) {
return false;
}
}
$jwt = $this->fetchJwt($token);
if (empty($jwt)) {
return false;
}
return $url . $jwt;
}
/**
* @return string
*/
private function getToken()
{
return \Configuration::get('EMARKETING_SHOPTOKEN');
}
/**
* @param $token
* @return bool
*/
private function saveToken($token)
{
return \Configuration::updateValue('EMARKETING_SHOPTOKEN', $token);
}
/**
* @return bool|string
*/
private function register()
{
$data = array(
"partner_short_name" => "prestashop",
"language" => strtolower(substr(\Language::getIsoById(\Configuration::get('PS_LANG_DEFAULT')), 0, 2)),
"country" => strtoupper(\Country::getIsoById(\Configuration::get('PS_COUNTRY_DEFAULT'))),
"email" => \Configuration::get('PS_SHOP_EMAIL')
);
$data = $this->validateRegistrationData($data);
$header = "Origin: " . \Context::getContext()->shop->getBaseURL(true);
$token = $this->registerRequest($data, $header);
if (empty($token)) {
return false;
}
$this->saveToken($token);
return $token;
}
/**
* @param $data
* @return mixed
*/
private function validateRegistrationData($data)
{
$schema = json_decode(file_get_contents('https://ecommerce-os.s3.eu-west-1.amazonaws.com/schema/partner.json'));
$languages = $schema->links[0]->schema->properties->language->enum;
$countries = $schema->links[0]->schema->properties->country->enum;
if (!in_array($data['language'], $languages)) {
$data['language'] = 'en';
}
if (!in_array($data['country'], $countries)) {
$data['country'] = 'DE';
}
return $data;
}
/**
* @param $data
* @param $header
* @return bool|string
*/
private function registerRequest($data, $header)
{
$response = $this->sendRequest('/signup', $header, $data);
if ($response['code'] == 400) {
unset($data['email']);
$response = $this->sendRequest('/signup', $header, $data);
}
if ($response['code'] !== 200 || empty($response['body']->token)) {
return false;
}
return $response['body']->token;
}
/**
* @param $token
* @return bool|string
*/
private function fetchJwt($token)
{
$header = "Authorization: " . $token;
$response = $this->sendRequest('/jwt', $header);
if (empty($response['body']->jwt)) {
return false;
}
return $response['body']->jwt;
}
/**
* @param $path
* @param string $additionalHeader
* @param array $data
* @return array
*/
private function sendRequest($path, $additionalHeader = "", $data = array())
{
$curl = new CurlRequest($this->gatewayUrl . $path);
$dataJson = "";
if (!empty($data)) {
$curl->setOption(CURLOPT_CUSTOMREQUEST, 'POST');
$dataJson = json_encode($data);
$curl->setOption(CURLOPT_POSTFIELDS, $dataJson);
}
$header = array(
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . \Tools::strlen($dataJson),
$additionalHeader
);
$curl->setOption(CURLOPT_HTTPHEADER, $header);
$response = $curl->execute();
$return = array(
'body' => json_decode($response),
'code' => $curl->getInfo(CURLINFO_HTTP_CODE)
);
$curl->close();
return $return;
}
}

View File

@@ -0,0 +1,180 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service;
use Emarketing\Service\Products\Variants;
use Emarketing\Service\Products\Images;
use Emarketing\Service\Products\Carriers;
use Emarketing\Service\Products\Features;
/**
* Class Products
* @package Emarketing\Service
*/
class Products
{
/**
* @var Carriers
*/
private $serviceCarriers;
/**
* @var Variants
*/
private $serviceVariants;
/**
* @var Images
*/
private $serviceImages;
/**
* @var Features
*/
private $serviceFeatures;
/**
* @var \Context
*/
private $context;
/**
* Products constructor.
*/
public function __construct()
{
$this->serviceVariants = new Variants();
$this->serviceImages = new Images();
$this->serviceCarriers = new Carriers();
$this->serviceFeatures = new Features();
$this->context = \Context::getContext();
}
/**
* @param $offset
* @param $limit
* @param $idLang
* @param $idCountry
* @return array
* @throws \Exception
*/
public function buildProductsInformation($offset, $limit, $idLang, $idCountry)
{
$productsData = array();
$productsData['settings'] = $this->getShopSettings();
$products = $this->getAllProducts($offset, $limit, $idLang);
foreach ($products as $product) {
$productData = $this->getProductDetails($product, $idLang, $idCountry);
$productsData[$product['id_product']] = $productData;
}
return $productsData;
}
/**
* @param $offset
* @param $limit
* @param $idLang
* @return array
* @throws \Exception
*/
private function getAllProducts($offset, $limit, $idLang)
{
$products = \Product::getProducts($idLang, $offset, $limit, 'id_product', 'ASC', false, true);
if ($products === false) {
throw new \Exception('Error while fetching products.');
}
return $products;
}
/**
* @param $product
* @param $idLang
* @param $idCountry
* @return array
* @throws \PrestaShopException
*/
private function getProductDetails($product, $idLang, $idCountry)
{
$productData = array();
$psProduct = new \Product($product['id_product'], false, $idLang);
$productData['details'] = $product;
$productData['additional'] = $this->getAdditionalInformation($psProduct, $idLang);
$productData['variants'] = $this->serviceVariants->buildVariantInformation($psProduct, $idLang);
$productData['images'] = $this->serviceImages->buildImageInformation($psProduct, $idLang);
$productData['carriers'] = $this->serviceCarriers->buildCarrierInformation($idLang, $idCountry, $psProduct);
$productData['features'] = $this->serviceFeatures->buildFeatureInformation($psProduct, $idLang);
$productData['attributes'] = $psProduct->getAttributesGroups($idLang);
return $productData;
}
/**
* @return array
*/
private function getShopSettings()
{
$settings = array();
$settings['dimension_unit'] = \Configuration::get('PS_DIMENSION_UNIT');
$settings['weight_unit'] = \Configuration::get('PS_WEIGHT_UNIT');
$settings['allow_ordering_oos'] = \Configuration::get('PS_ORDER_OUT_OF_STOCK');
return $settings;
}
/**
* @param \Product $psProduct
* @param $idLang
* @return array
* @throws \PrestaShopException
*/
public function getAdditionalInformation($psProduct, $idLang)
{
$additional = array();
$additional['categories'] = $psProduct->getCategories();
$additional['url'] = $this->context->link->getProductLink(
$psProduct->id,
null,
null,
null,
$idLang
);
$additional['quantity'] = \StockAvailable::getQuantityAvailableByProduct($psProduct->id);
$additional['availability'] = $psProduct->checkQty(1);
$additional['special_price'] = \SpecificPrice::getByProductId($psProduct->id);
return $additional;
}
}

View File

@@ -0,0 +1,120 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service\Products;
/**
* Class Carriers
* @package Emarketing\Service
*/
class Carriers
{
/**
* @param $idLang
* @param $idCountry
* @param \Product $psProduct
* @return array
* @throws \PrestaShopException
*/
public function buildCarrierInformation($idLang, $idCountry, $psProduct)
{
$idZone = \Country::getIdZone($idCountry);
$carriers = $this->getAllCarriers($idLang, $idZone);
foreach ($carriers as $carrierKey => $carrier) {
$carriers[$carrierKey]['price'] = $this->getShippingCost($idZone, $psProduct, $carrier);
}
return $carriers;
}
/**
* @param $idLang
* @param $idZone
* @return array
*/
private function getAllCarriers($idLang, $idZone)
{
return \Carrier::getCarriers($idLang, true, false, $idZone, null, \Carrier::ALL_CARRIERS);
}
/**
* @param $idZone
* @param \Product $psProduct
* @param $carrier
* @return bool|float
* @throws \PrestaShopException
*/
private function getShippingCost($idZone, $psProduct, $carrier)
{
$carrier = new \Carrier($carrier['id_carrier']);
$rangeTable = $carrier->getRangeTable();
if ($rangeTable == 'range_weight') {
$costs = $this->getCostsByWeight($carrier, $psProduct->weight, $idZone, $carrier->range_behavior);
}
if ($rangeTable == 'range_price') {
$costs = $this->getCostsByPrice($carrier, $psProduct->price, $idZone, $carrier->range_behavior);
}
if (empty($costs)) {
return false;
}
$address = \Address::initialize();
$carrierTax = $carrier->getTaxesRate($address);
if (!empty($carrierTax)) {
return $costs + ($costs * $carrierTax / 100);
}
return $costs;
}
/**
* @param \Carrier $carrier
* @param $productWeight
* @param $idZone
* @param $rangeBehaviour
* @return bool|float
*/
private function getCostsByWeight($carrier, $productWeight, $idZone, $rangeBehaviour)
{
$priceByWeightCheck = \Carrier::checkDeliveryPriceByWeight($carrier->id, $productWeight, $idZone);
if ($priceByWeightCheck || $rangeBehaviour == 0) {
return $carrier->getDeliveryPriceByWeight($productWeight, $idZone);
}
return false;
}
/**
* @param \Carrier $carrier
* @param $productPrice
* @param $idZone
* @param $rangeBehaviour
* @return bool|float
*/
private function getCostsByPrice($carrier, $productPrice, $idZone, $rangeBehaviour)
{
$priceByPriceCheck = \Carrier::checkDeliveryPriceByPrice($carrier->id, $productPrice, $idZone);
if ($priceByPriceCheck || $rangeBehaviour == 0) {
return $carrier->getDeliveryPriceByPrice($productPrice, $idZone);
}
return false;
}
}

View File

@@ -0,0 +1,52 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service\Products;
/**
* Class Features
* @package Emarketing\Service
*/
class Features
{
/**
* @param \Product $psProduct
* @param $idLang
* @return array
* @throws \PrestaShopException
*/
public function buildFeatureInformation($psProduct, $idLang)
{
$features = $psProduct->getFeatures();
$featureData = array();
foreach ($features as $feature) {
$featureData[] = $this->getValue($feature['id_feature_value'], $idLang);
}
return $featureData;
}
/**
* @param $idValue
* @param $idLang
* @return \FeatureValue
* @throws \PrestaShopException
*/
private function getValue($idValue, $idLang)
{
$featureValue = new \FeatureValue($idValue, $idLang);
return get_object_vars($featureValue);
}
}

View File

@@ -0,0 +1,79 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service\Products;
/**
* Class Images
* @package Emarketing\Service
*/
class Images
{
/**
* @var \Context
*/
private $context;
/**
* Images constructor.
*/
public function __construct()
{
$this->context= \Context::getContext();
}
/**
* @param \Product $psProduct
* @param $idLang
* @return mixed
*/
public function buildImageInformation($psProduct, $idLang)
{
$images = array();
$productImages = $psProduct->getImages($idLang);
$images['product'] = $this->addUrls($productImages, $psProduct->link_rewrite);
$images['variants'] = array();
$variantImages = $psProduct->getCombinationImages($idLang);
if (empty($variantImages)) {
return $images;
}
foreach ($variantImages as $variantImage) {
$images['variants'][] = $this->addUrls($variantImage, $psProduct->link_rewrite);
}
return $images;
}
/**
* @param $images
* @param $linkRewrite
* @return array
*/
private function addUrls($images, $linkRewrite)
{
if (empty($images)) {
return array();
}
$completeImages = array();
foreach ($images as $image) {
$image['url'] = $this->context->link->getImageLink($linkRewrite, $image['id_image']);
$completeImages[] = $image;
}
return $completeImages;
}
}

View File

@@ -0,0 +1,84 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service\Products;
/**
* Class Variants
* @package Emarketing\Service
*/
class Variants
{
/**
* @var \Context
*/
private $context;
/**
* Variants constructor.
*/
public function __construct()
{
$this->context = \Context::getContext();
}
/**
* @param \Product $psProduct
* @param $idLang
* @return mixed
* @throws \PrestaShopException
*/
public function buildVariantInformation($psProduct, $idLang)
{
$variants = $psProduct->getAttributesResume($idLang);
if (empty($variants)) {
return array();
}
foreach ($variants as $variantKey => $variant) {
$variants[$variantKey]['url'] = $this->getUrl($psProduct->id, $idLang, $variant['id_product_attribute']);
$variants[$variantKey]['special_price'] = \SpecificPrice::getByProductId(
$psProduct->id,
$variant['id_product_attribute']
);
$variants[$variantKey]['availability'] = $psProduct->checkQty(1);
}
return $variants;
}
/**
* @param $idProduct
* @param $idLang
* @param $idVariant
* @return string
* @throws \PrestaShopException
*/
private function getUrl($idProduct, $idLang, $idVariant)
{
$url = $this->context->link->getProductLink(
$idProduct,
null,
null,
null,
$idLang,
null,
$idVariant
);
return $url;
}
}

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,114 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service;
/**
* Class Tracker
* @package Emarketing\Service
*/
class Tracker
{
/**
* @param $globalSiteTracker
* @param $conversionTracker
* @return bool
* @throws \Exception
*/
public function saveTracker($globalSiteTracker, $conversionTracker)
{
$this->saveInConfiguration('GLOBAL_SITE_TRACKER', $globalSiteTracker);
$this->saveInConfiguration('CONVERSION_TRACKER', $conversionTracker);
return true;
}
/**
* @return string
*/
public function getGlobalSiteTracker()
{
$globalSiteTracker = $this->getFromConfiguration('GLOBAL_SITE_TRACKER');
return $globalSiteTracker;
}
/**
* @return string
* @throws \Exception
*/
public function getConversionTracker()
{
$conversionTracker = $this->getFromConfiguration('CONVERSION_TRACKER');
$idOrder = (int)\Tools::getValue('id_order');
$cart = new \Cart($idOrder);
$currency = new \Currency($cart->id_currency);
$conversionTracker = preg_replace(
'/\'value\'\:[\s\S]+?,/',
"'value': " . $cart->getOrderTotal() . ",",
$conversionTracker
);
$conversionTracker = preg_replace(
'/\'currency\'\:[\s\S]+?,/',
"'currency': '" . $currency->iso_code . "',",
$conversionTracker
);
$conversionTracker = preg_replace(
'/\'transaction_id\'\:[\s\S]+?\'\'/',
"'transaction_id': '" . $idOrder . "',",
$conversionTracker
);
return $conversionTracker;
}
/**
* @param $key
* @param $code
* @return bool
* @throws \Exception
*/
private function saveInConfiguration($key, $code)
{
if (is_null($code) || !is_string($code)) {
return false;
}
$code = htmlentities($code, ENT_QUOTES);
$saved = \Configuration::updateValue('EMARKETING_' . $key, $code);
if (!$saved) {
throw new \Exception('Error while saving ' . $key);
}
return true;
}
/**
* @param $key
* @return string
*/
private function getFromConfiguration($key)
{
$code = \Configuration::get('EMARKETING_' . $key);
return html_entity_decode($code, ENT_QUOTES);
}
}

View File

@@ -0,0 +1,62 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
namespace Emarketing\Service;
/**
* Class Verification
* @package Emarketing\Service
*/
class Verification
{
/**
* @var string
*/
private $configName = 'EMARKETING_VERIFICATION_TAG';
/**
* @param $tag
* @return bool
* @throws \Exception
*/
public function saveTag($tag)
{
if (is_null($tag) || !is_string($tag)) {
$tag = "";
}
$tag = htmlentities($tag, ENT_QUOTES);
$saved = \Configuration::updateValue($this->configName, $tag);
if (!$saved) {
throw new \Exception('Error while saving tag.');
}
return true;
}
/**
* @return string
*/
public function getTag()
{
$tag = \Configuration::get($this->configName);
if (empty($tag)) {
return "";
}
return html_entity_decode($tag);
}
}

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,12 @@
{
"autoload": {
"psr-4": {
"Emarketing\\": "classes/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\Emarketing\\": "tests/"
}
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>emarketing</name>
<displayName><![CDATA[PrestaShop Ads]]></displayName>
<version><![CDATA[2.0.8]]></version>
<description><![CDATA[Boost your sales on Google Shopping! This module is your
one-click-solution for advertising on Google Shopping, Amazon &amp; Facebook. Easy campaign creation,
price-comparison and competitor-check included.]]></description>
<author><![CDATA[emarketing]]></author>
<tab><![CDATA[advertising_marketing]]></tab>
<confirmUninstall><![CDATA[Are you sure you want to uninstall?]]></confirmUninstall>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,26 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
class AdminEmarketingController extends ModuleAdminController
{
/**
* AdminEmarketingController constructor.
* @throws PrestaShopException
*/
public function __construct()
{
parent::__construct();
\Tools::redirectAdmin(\Context::getContext()->link->getAdminLink('AdminModules').'&configure=emarketing');
}
}

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,51 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
require_once(dirname(__FILE__) . '/../../vendor/autoload.php');
/**
* Class EmarketingEcomModuleFrontController
*/
class EmarketingEcomModuleFrontController extends ModuleFrontController
{
/**
* @var \Emarketing\Service\Gateway
*/
private $gateway;
/**
* EmarketingEcomModuleFrontController constructor.
*/
public function __construct()
{
parent::__construct();
$this->gateway = new \Emarketing\Service\Gateway;
}
/**
* @return bool
*/
public function display()
{
return true;
}
/**
* @throws Exception
*/
public function initContent()
{
\Tools::redirect($this->gateway->getEcomUrl());
}
}

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,131 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
require_once(dirname(__FILE__) . '/../../vendor/autoload.php');
/**
* Class EmarketingServiceModuleFrontController
*/
class EmarketingServiceModuleFrontController extends ModuleFrontController
{
/**
* @var \Emarketing\ErrorHandler
*/
private $errorHandler;
/**
* EmarketingServiceModuleFrontController constructor.
*/
public function __construct()
{
$this->errorHandler = new Emarketing\ErrorHandler();
}
/**
*
*/
public function init()
{
header('Content-Type: application/json; charset=utf-8', true);
$this->handleErrors();
}
/**
* @return bool
*/
public function display()
{
return true;
}
/**
* @throws Exception
*/
public function initContent()
{
$postData = json_decode(\Tools::file_get_contents('php://input'), true);
try {
if (!$this->authenticate($postData)) {
return $this->errorHandler->outputError(401, array('errors' => 'Invalid token'));
}
$result = $this->handleActions($postData);
} catch (\PrestaShopException $exception) {
throw new \Exception($exception->getMessage(), 0, $exception);
}
$result = array('result' => $result, 'errors' => $this->errorHandler->getErrors());
echo json_encode($result, JSON_FORCE_OBJECT);
}
/**
*
*/
private function handleErrors()
{
ini_set('display_errors', 'Off');
set_exception_handler(array($this->errorHandler, 'handleExceptions'));
set_error_handler(array($this->errorHandler, 'handleErrors'));
}
/**
* @param $postData
* @return bool
*/
private function authenticate($postData)
{
$token = \Configuration::get('EMARKETING_SHOPTOKEN');
$tokenParts = explode(':', $token);
if (!empty($postData['authorization']) && $postData['authorization'] == $tokenParts[1]) {
return true;
}
return false;
}
/**
* @param $postData
* @return array|bool
* @throws \Emarketing\ClientError
* @throws Exception
*/
private function handleActions($postData)
{
switch ($postData['action']) {
case 'categories':
$action = new \Emarketing\Action\Categories;
return $action->fetchCategory($postData);
case 'countries':
$action = new \Emarketing\Action\Countries;
return $action->fetchCountries();
case 'attributes':
$action = new \Emarketing\Action\Attributes;
return $action->fetchAttributes($postData);
case 'products':
$action = new \Emarketing\Action\Products;
return $action->fetchProducts($postData);
case 'tracker':
$action = new \Emarketing\Action\Tracker;
return $action->receiveTracker($postData);
case 'verification':
$action = new \Emarketing\Action\Verification;
return $action->receiveTag($postData);
default:
throw new \Emarketing\ClientError('Not a valid action');
}
}
}

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,174 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
if (!defined('_PS_VERSION_')) {
exit;
}
require_once(dirname(__FILE__) . '/vendor/autoload.php');
/**
* Class Emarketing
*/
class Emarketing extends Module
{
/**
* Emarketing constructor.
*/
public function __construct()
{
$this->name = 'emarketing';
$this->tab = 'advertising_marketing';
$this->version = '2.0.8';
$this->author = 'emarketing';
$this->module_key = 'f28d5933d349ca55af63ed0b10f6ca33';
$this->need_instance = 0;
$this->ps_versions_compliancy = array(
'min' => '1.6.0.5',
'max' => _PS_VERSION_
);
$this->bootstrap = true;
parent::__construct();
$this->displayName = 'PrestaShop Ads';
$this->description = $this->l('Boost your sales on Google Shopping! This module is your
one-click-solution for advertising on Google Shopping, Amazon & Facebook. Easy campaign creation,
price-comparison and competitor-check included.');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
}
/**
* @return bool
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
public function install()
{
if (!parent::install()) {
return false;
}
\Configuration::updateValue('EMARKETING_SHOPTOKEN', "");
\Configuration::updateValue('EMARKETING_GLOBAL_SITE_TRACKER', "");
\Configuration::updateValue('EMARKETING_CONVERSION_TRACKER', "");
\Configuration::updateValue('EMARKETING_VERIFICATION_TAG', "");
$this->registerHook('displayHeader');
$this->registerHook('displayBackOfficeHeader');
$this->installTab();
return true;
}
/**
* @return bool
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
public function uninstall()
{
if (!parent::uninstall()) {
return false;
}
$this->uninstallTab();
return true;
}
/**
* @return string
* @throws Exception
*/
public function hookDisplayHeader()
{
$serviceFrontendHeader = new \Emarketing\Service\FrontendHeader;
$html = $serviceFrontendHeader->buildHtml();
return $html;
}
/**
*
*/
public function hookDisplayBackOfficeHeader()
{
$this->context->controller->addCss($this->_path . 'views/css/menuTabIcon.css');
}
/**
* @return mixed
*/
public function getContent()
{
$link = new \Link();
$templateData = array(
'ecom_url' => $link->getModuleLink($this->name, 'ecom')
);
$this->smarty->assign($templateData);
return $this->display(__FILE__, 'views/templates/admin/configure.tpl');
}
/**
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
private function installTab()
{
$tab = new Tab();
$tab->module = $this->name;
$languages = \Language::getLanguages(false);
$name = array();
foreach ($languages as $language) {
$name[$language['id_lang']] = 'Advertising';
}
$tab->name = $name;
$tab->class_name = 'AdminEmarketing';
if (version_compare(_PS_VERSION_, '1.7.0', '>=')) {
$tab->icon = 'track_changes';
$tab->id_parent = (int)Tab::getIdFromClassName('IMPROVE');
$tab->save();
} else {
$tab->id_parent = 0;
$tab->add();
}
}
/**
* @return bool
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
private function uninstallTab()
{
$tabId = (int)Tab::getIdFromClassName('AdminEmarketing');
if (!$tabId) {
return true;
}
$tab = new Tab($tabId);
return $tab->delete();
}
}

View File

@@ -0,0 +1,11 @@
<?php
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/emarketing/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

View File

@@ -0,0 +1,91 @@
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_2_0_0()
{
$oldSignupToken = \Configuration::get('EMARKETING_SIGNUP_TOKEN');
$oldShoptoken = \Configuration::get('EMARKETING_SHOP_TOKEN');
if (empty($oldShoptoken) || empty($oldSignupToken)) {
return true;
}
$response = sendRequest(
'/merchant',
'Origin: ' . \Context::getContext()->shop->getBaseURL(true),
array('sso_token' => $oldSignupToken)
);
if ($response['code'] !== 200 || empty($response['body']->token)) {
return true;
}
$newToken = $response['body']->token;
\Configuration::updateValue('EMARKETING_SHOPTOKEN', $newToken);
sleep(2);
sendRequest(
'/shopsystem_connection',
'Authorization: ' . $newToken,
array('shop_token' => $oldShoptoken)
);
return true;
}
/**
* @param $path
* @param string $additionalHeader
* @param array $data
* @return array
*/
function sendRequest($path, $additionalHeader = "", $data = array())
{
$curlHandle = curl_init('https://gateway.emarketing.com/prestashop_api/upgrade' . $path);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
$dataJson = "";
if (!empty($data)) {
curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'POST');
$dataJson = json_encode($data);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $dataJson);
}
$header = array(
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . \Tools::strlen($dataJson),
$additionalHeader
);
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $header);
$response = curl_exec($curlHandle);
$return = array(
'body' => json_decode($response),
'code' => curl_getinfo($curlHandle, CURLINFO_HTTP_CODE)
);
curl_close($curlHandle);
return $return;
}

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit2d54b3797065b490d541cdc80f3666ef::getLoader();

View File

@@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

View File

@@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,9 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,11 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Tests\\Emarketing\\' => array($baseDir . '/tests'),
'Emarketing\\' => array($baseDir . '/classes'),
);

View File

@@ -0,0 +1,52 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit2d54b3797065b490d541cdc80f3666ef
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit2d54b3797065b490d541cdc80f3666ef', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit2d54b3797065b490d541cdc80f3666ef', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit2d54b3797065b490d541cdc80f3666ef::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}

View File

@@ -0,0 +1,39 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit2d54b3797065b490d541cdc80f3666ef
{
public static $prefixLengthsPsr4 = array (
'T' =>
array (
'Tests\\Emarketing\\' => 17,
),
'E' =>
array (
'Emarketing\\' => 11,
),
);
public static $prefixDirsPsr4 = array (
'Tests\\Emarketing\\' =>
array (
0 => __DIR__ . '/../..' . '/tests',
),
'Emarketing\\' =>
array (
0 => __DIR__ . '/../..' . '/classes',
),
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit2d54b3797065b490d541cdc80f3666ef::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2d54b3797065b490d541cdc80f3666ef::$prefixDirsPsr4;
}, null, ClassLoader::class);
}
}

View File

@@ -0,0 +1,11 @@
<?php
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;

11
modules/emarketing/vendor/index.php vendored Normal file
View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,3 @@
.icon-AdminEmarketing:before {
content: "\f140";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,11 @@
<?php
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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,154 @@
{**
* NOTICE OF LICENSE
*
* This file is licenced under the GNU General Public License, version 3 (GPL-3.0).
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* @author emarketing www.emarketing.com <integrations@emarketing.com>
* @copyright 2019 easymarketing AG
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
*}
<div>
<div class="panel emarketing informations col-lg-10 col-lg-offset-1">
<div class="col-lg-10 col-lg-offset-1">
<div class="row emarketing_header">
<div class="presentation col-lg-6">
<div class="col-lg-12">
<div class="row">
<p style="font-size: 40px; font-weight: bold; margin-top: 55px; margin-bottom: 20px; margin-left: -10px;"><img src="{$module_dir|escape:'html':'UTF-8'}views/img/ps-logo.png" alt="Prestashop Ads" style="width: 440px; height: 110px;" /></p>
<p style="margin-bottom: 20px;">
{l s='Sign up to advertise your products to the most interested customers.' mod='emarketing'}
</p>
<p>
<a href="{$ecom_url|escape:'html':'UTF-8'}" target="_blank" rel="noopener noreferrer">Sign up</a><a href="https://support.emarketing.com/?q=prestashop" target="_blank" class="faqbutton" rel="noopener noreferrer">FAQ</a>
</p>
</div>
</div>
</div>
<div class="bgimage col-lg-6 text-center">
<img src="{$module_dir|escape:'html':'UTF-8'}views/img/shape_bg_img.png" style="width: 434px; height: 255px; position: absolute;" />
<img src="{$module_dir|escape:'html':'UTF-8'}views/img/PS_ads_img.png" style="width: 296px; height: 224px; position: relative; left: 75px; top: 35px;" />
</div>
</div>
<div class="row emarketing-content">
<div class="col-lg-8 col-lg-offset-2">
<div class="row">
<div class="col-lg-2">
<img src="{$module_dir|escape:'html':'UTF-8'}views/img/catalog_upload_img.png"/>
</div>
<div class="col-lg-10">
<p class="title">{l s='Simplified catalog upload' mod='emarketing'}</p>
<p class="content">{l s='We help you create an account, generate your product feed and upload it to Google Merchant Center. With a new account, Google will credit back what you spend in the first 30 days, up to 120€.' mod='emarketing'}</p>
</div>
</div>
<div class="row">
<div class="col-lg-2">
<img src="{$module_dir|escape:'html':'UTF-8'}views/img/google_smart_shopping_campaign_img.png"/>
</div>
<div class="col-lg-10">
<p class="title">{l s='Smart Shopping campaigns on Google' mod='emarketing'}</p>
<p class="content">{l s='On PrestaShop Ads, you only need to set your budget to launch a Smart Shopping campaign on Google. Your products will appear on Google Search, Display, Gmail and YouTube, on mobile and desktop.' mod='emarketing'}</p>
</div>
</div>
<div class="row">
<div class="col-lg-2">
<img src="{$module_dir|escape:'html':'UTF-8'}views/img/competitors_analysis_img.png"/>
</div>
<div class="col-lg-10">
<p class="title">{l s='Competitors Analysis' mod='emarketing'}</p>
<p class="content">{l s='If you sell products that others are selling, you can monitor competitors\' prices on Amazon, eBay and Shopping ads. Create alerts to reprice your articles and focus your ads on your most promising products.' mod='emarketing'}</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="clear: both;">&nbsp;</div>
</div>
<style type="text/css">
.informations {
font-family: OpenSans-Regular, sans-serif;
font-size: 16px;
color: #363A41;
letter-spacing: 0;
line-height: 24px;
}
.emarketing {
padding: 0 16px 20px !important;
}
.emarketing img {
display: block;
height: 257px;
margin: 0;
}
.emarketing a, .emarketing a:hover, .emarketing a:active, .emarketing a:focus {
display: inline-block;
background-color: #24B9D7;
border: 1px solid #24B9D7;
border-radius: 1px;
padding: 5px 12px;
margin-right: 20px;
text-decoration: none;
color: #fff;
font-size: 14px;
font-weight: bold;
}
a.faqbutton {
color: #24B9D7 !important;
background-color: #fff !important;
}
.emarketing_header {
border-bottom: 1px solid #ccc;
height: 300px;
}
.emarketing-content {
margin: 20px 0;
}
.emarketing-content img {
width: 90px;
height: 90px;
margin-bottom: 15px;
}
.emarketing-content .row {
margin: 15px 0 35px 0;
}
.emarketing-content .row:last-child{
margin-bottom: 0;
}
.emarketing-content .row i{
font-size: 34px;
}
.emarketing-content .row .title{
color: #363A41;
font-family: "Open Sans";
font-size: 28px;
line-height: 19px;
font-weight: normal;
margin-top: 6px;
margin-bottom: 20px;
}
.emarketing-content .row .content{
color: #6C868E;
font-family: "Open Sans";
font-size: 14px;
line-height: 19px;
}
.emarketing-content .material-icons.green {
color: #00b555;
}
.emarketing-content .material-icons.red {
color: #f9001a;
}
.emarketing-content .material-icons.yellow {
color: #ffc100;
}
@media only screen and (max-width: 1240px) {
.bgimage {
display: none;
}
}
</style>

View File

@@ -0,0 +1,11 @@
<?php
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;

View File

@@ -0,0 +1,11 @@
<?php
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;