diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 03eb7bd..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "backward_compatibility"] - path = backward_compatibility - url = https://github.com/PrestaShop/PrestaShop-backward_compatibility diff --git a/backward_compatibility b/backward_compatibility deleted file mode 160000 index 35e345c..0000000 --- a/backward_compatibility +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 35e345cb573926c15094ba742039827a55d39de3 diff --git a/classes/GAdwordsModuleManagement.php b/classes/GAdwordsModuleManagement.php new file mode 100644 index 0000000..ed0ccca --- /dev/null +++ b/classes/GAdwordsModuleManagement.php @@ -0,0 +1,99 @@ + + * @copyright 2007-2019 PrestaShop SA + * @version Release: $Revision: 17142 $ + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +class GAdwordsModuleManagement +{ + /** + * Manage the module and return the module configuration link if it is installed + * + * @param string $moduleName + * @param int $moduleId + * + * @return bool + */ + public function moduleManagement($moduleName, $moduleId) + { + // Is the module is installed ? + if (Module::isInstalled($moduleName)) { + return true; + } + + if (!$this->isModuleOnDisk($moduleName, $moduleId)) { + return false; + } + + $modulePrestashopAds = Module::getInstanceByName($moduleName); + + if (!$modulePrestashopAds) { + return false; + } + + return $modulePrestashopAds->install(); + } + + /** + * Check if a module is on the disk + * + * @param string $moduleName + * @param int $moduleId + * + * @return bool + */ + private function isModuleOnDisk($moduleName, $moduleId) + { + $modulesOnDisk = Module::getModulesDirOnDisk(); + + if (in_array($moduleName, $modulesOnDisk)) { + return true; + } + + return $this->downloadModule($moduleName, $moduleId); + } + + /** + * Download module from Addons + * + * @param string $moduleName + * @param int $moduleId + * + * @return bool + */ + public function downloadModule($moduleName, $moduleId) + { + $length = file_put_contents( + _PS_MODULE_DIR_.basename($moduleName).'.zip', + Tools::addonsRequest('module', array('id_module' => $moduleId)) + ); + + if (!empty($length) && Tools::ZipExtract(_PS_MODULE_DIR_.basename($moduleName).'.zip', _PS_MODULE_DIR_)) { + @unlink(_PS_MODULE_DIR_.basename($moduleName).'.zip'); + return true; + } + + return false; + } +} diff --git a/css/index.php b/classes/index.php similarity index 100% rename from css/index.php rename to classes/index.php diff --git a/config.xml b/config.xml index c4246fd..95563ad 100644 --- a/config.xml +++ b/config.xml @@ -1,12 +1,12 @@ - gadwords - - - - - - 1 - 1 + gadwords + + + + + + 1 + 1 - + \ No newline at end of file diff --git a/controllers/admin/AdminModuleManagerController.php b/controllers/admin/AdminModuleManagerController.php new file mode 100755 index 0000000..100650d --- /dev/null +++ b/controllers/admin/AdminModuleManagerController.php @@ -0,0 +1,53 @@ + + * @copyright 2007-2019 PrestaShop SA + * @version Release: $Revision: 17142 $ + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +require_once dirname(__FILE__).'/../../classes/GAdwordsModuleManagement.php'; + +class AdminModuleManagerController extends ModuleAdminController +{ + /** + * Install the module PRESTASHOP_ADS_MODULE_NAME on ajax call + * + * @return void + */ + public function ajaxProcessInstallModule() + { + $moduleAds = new GAdwordsModuleManagement(); + + $installModule = $moduleAds->moduleManagement( + $this->module::PRESTASHOP_ADS_MODULE_NAME, + $this->module::PRESTASHOP_ADS_MODULE_ID + ); + + $returnJson = array( + 'installed' => $installModule, + 'moduleLink' => $this->module->getModulePrestashopAdsLink($installModule), + ); + + $this->ajaxDie(\Tools::jsonEncode($returnJson)); + } +} diff --git a/controllers/admin/index.php b/controllers/admin/index.php new file mode 100755 index 0000000..5ad7ec2 --- /dev/null +++ b/controllers/admin/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2019 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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; diff --git a/controllers/index.php b/controllers/index.php new file mode 100755 index 0000000..5ad7ec2 --- /dev/null +++ b/controllers/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2019 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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; diff --git a/css/gadwords-nobootstrap.css b/css/gadwords-nobootstrap.css deleted file mode 100644 index 8e130a3..0000000 --- a/css/gadwords-nobootstrap.css +++ /dev/null @@ -1,74 +0,0 @@ -/** -* 2007-2015 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 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/afl-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 -* @copyright 2007-2015 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -#content .panel { -border-radius: 5px; -border: 1px solid rgb(230, 230, 230); -font-family: 'Open Sans', Helvetica, Arial, sans-serif; -box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 0px 0px, rgb(255, 255, 255) 0px 0px 0px 3px inset; -color: rgb(85, 85, 85); -display: block; -font-size: 12px; -margin: 0 auto 20px auto; -max-width: 900px; -background: white; -padding: 10px 20px 20px 20px; -} -#content hr { -border-bottom: 1px solid rgb(230, 230, 230); -} -.gadwords-header > div, -.gadwords-content > .row { - background-color: white; -} -.gadwords-content a { -color: #00aff0; -} -.gadwords-header .text-center { -text-align: center; -} -.gadwords-content .text-center { -text-align: center; -} -.gadwords-content ul { -list-style: disc; -} -.gadwords-content ul { -margin:auto; -padding:auto; -padding-left:40px; -} -#adwords_voucher { - background-color: #f5f5f5; - border: 1px solid #ccc; - border-radius: 3px; - color: #333; - display: block; - font-size: 11px; - line-height: 1.42857; - padding: 8px; - word-break: break-all; - word-wrap: break-word; -} \ No newline at end of file diff --git a/gadwords.php b/gadwords.php index 1d46596..376a02b 100644 --- a/gadwords.php +++ b/gadwords.php @@ -1,6 +1,6 @@ - * @copyright 2007-2015 PrestaShop SA - * @version Release: $Revision: 17142 $ + * @copyright 2007-2019 PrestaShop SA + * @version Release: $Revision: 17142 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -if (!defined('_PS_VERSION_')) - exit; +if (!defined('_PS_VERSION_')) { + exit; +} class GAdwords extends Module { - - public function __construct() - { - $this->name = 'gadwords'; - $this->tab = 'advertising_marketing'; - $this->version = '1.3.6'; - $this->author = 'PrestaShop'; - $this->need_instance = 1; - - $this->bootstrap = true; - parent::__construct(); - - $this->displayName = $this->l('Google AdWords'); - $this->description = $this->l('You want to be more visible on Google and attract new clients ? Use our 75€ promo code on Google Adwords !'); - - if (_PS_VERSION_ < '1.5') - require(_PS_MODULE_DIR_.$this->name.'/backward_compatibility/backward.php'); - - if (!isset($this->_path)) - $this->_path = _PS_MODULE_DIR_.$this->name; - } - - public function install() - { - return parent::install() && $this->registerHook('backOfficeHeader'); - } - - public function hookBackOfficeHeader() - { - if (strcmp(Tools::getValue('configure'), $this->name) === 0) - { - if (version_compare(_PS_VERSION_, '1.5', '>') == true) - { - $this->context->controller->addCSS($this->_path.'css/gadwords.css'); - if (version_compare(_PS_VERSION_, '1.6', '<') == true) - $this->context->controller->addCSS($this->_path.'css/gadwords-nobootstrap.css'); - } - else - { - echo ''; - echo ''; - } - } - } - - public function getContent() - { - switch (Tools::strtolower($this->context->language->iso_code)) - { - case 'be': - $landing_page = 'http://www.google.com/intl/fr/ads/get/prestashop75/index.html'; - break; - case 'cz': - $landing_page = 'http://www.google.com/ads/get/prestashop1000/index.html'; - break; - case 'de': - $landing_page = 'http://www.google.com/intl/de/ads/get/prestashop50/index.html'; - break; - case 'fr': - $landing_page = 'http://www.google.com/intl/fr/ads/get/prestashop75/index.html'; - break; - case 'gb': - case 'en': - $landing_page = 'http://www.google.co.uk/ads/get/prestashop75/index.html'; - break; - case 'es': - $landing_page = 'http://www.google.com/intl/es/ads/get/prestashop75/index.html'; - break; - case 'it': - $landing_page = 'http://www.google.com/intl/it/ads/get/prestashop75/index.html'; - break; - case 'nl': - $landing_page = 'http://www.google.com/intl/nl/ads/get/prestashop75/index.html'; - break; - case 'pl': - $landing_page = 'http://www.google.com/intl/pl/ads/get/prestashop250/index.html'; - break; - case 'ro': - $landing_page = 'http://www.google.com/ads/get/prestashop200/index.html'; - break; - default: - $landing_page = 'http://www.google.co.uk/adwords/start'; - } - - $is_local = preg_match('/^172\.16\.|^192\.168\.|^10\.|^127\.|^localhost|\.local$/', Configuration::get('PS_SHOP_DOMAIN')); - - //Prepare data for voucher code - $data = array( - 'campaign' => $this->name, - 'iso_country' => $this->context->country->iso_code, - 'iso_lang' => $this->context->language->iso_code, - 'ps_version' => _PS_VERSION_, - 'host' => Configuration::get('PS_SHOP_DOMAIN'), - 'is_local' => $is_local, - 'email' => $is_local ? Configuration::get('PS_SHOP_EMAIL') : '' - ); - - $code = '----'; - - // Call to get voucher code - $content = Tools::jsonDecode(Tools::file_get_contents('https://gamification.prestashop.com/get_campaign.php?'.http_build_query($data))); - if ($content) - { - if (isset($content->error) && isset($content->code)) - { - if ($content->error === false) - $code = $content->code; - else - Logger::addLog('Module Google AdWords: Error returned by the Gamification ('.$content->code.').', 3); - } - else - Logger::addLog('Module Google AdWords: Missing required fields.', 3); - } - else - Logger::addLog('Module Google AdWords: Unexpected data returned from the Gamification.', 3); - - $this->context->smarty->assign(array( - 'module_dir' => $this->_path, - 'code' => $code, - 'landing_page' => $landing_page, - 'is_local' => $is_local, - )); - return $this->display(__FILE__, 'views/templates/admin/gadwords.tpl'); - } - + const PRESTASHOP_ADS_MODULE_NAME = 'emarketing'; + const PRESTASHOP_ADS_MODULE_ID = 18716; + + public $name; + public $tab; + public $version; + public $author; + public $bootstrap; + public $displayName; + public $description; + public $ps_versions_compliancy; + public $isPrestashop16; + + public function __construct() + { + $this->name = 'gadwords'; + $this->tab = 'advertising_marketing'; + $this->version = '2.0.0'; + $this->author = 'PrestaShop'; + $this->bootstrap = true; + parent::__construct(); + + $this->displayName = $this->l('Google Ads'); + $this->description = $this->l('Get visible results with Shopping Ads from Google. Make it easy for shoppers to discover and buy your products with a Google Smart Shopping campaign in PrestaShop.'); + $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); + $this->isPrestashop16 = version_compare(_PS_VERSION_, '1.7.0.0', '<'); + $this->controller = 'AdminModuleManager'; + } + + /** + * Install the module gadwords and manage the module Prestashop Ads + * + * @return bool + */ + public function install() + { + return parent::install() & $this->installTab(); + } + + /** + * This method is often use to create an ajax controller + * + * @param none + * @return bool + */ + private function installTab() + { + $tab = new Tab(); + $tab->class_name = $this->controller; + $tab->active = 1; + $tab->name = array(); + + foreach (Language::getLanguages(true) as $lang) { + $tab->name[$lang['id_lang']] = $this->name; + } + + $tab->id_parent = -1; + $tab->module = $this->name; + + return $tab->add(); + } + + /** + * Load Assets + * + * @return void + */ + private function loadAssets() + { + if ($this->isPrestashop16) { + $this->context->controller->addCSS('//fonts.googleapis.com/icon?family=Material+Icons'); + } + + $this->context->controller->addCSS($this->_path.'views/css/gadwords.css'); + $this->context->controller->addJS($this->_path.'views/js/admin.js'); + + Media::addJsDef(array( + 'gadwords_controller_url' => $this->context->link->getAdminLink($this->controller), + 'gadwords_controller_name' => $this->controller, + 'gadwords_ajax_error' => $this->l('Unable to install Prestashop Ads'), + )); + } + + /** + * Get the module's configuration link for Prestashop 1.6 or Prestashop 1.7 + * + * @param bool $moduleIsInstalled + * + * @return string + */ + public function getModulePrestashopAdsLink($moduleIsInstalled) + { + if (false === $moduleIsInstalled) { + return ''; + } + + if ($this->isPrestashop16) { + return $this->context->link->getAdminLink('AdminModules').'&configure='.self::PRESTASHOP_ADS_MODULE_NAME; + } + + return $this->context->link->getAdminLink( + 'AdminModules', + true, + false, + array('configure' => self::PRESTASHOP_ADS_MODULE_NAME) + ); + } + + /** + * getContent + * + * @return string + */ + public function getContent() + { + $this->loadAssets(); + + $moduleAdsIsInstalled = Module::isInstalled(self::PRESTASHOP_ADS_MODULE_NAME); + + $this->context->smarty->assign(array( + 'module_dir' => $this->_path, + 'moduleLink' => $this->getModulePrestashopAdsLink($moduleAdsIsInstalled), + 'modulePrestashopAdsInstalled' => $moduleAdsIsInstalled, + )); + + return $this->display(__FILE__, 'views/templates/admin/router.tpl'); + } } diff --git a/img/header_logo.jpg b/img/header_logo.jpg deleted file mode 100644 index 75f308e..0000000 Binary files a/img/header_logo.jpg and /dev/null differ diff --git a/logo.gif b/logo.gif deleted file mode 100644 index 7a17a15..0000000 Binary files a/logo.gif and /dev/null differ diff --git a/logo.png b/logo.png index 9d6fc53..a0107da 100644 Binary files a/logo.png and b/logo.png differ diff --git a/de.php b/translations/de.php similarity index 100% rename from de.php rename to translations/de.php diff --git a/es.php b/translations/es.php similarity index 100% rename from es.php rename to translations/es.php diff --git a/fr.php b/translations/fr.php similarity index 100% rename from fr.php rename to translations/fr.php diff --git a/gb.php b/translations/gb.php similarity index 100% rename from gb.php rename to translations/gb.php diff --git a/img/index.php b/translations/index.php similarity index 100% rename from img/index.php rename to translations/index.php diff --git a/it.php b/translations/it.php similarity index 100% rename from it.php rename to translations/it.php diff --git a/nl.php b/translations/nl.php similarity index 100% rename from nl.php rename to translations/nl.php diff --git a/pl.php b/translations/pl.php similarity index 100% rename from pl.php rename to translations/pl.php diff --git a/pt.php b/translations/pt.php similarity index 100% rename from pt.php rename to translations/pt.php diff --git a/views/css/gadwords.css b/views/css/gadwords.css new file mode 100644 index 0000000..b0ab3e3 --- /dev/null +++ b/views/css/gadwords.css @@ -0,0 +1,142 @@ +/** +* 2007-2019 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 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/afl-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 +* @copyright 2007-2019 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +/** Header **/ +.gadwords_header { + padding: 20px 0; + border-bottom: 1px solid #DCE1E3; +} +.gadwords_header img { + max-width: 100%; +} +.gadwords_header .presentation .logo{ + padding: 0; + margin-bottom: 15px; +} +.gadwords_header .presentation h1{ + color: #363A41; + font-family: "Open Sans"; + font-size: 24px; + line-height: 33px; + margin-top: 0px; +} +.gadwords_header .presentation p{ + margin: 25px 0; + color: #363A41; + font-family: "Open Sans"; + font-size: 16px; + line-height: 24px; +} +/** content **/ +.gadwords-content { + margin: 20px 0; +} +.gadwords-content img { + max-width: 100%; + margin-bottom: 15px; +} +.gadwords-content .row { + margin: 15px 0 35px 0; +} +.gadwords-content .row:last-child{ + margin-bottom: 0; +} +.gadwords-content .row i{ + font-size: 34px; +} +.gadwords-content .row .title{ + color: #363A41; + font-family: "Open Sans"; + font-size: 18px; + line-height: 19px; + font-weight: 600; + margin-top: 6px; + margin-bottom: 15px; +} +.gadwords-content .row .content{ + color: #6C868E; + font-family: "Open Sans"; + font-size: 14px; + line-height: 19px; +} +.gadwords-content .material-icons.green { + color: #00b555; +} +.gadwords-content .material-icons.red { + color: #f9001a; +} +.gadwords-content .material-icons.yellow { + color: #ffc100; +} + +/** create ads**/ +.activate_ads { + padding: 15px 0; +} +.activate_ads img { + max-width: 100%; +} +.activate_ads p { + color: #363A41; + font-family: "Open Sans"; + font-size: 16px; + line-height: 24px; + margin-top: 10px; +} +.activate_ads .btn-primary { + margin-top: 20px; + border-radius: 1px; + box-shadow: 1px 1px 3px 0 rgba(0,0,0,0.1); + color: #FFFFFF; + font-family: "Open Sans"; + font-size: 14px; + font-weight: 600; + line-height: 20px; + text-transform: capitalize !important; + background-color: #24B9D7 !important; + border-color: #24B9D7 !important; +} + +/* Spinner */ +.loader { + display: none; + border-radius: 50%; + -webkit-animation: spin 2s linear infinite; + animation: spin 2s linear infinite; + margin: auto; + margin-top: 25px; + border: 3px solid #f3f3f3; + border-top: 3px solid #25b9d7; + width: 31px; + height: 31px; +} +@-webkit-keyframes spin { + 0% { -webkit-transform: rotate(0deg); } + 100% { -webkit-transform: rotate(360deg); } +} +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} diff --git a/views/css/index.php b/views/css/index.php new file mode 100644 index 0000000..a85fb99 --- /dev/null +++ b/views/css/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2012 PrestaShop SA +* @version Release: $Revision: 14011 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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; \ No newline at end of file diff --git a/views/img/Ads_icon_benefit01.png b/views/img/Ads_icon_benefit01.png new file mode 100644 index 0000000..5c97aed Binary files /dev/null and b/views/img/Ads_icon_benefit01.png differ diff --git a/views/img/Ads_icon_benefit02.png b/views/img/Ads_icon_benefit02.png new file mode 100644 index 0000000..1cc2c1b Binary files /dev/null and b/views/img/Ads_icon_benefit02.png differ diff --git a/views/img/Ads_icon_benefit03.png b/views/img/Ads_icon_benefit03.png new file mode 100644 index 0000000..7d5703f Binary files /dev/null and b/views/img/Ads_icon_benefit03.png differ diff --git a/views/img/for_shopping.png b/views/img/for_shopping.png new file mode 100644 index 0000000..e2f90a4 Binary files /dev/null and b/views/img/for_shopping.png differ diff --git a/views/img/google_logo.png b/views/img/google_logo.png new file mode 100644 index 0000000..ccafc24 Binary files /dev/null and b/views/img/google_logo.png differ diff --git a/views/img/index.php b/views/img/index.php new file mode 100644 index 0000000..a85fb99 --- /dev/null +++ b/views/img/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2012 PrestaShop SA +* @version Release: $Revision: 14011 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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; \ No newline at end of file diff --git a/views/img/target_img.png b/views/img/target_img.png new file mode 100644 index 0000000..3ab477a Binary files /dev/null and b/views/img/target_img.png differ diff --git a/views/js/admin.js b/views/js/admin.js new file mode 100644 index 0000000..eac83b2 --- /dev/null +++ b/views/js/admin.js @@ -0,0 +1,55 @@ +/** +* 2007-2019 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 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/afl-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 +* @copyright 2007-2019 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +var installModule = (e) => { + $('#gadwords_action-btn #gadwords_installmodule').hide(); + $('#gadwords_action-btn .loader').show(); + + $.ajax({ + type: 'POST', + url: gadwords_controller_url, + dataType: 'json', + data: { + controller : gadwords_controller_name, + action : 'InstallModule', + ajax : true + }, + success: (json) => { + $('#gadwords_action-btn .loader').hide(); + + if (json.installed === true) { + // redirect to module configuration's page + window.location.href = json.moduleLink; + } else { + $('#gadwords_installmodule').show(); + } + }, + error: () => { + $.growl.error({ title: "Notice!", message: gadwords_ajax_error }); + } + }); +} + +$(document).on('click', '#gadwords_installmodule', installModule); diff --git a/views/js/index.php b/views/js/index.php new file mode 100644 index 0000000..a85fb99 --- /dev/null +++ b/views/js/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2012 PrestaShop SA +* @version Release: $Revision: 14011 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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; \ No newline at end of file diff --git a/views/templates/admin/create_ads.tpl b/views/templates/admin/create_ads.tpl new file mode 100644 index 0000000..24ae4aa --- /dev/null +++ b/views/templates/admin/create_ads.tpl @@ -0,0 +1,45 @@ +{* +* 2007-2019 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 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/afl-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 +* @copyright 2007-2019 PrestaShop SA +* @version Release: $Revision: 14985 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +
+
+
+ {l s='Google AdWords' mod='gadwords'} +
+
+

