-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |