Completed
Branch 1.2 (19915c)
by Jason
02:54
created
code/objects/OptionItem.php 3 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 		//'Category' => 'ProductCategory'
26 26
 	);
27 27
 
28
-    private static $belongs_many_many = array(
29
-        'OrderDetails' => 'OrderDetail'
30
-    );
28
+	private static $belongs_many_many = array(
29
+		'OrderDetails' => 'OrderDetail'
30
+	);
31 31
 
32
-    private static $defaults = array(
32
+	private static $defaults = array(
33 33
 		'Available' => true
34 34
 	);
35 35
 
36 36
 	private static $summary_fields = array(
37 37
 		'Title' => 'Title',
38 38
 		'ProductOptionGroup.Title' => 'Group',
39
-        'Available.Nice' => 'Available'
39
+		'Available.Nice' => 'Available'
40 40
 	);
41 41
 
42 42
 	private static $default_sort = 'SortOrder';
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 		);
51 51
 
52 52
 		// set variables from Product
53
-        $productID = ($this->ProductID != 0) ? $this->ProductID : Session::get('CMSMain.currentPage');
54
-        $product = ProductPage::get()->byID($productID);
53
+		$productID = ($this->ProductID != 0) ? $this->ProductID : Session::get('CMSMain.currentPage');
54
+		$product = ProductPage::get()->byID($productID);
55 55
 
56 56
 		$parentPrice = $product->obj('Price')->Nice();
57 57
 		$parentWeight = $product->Weight;
@@ -59,21 +59,21 @@  discard block
 block discarded – undo
59 59
 
60 60
 		// ProductOptionGroup Dropdown field w/ add new
61 61
 		$groups = function(){
62
-		    return OptionGroup::get()->map()->toArray();
62
+			return OptionGroup::get()->map()->toArray();
63 63
 		};
64 64
 		$groupFields = singleton('OptionGroup')->getCMSFields();
65 65
 		$groupField = DropdownField::create('ProductOptionGroupID', _t("OptionItem.Group", "Group"), $groups())
66 66
 			->setEmptyString('')
67
-            ->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>'));
67
+			->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>'));
68 68
 		if (class_exists('QuickAddNewExtension')) $groupField->useAddNew('OptionGroup', $groups, $groupFields);
69 69
 
70
-        $fields->addFieldsToTab('Root.Main', array(
70
+		$fields->addFieldsToTab('Root.Main', array(
71 71
 			HeaderField::create('DetailsHD', _t("OptionItem.DetailsHD", "Product Option Details"), 2),
72 72
 			Textfield::create('Title')
73
-                ->setTitle(_t("OptionItem.Title", "Product Option Name")),
73
+				->setTitle(_t("OptionItem.Title", "Product Option Name")),
74 74
 			CheckboxField::create('Available')
75 75
 				->setTitle( _t("OptionItem.Available", "Available for purchase"))
76
-                ->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")),
76
+				->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")),
77 77
 			$groupField
78 78
 		));
79 79
 
@@ -83,22 +83,22 @@  discard block
 block discarded – undo
83 83
 			// Weight Modifier Fields
84 84
 			HeaderField::create('WeightHD', _t('OptionItem.WeightHD', 'Modify Weight'), 3),
85 85
 			NumericField::create('WeightModifier')
86
-                ->setTitle(_t('OptionItem.WeightModifier', 'Weight')),
86
+				->setTitle(_t('OptionItem.WeightModifier', 'Weight')),
87 87
 			DropdownField::create('WeightModifierAction', _t('OptionItem.WeightModifierAction', 'Weight Modification'),
88 88
 				array(
89
-                    'Add' => _t(
90
-                        'OptionItem.WeightAdd',
91
-                        "Add to Base Weight ({weight})",
92
-                        'Add to weight',
93
-                        array('weight' => $parentWeight)
94
-                    ),
95
-                    'Subtract' => _t(
96
-                        'OptionItem.WeightSubtract',
97
-                        "Subtract from Base Weight ({weight})",
98
-                        'Subtract from weight',
99
-                        array('weight' => $parentWeight)
100
-                    ),
101
-                    'Set' => _t('OptionItem.WeightSet', 'Set as a new Weight')
89
+					'Add' => _t(
90
+						'OptionItem.WeightAdd',
91
+						"Add to Base Weight ({weight})",
92
+						'Add to weight',
93
+						array('weight' => $parentWeight)
94
+					),
95
+					'Subtract' => _t(
96
+						'OptionItem.WeightSubtract',
97
+						"Subtract from Base Weight ({weight})",
98
+						'Subtract from weight',
99
+						array('weight' => $parentWeight)
100
+					),
101
+					'Set' => _t('OptionItem.WeightSet', 'Set as a new Weight')
102 102
 				)
103 103
 			)->setEmptyString('')
104 104
 			->setDescription(_t('OptionItem.WeightDescription', 'Does weight modify or replace base weight?')),
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
 			// Price Modifier FIelds
107 107
 			HeaderField::create('PriceHD', _t('OptionItem.PriceHD', 'Modify Price'), 3),
108 108
 			CurrencyField::create('PriceModifier')
109
-                ->setTitle(_t('OptionItem.PriceModifier', 'Price')),
109
+				->setTitle(_t('OptionItem.PriceModifier', 'Price')),
110 110
 			DropdownField::create('PriceModifierAction', _t('OptionItem.PriceModifierAction', 'Price Modification'),
111 111
 				array(
112 112
 					'Add' => _t(
113
-                        'OptionItem.PriceAdd',
114
-                        "Add to Base Price ({price})",
115
-                        'Add to price',
116
-                        array('price' => $parentPrice)
117
-                    ),
113
+						'OptionItem.PriceAdd',
114
+						"Add to Base Price ({price})",
115
+						'Add to price',
116
+						array('price' => $parentPrice)
117
+					),
118 118
 					'Subtract' => _t(
119
-                        'OptionItem.PriceSubtract',
120
-                        "Subtract from Base Price ({price})",
121
-                        'Subtract from price',
122
-                        array('price' => $parentPrice)
123
-                    ),
119
+						'OptionItem.PriceSubtract',
120
+						"Subtract from Base Price ({price})",
121
+						'Subtract from price',
122
+						array('price' => $parentPrice)
123
+					),
124 124
 					'Set' => _t('OptionItem.PriceSet', 'Set as a new Price')
125 125
 				)
126 126
 			)->setEmptyString('')
@@ -129,28 +129,28 @@  discard block
 block discarded – undo
129 129
 			// Code Modifier Fields
130 130
 			HeaderField::create('CodeHD', _t('OptionItem.CodeHD', 'Modify Code'), 3),
131 131
 			TextField::create('CodeModifier')
132
-                ->setTitle(_t('OptionItem.CodeModifier', 'Code')),
132
+				->setTitle(_t('OptionItem.CodeModifier', 'Code')),
133 133
 			DropdownField::create('CodeModifierAction', _t('OptionItem.CodeModifierAction', 'Code Modification'),
134 134
 				array(
135 135
 					'Add' => _t(
136
-                        'OptionItem.CodeAdd',
137
-                        "Add to Base Code ({code})",
138
-                        'Add to code',
139
-                        array('code' => $parentCode)
140
-                    ),
136
+						'OptionItem.CodeAdd',
137
+						"Add to Base Code ({code})",
138
+						'Add to code',
139
+						array('code' => $parentCode)
140
+					),
141 141
 					'Subtract' => _t(
142
-                        'OptionItem.CodeSubtract',
143
-                        'Subtract from Base Code ({code})',
144
-                        'Subtract from code',
145
-                        array('code' => $parentCode)
146
-                    ),
142
+						'OptionItem.CodeSubtract',
143
+						'Subtract from Base Code ({code})',
144
+						'Subtract from code',
145
+						array('code' => $parentCode)
146
+					),
147 147
 					'Set' => _t('OptionItem.CodeSet', 'Set as a new Code')
148 148
 				)
149 149
 			)->setEmptyString('')
150 150
 			->setDescription(_t('OptionItem.CodeDescription', 'Does code modify or replace base code?'))
151 151
 		));
152 152
 
153
-        /*
153
+		/*
154 154
         // Cateogry Dropdown field w/ add new
155 155
         // removed until relevance determined
156 156
         $categories = function(){
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $fields->insertAfter($categoryField, 'ProductOptionGroupID');
167 167
         */
168 168
 
169
-        // allow CMS fields to be extended
169
+		// allow CMS fields to be extended
170 170
 		$this->extend('getCMSFields', $fields);
171 171
 
