1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+Isotope Shipment Tracking |
|
2 |
+==== |
|
3 |
+ |
|
4 |
+Integrates shipment tracking functionality into Isotope eCommerce. |
|
5 |
+ |
|
6 |
+This module is developed and provided by [eSales Media][1]. |
|
7 |
+ |
|
8 |
+__Author:__ Benjamin Roth [benjamin@esales-media.de] |
|
9 |
+ |
|
10 |
+ |
|
11 |
+System requirements |
|
12 |
+---- |
|
13 |
+Contao CMS >= 3.4.x |
|
14 |
+Isotope eCommerce >= 2.4.x |
|
15 |
+ |
|
16 |
+ |
|
17 |
+Installation |
|
18 |
+---- |
|
19 |
+Copy into your system/modules/ folder and don't forget to update the database. |
|
20 |
+ |
|
21 |
+ |
|
22 |
+License |
|
23 |
+---- |
|
24 |
+commercial |
|
25 |
+ |
|
26 |
+ |
|
27 |
+ |
|
28 |
+[1]: http://www.esales-media.de |
|
0 | 29 |
\ No newline at end of file |
1 | 30 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,26 @@ |
1 |
+{ |
|
2 |
+ "name":"esalesmedia/contao-isotope-shipmenttracking", |
|
3 |
+ "description":"Integrates shipment tracking functionality into Isotope eCommerce.", |
|
4 |
+ "keywords":["contao", "isotope", "shipment", "tracking"], |
|
5 |
+ "type":"contao-module", |
|
6 |
+ "license":"proprietary", |
|
7 |
+ "authors":[ |
|
8 |
+ { |
|
9 |
+ "name": "Benjamin Roth", |
|
10 |
+ "homepage": "https://www.esales-media.de" |
|
11 |
+ } |
|
12 |
+ ], |
|
13 |
+ "require":{ |
|
14 |
+ "php": "^5.6 || ^7.0", |
|
15 |
+ "contao/core-bundle": "^3.5 || ^4.4", |
|
16 |
+ "isotope/isotope-core": ">=2.4 <2.6", |
|
17 |
+ "contao-community-alliance/composer-plugin": "~2.4 || ~3.0" |
|
18 |
+ }, |
|
19 |
+ "extra":{ |
|
20 |
+ "contao": { |
|
21 |
+ "sources":{ |
|
22 |
+ "": "system/modules/eSM_isotope_shipmenttracking" |
|
23 |
+ } |
|
24 |
+ } |
|
25 |
+ } |
|
26 |
+} |
|
0 | 27 |
\ No newline at end of file |
1 | 28 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,11 @@ |
1 |
+;; |
|
2 |
+; List modules which are required to be loaded beforehand |
|
3 |
+;; |
|
4 |
+requires[] = "isotope" |
|
5 |
+ |
|
6 |
+;; |
|
7 |
+; Configure what you want the autoload creator to register |
|
8 |
+;; |
|
9 |
+register_namespaces = true |
|
10 |
+register_classes = true |
|
11 |
+register_templates = true |
0 | 12 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,39 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Contao Open Source CMS |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2005-2016 Leo Feyer |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+ |
|
12 |
+/** |
|
13 |
+ * Register the namespaces |
|
14 |
+ */ |
|
15 |
+ClassLoader::addNamespaces(array |
|
16 |
+( |
|
17 |
+ 'eSM_isotope_shipmenttracking', |
|
18 |
+)); |
|
19 |
+ |
|
20 |
+ |
|
21 |
+/** |
|
22 |
+ * Register the classes |
|
23 |
+ */ |
|
24 |
+ClassLoader::addClasses(array |
|
25 |
+( |
|
26 |
+ // Hooks |
|
27 |
+ 'eSM_isotope_shipmenttracking\Hooks\IsotopeHooks' => 'system/modules/eSM_isotope_shipmenttracking/hooks/IsotopeHooks.php', |
|
28 |
+ |
|
29 |
+ // Models |
|
30 |
+ 'eSM_isotope_shipmenttracking\Model\ShipmentTrackingModel' => 'system/modules/eSM_isotope_shipmenttracking/models/ShipmentTrackingModel.php', |
|
31 |
+)); |
|
32 |
+ |
|
33 |
+ |
|
34 |
+/** |
|
35 |
+ * Register the templates |
|
36 |
+ */ |
|
37 |
+TemplateLoader::addFiles(array |
|
38 |
+( |
|
39 |
+)); |
0 | 40 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,31 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+$GLOBALS['TL_MODELS'][\eSM_isotope_shipmenttracking\Model\ShipmentTrackingModel::getTable()] = 'eSM_isotope_shipmenttracking\Model\ShipmentTrackingModel'; |
|
12 |
+ |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * Isotope Modules |
|
16 |
+ */ |
|
17 |
+$GLOBALS['ISO_MOD']['config']['shipmenttracking'] = array |
|
18 |
+( |
|
19 |
+ 'tables' => array(\eSM_isotope_shipmenttracking\Model\ShipmentTrackingModel::getTable()), |
|
20 |
+ 'icon' => 'system/modules/isotope/assets/images/setup-shipping.png', |
|
21 |
+); |
|
22 |
+ |
|
23 |
+$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'][] = 'shipmenttracking_note'; |
|
24 |
+$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'][] = 'shipmenttracking_number'; |
|
25 |
+$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'][] = 'shipmenttracking_url'; |
|
26 |
+$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'][] = 'shipmenttracking_note_text'; |
|
27 |
+$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'][] = 'shipmenttracking_shippingdate'; |
|
28 |
+$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'][] = 'shipmenttracking_shippinginfo'; |
|
29 |
+ |
|
30 |
+ |
|
31 |
+$GLOBALS['ISO_HOOKS']['getOrderNotificationTokens'][] = array('eSM_isotope_shipmenttracking\\Hooks\\IsotopeHooks','getOrderNotificationTokens'); |
|
0 | 32 |
\ No newline at end of file |
1 | 33 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,88 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+$GLOBALS['TL_DCA']['tl_iso_product_collection']['config']['onload_callback'][] = array('tl_iso_product_collection_eSM_isotope_shipmenttracking','registerSubPalettes'); |
|
12 |
+ |
|
13 |
+$GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['default'] = str_replace('date_shipped','date_shipped,shipping_tracking',$GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['default']); |
|
14 |
+$GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['__selector__'][] = 'shipping_tracking'; |
|
15 |
+ |
|
16 |
+$GLOBALS['TL_DCA']['tl_iso_product_collection']['subpalettes']['shipping_tracking'] = 'tracking_number'; |
|
17 |
+ |
|
18 |
+ |
|
19 |
+$GLOBALS['TL_DCA']['tl_iso_product_collection']['fields']['shipping_tracking'] = array |
|
20 |
+( |
|
21 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['shipping_tracking'], |
|
22 |
+ 'exclude' => true, |
|
23 |
+ 'inputType' => 'select', |
|
24 |
+ 'foreignKey' => 'tl_iso_shipmenttracking.name', |
|
25 |
+ 'save_callback' => array |
|
26 |
+ ( |
|
27 |
+ array('tl_iso_product_collection_eSM_isotope_shipmenttracking','resetTracking') |
|
28 |
+ ), |
|
29 |
+ 'eval' => array('includeBlankOption'=>true,'submitOnChange'=>true,'tl_class'=>'clr w50'), |
|
30 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'", |
|
31 |
+ 'relation' => array('type'=>'hasMany', 'load'=>'lazy'), |
|
32 |
+); |
|
33 |
+ |
|
34 |
+$GLOBALS['TL_DCA']['tl_iso_product_collection']['fields']['tracking_number'] = array |
|
35 |
+( |
|
36 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['tracking_number'], |
|
37 |
+ 'exclude' => true, |
|
38 |
+ 'inputType' => 'text', |
|
39 |
+ 'eval' => array('mandatory'=>true, 'maxlength'=>255, 'tl_class'=>'w50', 'decodeEntities'=>true), |
|
40 |
+ 'sql' => "varchar(255) NOT NULL default ''", |
|
41 |
+); |
|
42 |
+ |
|
43 |
+ |
|
44 |
+ |
|
45 |
+class tl_iso_product_collection_eSM_isotope_shipmenttracking extends \Backend |
|
46 |
+{ |
|
47 |
+ /** |
|
48 |
+ * Import the back end user object |
|
49 |
+ */ |
|
50 |
+ public function __construct() |
|
51 |
+ { |
|
52 |
+ parent::__construct(); |
|
53 |
+ $this->import('BackendUser', 'User'); |
|
54 |
+ } |
|
55 |
+ |
|
56 |
+ /** |
|
57 |
+ * Dynamically add subpalettes on runtime |
|
58 |
+ * |
|
59 |
+ * @param DataContainer $dc |
|
60 |
+ */ |
|
61 |
+ public function registerSubPalettes(\DataContainer $dc) |
|
62 |
+ { |
|
63 |
+ $Tracking = \eSM_isotope_shipmenttracking\Model\ShipmentTrackingModel::findAll(); |
|
64 |
+ |
|
65 |
+ if ($Tracking === null) |
|
66 |
+ { |
|
67 |
+ return; |
|
68 |
+ } |
|
69 |
+ |
|
70 |
+ while ($Tracking->next()) |
|
71 |
+ { |
|
72 |
+ if ($Tracking->trackingUrl) |
|
73 |
+ { |
|
74 |
+ $GLOBALS['TL_DCA']['tl_iso_product_collection']['subpalettes']['shipping_tracking_' . $Tracking->id] = 'tracking_number'; |
|
75 |
+ } |
|
76 |
+ } |
|
77 |
+ |
|
78 |
+ } |
|
79 |
+ |
|
80 |
+ public function resetTracking($varValue, \DataContainer $dc) |
|
81 |
+ { |
|
82 |
+ if (!$varValue) { |
|
83 |
+ $t = \Isotope\Model\ProductCollection::getTable(); |
|
84 |
+ \Database::getInstance()->prepare("UPDATE $t SET tracking_number = '' WHERE id = ?")->execute($dc->id); |
|
85 |
+ } |
|
86 |
+ return $varValue; |
|
87 |
+ } |
|
88 |
+} |
|
0 | 89 |
\ No newline at end of file |
1 | 90 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,207 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Table tl_iso_shipmenttracking |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_DCA']['tl_iso_shipmenttracking'] = array |
|
15 |
+( |
|
16 |
+ |
|
17 |
+ // Config |
|
18 |
+ 'config' => array |
|
19 |
+ ( |
|
20 |
+ 'dataContainer' => 'Table', |
|
21 |
+ 'enableVersioning' => true, |
|
22 |
+ 'closed' => true, |
|
23 |
+ 'onload_callback' => array |
|
24 |
+ ( |
|
25 |
+ array('\Isotope\Backend', 'initializeSetupModule'), |
|
26 |
+ array('tl_iso_shipmenttracking', 'checkPermission'), |
|
27 |
+ array('tl_iso_shipmenttracking', 'mandatoryCheck'), |
|
28 |
+ ), |
|
29 |
+ 'sql' => array |
|
30 |
+ ( |
|
31 |
+ 'keys' => array |
|
32 |
+ ( |
|
33 |
+ 'id' => 'primary', |
|
34 |
+ ) |
|
35 |
+ ), |
|
36 |
+ ), |
|
37 |
+ |
|
38 |
+ // List |
|
39 |
+ 'list' => array |
|
40 |
+ ( |
|
41 |
+ 'sorting' => array |
|
42 |
+ ( |
|
43 |
+ 'mode' => 1, |
|
44 |
+ 'fields' => array('name'), |
|
45 |
+ 'flag' => 1, |
|
46 |
+ 'panelLayout' => 'sort,filter;search,limit', |
|
47 |
+ ), |
|
48 |
+ 'label' => array |
|
49 |
+ ( |
|
50 |
+ 'fields' => array('name'), |
|
51 |
+ 'format' => '%s', |
|
52 |
+ ), |
|
53 |
+ 'global_operations' => array |
|
54 |
+ ( |
|
55 |
+ 'back' => array |
|
56 |
+ ( |
|
57 |
+ 'label' => &$GLOBALS['TL_LANG']['MSC']['backBT'], |
|
58 |
+ 'href' => 'mod=&table=', |
|
59 |
+ 'class' => 'header_back', |
|
60 |
+ 'attributes' => 'onclick="Backend.getScrollOffset();"', |
|
61 |
+ ), |
|
62 |
+ 'new' => array |
|
63 |
+ ( |
|
64 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['new'], |
|
65 |
+ 'href' => 'act=create', |
|
66 |
+ 'class' => 'header_new', |
|
67 |
+ 'attributes' => 'onclick="Backend.getScrollOffset();"', |
|
68 |
+ ), |
|
69 |
+ 'all' => array |
|
70 |
+ ( |
|
71 |
+ 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], |
|
72 |
+ 'href' => 'act=select', |
|
73 |
+ 'class' => 'header_edit_all', |
|
74 |
+ 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
|
75 |
+ ) |
|
76 |
+ ), |
|
77 |
+ 'operations' => array |
|
78 |
+ ( |
|
79 |
+ 'edit' => array |
|
80 |
+ ( |
|
81 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['edit'], |
|
82 |
+ 'href' => 'act=edit', |
|
83 |
+ 'icon' => 'edit.gif', |
|
84 |
+ ), |
|
85 |
+ 'copy' => array |
|
86 |
+ ( |
|
87 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['copy'], |
|
88 |
+ 'href' => 'act=copy', |
|
89 |
+ 'icon' => 'copy.gif' |
|
90 |
+ ), |
|
91 |
+ 'delete' => array |
|
92 |
+ ( |
|
93 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['delete'], |
|
94 |
+ 'href' => 'act=delete', |
|
95 |
+ 'icon' => 'delete.gif', |
|
96 |
+ ), |
|
97 |
+ 'toggle' => array |
|
98 |
+ ( |
|
99 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['toggle'], |
|
100 |
+ 'icon' => 'visible.gif', |
|
101 |
+ 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', |
|
102 |
+// 'button_callback' => array('tl_iso_shipmenttracking', 'toggleIcon') |
|
103 |
+ ), |
|
104 |
+ 'show' => array |
|
105 |
+ ( |
|
106 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['show'], |
|
107 |
+ 'icon' => 'show.gif', |
|
108 |
+ ), |
|
109 |
+ ) |
|
110 |
+ ), |
|
111 |
+ |
|
112 |
+ // Palettes |
|
113 |
+ 'palettes' => array |
|
114 |
+ ( |
|
115 |
+ 'default' => '{title_legend},name;{note_legend},note;{tracking_legend},trackingUrl' |
|
116 |
+ ), |
|
117 |
+ |
|
118 |
+ // Subpalettes |
|
119 |
+ 'subpalettes' => array |
|
120 |
+ ( |
|
121 |
+ ), |
|
122 |
+ |
|
123 |
+ // Fields |
|
124 |
+ 'fields' => array |
|
125 |
+ ( |
|
126 |
+ 'id' => array |
|
127 |
+ ( |
|
128 |
+ 'sql' => "int(10) unsigned NOT NULL auto_increment" |
|
129 |
+ ), |
|
130 |
+ 'tstamp' => array |
|
131 |
+ ( |
|
132 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
133 |
+ ), |
|
134 |
+ 'name' => array |
|
135 |
+ ( |
|
136 |
+ 'exclude' => true, |
|
137 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['name'], |
|
138 |
+ 'sorting' => true, |
|
139 |
+ 'search' => true, |
|
140 |
+ 'flag' => 1, |
|
141 |
+ 'inputType' => 'text', |
|
142 |
+ 'eval' => array('mandatory'=>true, 'maxlength'=>255), |
|
143 |
+ 'sql' => "varchar(255) NOT NULL default ''", |
|
144 |
+ ), |
|
145 |
+ 'note' => array |
|
146 |
+ ( |
|
147 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['note'], |
|
148 |
+ 'exclude' => true, |
|
149 |
+ 'inputType' => 'textarea', |
|
150 |
+ 'explanation' => 'iso_shipmenttracking_placeholder', |
|
151 |
+ 'eval' => array('mandatory'=>true,'rte'=>'tinyMCE', 'decodeEntities'=>true, 'helpwizard'=>true), |
|
152 |
+ 'sql' => "text NULL", |
|
153 |
+ ), |
|
154 |
+ 'trackingUrl' => array |
|
155 |
+ ( |
|
156 |
+ 'exclude' => true, |
|
157 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['trackingUrl'], |
|
158 |
+ 'inputType' => 'text', |
|
159 |
+ 'eval' => array('mandatory'=>false, 'rgxp'=>'url', 'maxlength'=>255, 'decodeEntities'=>true), |
|
160 |
+ 'sql' => "varchar(255) NOT NULL default ''", |
|
161 |
+ ), |
|
162 |
+ ) |
|
163 |
+); |
|
164 |
+ |
|
165 |
+ |
|
166 |
+class tl_iso_shipmenttracking extends \Backend |
|
167 |
+{ |
|
168 |
+ /** |
|
169 |
+ * Import the back end user object |
|
170 |
+ */ |
|
171 |
+ public function __construct() |
|
172 |
+ { |
|
173 |
+ parent::__construct(); |
|
174 |
+ $this->import('BackendUser', 'User'); |
|
175 |
+ } |
|
176 |
+ |
|
177 |
+ /** |
|
178 |
+ * Check permissions to edit table tl_iso_shipping |
|
179 |
+ * @return void |
|
180 |
+ */ |
|
181 |
+ public function checkPermission() |
|
182 |
+ { |
|
183 |
+ // Check permissions to add shipping modules |
|
184 |
+ if (!\BackendUser::getInstance()->hasAccess(\Input::get('mod'), 'iso_modules')) { |
|
185 |
+ $GLOBALS['TL_DCA']['tl_iso_shipmenttracking']['config']['closed'] = true; |
|
186 |
+ unset($GLOBALS['TL_DCA']['tl_iso_shipping']['list']['global_operations']['new']); |
|
187 |
+ } |
|
188 |
+ } |
|
189 |
+ |
|
190 |
+ /** |
|
191 |
+ * Set fields mandatory if needed |
|
192 |
+ * @param DataContainer $dc |
|
193 |
+ * @return void |
|
194 |
+ */ |
|
195 |
+ public function mandatoryCheck(\DataContainer $dc) |
|
196 |
+ { |
|
197 |
+ if (\Input::get('act') == 'edit') |
|
198 |
+ { |
|
199 |
+ $data = \Database::getInstance()->execute("SELECT note FROM $dc->table WHERE id = $dc->id"); |
|
200 |
+ if ($data->numRows && preg_match('/(%%TRACKING[^%]+%%)/', $data->note)) |
|
201 |
+ { |
|
202 |
+ $GLOBALS['TL_DCA']['tl_iso_shipmenttracking']['fields']['trackingUrl']['eval']['mandatory'] = true; |
|
203 |
+ } |
|
204 |
+ } |
|
205 |
+ } |
|
206 |
+ |
|
207 |
+} |
0 | 208 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,74 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+namespace eSM_isotope_shipmenttracking\Hooks; |
|
12 |
+ |
|
13 |
+use eSM_isotope_shipmenttracking\Model\ShipmentTrackingModel; |
|
14 |
+ |
|
15 |
+class IsotopeHooks extends \Controller |
|
16 |
+{ |
|
17 |
+ public function getOrderNotificationTokens($Order, $arrTokens) |
|
18 |
+ { |
|
19 |
+ if (!$Order->shipping_tracking) |
|
20 |
+ { |
|
21 |
+ return $arrTokens; |
|
22 |
+ } |
|
23 |
+ |
|
24 |
+ $Tracking = ShipmentTrackingModel::findByPk($Order->shipping_tracking); |
|
25 |
+ |
|
26 |
+ if ($Tracking === null) |
|
27 |
+ { |
|
28 |
+ return $arrTokens; |
|
29 |
+ } |
|
30 |
+ |
|
31 |
+ $strTrackingNumber = trim($Order->tracking_number); |
|
32 |
+ $strUrl = $this->replacePlaceholders($Tracking->trackingUrl,array('%%TRACKINGNO%%'=>$strTrackingNumber)); |
|
33 |
+ $strShippingdate = \Date::parse(\Date::getNumericDateFormat(),$Order->date_shipped); |
|
34 |
+ $strShippingInfo = sprintf($GLOBALS['TL_LANG']['iso_shipmenttracking']['shippingdate_info_today'],$Order->date_shipped,$Tracking->name); |
|
35 |
+ if (date('Ymd',$Order->date_shipped) < date('Ymd')) |
|
36 |
+ { |
|
37 |
+ $strShippingInfo = sprintf($GLOBALS['TL_LANG']['iso_shipmenttracking']['shippingdate_info_past'],$Order->date_shipped,$Tracking->name); |
|
38 |
+ } else if (date('Ymd',$Order->date_shipped) > date('Ymd')) { |
|
39 |
+ $strShippingInfo = sprintf($GLOBALS['TL_LANG']['iso_shipmenttracking']['shippingdate_info_future'],$Order->date_shipped,$Tracking->name); |
|
40 |
+ } |
|
41 |
+ |
|
42 |
+ $arrTokens['shipmenttracking_number'] = $strTrackingNumber; |
|
43 |
+ $arrTokens['shipmenttracking_url'] = $strUrl; |
|
44 |
+ $arrTokens['shipmenttracking_shippingdate'] = $strShippingdate; |
|
45 |
+ $arrTokens['shipmenttracking_shipping_info'] = $strShippingInfo; |
|
46 |
+ $arrTokens['shipmenttracking_note'] = $this->replacePlaceholders($Tracking->note,array('%%TRACKINGNO%%'=>$strTrackingNumber,'%%TRACKINGURL%%'=>$strUrl, '%%SHIPPINGDATE%%'=>$strShippingdate, '%%SHIPPINGINFO%%'=>$strShippingInfo)); |
|
47 |
+ $arrTokens['shipmenttracking_note_text'] = strip_tags(str_ireplace(array('</p>','</ p>',),"\n\n",str_ireplace(array('<br>','<br />','</ br>','</br>'),"\n",str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),"",$arrTokens['shipmenttracking_note'])))); |
|
48 |
+ |
|
49 |
+ return $arrTokens; |
|
50 |
+ } |
|
51 |
+ |
|
52 |
+ /** |
|
53 |
+ * Replace placeholders |
|
54 |
+ * |
|
55 |
+ * @param $strString |
|
56 |
+ * @return string |
|
57 |
+ */ |
|
58 |
+ protected function replacePlaceholders($strString, $arrReplace) |
|
59 |
+ { |
|
60 |
+ // Split placeholders |
|
61 |
+ $arrPlaceholders = preg_split('/(%%[^%]+%%)/', $strString, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); |
|
62 |
+ |
|
63 |
+ // Replace placeholders |
|
64 |
+ foreach ($arrPlaceholders as $placeholder) |
|
65 |
+ { |
|
66 |
+ if (isset($arrReplace[$placeholder])) |
|
67 |
+ { |
|
68 |
+ $strString = str_ireplace($placeholder,$arrReplace[$placeholder],$strString); |
|
69 |
+ } |
|
70 |
+ } |
|
71 |
+ |
|
72 |
+ return $strString; |
|
73 |
+ } |
|
74 |
+} |
|
0 | 75 |
\ No newline at end of file |
1 | 76 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,16 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Misc |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['iso_shipmenttracking']['shippingdate_info_today'] = 'Der Versand erfolgt heute, am %s durch %s'; |
|
15 |
+$GLOBALS['TL_LANG']['iso_shipmenttracking']['shippingdate_info_past'] = 'Der Versand erfolgt am %s durch %s'; |
|
16 |
+$GLOBALS['TL_LANG']['iso_shipmenttracking']['shippingdate_info_future'] = 'Der Versand erfolgte am %s durch %s'; |
|
0 | 17 |
\ No newline at end of file |
1 | 18 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Isotope modules |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['XPL']['iso_shipmenttracking_placeholder'][0][0] = '%%TRACKINGNO%%'; |
|
15 |
+$GLOBALS['TL_LANG']['XPL']['iso_shipmenttracking_placeholder'][0][1] = 'Wird durch die Tracking-Nummer ersetzt.'; |
|
16 |
+$GLOBALS['TL_LANG']['XPL']['iso_shipmenttracking_placeholder'][1][0] = '%%TRACKINGURL%%'; |
|
17 |
+$GLOBALS['TL_LANG']['XPL']['iso_shipmenttracking_placeholder'][1][1] = 'Wird durch die finale Tracking-URL ersetzt.'; |
|
18 |
+$GLOBALS['TL_LANG']['XPL']['iso_shipmenttracking_placeholder'][2][0] = '%%SHIPPINGDATE%%'; |
|
19 |
+$GLOBALS['TL_LANG']['XPL']['iso_shipmenttracking_placeholder'][2][1] = 'Wird durch das eingetragene Versanddatum ersetzt.'; |
|
20 |
+$GLOBALS['TL_LANG']['XPL']['iso_shipmenttracking_placeholder'][3][0] = '%%SHIPPINGINFO%%'; |
|
21 |
+$GLOBALS['TL_LANG']['XPL']['iso_shipmenttracking_placeholder'][3][1] = 'Wird durch einen Hinweistext mit dem eingetragenen Versanddatum und dem Versandunternehmen ersetzt.'; |
0 | 22 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Isotope modules |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['IMD']['shipmenttracking'][0] = 'Sendungsverfolgung'; |
|
15 |
+$GLOBALS['TL_LANG']['IMD']['shipmenttracking'][1] = 'Legen Sie für verschiedene Versandunternehmen individuelle Sendungsverfolgungslinks an, welche Sie z.B. in einer Versandbestätigungsmail nutzen können.'; |
|
0 | 16 |
\ No newline at end of file |
1 | 17 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,17 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Fields |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['tl_iso_product_collection']['shipping_tracking'][0] = 'Sendungsverfolgung'; |
|
15 |
+$GLOBALS['TL_LANG']['tl_iso_product_collection']['shipping_tracking'][1] = 'Wählen Sie hier die gewünschte Sendungsverfolgung'; |
|
16 |
+$GLOBALS['TL_LANG']['tl_iso_product_collection']['tracking_number'][0] = 'Tracking Nummer'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_iso_product_collection']['tracking_number'][1] = 'Geben Sie hier die Tracking-Nummer ein, welche Sie vom Versandunternehmen für diese Sendung erhalten haben.'; |
0 | 18 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,27 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Fields |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['name'][0] = 'Sendungsverfolgung-Name'; |
|
15 |
+$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['name'][1] = 'Der interne Name der Sendungsverfolgung'; |
|
16 |
+$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['note'][0] = 'Sendungsverfolgungstext'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['note'][1] = 'Dieser Text kann dem Kunden z.B. in Versandbestätigungsmails ausgegeben werden. Eine Übersicht der verwendbaren Platzhalter finden Sie in der Hilfe.'; |
|
18 |
+$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['trackingUrl'][0] = 'Tracking-URL'; |
|
19 |
+$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['trackingUrl'][1] = 'Die Tracking URL des Dienstleisters. Der Platzhalter <em>%%TRACKINGNO%%</em> wird durch die Tracking-Nummer ersetzt.'; |
|
20 |
+ |
|
21 |
+/** |
|
22 |
+ * Legends |
|
23 |
+ */ |
|
24 |
+ |
|
25 |
+$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['title_legend'] = 'Titel'; |
|
26 |
+$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['note_legend'] = 'Sendungsverfolgungshinweis'; |
|
27 |
+$GLOBALS['TL_LANG']['tl_iso_shipmenttracking']['tracking_legend'] = 'Sendungsverfolgungslink'; |
|
0 | 28 |
\ No newline at end of file |
1 | 29 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,18 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Isotope modules |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['NOTIFICATION_CENTER_TOKEN']['iso_order_status_change']['shipmenttracking_note'] = 'Sendungsverfolgungs-Hinweistext'; |
|
15 |
+$GLOBALS['TL_LANG']['NOTIFICATION_CENTER_TOKEN']['iso_order_status_change']['shipmenttracking_number'] = 'Sendungsverfolgungs-Paketnummer'; |
|
16 |
+$GLOBALS['TL_LANG']['NOTIFICATION_CENTER_TOKEN']['iso_order_status_change']['shipmenttracking_url'] = 'Sendungsverfolgungs-Link'; |
|
17 |
+$GLOBALS['TL_LANG']['NOTIFICATION_CENTER_TOKEN']['iso_order_status_change']['shipmenttracking_shippingdate'] = 'Sendungsverfolgungs-Versanddatum'; |
|
18 |
+$GLOBALS['TL_LANG']['NOTIFICATION_CENTER_TOKEN']['iso_order_status_change']['shipmenttracking_shippinginfo'] = 'Sendungsverfolgungs-Verssandinfo (Versanddatum und Versandunternehmen)'; |
0 | 19 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,16 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Misc |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['iso_shipmenttracking']['shippingdate_info_today'] = 'Der Versand erfolgt heute, am %s durch %s'; |
|
15 |
+$GLOBALS['TL_LANG']['iso_shipmenttracking']['shippingdate_info_past'] = 'Der Versand erfolgt am %s durch %s'; |
|
16 |
+$GLOBALS['TL_LANG']['iso_shipmenttracking']['shippingdate_info_future'] = 'Der Versand erfolgte am %s durch %s'; |
|
0 | 17 |
\ No newline at end of file |
1 | 18 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Isotope modules |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['IMD']['shipmenttracking'][0] = 'Shipment tracking'; |
|
15 |
+$GLOBALS['TL_LANG']['IMD']['shipmenttracking'][1] = 'Add shipment tracking links for various shipping services which you can use e.g. for shipping information mails.'; |
|
0 | 16 |
\ No newline at end of file |
1 | 17 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,30 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Shipment tracking for Isotope eCommerce |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+namespace eSM_isotope_shipmenttracking\Model; |
|
12 |
+ |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * @property int $id |
|
16 |
+ * @property int $tstamp |
|
17 |
+ * @property string $name |
|
18 |
+ * @property string $note |
|
19 |
+ * @property string $trackingUrl |
|
20 |
+ */ |
|
21 |
+class ShipmentTrackingModel extends \Model |
|
22 |
+{ |
|
23 |
+ |
|
24 |
+ /** |
|
25 |
+ * Name of the current table |
|
26 |
+ * @var string |
|
27 |
+ */ |
|
28 |
+ protected static $strTable = 'tl_iso_shipmenttracking'; |
|
29 |
+ |
|
30 |
+} |