From 9ae6a403a5c98ed39e9e76fb0db0aa14afafdc80 Mon Sep 17 00:00:00 2001 From: ThomasJanda Date: Fri, 13 Mar 2020 01:29:50 +0100 Subject: [PATCH] init --- Application/views/admin/de/rs-awin_lang.php | 9 ++++ Core/Controller/ThankYouController.php | 47 +++++++++++++++++++++ Core/ViewConfig.php | 24 +++++++++++ README.md | 29 +++++++++++++ composer.json | 24 +++++++++++ metadata.php | 36 ++++++++++++++++ views/blocks/layout/base__base_js.tpl | 2 + 7 files changed, 171 insertions(+) create mode 100755 Application/views/admin/de/rs-awin_lang.php create mode 100755 Core/Controller/ThankYouController.php create mode 100755 Core/ViewConfig.php create mode 100755 README.md create mode 100755 composer.json create mode 100755 metadata.php create mode 100755 views/blocks/layout/base__base_js.tpl diff --git a/Application/views/admin/de/rs-awin_lang.php b/Application/views/admin/de/rs-awin_lang.php new file mode 100755 index 0000000..922366e --- /dev/null +++ b/Application/views/admin/de/rs-awin_lang.php @@ -0,0 +1,9 @@ + 'UTF-8', + + 'SHOP_MODULE_GROUP_rs-awin_main' => 'Grundeinstellungen', + 'SHOP_MODULE_rs-awin_id' => 'Advertiser Id', +); diff --git a/Core/Controller/ThankYouController.php b/Core/Controller/ThankYouController.php new file mode 100755 index 0000000..c674a5b --- /dev/null +++ b/Core/Controller/ThankYouController.php @@ -0,0 +1,47 @@ +rs_awin(); + return $sRet; + } + protected function rs_awin() + { + + /** + * @var \oxorder $oOrder + */ + $oOrder = $this->getOrder(); + + $sMerchant = (int) $this->getConfig()->getConfigParam('rs-awin_id'); + if($sMerchant!="") + { + $awc = \OxidEsales\Eshop\Core\Registry::getUtilsServer()->getOxCookie('awc'); + + $url = "https://www.awin1.com/sread.php?tt=ss&tv=2&merchant=".$sMerchant; + $url .= "&amount=" . $oOrder->getTotalOrderSum(); + $url .= "&ch=aw"; + $url .= "&cr=" . $oOrder->getOrderCurrency()->name; + $url .= "&ref=" . $oOrder->oxorder__oxordernr->value; + $url .= "&parts=DEFAULT:" . $oOrder->getTotalOrderSum(); + $url .= "&testmode=0&vc=" . ""; + if ($awc!="") { + $url .= "&cks=" . $awc; // Populate the Awin click checksum if one is associated with the conversion + } + + $c = curl_init(); + curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + curl_setopt($c, CURLOPT_URL, $url); + curl_exec($c); + curl_close($c); + + } + } +} diff --git a/Core/ViewConfig.php b/Core/ViewConfig.php new file mode 100755 index 0000000..07af659 --- /dev/null +++ b/Core/ViewConfig.php @@ -0,0 +1,24 @@ +getRequestParameter("awc"); + if($sValue!="") + { + $iDays=365; + $sName = "awc"; + $iTime = time() + $iDays*24*60*60; + \OxidEsales\Eshop\Core\Registry::getUtilsServer()->setOxCookie($sName, $sValue, $iTime); + } + } +} diff --git a/README.md b/README.md new file mode 100755 index 0000000..f169bf5 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# Oxid Cookie Manager + +## Description + +Implement the Awin tracking. + +https://wiki.awin.com/index.php/Advertiser_Tracking_Guide/Conversion_Pixel_Only_Tracking + +## Install + +1. Copy module into following directory + + source/modules/rs/awin + +2. Add following to composer.json on the shop root + + "autoload": { + "psr-4": { + "rs\\awin\\": "./source/modules/rs/awin" + } + }, + +3. Refresh autoloader files with composer in the oxid root directory. + + composer dump-autoload + +6. Enable module in the oxid admin area, Extensions => Modules + +7. Set you awin-id into the module settings diff --git a/composer.json b/composer.json new file mode 100755 index 0000000..130cdf8 --- /dev/null +++ b/composer.json @@ -0,0 +1,24 @@ +{ + "name": "rs/awin", + "description": "awin", + "type": "oxideshop-module", + "keywords": ["oxid", "modules", "eShop", "cookie", "affiliate", "marketing"], + "homepage": "https://www.reisacher-software.de", + "license": [ + "GPL-3.0-only", + "proprietary" + ], + "extra": { + "oxideshop": { + "target-directory": "rs/awin" + } + }, + "require": { + "php": ">=5.3" + }, + "autoload": { + "psr-4": { + "rs\\awin\\": "../../../source/modules/rs/awin" + } + } +} diff --git a/metadata.php b/metadata.php new file mode 100755 index 0000000..72833f5 --- /dev/null +++ b/metadata.php @@ -0,0 +1,36 @@ + 'rs-awin', + 'title' => '*RS awin', + 'description' => 'Affiliate Marketing Awin', + 'thumbnail' => '', + 'version' => '1.0.0', + 'author' => 'Thomas Janda', + 'url' => 'https://www.awin.com', + 'email' => '', + + 'extend' => array( + \OxidEsales\Eshop\Core\ViewConfig::class => rs\awin\Core\ViewConfig::class, + \OxidEsales\Eshop\Application\Controller\ThankYouController::class => \rs\awin\Core\Controller\ThankYouController::class, + ), + 'controllers' => array( + ), + 'blocks' => array( + array( + 'template' => 'layout/base.tpl', + 'block' => 'base_js', + 'file' => '/views/blocks/layout/base__base_js.tpl', + ), + ), + 'settings' => array( + array( + 'group' => 'rs-awin_main', + 'name' => 'rs-awin_id', //advertiserId + 'type' => 'str', + 'value' => '', + ), + ), +); diff --git a/views/blocks/layout/base__base_js.tpl b/views/blocks/layout/base__base_js.tpl new file mode 100755 index 0000000..4c74b22 --- /dev/null +++ b/views/blocks/layout/base__base_js.tpl @@ -0,0 +1,2 @@ +[{$smarty.block.parent}] +[{$oViewConf->rs_awin()}]