Browse code

Add a shipping annotation fields for customer informations

Benjamin Roth authored on17/06/2020 09:50:23
Showing1 changed files
... ...
@@ -11,6 +11,7 @@
11 11
 $GLOBALS['TL_DCA']['tl_iso_product_collection']['config']['onload_callback'][] = array('tl_iso_product_collection_eSM_isotope_shipmenttracking','registerSubPalettes');
12 12
 
13 13
 $GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['default'] = str_replace(array('{status_legend}','{status_legend:hide}'),array('{status_legend},shipping_tracking','{status_legend:hide},shipping_tracking'),$GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['default']);
14
+$GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['default'] = str_replace('date_paid','shipping_annotation,date_paid',$GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['default']);
14 15
 $GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['__selector__'][] = 'shipping_tracking';
15 16
 
16 17
 $GLOBALS['TL_DCA']['tl_iso_product_collection']['subpalettes']['shipping_tracking'] = 'tracking_number';
... ...
@@ -39,6 +40,14 @@ $GLOBALS['TL_DCA']['tl_iso_product_collection']['fields']['tracking_number'] = a
39 40
   'eval'                      => array('mandatory'=>true, 'maxlength'=>255, 'tl_class'=>'w50', 'decodeEntities'=>true),
40 41
   'sql'                       => "varchar(255) NOT NULL default ''",
41 42
 );
43
+$GLOBALS['TL_DCA']['tl_iso_product_collection']['fields']['shipping_annotation'] = array
44
+(
45
+  'label'                     => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['shipping_annotation'],
46
+  'exclude'                   => true,
47
+  'inputType'                 => 'textarea',
48
+  'eval'                      => array('style'=>'height:80px;', 'tl_class'=>'clr'),
49
+  'sql'                       => "mediumtext NULL",
50
+);
42 51
 
43 52
 $GLOBALS['TL_DCA']['tl_iso_product_collection']['fields']['order_status']['eval']['tl_class'] = 'clr';
44 53
 
Browse code

Move shipmenttracking fields above order status

Benjamin Roth authored on22/03/2019 19:35:11
Showing1 changed files
... ...
@@ -10,7 +10,7 @@
10 10
 
11 11
 $GLOBALS['TL_DCA']['tl_iso_product_collection']['config']['onload_callback'][] = array('tl_iso_product_collection_eSM_isotope_shipmenttracking','registerSubPalettes');
12 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']);
13
+$GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['default'] = str_replace(array('{status_legend}','{status_legend:hide}'),array('{status_legend},shipping_tracking','{status_legend:hide},shipping_tracking'),$GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['default']);
14 14
 $GLOBALS['TL_DCA']['tl_iso_product_collection']['palettes']['__selector__'][] = 'shipping_tracking';
15 15
 
16 16
 $GLOBALS['TL_DCA']['tl_iso_product_collection']['subpalettes']['shipping_tracking'] = 'tracking_number';
... ...
@@ -40,6 +40,7 @@ $GLOBALS['TL_DCA']['tl_iso_product_collection']['fields']['tracking_number'] = a
40 40
   'sql'                       => "varchar(255) NOT NULL default ''",
41 41
 );
42 42
 
43
+$GLOBALS['TL_DCA']['tl_iso_product_collection']['fields']['order_status']['eval']['tl_class'] = 'clr';
43 44
 
44 45
 
45 46
 class tl_iso_product_collection_eSM_isotope_shipmenttracking extends \Backend
Browse code

Initial commit

Benjamin Roth authored on19/03/2019 14:48:59
Showing1 changed files
1 1
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