Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasJanda committed Mar 13, 2020
0 parents commit 9ae6a40
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Application/views/admin/de/rs-awin_lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
$sLangName = "Deutsch";

$aLang = array(
'charset' => 'UTF-8',

'SHOP_MODULE_GROUP_rs-awin_main' => 'Grundeinstellungen',
'SHOP_MODULE_rs-awin_id' => 'Advertiser Id',
);
47 changes: 47 additions & 0 deletions Core/Controller/ThankYouController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace rs\awin\Core\Controller;

class ThankYouController extends ThankYouController_parent
{

public function init()
{
$sRet = parent::init();
$this->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);

}
}
}
24 changes: 24 additions & 0 deletions Core/ViewConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace rs\awin\Core;

use OxidEsales\Eshop\Core\Request;

class ViewConfig extends ViewConfig_parent
{
/**
* set awin cookie
*/
public function rs_awin()
{
$request = oxNew(Request::class);
$sValue=$request->getRequestParameter("awc");
if($sValue!="")
{
$iDays=365;
$sName = "awc";
$iTime = time() + $iDays*24*60*60;
\OxidEsales\Eshop\Core\Registry::getUtilsServer()->setOxCookie($sName, $sValue, $iTime);
}
}
}
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
36 changes: 36 additions & 0 deletions metadata.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

$sMetadataVersion = '2.0';

$aModule = array(
'id' => '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' => '',
),
),
);
2 changes: 2 additions & 0 deletions views/blocks/layout/base__base_js.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[{$smarty.block.parent}]
[{$oViewConf->rs_awin()}]

0 comments on commit 9ae6a40

Please sign in to comment.