172 172
 		return $fields;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-class OptionItem extends DataObject{
8
+class OptionItem extends DataObject {
9 9
 
10 10
 	private static $db = array(
11 11
 		'Title' => 'Text',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 	private static $default_sort = 'SortOrder';
43 43
 
44
-	public function getCMSFields(){
44
+	public function getCMSFields() {
45 45
 		$fields = FieldList::create(
46 46
 			new Tabset('Root',
47 47
 				new Tab('Main'),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		$parentCode = $product->Code;
59 59
 
60 60
 		// ProductOptionGroup Dropdown field w/ add new
61
-		$groups = function(){
61
+		$groups = function() {
62 62
 		    return OptionGroup::get()->map()->toArray();
63 63
 		};
64 64
 		$groupFields = singleton('OptionGroup')->getCMSFields();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			Textfield::create('Title')
73 73
                 ->setTitle(_t("OptionItem.Title", "Product Option Name")),
74 74
 			CheckboxField::create('Available')
75
-				->setTitle( _t("OptionItem.Available", "Available for purchase"))
75
+				->setTitle(_t("OptionItem.Available", "Available for purchase"))
76 76
                 ->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")),
77 77
 			$groupField
78 78
 		));
@@ -172,18 +172,18 @@  discard block
 block discarded – undo
172 172
 		return $fields;
173 173
 	}
174 174
 
175
-	public function validate(){
175
+	public function validate() {
176 176
 		$result = parent::validate();
177 177
 
178
-		if($this->ProductOptionGroupID == 0){
178
+		if ($this->ProductOptionGroupID == 0) {
179 179
 			$result->error('Must set a Group prior to saving');
180 180
 		}
181 181
 
182 182
 		return $result;
183 183
 	}
184 184
 
185
-	public static function getOptionModifierActionSymbol($oma, $returnWithOnlyPlusMinus=false){
186
-		switch($oma){
185
+	public static function getOptionModifierActionSymbol($oma, $returnWithOnlyPlusMinus = false) {
186
+		switch ($oma) {
187 187
 			case 'Subtract':
188 188
 				$symbol = '-';
189 189
 				break;
@@ -196,23 +196,23 @@  discard block
 block discarded – undo
196 196
 		return $symbol;
197 197
 	}
198 198
 
199
-	public function getWeightModifierWithSymbol(){
199
+	public function getWeightModifierWithSymbol() {
200 200
 		return self::getOptionModifierActionSymbol($this->WeightModifierAction).$this->WeightModifier;
201 201
 	}
202 202
 
203
-	public function getPriceModifierWithSymbol(){
203
+	public function getPriceModifierWithSymbol() {
204 204
 		return self::getOptionModifierActionSymbol($this->PriceModifierAction).$this->PriceModifier;
205 205
 	}
206 206
 
207
-	public function getCodeModifierWithSymbol(){
207
+	public function getCodeModifierWithSymbol() {
208 208
 		return self::getOptionModifierActionSymbol($this->CodeModifierAction).$this->CodeModifier;
209 209
 	}
210 210
 
211
-	public function getProductOptionGroupTitle(){
211
+	public function getProductOptionGroupTitle() {
212 212
 		return $this->ProductOptionGroup()->Title;
213 213
 	}
214 214
 
215
-	public function getGeneratedValue(){
215
+	public function getGeneratedValue() {
216 216
 		$modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0';
217 217
 		$modPriceWithSymbol = OptionItem::getOptionModifierActionSymbol($this->PriceModifierAction).$modPrice;
218 218
 		$modWeight = ($this->WeightModifier) ? (string)$this->WeightModifier : '0';
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
 		return $this->Title.'{p'.$modPriceWithSymbol.'|w'.$modWeight.'|c'.$modCode.'}';
222 222
 	}
223 223
 
224
-	public function getGeneratedTitle(){
224
+	public function getGeneratedTitle() {
225 225
 		$modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0';
226 226
 		$title = $this->Title;
227
-		$title .= ($this->PriceModifier != 0) ? ': ('.OptionItem::getOptionModifierActionSymbol($this->PriceModifierAction, $returnWithOnlyPlusMinus=true).'$'.$modPrice.')' : '';
227
+		$title .= ($this->PriceModifier != 0) ? ': ('.OptionItem::getOptionModifierActionSymbol($this->PriceModifierAction, $returnWithOnlyPlusMinus = true).'$'.$modPrice.')' : '';
228 228
 		return $title;
229 229
 	}
230 230
 
231
-	public function getAvailability(){
232
-		return ($this->Available == 0) ? true : false ;
231
+	public function getAvailability() {
232
+		return ($this->Available == 0) ? true : false;
233 233
 	}
234 234
 
235 235
 	public function canView($member = false) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@
 block discarded – undo
65 65
 		$groupField = DropdownField::create('ProductOptionGroupID', _t("OptionItem.Group", "Group"), $groups())
66 66
 			->setEmptyString('')
67 67
             ->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>'));
68
-		if (class_exists('QuickAddNewExtension')) $groupField->useAddNew('OptionGroup', $groups, $groupFields);
68
+		if (class_exists('QuickAddNewExtension')) {
69
+			$groupField->useAddNew('OptionGroup', $groups, $groupFields);
70
+		}
69 71
 
70 72
         $fields->addFieldsToTab('Root.Main', array(
71 73
 			HeaderField::create('DetailsHD', _t("OptionItem.DetailsHD", "Product Option Details"), 2),
Please login to merge, or discard this patch.
code/objects/OrderAddress.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,30 +2,30 @@
 block discarded – undo
2 2
 
3 3
 class OrderAddress extends DataObject {
4 4
 
5
-    private static $db = array(
6
-        'Name' => 'Varchar(100)',
7
-        'Company' => 'Varchar',
8
-        'Address1' => 'Varchar(200)',
9
-        'Address2' => 'Varchar(200)',
10
-        'City' => 'Varchar(100)',
11
-        'State' => 'Varchar(100)',
12
-        'PostalCode' => 'Varchar(10)',
13
-        'Country' => 'Varchar(100)',
14
-        'Phone' => 'Varchar(20)'
15
-    );
16
-
17
-    private static $has_one = array(
18
-        'Order' => 'Order',
19
-        'Customer' => 'Member'
20
-    );
21
-
22
-    private static $singular_name = 'Order Address';
23
-    private static $plural_name = 'Order Addresses';
24
-    private static $description = '';
5
+	private static $db = array(
6
+		'Name' => 'Varchar(100)',
7
+		'Company' => 'Varchar',
8
+		'Address1' => 'Varchar(200)',
9
+		'Address2' => 'Varchar(200)',
10
+		'City' => 'Varchar(100)',
11
+		'State' => 'Varchar(100)',
12
+		'PostalCode' => 'Varchar(10)',
13
+		'Country' => 'Varchar(100)',
14
+		'Phone' => 'Varchar(20)'
15
+	);
16
+
17
+	private static $has_one = array(
18
+		'Order' => 'Order',
19
+		'Customer' => 'Member'
20
+	);
21
+
22
+	private static $singular_name = 'Order Address';
23
+	private static $plural_name = 'Order Addresses';
24
+	private static $description = '';
25 25
     
26
-    public function getTitle() {
27
-	    return $this->Name . ', ' . $this->Address1 . ', ' . $this->City . ' ' . $this->State . ' ' . $this->PostalCode . ' ' . $this->Country;
28
-    }
26
+	public function getTitle() {
27
+		return $this->Name . ', ' . $this->Address1 . ', ' . $this->City . ' ' . $this->State . ' ' . $this->PostalCode . ' ' . $this->Country;
28
+	}
29 29
 
30 30
 	public function getCMSFields(){
31 31
 		$fields = parent::getCMSFields();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@
 block discarded – undo
24 24
     private static $description = '';
25 25
     
26 26
     public function getTitle() {
27
-	    return $this->Name . ', ' . $this->Address1 . ', ' . $this->City . ' ' . $this->State . ' ' . $this->PostalCode . ' ' . $this->Country;
27
+	    return $this->Name.', '.$this->Address1.', '.$this->City.' '.$this->State.' '.$this->PostalCode.' '.$this->Country;
28 28
     }
29 29
 
30
-	public function getCMSFields(){
30
+	public function getCMSFields() {
31 31
 		$fields = parent::getCMSFields();
32 32
 
33 33
 
Please login to merge, or discard this patch.
code/objects/ProductDiscountTier.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	);
37 37
 	private static $indexes = array();
38 38
 
39
-	public function getCMSFields(){
39
+	public function getCMSFields() {
40 40
 		$fields = parent::getCMSFields();
41 41
 
42 42
 		$fields->removeByName('ProductPageID');
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * TODO implement validation to ensure values aren't duplicated in multiple tiers
61 61
 	 */
62
-	public function validate(){
62
+	public function validate() {
63 63
 		$result = parent::validate();
64 64
 
65 65
 		/*$tierQuantity = ProductDiscountTier::get()
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 		return $result;
89 89
 	}
90 90
 
91
-	public function getTitle(){
91
+	public function getTitle() {
92 92
 		return "{$this->Quantity} at {$this->Percentage}%";
93 93
 	}
94 94
 
95
-	public function getDiscountPercentage(){
95
+	public function getDiscountPercentage() {
96 96
 		return "{$this->Percentage}%";
97 97
 	}
98 98
 
Please login to merge, or discard this patch.
code/objects/ProductCategory.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@
 block discarded – undo
7 7
 
8 8
 class ProductCategory extends DataObject {
9 9
 
10
-    private static $db = array(
10
+	private static $db = array(
11 11
 		'Title' => 'Varchar(255)',
12 12
 		'Code' => 'Varchar(50)'
13 13
 	);
14 14
 
15
-    private static $singular_name = 'FoxyCart Category';
16
-    private static $plural_name = 'FoxyCart Categories';
17
-    private static $description = 'Set the FoxyCart Category on a Product';
15
+	private static $singular_name = 'FoxyCart Category';
16
+	private static $plural_name = 'FoxyCart Categories';
17
+	private static $description = 'Set the FoxyCart Category on a Product';
18 18
 
19
-    private static $summary_fields = array(
20
-        'Title' => 'Name',
21
-        'Code' => 'Code'
22
-    );
19
+	private static $summary_fields = array(
20
+		'Title' => 'Name',
21
+		'Code' => 'Code'
22
+	);
23 23
 
24 24
 	private static $indexes = array(
25 25
 		'Code' => true
26 26
 	);
27 27
 
28
-    public function getCMSFields() {
28
+	public function getCMSFields() {
29 29
 
30 30
 		$fields = FieldList::create(
31
-            LiteralField::create(
32
-                'PCIntro',
33
-                _t(
34
-                    'ProductCategory.PCIntro',
35
-                    '<p>Categories must be created in your
31
+			LiteralField::create(
32
+				'PCIntro',
33
+				_t(
34
+					'ProductCategory.PCIntro',
35
+					'<p>Categories must be created in your
36 36
                         <a href="https://admin.foxycart.com/admin.php?ThisAction=ManageProductCategories" target="_blank">
37 37
                             FoxyCart Product Categories
38 38
                         </a>, and also manually created in FoxyStripe.
39 39
                     </p>'
40
-                )
41
-            ),
42
-            TextField::create('Code')
43
-                ->setTitle(_t('ProductCategory.Code', 'FoxyCart Category Code'))
44
-                ->setDescription(_t('ProductCategory.CodeDescription', 'copy/paste from FoxyCart')),
45
-            TextField::create('Title')
46
-                ->setTitle(_t('ProductCategory.Title', 'FoxyCart Category Description'))
47
-                ->setDescription(_t('ProductCategory.TitleDescription', 'copy/paste from FoxyCart'))
48
-        );
49
-
50
-        $this->extend('updateCMSFields', $fields);
51
-
52
-        return $fields;
40
+				)
41
+			),
42
+			TextField::create('Code')
43
+				->setTitle(_t('ProductCategory.Code', 'FoxyCart Category Code'))
44
+				->setDescription(_t('ProductCategory.CodeDescription', 'copy/paste from FoxyCart')),
45
+			TextField::create('Title')
46
+				->setTitle(_t('ProductCategory.Title', 'FoxyCart Category Description'))
47
+				->setDescription(_t('ProductCategory.TitleDescription', 'copy/paste from FoxyCart'))
48
+		);
49
+
50
+		$this->extend('updateCMSFields', $fields);
51
+
52
+		return $fields;
53 53
 	}
54 54
 
55 55
 	public function requireDefaultRecords() {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 	public function requireDefaultRecords() {
56 56
 		parent::requireDefaultRecords();
57 57
 		$allCats = DataObject::get('ProductCategory');
58
-		if(!$allCats->count()){
58
+		if (!$allCats->count()) {
59 59
 			$cat = new ProductCategory();
60 60
 			$cat->Title = 'Default';
61 61
 			$cat->Code = 'DEFAULT';
Please login to merge, or discard this patch.
code/pages/OrderHistoryPage.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
 class OrderHistoryPage extends Page {
9 9
 
10
-    private static $singular_name = 'Order History Page';
11
-    private static $plural_name = 'Order History Pages';
12
-    private static $description = 'Show a customers past orders. Requires authentication';
10
+	private static $singular_name = 'Order History Page';
11
+	private static $plural_name = 'Order History Pages';
12
+	private static $description = 'Show a customers past orders. Requires authentication';
13 13
 
14 14
 	public function getCMSFields(){
15 15
 		$fields = parent::getCMSFields();
@@ -20,43 +20,43 @@  discard block
 block discarded – undo
20 20
 		return $fields;
21 21
 	}
22 22
 
23
-    // return all current Member's Orders
24
-    public function getOrders($limit = 10) {
25
-        if ($Member = Member::currentUser()) {
26
-            $Orders = $Member->Orders()->sort('TransactionDate', 'DESC');
23
+	// return all current Member's Orders
24
+	public function getOrders($limit = 10) {
25
+		if ($Member = Member::currentUser()) {
26
+			$Orders = $Member->Orders()->sort('TransactionDate', 'DESC');
27 27
 
28
-            $list = new PaginatedList($Orders, Controller::curr()->request);
29
-            $list->setPageLength($limit);
30
-            return $list;
31
-        }
32
-        return false;
33
-    }
28
+			$list = new PaginatedList($Orders, Controller::curr()->request);
29
+			$list->setPageLength($limit);
30
+			return $list;
31
+		}
32
+		return false;
33
+	}
34 34
 
35 35
 }
36 36
 
37 37
 class OrderHistoryPage_Controller extends Page_Controller {
38 38
 	
39 39
 	private static $allowed_actions = array(
40
-        'index'
41
-    );
42
-
43
-    public function checkMember() {
44
-        if(Member::currentUser()) {
45
-            return true;
46
-        } else {
47
-            return Security::permissionFailure ($this, _t (
48
-                'AccountPage.CANNOTCONFIRMLOGGEDIN',
49
-                'Please login to view this page.'
50
-            ));
51
-        }
52
-    }
53
-
54
-    public function Index() {
55
-
56
-        $this->checkMember();
57
-        return array();
58
-
59
-    }
40
+		'index'
41
+	);
42
+
43
+	public function checkMember() {
44
+		if(Member::currentUser()) {
45
+			return true;
46
+		} else {
47
+			return Security::permissionFailure ($this, _t (
48
+				'AccountPage.CANNOTCONFIRMLOGGEDIN',
49
+				'Please login to view this page.'
50
+			));
51
+		}
52
+	}
53
+
54
+	public function Index() {
55
+
56
+		$this->checkMember();
57
+		return array();
58
+
59
+	}
60 60
 
61 61
 
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     private static $plural_name = 'Order History Pages';
12 12
     private static $description = 'Show a customers past orders. Requires authentication';
13 13
 
14
-	public function getCMSFields(){
14
+	public function getCMSFields() {
15 15
 		$fields = parent::getCMSFields();
16 16
 
17 17
 
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
     );
42 42
 
43 43
     public function checkMember() {
44
-        if(Member::currentUser()) {
44
+        if (Member::currentUser()) {
45 45
             return true;
46
-        } else {
47
-            return Security::permissionFailure ($this, _t (
46
+        }else {
47
+            return Security::permissionFailure($this, _t(
48 48
                 'AccountPage.CANNOTCONFIRMLOGGEDIN',
49 49
                 'Please login to view this page.'
50 50
             ));
Please login to merge, or discard this patch.
code/pages/ProductPage.php 3 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 class ProductPage extends Page implements PermissionProvider {
9 9
 
10 10
 	private static $allowed_children = 'none';
11
-    private static $default_parent = 'ProductHolder';
12
-    private static $can_be_root = false;
11
+	private static $default_parent = 'ProductHolder';
12
+	private static $can_be_root = false;
13 13
 
14 14
 	private static $db = array(
15 15
 		'Price' => 'Currency',
@@ -29,72 +29,72 @@  discard block
 block discarded – undo
29 29
 	private static $has_many = array(
30 30
 		'ProductImages' => 'ProductImage',
31 31
 		'ProductOptions' => 'OptionItem',
32
-        'OrderDetails' => 'OrderDetail',
32
+		'OrderDetails' => 'OrderDetail',
33 33
 		'ProductDiscountTiers' => 'ProductDiscountTier'
34 34
 	);
35 35
 
36
-    private static $belongs_many_many = array(
36
+	private static $belongs_many_many = array(
37 37
 		'ProductHolders' => 'ProductHolder'
38
-    );
38
+	);
39 39
 
40
-    private static $singular_name = 'Product';
41
-    private static $plural_name = 'Products';
42
-    private static $description = 'A product that can be added to the shopping cart';
40
+	private static $singular_name = 'Product';
41
+	private static $plural_name = 'Products';
42
+	private static $description = 'A product that can be added to the shopping cart';
43 43
 
44
-    private static $indexes = array(
45
-        'Code' => true // make unique
46
-    );
44
+	private static $indexes = array(
45
+		'Code' => true // make unique
46
+	);
47 47
 
48 48
 	private static $defaults = array(
49 49
 		'ShowInMenus' => false,
50 50
 		'Available' => true,
51
-        'Weight' => '1.0'
51
+		'Weight' => '1.0'
52
+	);
53
+
54
+	private static $summary_fields = array(
55
+		'Title',
56
+		'Code',
57
+		'Price.Nice',
58
+		'Category.Title'
52 59
 	);
53 60
 
54
-    private static $summary_fields = array(
55
-        'Title',
56
-        'Code',
57
-        'Price.Nice',
58
-        'Category.Title'
59
-    );
60
-
61
-    private static $searchable_fields = array(
62
-        'Title',
63
-        'Code',
64
-        'Featured',
65
-        'Available',
66
-        'Category.ID'
67
-    );
68
-
69
-    function fieldLabels($includerelations = true) {
70
-        $labels = parent::fieldLabels();
71
-
72
-        $labels['Title'] = _t('ProductPage.TitleLabel', 'Name');
73
-        $labels['Code'] = _t('ProductPage.CodeLabel', "Code");
74
-        $labels['Price.Nice'] = _t('ProductPage.PriceLabel', 'Price');
75
-        $labels['Featured.Nice'] = _t('ProductPage.NiceLabel', 'Featured');
76
-        $labels['Available.Nice'] = _t('ProductPage.AvailableLabel', 'Available');
77
-        $labels['Category.ID'] = _t('ProductPage.IDLabel', 'Category');
78
-        $labels['Category.Title'] = _t('ProductPage.CategoryTitleLabel', 'Category');
79
-
80
-        return $labels;
81
-    }
61
+	private static $searchable_fields = array(
62
+		'Title',
63
+		'Code',
64
+		'Featured',
65
+		'Available',
66
+		'Category.ID'
67
+	);
68
+
69
+	function fieldLabels($includerelations = true) {
70
+		$labels = parent::fieldLabels();
71
+
72
+		$labels['Title'] = _t('ProductPage.TitleLabel', 'Name');
73
+		$labels['Code'] = _t('ProductPage.CodeLabel', "Code");
74
+		$labels['Price.Nice'] = _t('ProductPage.PriceLabel', 'Price');
75
+		$labels['Featured.Nice'] = _t('ProductPage.NiceLabel', 'Featured');
76
+		$labels['Available.Nice'] = _t('ProductPage.AvailableLabel', 'Available');
77
+		$labels['Category.ID'] = _t('ProductPage.IDLabel', 'Category');
78
+		$labels['Category.Title'] = _t('ProductPage.CategoryTitleLabel', 'Category');
79
+
80
+		return $labels;
81
+	}
82 82
 
83 83
 	public function getCMSFields() {
84 84
 		$fields = parent::getCMSFields();
85 85
 
86
-        // allow extensions of ProductPage to override the PreviewImage field description
86
+		// allow extensions of ProductPage to override the PreviewImage field description
87 87
 		$previewDescription = ($this->stat('customPreviewDescription')) ? $this->stat('customPreviewDescription') : _t('ProductPage.PreviewImageDescription', 'Image used throughout site to represent this product');
88 88
 
89 89
 		// Cateogry Dropdown field w/ add new
90 90
 		$source = function(){
91
-		    return ProductCategory::get()->map()->toArray();
91
+			return ProductCategory::get()->map()->toArray();
92 92
 		};
93 93
 		$catField = DropdownField::create('CategoryID', _t('ProductPage.Category', 'FoxyCart Category'), $source())
94
-            ->setEmptyString('')
95
-            ->setDescription(_t(
96
-                'ProductPage.CategoryDescription',
97
-                'Required, must also exist in
94
+			->setEmptyString('')
95
+			->setDescription(_t(
96
+				'ProductPage.CategoryDescription',
97
+				'Required, must also exist in
98 98
                     <a href="https://admin.foxycart.com/admin.php?ThisAction=ManageProductCategories" target="_blank">
99 99
                         FoxyCart Categories
100 100
                     </a>.
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                         <a href="admin/settings">
103 103
                             Settings > FoxyStripe > Categories
104 104
                         </a>'
105
-            ));
105
+			));
106 106
 		if (class_exists('QuickAddNewExtension')) $catField->useAddNew('ProductCategory', $source);
107 107
 
108 108
 		// Product Images gridfield
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 			$config->getComponentByType('GridFieldBulkUpload')->setUfConfig('folderName', 'Uploads/ProductImages');
114 114
 		}
115 115
 		$prodImagesField = GridField::create(
116
-            'ProductImages',
117
-            _t('ProductPage.ProductImages', 'Images'),
118
-            $this->ProductImages(),
119
-            $config
120
-        );
116
+			'ProductImages',
117
+			_t('ProductPage.ProductImages', 'Images'),
118
+			$this->ProductImages(),
119
+			$config
120
+		);
121 121
 
122 122
 		// Product Options field
123 123
 		$config = GridFieldConfig_RelationEditor::create();
@@ -130,47 +130,47 @@  discard block
 block discarded – undo
130 130
 		}
131 131
 		$config->removeComponentsByType('GridFieldAddExistingAutocompleter');
132 132
 		$prodOptField = GridField::create(
133
-            'ProductOptions',
134
-            _t('ProductPage.ProductOptions', 'Options'),
135
-            $products,
136
-            $config
137
-        );
133
+			'ProductOptions',
134
+			_t('ProductPage.ProductOptions', 'Options'),
135
+			$products,
136
+			$config
137
+		);
138 138
 
139 139
 		// Details tab
140 140
 		$fields->addFieldsToTab('Root.Details', array(
141 141
 			HeaderField::create('DetailHD', 'Product Details', 2),
142 142
 			CheckboxField::create('Available')
143 143
 				->setTitle(_t('ProductPage.Available', 'Available for purchase'))
144
-                ->setDescription(_t(
145
-                    'ProductPage.AvailableDescription',
146
-                    'If unchecked, will remove "Add to Cart" form and instead display "Currently unavailable"'
147
-                )),
148
-            TextField::create('Code')
149
-                ->setTitle(_t('ProductPage.Code', 'Product Code'))
150
-                ->setDescription(_t(
151
-                    'ProductPage.CodeDescription',
152
-                    'Required, must be unique. Product identifier used by FoxyCart in transactions'
153
-                )),
154
-            $catField,
155
-            CurrencyField::create('Price')
156
-                ->setTitle(_t('ProductPage.Price', 'Price'))
157
-                ->setDescription(_t(
158
-                    'ProductPage.PriceDescription',
159
-                    'Base price for this product. Can be modified using Product Options'
160
-                )),
161
-            NumericField::create('Weight')
162
-                ->setTitle(_t('ProductPage.Weight', 'Weight'))
163
-                ->setDescription(_t(
164
-                    'ProductPage.WeightDescription',
165
-                    'Base weight for this product in lbs. Can be modified using Product Options'
166
-                )),
144
+				->setDescription(_t(
145
+					'ProductPage.AvailableDescription',
146
+					'If unchecked, will remove "Add to Cart" form and instead display "Currently unavailable"'
147
+				)),
148
+			TextField::create('Code')
149
+				->setTitle(_t('ProductPage.Code', 'Product Code'))
150
+				->setDescription(_t(
151
+					'ProductPage.CodeDescription',
152
+					'Required, must be unique. Product identifier used by FoxyCart in transactions'
153
+				)),
154
+			$catField,
155
+			CurrencyField::create('Price')
156
+				->setTitle(_t('ProductPage.Price', 'Price'))
157
+				->setDescription(_t(
158
+					'ProductPage.PriceDescription',
159
+					'Base price for this product. Can be modified using Product Options'
160
+				)),
161
+			NumericField::create('Weight')
162
+				->setTitle(_t('ProductPage.Weight', 'Weight'))
163
+				->setDescription(_t(
164
+					'ProductPage.WeightDescription',
165
+					'Base weight for this product in lbs. Can be modified using Product Options'
166
+				)),
167 167
 			CheckboxField::create('Featured')
168 168
 				->setTitle(_t('ProductPage.Featured', 'Featured Product')),
169
-            TextField::create('ReceiptTitle')
170
-                ->setTitle(_t('ProductPage.ReceiptTitle', 'Product Title for Receipt'))
171
-                ->setDescription(_t(
172
-                        'ProductPage.ReceiptTitleDescription', 'Optional'
173
-                ))
169
+			TextField::create('ReceiptTitle')
170
+				->setTitle(_t('ProductPage.ReceiptTitle', 'Product Title for Receipt'))
171
+				->setDescription(_t(
172
+						'ProductPage.ReceiptTitleDescription', 'Optional'
173
+				))
174 174
 		));
175 175
 
176 176
 		// Images tab
@@ -184,19 +184,19 @@  discard block
 block discarded – undo
184 184
 			HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD'. 'Product Image Gallery'), 2),
185 185
 			$prodImagesField
186 186
 				->setDescription(_t(
187
-                        'ProductPage.ProductImagesDescription',
188
-                        'Additional Product Images, shown in gallery on Product page'
189
-                ))
187
+						'ProductPage.ProductImagesDescription',
188
+						'Additional Product Images, shown in gallery on Product page'
189
+				))
190 190
 		));
191 191
 
192 192
 		// Options Tab
193 193
 		$fields->addFieldsToTab('Root.Options', array(
194 194
 			HeaderField::create('OptionsHD', _t('ProductPage.OptionsHD', 'Product Options'), 2),
195 195
 			LiteralField::create('OptionsDescrip', _t(
196
-                'Page.OptionsDescrip',
197
-                '<p>Product Options allow products to be customized by attributes such as size or color.
196
+				'Page.OptionsDescrip',
197
+				'<p>Product Options allow products to be customized by attributes such as size or color.
198 198
                     Options can also modify the product\'s price, weight or code.</p>'
199
-            )),
199
+			)),
200 200
 			$prodOptField
201 201
 		));
202 202
 
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
 
215 215
 		if(FoxyCart::store_name_warning()!==null){
216 216
 			$fields->addFieldToTab('Root.Main', LiteralField::create("StoreSubDomainHeaderWarning", _t(
217
-                'ProductPage.StoreSubDomainHeaderWarning',
218
-                "<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>"
219
-            )), 'Title');
217
+				'ProductPage.StoreSubDomainHeaderWarning',
218
+				"<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>"
219
+			)), 'Title');
220 220
 		}
221 221
 
222 222
 		// allows CMS fields to be extended
Please login to merge, or discard this patch.
Spacing   +38 added lines, -39 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		$previewDescription = ($this->stat('customPreviewDescription')) ? $this->stat('customPreviewDescription') : _t('ProductPage.PreviewImageDescription', 'Image used throughout site to represent this product');
88 88
 
89 89
 		// Cateogry Dropdown field w/ add new
90
-		$source = function(){
90
+		$source = function() {
91 91
 		    return ProductCategory::get()->map()->toArray();
92 92
 		};
93 93
 		$catField = DropdownField::create('CategoryID', _t('ProductPage.Category', 'FoxyCart Category'), $source())
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 		// Product Options field
123 123
 		$config = GridFieldConfig_RelationEditor::create();
124 124
 		if (class_exists('GridFieldBulkManager')) $config->addComponent(new GridFieldBulkManager());
125
-		if (class_exists('GridFieldSortableRows')){
125
+		if (class_exists('GridFieldSortableRows')) {
126 126
 			$config->addComponent(new GridFieldSortableRows('SortOrder'));
127 127
 			$products = $this->ProductOptions()->sort('SortOrder');
128
-		}else{
128
+		}else {
129 129
 			$products = $this->ProductOptions();
130 130
 		}
131 131
 		$config->removeComponentsByType('GridFieldAddExistingAutocompleter');
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 				->setFolderName('Uploads/Products')
182 182
 				->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'))
183 183
 				->setAllowedMaxFileNumber(1),
184
-			HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD'. 'Product Image Gallery'), 2),
184
+			HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD'.'Product Image Gallery'), 2),
185 185
 			$prodImagesField
186 186
 				->setDescription(_t(
187 187
                         'ProductPage.ProductImagesDescription',
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
 			$prodOptField
201 201
 		));
202 202
 
203
-		if(!$this->DiscountTitle && $this->ProductDiscountTiers()->exists()){
203
+		if (!$this->DiscountTitle && $this->ProductDiscountTiers()->exists()) {
204 204
 			$fields->addFieldTotab('Root.Discounts', new LiteralField("ProductDiscountHeaderWarning", "<p class=\"message warning\">A discount title is required for FoxyCart to properly parse the value. The discounts will not be applied until a title is entered.</p>"));
205 205
 		}
206 206
 
207
-		$fields->addFieldToTab('Root.Discounts', TextField::create('DiscountTitle')->setTitle(_t('Product.DiscountTitle','Discount Title')));
207
+		$fields->addFieldToTab('Root.Discounts', TextField::create('DiscountTitle')->setTitle(_t('Product.DiscountTitle', 'Discount Title')));
208 208
 		$discountsConfig = GridFieldConfig_RelationEditor::create();
209 209
 		$discountsConfig->removeComponentsByType('GridFieldAddExistingAutocompleter');
210 210
 		$discountsConfig->removeComponentsByType('GridFieldDeleteAction');
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		$discountGrid = GridField::create('ProductDiscountTiers', 'Product Discounts', $this->ProductDiscountTiers(), $discountsConfig);
213 213
 		$fields->addFieldToTab('Root.Discounts', $discountGrid);
214 214
 
215
-		if(FoxyCart::store_name_warning()!==null){
215
+		if (FoxyCart::store_name_warning() !== null) {
216 216
 			$fields->addFieldToTab('Root.Main', LiteralField::create("StoreSubDomainHeaderWarning", _t(
217 217
                 'ProductPage.StoreSubDomainHeaderWarning',
218 218
                 "<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>"
@@ -225,25 +225,25 @@  discard block
 block discarded – undo
225 225
 		return $fields;
226 226
 	}
227 227
 
228
-	public function onBeforeWrite(){
228
+	public function onBeforeWrite() {
229 229
 		parent::onBeforeWrite();
230
-		if(!$this->CategoryID){
230
+		if (!$this->CategoryID) {
231 231
 			$default = ProductCategory::get()->filter(array('Code' => 'DEFAULT'))->first();
232 232
 			$this->CategoryID = $default->ID;
233 233
 		}
234 234
 
235 235
 		//update many_many lists when multi-group is on
236
-		if(SiteConfig::current_site_config()->MultiGroup){
236
+		if (SiteConfig::current_site_config()->MultiGroup) {
237 237
 			$holders = $this->ProductHolders();
238 238
 			$product = ProductPage::get()->byID($this->ID);
239 239
 			if (isset($product->ParentID)) {
240 240
 				$origParent = $product->ParentID;
241
-			} else {
241
+			}else {
242 242
 				$origParent = null;
243 243
 			}
244 244
 			$currentParent = $this->ParentID;
245
-			if($origParent!=$currentParent){
246
-				if($holders->find('ID', $origParent)){
245
+			if ($origParent != $currentParent) {
246
+				if ($holders->find('ID', $origParent)) {
247 247
 					$holders->removeByID($origParent);
248 248
 				}
249 249
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
 	}
260 260
 
261
-	public function onAfterWrite(){
261
+	public function onAfterWrite() {
262 262
 		parent::onAfterWrite();
263 263
 
264 264
 
@@ -266,17 +266,17 @@  discard block
 block discarded – undo
266 266
 	}
267 267
 
268 268
 	public function onBeforeDelete() {
269
-		if(!$this->isPublished()) {
269
+		if (!$this->isPublished()) {
270 270
 
271
-			$delete = function($object){
271
+			$delete = function($object) {
272 272
 				$object->delete();
273 273
 			};
274 274
 
275
-			if($this->ProductOptions()) {
275
+			if ($this->ProductOptions()) {
276 276
 				$options = $this->getComponents('ProductOptions');
277 277
 				$options->each($delete);
278 278
 			}
279
-			if($this->ProductImages()) {
279
+			if ($this->ProductImages()) {
280 280
 				//delete product image dataobjects, not the images themselves.
281 281
 				$images = $this->getComponents('ProductImages');
282 282
 				$images->each($delete);
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		parent::onBeforeDelete();
287 287
 	}
288 288
 
289
-	public function validate(){
289
+	public function validate() {
290 290
 		$result = parent::validate();
291 291
 
292 292
 		/*if($this->ID>0){
@@ -308,17 +308,16 @@  discard block
 block discarded – undo
308 308
 		return new RequiredFields(array('CategoryID', 'Price', 'Weight', 'Code'));
309 309
 	}
310 310
 
311
-	public static function getGeneratedValue($productCode = null, $optionName = null, $optionValue = null, $method = 'name', $output = false, $urlEncode = false){
312
-		$optionName = ($optionName !== null) ? preg_replace('/\s/','_', $optionName) : $optionName;
311
+	public static function getGeneratedValue($productCode = null, $optionName = null, $optionValue = null, $method = 'name', $output = false, $urlEncode = false) {
312
+		$optionName = ($optionName !== null) ? preg_replace('/\s/', '_', $optionName) : $optionName;
313 313
 		return (SiteConfig::current_site_config()->CartValidation)
314
-			? FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode):
315
-			$optionValue;
314
+			? FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : $optionValue;
316 315
 	}
317 316
 
318
-	public function getDiscountFieldValue(){
317
+	public function getDiscountFieldValue() {
319 318
 		$tiers = $this->ProductDiscountTiers();
320 319
 		$bulkString = '';
321
-		foreach($tiers as $tier){
320
+		foreach ($tiers as $tier) {
322 321
 			$bulkString .= "|{$tier->Quantity}-{$tier->Percentage}";
323 322
 		}
324 323
 		return "{$this->Title}{allunits{$bulkString}}";
@@ -340,7 +339,7 @@  discard block
 block discarded – undo
340 339
 		return Permission::check('Product_CANCRUD');
341 340
 	}
342 341
 
343
-	public function canPublish($member = null){
342
+	public function canPublish($member = null) {
344 343
 		return Permission::check('Product_CANCRUD');
345 344
 	}
346 345
 
@@ -358,10 +357,10 @@  discard block
 block discarded – undo
358 357
 		'PurchaseForm'
359 358
 	);
360 359
 
361
-	public function init(){
360
+	public function init() {
362 361
 		parent::init();
363 362
 		Requirements::javascript("framework/thirdparty/jquery/jquery.js");
364
-		if($this->data()->Available && $this->ProductOptions()->exists()){
363
+		if ($this->data()->Available && $this->ProductOptions()->exists()) {
365 364
 			Requirements::javascript("foxystripe/javascript/outOfStock.min.js");
366 365
 			Requirements::javascript("foxystripe/javascript/ProductOptions.min.js");
367 366
 		}
@@ -376,7 +375,7 @@  discard block
 block discarded – undo
376 375
 
377 376
 		$config = SiteConfig::current_site_config();
378 377
 
379
-		$assignAvailable = function($self){
378
+		$assignAvailable = function($self) {
380 379
 			$self->Available = ($self->getAvailability()) ? true : false;
381 380
 		};
382 381
 
@@ -386,12 +385,12 @@  discard block
 block discarded – undo
386 385
 		$hiddenTitle = ($data->ReceiptTitle) ? htmlspecialchars($data->ReceiptTitle) : htmlspecialchars($data->Title);
387 386
 		$code = $data->Code;
388 387
 
389
-		if($data->Available) {
388
+		if ($data->Available) {
390 389
 			$fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'name', $hiddenTitle))->setValue($hiddenTitle));
391 390
 			$fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'category', $data->Category()->Code))->setValue($data->Category()->Code));
392 391
 			$fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'code', $data->Code))->setValue($data->Code));
393 392
 			$fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'product_id', $data->ID))->setValue($data->ID));
394
-			$fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'price', $data->Price))->setValue($data->Price));//can't override id
393
+			$fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'price', $data->Price))->setValue($data->Price)); //can't override id
395 394
 			$fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'weight', $data->Weight))->setValue($data->Weight));
396 395
 			if ($this->DiscountTitle && $this->ProductDiscountTiers()->exists()) {
397 396
 				$fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'discount_quantity_percentage', $data->getDiscountFieldValue()))->setValue($data->getDiscountFieldValue()));
@@ -407,16 +406,16 @@  discard block
 block discarded – undo
407 406
 
408 407
 			$optionsSet = CompositeField::create();
409 408
 
410
-			foreach($groupedBy as $id => $set){
409
+			foreach ($groupedBy as $id => $set) {
411 410
 				$group = OptionGroup::get()->byID($id);
412 411
 				$title = $group->Title;
413
-				$name = preg_replace('/\s/','_', $title);
412
+				$name = preg_replace('/\s/', '_', $title);
414 413
 				$set->each($assignAvailable);
415 414
 				$disabled = array();
416 415
 				$fullOptions = array();
417
-				foreach($set as $item){
416
+				foreach ($set as $item) {
418 417
 					$fullOptions[ProductPage::getGeneratedValue($data->Code, $group->Title, $item->getGeneratedValue(), 'value')] = $item->getGeneratedTitle();
419
-					if(!$item->Availability) array_push($disabled, ProductPage::getGeneratedValue($data->Code, $group->Title, $item->getGeneratedValue(), 'value'));
418
+					if (!$item->Availability) array_push($disabled, ProductPage::getGeneratedValue($data->Code, $group->Title, $item->getGeneratedValue(), 'value'));
420 419
 				}
421 420
 				$optionsSet->push(
422 421
 					$dropdown = DropdownField::create($name, $title, $fullOptions)->setTitle($title)
@@ -438,7 +437,7 @@  discard block
 block discarded – undo
438 437
 
439 438
 			$fields->push(DropdownField::create('quantity', 'Quantity', $quantity));
440 439
 
441
-			$fields->push(HeaderField::create('submitPrice', '$' . $data->Price, 4));
440
+			$fields->push(HeaderField::create('submitPrice', '$'.$data->Price, 4));
442 441
 
443 442
 
444 443
 			$actions = FieldList::create(
@@ -448,17 +447,17 @@  discard block
 block discarded – undo
448 447
 				)
449 448
 			);
450 449
 			$submit->setAttribute('name', ProductPage::getGeneratedValue($code, 'Submit', _t('ProductForm.AddToCart', 'Add to Cart')));
451
-			if(!$config->StoreName || $config->StoreName == '' || !isset($config->StoreName)){
450
+			if (!$config->StoreName || $config->StoreName == '' || !isset($config->StoreName)) {
452 451
 				$submit->setAttribute('Disabled', true);
453 452
 			}
454 453
 			$this->extend('updatePurchaseFormFields', $fields);
455
-		}else{
454
+		}else {
456 455
 			$fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock'), 4);
457 456
 			$actions = FieldList::create();
458 457
 		}
459 458
 
460 459
 		$form = Form::create($this, 'PurchaseForm', $fields, $actions);
461
-		$form->setAttribute('action',FoxyCart::FormActionURL());
460
+		$form->setAttribute('action', FoxyCart::FormActionURL());
462 461
 		$form->disableSecurityToken();
463 462
 
464 463
 		$this->extend('updatePurchaseForm', $form);
Please login to merge, or discard this patch.
Braces   +17 added lines, -7 removed lines patch added patch discarded remove patch
@@ -103,11 +103,15 @@  discard block
 block discarded – undo
103 103
                             Settings > FoxyStripe > Categories
104 104
                         </a>'
105 105
             ));
106
-		if (class_exists('QuickAddNewExtension')) $catField->useAddNew('ProductCategory', $source);
106
+		if (class_exists('QuickAddNewExtension')) {
107
+			$catField->useAddNew('ProductCategory', $source);
108
+		}
107 109
 
108 110
 		// Product Images gridfield
109 111
 		$config = GridFieldConfig_RelationEditor::create();
110
-		if (class_exists('GridFieldSortableRows')) $config->addComponent(new GridFieldSortableRows('SortOrder'));
112
+		if (class_exists('GridFieldSortableRows')) {
113
+			$config->addComponent(new GridFieldSortableRows('SortOrder'));
114
+		}
111 115
 		if (class_exists('GridFieldBulkImageUpload')) {
112 116
 			$config->addComponent(new GridFieldBulkUpload());
113 117
 			$config->getComponentByType('GridFieldBulkUpload')->setUfConfig('folderName', 'Uploads/ProductImages');
@@ -121,11 +125,13 @@  discard block
 block discarded – undo
121 125
 
122 126
 		// Product Options field
123 127
 		$config = GridFieldConfig_RelationEditor::create();
124
-		if (class_exists('GridFieldBulkManager')) $config->addComponent(new GridFieldBulkManager());
128
+		if (class_exists('GridFieldBulkManager')) {
129
+			$config->addComponent(new GridFieldBulkManager());
130
+		}
125 131
 		if (class_exists('GridFieldSortableRows')){
126 132
 			$config->addComponent(new GridFieldSortableRows('SortOrder'));
127 133
 			$products = $this->ProductOptions()->sort('SortOrder');
128
-		}else{
134
+		} else{
129 135
 			$products = $this->ProductOptions();
130 136
 		}
131 137
 		$config->removeComponentsByType('GridFieldAddExistingAutocompleter');
@@ -396,10 +402,12 @@  discard block
 block discarded – undo
396 402
 			if ($this->DiscountTitle && $this->ProductDiscountTiers()->exists()) {
397 403
 				$fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'discount_quantity_percentage', $data->getDiscountFieldValue()))->setValue($data->getDiscountFieldValue()));
398 404
 			}
399
-			if ($this->PreviewImage()->Exists()) $fields->push(
405
+			if ($this->PreviewImage()->Exists()) {
406
+				$fields->push(
400 407
 				HiddenField::create(ProductPage::getGeneratedValue($code, 'image', $data->PreviewImage()->PaddedImage(80, 80)->absoluteURL))
401 408
 					->setValue($data->PreviewImage()->PaddedImage(80, 80)->absoluteURL)
402 409
 			);
410
+			}
403 411
 
404 412
 			$options = $data->ProductOptions();
405 413
 			$groupedOptions = new GroupedList($options);
@@ -416,7 +424,9 @@  discard block
 block discarded – undo
416 424
 				$fullOptions = array();
417 425
 				foreach($set as $item){
418 426
 					$fullOptions[ProductPage::getGeneratedValue($data->Code, $group->Title, $item->getGeneratedValue(), 'value')] = $item->getGeneratedTitle();
419
-					if(!$item->Availability) array_push($disabled, ProductPage::getGeneratedValue($data->Code, $group->Title, $item->getGeneratedValue(), 'value'));
427
+					if(!$item->Availability) {
428
+						array_push($disabled, ProductPage::getGeneratedValue($data->Code, $group->Title, $item->getGeneratedValue(), 'value'));
429
+					}
420 430
 				}
421 431
 				$optionsSet->push(
422 432
 					$dropdown = DropdownField::create($name, $title, $fullOptions)->setTitle($title)
@@ -452,7 +462,7 @@  discard block
 block discarded – undo
452 462
 				$submit->setAttribute('Disabled', true);
453 463
 			}
454 464
 			$this->extend('updatePurchaseFormFields', $fields);
455
-		}else{
465
+		} else{
456 466
 			$fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock'), 4);
457 467
 			$actions = FieldList::create();
458 468
 		}
Please login to merge, or discard this patch.
code/extensions/FoxyStripeSiteConfig.php 2 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -11,24 +11,24 @@  discard block
 block discarded – undo
11 11
 		'MaxQuantity' => 'Int'
12 12
 	);
13 13
 
14
-    // Set Default values
15
-    private static $defaults = array(
16
-        'ProductLimit' => 10
17
-    );
14
+	// Set Default values
15
+	private static $defaults = array(
16
+		'ProductLimit' => 10
17
+	);
18 18
 
19 19
 	public function updateCMSFields(FieldList $fields){
20 20
 
21
-        // set TabSet names to avoid spaces from camel case
22
-        $fields->addFieldToTab('Root', new TabSet('FoxyStripe', 'FoxyStripe'));
21
+		// set TabSet names to avoid spaces from camel case
22
+		$fields->addFieldToTab('Root', new TabSet('FoxyStripe', 'FoxyStripe'));
23 23
 
24
-        // settings tab
25
-        $fields->addFieldsToTab('Root.FoxyStripe.Settings', array(
26
-            // Store Details
24
+		// settings tab
25
+		$fields->addFieldsToTab('Root.FoxyStripe.Settings', array(
26
+			// Store Details
27 27
 			HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3),
28 28
 			LiteralField::create('DetailsIntro', _t(
29 29
 				'FoxyStripeSiteConfig.DetailsIntro',
30
-                '<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditStore" target="_blank">FoxyCart store settings</a>.'
31
-            )),
30
+				'<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditStore" target="_blank">FoxyCart store settings</a>.'
31
+			)),
32 32
 			TextField::create('StoreName')
33 33
 				->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Sub Domain'))
34 34
 				->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'the sub domain for your FoxyCart store')),
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 			// Advanced Settings
37 37
 			HeaderField::create('AdvanceHeader', _t('FoxyStripeSiteConfig.AdvancedHeader', 'Advanced Settings'), 3),
38 38
 			LiteralField::create('AdvancedIntro', _t(
39
-                'FoxyStripeSiteConfig.AdvancedIntro',
39
+				'FoxyStripeSiteConfig.AdvancedIntro',
40 40
 				'<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures" target="_blank">FoxyCart advanced store settings</a>.</p>'
41 41
 			)),
42 42
 			ReadonlyField::create('DataFeedLink', _t('FoxyStripeSiteConfig.DataFeedLink', 'FoxyCart DataFeed URL'), self::getDataFeedLink())
@@ -44,108 +44,108 @@  discard block
 block discarded – undo
44 44
 			CheckboxField::create('CartValidation')
45 45
 				->setTitle(_t('FoxyStripeSiteConfig.CartValidation', 'Enable Cart Validation'))
46 46
 				->setDescription(_t(
47
-                    'FoxyStripeSiteConfig.CartValidationDescription',
48
-                    'You must <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures#use_cart_validation" target="_blank">enable cart validation</a> in the FoxyCart admin.'
49
-            )),
47
+					'FoxyStripeSiteConfig.CartValidationDescription',
48
+					'You must <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures#use_cart_validation" target="_blank">enable cart validation</a> in the FoxyCart admin.'
49
+			)),
50 50
 			ReadonlyField::create('StoreKey')
51 51
 				->setTitle(_t('FoxyStripeSiteConfig.StoreKey', 'FoxyCart API Key'))
52 52
 				->setDescription(_t('FoxyStripeSiteConfig.StoreKeyDescription', 'copy/paste to FoxyCart')),
53 53
 			ReadonlyField::create('SSOLink', _t('FoxyStripeSiteConfig.SSOLink', 'Single Sign On URL'), self::getSSOLink())
54 54
 				->setDescription(_t('FoxyStripeSiteConfig.SSOLinkDescription', 'copy/paste to FoxyCart'))
55
-        ));
55
+		));
56 56
 
57
-        // configuration warning
57
+		// configuration warning
58 58
 		if(FoxyCart::store_name_warning()!==null){
59 59
 			$fields->insertBefore(LiteralField::create(
60
-                "StoreSubDomainHeaderWarning",
61
-                _t(
62
-                    'FoxyStripeSiteConfig.StoreSubDomainHeadingWarning',
63
-                    "<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>"
64
-                )
65
-            ), 'StoreDetails');
60
+				"StoreSubDomainHeaderWarning",
61
+				_t(
62
+					'FoxyStripeSiteConfig.StoreSubDomainHeadingWarning',
63
+					"<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>"
64
+				)
65
+			), 'StoreDetails');
66 66
 		}
67 67
 
68
-        // products tab
68
+		// products tab
69 69
 		$fields->addFieldsToTab('Root.FoxyStripe.Products', array(
70 70
 			HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3),
71 71
 			CheckboxField::create('MultiGroup')
72 72
 				->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups'))
73 73
 				->setDescription(_t(
74
-                    'FoxyStripeSiteConfig.MultiGroupDescription',
75
-                    'Allows products to be shown in multiple Product Groups'
76
-                )),
74
+					'FoxyStripeSiteConfig.MultiGroupDescription',
75
+					'Allows products to be shown in multiple Product Groups'
76
+				)),
77 77
 			HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3),
78 78
 			NumericField::create('ProductLimit')
79 79
 				->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page'))
80 80
 				->setDescription(_t(
81
-                    'FoxyStripeSiteConfig.ProductLimitDescription',
82
-                    'Number of Products to show per page on a Product Group'
83
-                )),
81
+					'FoxyStripeSiteConfig.ProductLimitDescription',
82
+					'Number of Products to show per page on a Product Group'
83
+				)),
84 84
 			HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3),
85 85
 			NumericField::create('MaxQuantity')
86 86
 				->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity'))
87 87
 				->setDescription(_t(
88
-                    'FoxyStripeSiteConfig.MaxQuantityDescription',
89
-                    'Sets max quantity for product form dropdown (add to cart form - default 10)'
90
-                ))
88
+					'FoxyStripeSiteConfig.MaxQuantityDescription',
89
+					'Sets max quantity for product form dropdown (add to cart form - default 10)'
90
+				))
91 91
 		));
92 92
 
93
-        // categories tab
93
+		// categories tab
94 94
 		$fields->addFieldsToTab('Root.FoxyStripe.Categories', array(
95 95
 			HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3),
96 96
 			LiteralField::create('CategoryDescrip', _t(
97
-                'FoxyStripeSiteConfig.CategoryDescrip',
98
-                '<p>FoxyCart Categories offer a way to give products additional behaviors that cannot be accomplished by product options alone, including category specific coupon codes, shipping and handling fees, and email receipts. <a href="https://wiki.foxycart.com/v/2.0/categories" target="_blank">Learn More</a></p><p>Categories you\'ve created in FoxyStripe must also be created in your <a href="https://admin.foxycart.com/admin.php?ThisAction=ManageProductCategories" target="_blank">FoxyCart Categories</a> admin panel.</p>'
99
-            )),
97
+				'FoxyStripeSiteConfig.CategoryDescrip',
98
+				'<p>FoxyCart Categories offer a way to give products additional behaviors that cannot be accomplished by product options alone, including category specific coupon codes, shipping and handling fees, and email receipts. <a href="https://wiki.foxycart.com/v/2.0/categories" target="_blank">Learn More</a></p><p>Categories you\'ve created in FoxyStripe must also be created in your <a href="https://admin.foxycart.com/admin.php?ThisAction=ManageProductCategories" target="_blank">FoxyCart Categories</a> admin panel.</p>'
99
+			)),
100 100
 			GridField::create(
101
-                'ProductCategory',
102
-                _t('FoxyStripeSiteConfig.ProductCategory', 'FoxyCart Categories'),
103
-                ProductCategory::get(),
104
-                GridFieldConfig_RecordEditor::create()
105
-            )
101
+				'ProductCategory',
102
+				_t('FoxyStripeSiteConfig.ProductCategory', 'FoxyCart Categories'),
103
+				ProductCategory::get(),
104
+				GridFieldConfig_RecordEditor::create()
105
+			)
106 106
 		));
107 107
 
108
-        // option groups tab
108
+		// option groups tab
109 109
 		$fields->addFieldsToTab('Root.FoxyStripe.Groups', array(
110 110
 			HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3),
111 111
 			LiteralField::create('OptionGroupsDescrip', _t(
112
-                'FoxyStripeSiteConfig.OptionGroupsDescrip',
113
-                '<p>Product Option Groups allow you to name a set of product options.</p>'
114
-            )),
112
+				'FoxyStripeSiteConfig.OptionGroupsDescrip',
113
+				'<p>Product Option Groups allow you to name a set of product options.</p>'
114
+			)),
115 115
 			GridField::create(
116
-                'OptionGroup',
117
-                _t('FoxyStripeSiteConfig.OptionGroup', 'Product Option Groups'),
118
-                OptionGroup::get(),
119
-                GridFieldConfig_RecordEditor::create()
120
-            )
116
+				'OptionGroup',
117
+				_t('FoxyStripeSiteConfig.OptionGroup', 'Product Option Groups'),
118
+				OptionGroup::get(),
119
+				GridFieldConfig_RecordEditor::create()
120
+			)
121 121
 		));
122 122
 
123 123
 	}
124 124
 
125
-    private static function getSSOLink() {
126
-        return Director::absoluteBaseURL()."foxystripe/sso/";
127
-    }
125
+	private static function getSSOLink() {
126
+		return Director::absoluteBaseURL()."foxystripe/sso/";
127
+	}
128 128
 
129
-    private static function getDataFeedLink() {
130
-        return Director::absoluteBaseURL()."foxystripe/";
131
-    }
129
+	private static function getDataFeedLink() {
130
+		return Director::absoluteBaseURL()."foxystripe/";
131
+	}
132 132
 
133
-    // generate key on install
134
-    public function requireDefaultRecords() {
133
+	// generate key on install
134
+	public function requireDefaultRecords() {
135 135
 
136
-        parent::requireDefaultRecords();
136
+		parent::requireDefaultRecords();
137 137
 
138
-        $siteConfig = SiteConfig::current_site_config();
138
+		$siteConfig = SiteConfig::current_site_config();
139 139
 
140
-        if(!$siteConfig->StoreKey) {
141
-            $key = FoxyCart::setStoreKey();
142
-            while(!ctype_alnum($key)){
143
-                $key = FoxyCart::setStoreKey();
144
-            }
145
-            $siteConfig->StoreKey = $key;
146
-            $siteConfig->write();
147
-            DB::alteration_message($siteConfig->ClassName.": created FoxyCart Store Key " . $key, 'created');
148
-        }
149
-    }
140
+		if(!$siteConfig->StoreKey) {
141
+			$key = FoxyCart::setStoreKey();
142
+			while(!ctype_alnum($key)){
143
+				$key = FoxyCart::setStoreKey();
144
+			}
145
+			$siteConfig->StoreKey = $key;
146
+			$siteConfig->write();
147
+			DB::alteration_message($siteConfig->ClassName.": created FoxyCart Store Key " . $key, 'created');
148
+		}
149
+	}
150 150
 
151 151
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class FoxyStripeSiteConfig extends DataExtension{
3
+class FoxyStripeSiteConfig extends DataExtension {
4 4
 
5 5
 	private static $db = array(
6 6
 		'StoreName' => 'Varchar(255)',
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         'ProductLimit' => 10
17 17
     );
18 18
 
19
-	public function updateCMSFields(FieldList $fields){
19
+	public function updateCMSFields(FieldList $fields) {
20 20
 
21 21
         // set TabSet names to avoid spaces from camel case
22 22
         $fields->addFieldToTab('Root', new TabSet('FoxyStripe', 'FoxyStripe'));
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         ));
56 56
 
57 57
         // configuration warning
58
-		if(FoxyCart::store_name_warning()!==null){
58
+		if (FoxyCart::store_name_warning() !== null) {
59 59
 			$fields->insertBefore(LiteralField::create(
60 60
                 "StoreSubDomainHeaderWarning",
61 61
                 _t(
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 
138 138
         $siteConfig = SiteConfig::current_site_config();
139 139
 
140
-        if(!$siteConfig->StoreKey) {
140
+        if (!$siteConfig->StoreKey) {
141 141
             $key = FoxyCart::setStoreKey();
142
-            while(!ctype_alnum($key)){
142
+            while (!ctype_alnum($key)) {
143 143
                 $key = FoxyCart::setStoreKey();
144 144
             }
145 145
             $siteConfig->StoreKey = $key;
146 146
             $siteConfig->write();
147
-            DB::alteration_message($siteConfig->ClassName.": created FoxyCart Store Key " . $key, 'created');
147
+            DB::alteration_message($siteConfig->ClassName.": created FoxyCart Store Key ".$key, 'created');
148 148
         }
149 149
     }
150 150
 
Please login to merge, or discard this patch.
code/extensions/FoxyStripePageExtension.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 class FoxyStripePageExtension extends DataExtension {
4 4
 
5
-    // get FoxyCart Store Name for JS call
6
-    public function getCartScript() {
7
-        return '<script src="https://cdn.foxycart.com/' . FoxyCart::getFoxyCartStoreName() . '/loader.js" async defer></script>';
8
-    }
5
+	// get FoxyCart Store Name for JS call
6
+	public function getCartScript() {
7
+		return '<script src="https://cdn.foxycart.com/' . FoxyCart::getFoxyCartStoreName() . '/loader.js" async defer></script>';
8
+	}
9 9
 
10 10
 }
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
     // get FoxyCart Store Name for JS call
6 6
     public function getCartScript() {
7
-        return '<script src="https://cdn.foxycart.com/' . FoxyCart::getFoxyCartStoreName() . '/loader.js" async defer></script>';
7
+        return '<script src="https://cdn.foxycart.com/'.FoxyCart::getFoxyCartStoreName().'/loader.js" async defer></script>';
8 8
     }
9 9
 
10 10
 }
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
code/extensions/CustomerExtension.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -2,35 +2,35 @@
 block discarded – undo
2 2
 
3 3
 class CustomerExtension extends DataExtension{
4 4
 
5
-    private static $db = array(
6
-        'Customer_ID' => 'Int',
7
-        'MinifraudScore' => 'Varchar'
8
-    );
5
+	private static $db = array(
6
+		'Customer_ID' => 'Int',
7
+		'MinifraudScore' => 'Varchar'
8
+	);
9 9
 
10
-    private static $has_many = array(
11
-        'Orders' => 'Order',
12
-        'OrderAddresses' => 'OrderAddress'
13
-    );
10
+	private static $has_many = array(
11
+		'Orders' => 'Order',
12
+		'OrderAddresses' => 'OrderAddress'
13
+	);
14 14
 
15
-    private static $indexes = array(
16
-        'Customer_ID' => true // make unique
17
-    );
15
+	private static $indexes = array(
16
+		'Customer_ID' => true // make unique
17
+	);
18 18
 
19
-    public function onBeforeWrite() {
20
-        parent::onBeforeWrite();
19
+	public function onBeforeWrite() {
20
+		parent::onBeforeWrite();
21 21
 
22
-        // if Member data was imported from FoxyCart, PasswordEncryption will be set to 'none'.
23
-        // Change to sh1_v2.4 to ensure SilverStripe is using the same hash as FoxyCart API 1.1
24
-        $this->owner->PasswordEncryption = 'sha1_v2.4';
22
+		// if Member data was imported from FoxyCart, PasswordEncryption will be set to 'none'.
23
+		// Change to sh1_v2.4 to ensure SilverStripe is using the same hash as FoxyCart API 1.1
24
+		$this->owner->PasswordEncryption = 'sha1_v2.4';
25 25
 
26
-        // Send updated customer data to Foxy Cart via API
27
-        $response = FoxyCart::putCustomer($this->owner);
26
+		// Send updated customer data to Foxy Cart via API
27
+		$response = FoxyCart::putCustomer($this->owner);
28 28
 
29
-        // Grab customer_id record from FoxyCart response, store in Member
29
+		// Grab customer_id record from FoxyCart response, store in Member
30 30
 		if($response){
31
-        	$foxyResponse = new SimpleXMLElement($response);
32
-        	$this->owner->Customer_ID = (int) $foxyResponse->customer_id;
31
+			$foxyResponse = new SimpleXMLElement($response);
32
+			$this->owner->Customer_ID = (int) $foxyResponse->customer_id;
33 33
 		}
34
-    }
34
+	}
35 35
 
36 36
 }
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class CustomerExtension extends DataExtension{
3
+class CustomerExtension extends DataExtension {
4 4
 
5 5
     private static $db = array(
6 6
         'Customer_ID' => 'Int',
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
         $response = FoxyCart::putCustomer($this->owner);
28 28
 
29 29
         // Grab customer_id record from FoxyCart response, store in Member
30
-		if($response){
30
+		if ($response) {
31 31
         	$foxyResponse = new SimpleXMLElement($response);
32
-        	$this->owner->Customer_ID = (int) $foxyResponse->customer_id;
32
+        	$this->owner->Customer_ID = (int)$foxyResponse->customer_id;
33 33
 		}
34 34
     }
35 35
 
Please login to merge, or discard this patch.