Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
birdkiwi committed Dec 17, 2017
1 parent 78cbd6b commit 93ba7dc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# plg_jshoppingorder_jshopping_utm
Joomla 3 plugin for Joomshopping: saves UTM code in order comment.

💾 Download: https://github.com/birdkiwi/plg_jshoppingorder_jshopping_utm/archive/master.zip
27 changes: 27 additions & 0 deletions jshopping_utm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
defined('_JEXEC') or die('Restricted access');
jimport('joomla.filesystem.file');
jimport('joomla.log.log');

class plgJshoppingOrderJshopping_utm extends JPlugin{

function __construct(&$subject, $config){
parent::__construct($subject, $config);
}

function onBeforeCreateOrder(&$order) {
$session = JFactory::getSession();

$utm_tags = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'];
$utm_comment = "";

foreach ($utm_tags as $tag) {
$tag_val = $session->get($tag);
if (!empty($tag_val)) {
$utm_comment .= " $tag: $tag_val |";
}
}

$order->order_add_info = $order->order_add_info . ' UTM meta info: ' . $utm_comment;
}
}
13 changes: 13 additions & 0 deletions jshopping_utm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="1.7" method="upgrade" group="jshoppingorder">
<name>JoomShopping UTM save</name>
<creationDate>15.12.2017</creationDate>
<version>1.0.0</version>
<author>Alexey Startler</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>http://startler.ru</authorUrl>
<description>JoomShopping UTM plugin. Saves UTM code in order comments.</description>
<files>
<filename plugin="jshopping_utm">jshopping_utm.php</filename>
</files>
</extension>

0 comments on commit 93ba7dc

Please sign in to comment.