{l s='Start advertising on Google Shopping with the PrestaShop Ads module, get up to 120€ in ad credit.' mod='gadwords'}

+
+
+
+ + {l s='Activate PrestaShop Ads' mod='gadwords'} + + {if false === $modulePrestashopAdsInstalled} + {l s='Activate PrestaShop Ads' mod='gadwords'} + {/if} +
+
+
diff --git a/views/templates/admin/gadwords.tpl b/views/templates/admin/gadwords.tpl deleted file mode 100644 index fe53381..0000000 --- a/views/templates/admin/gadwords.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{* -* 2007-2015 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 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/afl-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 -* @copyright 2007-2015 PrestaShop SA -* @version Release: $Revision: 14985 $ -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - -
-
-
- -
-
- -
-
-
-
-
-
-

- - {l s='Show your ad to people at the very moment they are searching for what you offer. Google and PrestaShop increase your advertising investment by offering free advertising after you start spending!' mod='gadwords'} - -

- -
    -
  • {l s='Add your promotional code from Prestashop after entering billing details, and we will automatically credit your account when you spend a minimum credit*.' mod='gadwords'}
  • -
  • {l s='Got questions? Call at 0800 169 0489, and a Google AdWords expert will help you build your first campaign and offer tips on how to get the most out of AdWords.' mod='gadwords'}
  • -
-
-
-

{l s='Your Google AdWords promotional code for your shop is' mod='gadwords'}:

-
{$code|escape:htmlall}
-

{l s='Start your campaign now with your promotional code' mod='gadwords'}

-
- - * {l s='terms and conditions apply.' mod='gadwords'} - -
-
-
-
diff --git a/views/templates/admin/informations.tpl b/views/templates/admin/informations.tpl new file mode 100644 index 0000000..cd0caf4 --- /dev/null +++ b/views/templates/admin/informations.tpl @@ -0,0 +1,81 @@ +{* +* 2007-2019 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 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/afl-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 +* @copyright 2007-2019 PrestaShop SA +* @version Release: $Revision: 14985 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +
+
+ {* Google present Shopping ads *} +
+
+ +
+
+ {l s='for shopping' mod='gadwords'} +

+ {l s='Make it easy for shoppers to discover and buy your products with a Google Smart Shopping campaign in PrestaShop.' mod='gadwords'} +

+
+
+
+
+ +
+
+ {* Reassurance *} +
+
+
+
+ +
+
+

{l s='Smarter Campaigns. Wider reach.' mod='gadwords'}

+

{l s='Reach shoppers searching for the products you offer at the moment they want to purchase them - across Google Search, YouTube, Gmail and more!' mod='gadwords'}

+
+
+
+
+ +
+
+

{l s='No time? No problem!' mod='gadwords'}

+

{l s='After installation, all you need to do is setting a budget and Google smart technology does all the rest, like ad placement and bidding. Pay only when shoppers click on your Ads.' mod='gadwords'}

+
+
+
+
+ +
+
+

{l s='A picture is worth a thousand words' mod='gadwords'}

+

{l s='Many advertisers will see their Click Through Rate double or even triple with Shopping ads compared with text-only ads.' mod='gadwords'}

+
+
+
+
+
+
diff --git a/css/gadwords.css b/views/templates/admin/router.tpl similarity index 61% rename from css/gadwords.css rename to views/templates/admin/router.tpl index 119a58b..dc1df5d 100644 --- a/css/gadwords.css +++ b/views/templates/admin/router.tpl @@ -1,5 +1,5 @@ -/** -* 2007-2015 PrestaShop +{* +* 2007-2019 PrestaShop * * NOTICE OF LICENSE * @@ -17,23 +17,12 @@ * 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 -* @copyright 2007-2015 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ +* @author PrestaShop SA +* @copyright 2007-2019 PrestaShop SA +* @version Release: $Revision: 14985 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} -#content > * { - margin: 0 auto; - max-width: 900px; -} - -#adwords_voucher { - max-width: 40em; - margin:auto; - margin-bottom: 10px; -} - -#adwords_logo { - margin-top:3em; -} \ No newline at end of file +{include file="./informations.tpl"} +{include file="./create_ads.tpl"} \ No newline at end of file