Completed
Push — master ( aa83e2...f8f77e )
by Jason
22:25 queued 07:26
created
code/pages/ProductPage.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             'Image used throughout site to represent this product');
96 96
 
97 97
         // Cateogry Dropdown field w/ add new
98
-        $source = function () {
98
+        $source = function() {
99 99
             return ProductCategory::get()->map()->toArray();
100 100
         };
101 101
         $catField = DropdownField::create('CategoryID', _t('ProductPage.Category', 'FoxyCart Category'), $source())
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         if (class_exists('GridFieldSortableRows')) {
140 140
             $config->addComponent(new GridFieldSortableRows('SortOrder'));
141 141
             $products = $this->ProductOptions()->sort('SortOrder');
142
-        } else {
142
+        }else {
143 143
             $products = $this->ProductOptions();
144 144
         }
145 145
         $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                 ->setFolderName('Uploads/Products')
196 196
                 ->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'))
197 197
                 ->setAllowedMaxFileNumber(1),
198
-            HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD' . 'Product Image Gallery'), 2),
198
+            HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD'.'Product Image Gallery'), 2),
199 199
             $prodImagesField
200 200
                 ->setDescription(_t(
201 201
                     'ProductPage.ProductImagesDescription',
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             $product = ProductPage::get()->byID($this->ID);
242 242
             if (isset($product->ParentID)) {
243 243
                 $origParent = $product->ParentID;
244
-            } else {
244
+            }else {
245 245
                 $origParent = null;
246 246
             }
247 247
             $currentParent = $this->ParentID;
@@ -322,14 +322,13 @@  discard block
 block discarded – undo
322 322
     ) {
323 323
         $optionName = ($optionName !== null) ? preg_replace('/\s/', '_', $optionName) : $optionName;
324 324
         return (SiteConfig::current_site_config()->CartValidation)
325
-            ? FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) :
326
-            $optionValue;
325
+            ? FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : $optionValue;
327 326
     }
328 327
 
329 328
     // get FoxyCart Store Name for JS call
330 329
     public function getCartScript()
331 330
     {
332
-        return '<script src="https://cdn.foxycart.com/' . FoxyCart::getFoxyCartStoreName() . '/loader.js" async defer></script>';
331
+        return '<script src="https://cdn.foxycart.com/'.FoxyCart::getFoxyCartStoreName().'/loader.js" async defer></script>';
333 332
     }
334 333
 
335 334
     /**
Please login to merge, or discard this patch.
code/objects/OptionItem.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $parentCode = $product->Code;
91 91
 
92 92
         // ProductOptionGroup Dropdown field w/ add new
93
-        $groups = function () {
93
+        $groups = function() {
94 94
             return OptionGroup::get()->map()->toArray();
95 95
         };
96 96
         $groupFields = singleton('OptionGroup')->getCMSFields();
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      * @param bool $returnWithOnlyPlusMinus
225 225
      * @return string
226 226
      */
227
-    public static function getOptionModifierActionSymbol($oma, $returnWithOnlyPlusMinus=false)
227
+    public static function getOptionModifierActionSymbol($oma, $returnWithOnlyPlusMinus = false)
228 228
     {
229 229
         switch ($oma) {
230 230
             case 'Subtract':
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
     {
292 292
         $modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0';
293 293
         $title = $this->Title;
294
-        $title .= ($this->PriceModifier != 0) ? ': ('.OptionItem::getOptionModifierActionSymbol($this->PriceModifierAction, $returnWithOnlyPlusMinus=true).'$'.$modPrice.')' : '';
294
+        $title .= ($this->PriceModifier != 0) ? ': ('.OptionItem::getOptionModifierActionSymbol($this->PriceModifierAction, $returnWithOnlyPlusMinus = true).'$'.$modPrice.')' : '';
295 295
         return $title;
296 296
     }
297 297
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      */
301 301
     public function getAvailability()
302 302
     {
303
-        $available = ($this->Available == 1) ? true : false ;
303
+        $available = ($this->Available == 1) ? true : false;
304 304
 
305 305
         $this->extend('updateOptionAvailability', $available);
306 306
 
Please login to merge, or discard this patch.
code/extensions/CustomerExtension.php 1 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'
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
         $response = FoxyCart::putCustomer($this->owner);
26 26
 
27 27
         // Grab customer_id record from FoxyCart response, store in Member
28
-		if($response){
28
+		if ($response) {
29 29
         	$foxyResponse = new SimpleXMLElement($response);
30
-        	$this->owner->Customer_ID = (int) $foxyResponse->customer_id;
30
+        	$this->owner->Customer_ID = (int)$foxyResponse->customer_id;
31 31
 		}
32 32
     }
33 33
 
Please login to merge, or discard this patch.
code/model/FoxyStripeClient.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 }
128 128
             }
129 129
             if (count($errors)) {
130
-                \SS_Log::log('setCurrentStore errors - ' . json_encode($errors), \SS_Log::WARN);
130
+                \SS_Log::log('setCurrentStore errors - '.json_encode($errors), \SS_Log::WARN);
131 131
             }
132 132
         }
133 133
     }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
         $errors = array_merge($errors, $client->getErrors($result));
144 144
         if (count($errors)) {
145
-            \SS_Log::log('updateStore errors - ' . json_encode($errors), \SS_Log::WARN);
145
+            \SS_Log::log('updateStore errors - '.json_encode($errors), \SS_Log::WARN);
146 146
         }
147 147
     }
148 148
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
         $errors = array_merge($errors, $client->getErrors($result));
171 171
         if (count($errors)) {
172
-            \SS_Log::log('setItemCategoriesURL errors - ' . json_encode($errors), \SS_Log::WARN);
172
+            \SS_Log::log('setItemCategoriesURL errors - '.json_encode($errors), \SS_Log::WARN);
173 173
         }
174 174
     }
175 175
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
         $errors = array_merge($errors, $client->getErrors($result));
196 196
         if (count($errors)) {
197
-            \SS_Log::log('setItemCategories errors - ' . json_encode($errors), \SS_Log::WARN);
197
+            \SS_Log::log('setItemCategories errors - '.json_encode($errors), \SS_Log::WARN);
198 198
         }
199 199
     }
200 200
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                 }
218 218
                 $errors = array_merge($errors, $client->getErrors($result));
219 219
                 if (count($errors)) {
220
-                    \SS_Log::log('getCategory errors - ' . json_encode($errors), \SS_Log::WARN);
220
+                    \SS_Log::log('getCategory errors - '.json_encode($errors), \SS_Log::WARN);
221 221
                 }
222 222
             }
223 223
         }
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 
235 235
         if ($category = $this->getCategory($data['code'])) {
236 236
             $result = $client->patch($category, $data);
237
-        } else {
237
+        }else {
238 238
             $result = $client->post($this->getItemCategoriesURL(), $data);
239 239
         }
240 240
         $errors = array_merge($errors, $client->getErrors($result));
241 241
         if (count($errors)) {
242
-            \SS_Log::log('putCategory errors - ' . json_encode($errors), \SS_Log::WARN);
242
+            \SS_Log::log('putCategory errors - '.json_encode($errors), \SS_Log::WARN);
243 243
         }
244 244
     }
245 245
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
             $errors = array_merge($errors, $client->getErrors($result));
258 258
             if (count($errors)) {
259
-                \SS_Log::log('deleteCategory errors - ' . json_encode($errors), \SS_Log::WARN);
259
+                \SS_Log::log('deleteCategory errors - '.json_encode($errors), \SS_Log::WARN);
260 260
             }
261 261
         }
262 262
     }
Please login to merge, or discard this patch.
tests/FS_Test.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
     protected static $disable_themes = true;
7 7
     protected static $use_draft_site = false;
8 8
 
9
-    public function setUp(){
9
+    public function setUp() {
10 10
         parent::setUp();
11 11
 
12 12
         ini_set('display_errors', 1);
@@ -14,10 +14,10 @@  discard block
 block discarded – undo
14 14
         error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
15 15
     }
16 16
 
17
-    public function logOut(){
17
+    public function logOut() {
18 18
         $this->session()->clear('loggedInAs');
19 19
     }
20 20
 
21
-    public function testProductPage(){}
21
+    public function testProductPage() {}
22 22
 
23 23
 }
Please login to merge, or discard this patch.
code/extensions/FoxyStripeSiteConfig.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use Dynamic\FoxyStripe\Model\FoxyStripeClient;
4 4
 
5
-class FoxyStripeSiteConfig extends DataExtension{
5
+class FoxyStripeSiteConfig extends DataExtension {
6 6
 
7 7
 	private static $db = array(
8 8
 	    'StoreTitle' => 'Varchar(255)',
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         'ProductLimit' => 10
39 39
     );
40 40
 
41
-	public function updateCMSFields(FieldList $fields){
41
+	public function updateCMSFields(FieldList $fields) {
42 42
 
43 43
         // set TabSet names to avoid spaces from camel case
44 44
         $fields->addFieldToTab('Root', new TabSet('FoxyStripe', 'FoxyStripe'));
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         ]);
123 123
 
124 124
         // configuration warning
125
-		if(FoxyCart::store_name_warning()!==null){
125
+		if (FoxyCart::store_name_warning() !== null) {
126 126
 			$fields->insertBefore(LiteralField::create(
127 127
                 "StoreSubDomainHeaderWarning",
128 128
                 _t(
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
 
214 214
         $siteConfig = SiteConfig::current_site_config();
215 215
 
216
-        if(!$siteConfig->StoreKey) {
216
+        if (!$siteConfig->StoreKey) {
217 217
             $key = FoxyCart::setStoreKey();
218
-            while(!ctype_alnum($key)){
218
+            while (!ctype_alnum($key)) {
219 219
                 $key = FoxyCart::setStoreKey();
220 220
             }
221 221
             $siteConfig->StoreKey = $key;
222 222
             $siteConfig->write();
223
-            DB::alteration_message($siteConfig->ClassName.": created FoxyCart Store Key " . $key, 'created');
223
+            DB::alteration_message($siteConfig->ClassName.": created FoxyCart Store Key ".$key, 'created');
224 224
         }
225 225
     }
226 226
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
                 $errors = array_merge($errors, $client->getErrors($result));
287 287
                 if (count($errors)) {
288
-                    \SS_Log::log('FoxyStripeSiteConfig::onBeforeWrite errors - ' . json_encode($errors), \SS_Log::WARN);
288
+                    \SS_Log::log('FoxyStripeSiteConfig::onBeforeWrite errors - '.json_encode($errors), \SS_Log::WARN);
289 289
                 }
290 290
             }
291 291
         }
Please login to merge, or discard this patch.
tests/ProductPageTest.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class ProductPageTest extends FS_Test{
3
+class ProductPageTest extends FS_Test {
4 4
 
5 5
 	protected static $use_draft_site = true;
6 6
 
7
-	function setUp(){
7
+	function setUp() {
8 8
 		parent::setUp();
9 9
 
10 10
 		$groupForItem = OptionGroup::create();
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		$productHolder->write();*/
17 17
 	}
18 18
 
19
-	function testProductCreation(){
19
+	function testProductCreation() {
20 20
 
21 21
 		$this->logInWithPermission('Product_CANCRUD');
22 22
 		$default = $this->objFromFixture('ProductCategory', 'default');
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 	}
30 30
 
31
-	function testProductDeletion(){
31
+	function testProductDeletion() {
32 32
 
33 33
 		$this->logInWithPermission('Product_CANCRUD');
34 34
 		$holder = $this->objFromFixture('ProductHolder', 'default');
@@ -39,22 +39,22 @@  discard block
 block discarded – undo
39 39
 		$product2->doPublish();
40 40
 		$this->assertTrue($product2->isPublished());
41 41
 
42
-		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
42
+		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '.$productID);
43 43
 		$versionsPostPublish = array();
44
-		foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow;
44
+		foreach ($versions as $versionRow) $versionsPostPublish[] = $versionRow;
45 45
 
46 46
 		$product2->delete();
47 47
 		$this->assertTrue(!$product2->isPublished());
48 48
 
49
-		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
49
+		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '.$productID);
50 50
 		$versionsPostDelete = array();
51
-		foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow;
51
+		foreach ($versions as $versionRow) $versionsPostDelete[] = $versionRow;
52 52
 
53 53
 		$this->assertTrue($versionsPostPublish == $versionsPostDelete);
54 54
 
55 55
 	}
56 56
 
57
-	function testProductTitleLeadingWhiteSpace(){
57
+	function testProductTitleLeadingWhiteSpace() {
58 58
 
59 59
 		$this->logInWithPermission('ADMIN');
60 60
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 	}
71 71
 
72
-	function testProductTitleTrailingWhiteSpace(){
72
+	function testProductTitleTrailingWhiteSpace() {
73 73
 
74 74
 		$this->logInWithPermission('ADMIN');
75 75
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 	}
86 86
 
87
-	function testProductCategoryCreation(){
87
+	function testProductCategoryCreation() {
88 88
 
89 89
 		$this->logInWithPermission('Product_CANCRUD');
90 90
 		$category = $this->objFromFixture('ProductCategory', 'apparel');
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 	}
99 99
 
100
-	function testProductCategoryDeletion(){
100
+	function testProductCategoryDeletion() {
101 101
 
102 102
 		$this->logInWithPermission('Product_CANCRUD');
103 103
 
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 
125 125
 		$category2->delete();
126 126
 
127
-		$this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID')));
127
+		$this->assertFalse(in_array($category2ID, ProductCategory::get()->column('ID')));
128 128
 
129 129
 	}
130 130
 
131
-	function testOptionGroupCreation(){
131
+	function testOptionGroupCreation() {
132 132
 
133 133
 		$this->logInWithPermission('Product_CANCRUD');
134 134
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
 	}
141 141
 
142
-	function testOptionGroupDeletion(){
142
+	function testOptionGroupDeletion() {
143 143
 
144 144
 		$this->logInWithPermission('ADMIN');
145 145
 		$group = $this->objFromFixture('OptionGroup', 'color');
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 	}
160 160
 
161
-	function testOptionItemCreation(){
161
+	function testOptionItemCreation() {
162 162
 
163 163
 		$this->logInWithPermission('Product_CANCRUD');
164 164
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
 	}
178 178
 
179
-	function testOptionItemDeletion(){
179
+	function testOptionItemDeletion() {
180 180
 
181 181
 		$this->logInWithPermission('ADMIN');
182 182
 
@@ -200,44 +200,44 @@  discard block
 block discarded – undo
200 200
 
201 201
 	}
202 202
 
203
-	public function testProductDraftOptionDeletion(){
203
+	public function testProductDraftOptionDeletion() {
204 204
 
205
-		self::$use_draft_site = false;//make sure we can publish
205
+		self::$use_draft_site = false; //make sure we can publish
206 206
 
207 207
 		$this->logInWithPermission('ADMIN');
208 208
 
209
-		$holder = $this->objFromFixture('ProductHolder', 'default');//build holder page, ProductPage can't be on root level
209
+		$holder = $this->objFromFixture('ProductHolder', 'default'); //build holder page, ProductPage can't be on root level
210 210
 		$holder->doPublish();
211 211
 
212
-		$product = $this->objFromFixture('ProductPage', 'product1');//build product page
212
+		$product = $this->objFromFixture('ProductPage', 'product1'); //build product page
213 213
 		$product->doPublish();
214 214
 
215 215
 		$productID = $product->ID;
216 216
 
217 217
 
218
-		$optionGroup = $this->objFromFixture('OptionGroup', 'size');//build the group for the options
218
+		$optionGroup = $this->objFromFixture('OptionGroup', 'size'); //build the group for the options
219 219
 		$optionGroup->write();
220
-		$option = $this->objFromFixture('OptionItem', 'small');//build first option
220
+		$option = $this->objFromFixture('OptionItem', 'small'); //build first option
221 221
 		$option->write();
222
-		$option2 = $this->objFromFixture('OptionItem', 'large');//build second option
222
+		$option2 = $this->objFromFixture('OptionItem', 'large'); //build second option
223 223
 		$option2->write();
224 224
 
225
-		$this->assertTrue($product->isPublished());//check that product is published
225
+		$this->assertTrue($product->isPublished()); //check that product is published
226 226
 
227
-		$product->deleteFromStage('Stage');//remove product from draft site
227
+		$product->deleteFromStage('Stage'); //remove product from draft site
228 228
 
229
-		$this->assertTrue($product->isPublished());//check product is still published
229
+		$this->assertTrue($product->isPublished()); //check product is still published
230 230
 
231 231
 		$testOption = $this->objFromFixture('OptionItem', 'large');
232 232
 
233
-		$this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0)));//make sure the first option still exists
233
+		$this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0))); //make sure the first option still exists
234 234
 
235
-		$product->doRestoreToStage();//restore page to draft site
236
-		$product->doUnpublish();//unpublish page
237
-		$product->deleteFromStage('Stage');//remove product from draft site
235
+		$product->doRestoreToStage(); //restore page to draft site
236
+		$product->doUnpublish(); //unpublish page
237
+		$product->deleteFromStage('Stage'); //remove product from draft site
238 238
 
239
-		$checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first();//query same option as above
239
+		$checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first(); //query same option as above
240 240
 
241
-		$this->assertEquals($checkDeleted->ID, 0);//check that the ID is 0 (empty object/non-existent)
241
+		$this->assertEquals($checkDeleted->ID, 0); //check that the ID is 0 (empty object/non-existent)
242 242
 	}
243 243
 }
244 244
\ No newline at end of file
Please login to merge, or discard this patch.
code/controllers/FoxyStripe_Controller.php 1 patch
Spacing   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,9 +19,8 @@  discard block
 block discarded – undo
19 19
 		if ((isset($_POST["FoxyData"]) OR isset($_POST['FoxySubscriptionData']))) {
20 20
 
21 21
 			$FoxyData_encrypted = (isset($_POST["FoxyData"])) ?
22
-                urldecode($_POST["FoxyData"]) :
23
-                urldecode($_POST["FoxySubscriptionData"]);
24
-			$FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(),$FoxyData_encrypted);
22
+                urldecode($_POST["FoxyData"]) : urldecode($_POST["FoxySubscriptionData"]);
23
+			$FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(), $FoxyData_encrypted);
25 24
 
26 25
             // parse the response and save the order
27 26
 			self::handleDataFeed($FoxyData_encrypted, $FoxyData_decrypted);
@@ -31,14 +30,14 @@  discard block
 block discarded – undo
31 30
 			
32 31
 			return 'foxy';
33 32
 			
34
-		} else {
33
+		}else {
35 34
 			
36 35
 			return "No FoxyData or FoxySubscriptionData received.";
37 36
 			
38 37
 		}
39 38
 	}
40 39
 
41
-    public function handleDataFeed($encrypted, $decrypted){
40
+    public function handleDataFeed($encrypted, $decrypted) {
42 41
 
43 42
         $orders = new SimpleXMLElement($decrypted);
44 43
 
@@ -48,12 +47,11 @@  discard block
 block discarded – undo
48 47
             // if FoxyCart order id, then parse order
49 48
             if (isset($transaction->id)) {
50 49
 
51
-                ($order = Order::get()->filter('Order_ID', (int) $transaction->id)->First()) ?
52
-                    $order = Order::get()->filter('Order_ID', (int) $transaction->id)->First() :
53
-                    $order = Order::create();
50
+                ($order = Order::get()->filter('Order_ID', (int)$transaction->id)->First()) ?
51
+                    $order = Order::get()->filter('Order_ID', (int)$transaction->id)->First() : $order = Order::create();
54 52
 
55 53
                 // save base order info
56
-                $order->Order_ID = (int) $transaction->id;
54
+                $order->Order_ID = (int)$transaction->id;
57 55
                 $order->Response = urlencode($encrypted);
58 56
                 $order->write();
59 57
 
@@ -73,17 +71,17 @@  discard block
 block discarded – undo
73 71
         // get current member if logged in. If not, create a 'fake' user with Customer_ID = 0
74 72
         // fake user will redirect to FC checkout, ask customer to log in
75 73
         // to do: consider a login/registration form here if not logged in
76
-        if($Member = Member::currentUser()) {
74
+        if ($Member = Member::currentUser()) {
77 75
             $Member = Member::currentUser();
78
-        } else {
76
+        }else {
79 77
             $Member = new Member();
80 78
             $Member->Customer_ID = 0;
81 79
         }
82 80
 
83
-        $auth_token = sha1($Member->Customer_ID . '|' . $timestampNew . '|' . FoxyCart::getStoreKey());
81
+        $auth_token = sha1($Member->Customer_ID.'|'.$timestampNew.'|'.FoxyCart::getStoreKey());
84 82
 
85
-        $redirect_complete = 'https://' . FoxyCart::getFoxyCartStoreName() . '.foxycart.com/checkout?fc_auth_token=' . $auth_token .
86
-            '&fcsid=' . $fcsid . '&fc_customer_id=' . $Member->Customer_ID . '&timestamp=' . $timestampNew;
83
+        $redirect_complete = 'https://'.FoxyCart::getFoxyCartStoreName().'.foxycart.com/checkout?fc_auth_token='.$auth_token.
84
+            '&fcsid='.$fcsid.'&fc_customer_id='.$Member->Customer_ID.'&timestamp='.$timestampNew;
87 85
 	
88 86
 	    $this->redirect($redirect_complete);
89 87
 
Please login to merge, or discard this patch.
code/objects/Order.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 
86 86
     public function getReceiptLink()
87 87
     {
88
-        $obj= HTMLVarchar::create();
89
-        $obj->setValue('<a href="' . $this->ReceiptURL . '" target="_blank" class="cms-panel-link action external-link">view</a>');
88
+        $obj = HTMLVarchar::create();
89
+        $obj->setValue('<a href="'.$this->ReceiptURL.'" target="_blank" class="cms-panel-link action external-link">view</a>');
90 90
         return $obj;
91 91
     }
92 92
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
             return true;
115 115
 
116
-        } else {
116
+        }else {
117 117
 
118 118
             return false;
119 119
 
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
         foreach ($response->transactions->transaction as $transaction) {
126 126
 
127 127
             // Record transaction data from FoxyCart Datafeed:
128
-            $this->Store_ID = (int) $transaction->store_id;
129
-            $this->TransactionDate = (string) $transaction->transaction_date;
130
-            $this->ProductTotal = (float) $transaction->product_total;
131
-            $this->TaxTotal = (float) $transaction->tax_total;
132
-            $this->ShippingTotal = (float) $transaction->shipping_total;
133
-            $this->OrderTotal = (float) $transaction->order_total;
134
-            $this->ReceiptURL = (string) $transaction->receipt_url;
135
-            $this->OrderStatus = (string) $transaction->status;
128
+            $this->Store_ID = (int)$transaction->store_id;
129
+            $this->TransactionDate = (string)$transaction->transaction_date;
130
+            $this->ProductTotal = (float)$transaction->product_total;
131
+            $this->TaxTotal = (float)$transaction->tax_total;
132
+            $this->ShippingTotal = (float)$transaction->shipping_total;
133
+            $this->OrderTotal = (float)$transaction->order_total;
134
+            $this->ReceiptURL = (string)$transaction->receipt_url;
135
+            $this->OrderStatus = (string)$transaction->status;
136 136
 
137 137
             $this->extend('handleOrderInfo', $order, $response);
138 138
         }
@@ -146,24 +146,24 @@  discard block
 block discarded – undo
146 146
             if (isset($transaction->customer_email) && $transaction->is_anonymous == 0) {
147 147
 
148 148
                 // if Customer is existing member, associate with current order
149
-                if(Member::get()->filter('Email', $transaction->customer_email)->First()) {
149
+                if (Member::get()->filter('Email', $transaction->customer_email)->First()) {
150 150
 
151 151
                     $customer = Member::get()->filter('Email', $transaction->customer_email)->First();
152 152
 
153 153
                     // if new customer, create account with data from FoxyCart
154
-                } else {
154
+                }else {
155 155
 
156 156
                     // set PasswordEncryption to 'none' so imported, encrypted password is not encrypted again
157 157
                     Config::inst()->update('Security', 'password_encryption_algorithm', 'none');
158 158
 
159 159
                     // create new Member, set password info from FoxyCart
160 160
                     $customer = Member::create();
161
-                    $customer->Customer_ID = (int) $transaction->customer_id;
162
-                    $customer->FirstName = (string) $transaction->customer_first_name;
163
-                    $customer->Surname = (string) $transaction->customer_last_name;
164
-                    $customer->Email = (string) $transaction->customer_email;
165
-                    $customer->Password = (string) $transaction->customer_password;
166
-                    $customer->Salt = (string) $transaction->customer_password_salt;
161
+                    $customer->Customer_ID = (int)$transaction->customer_id;
162
+                    $customer->FirstName = (string)$transaction->customer_first_name;
163
+                    $customer->Surname = (string)$transaction->customer_last_name;
164
+                    $customer->Email = (string)$transaction->customer_email;
165
+                    $customer->Password = (string)$transaction->customer_password;
166
+                    $customer->Salt = (string)$transaction->customer_password_salt;
167 167
                     $customer->PasswordEncryption = 'none';
168 168
 
169 169
                     // record member record
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 
197 197
                 $OrderDetail = OrderDetail::create();
198 198
 
199
-                $OrderDetail->Quantity = (int) $detail->product_quantity;
200
-                $OrderDetail->ProductName = (string) $detail->product_name;
201
-                $OrderDetail->ProductCode = (string) $detail->product_code;
202
-                $OrderDetail->ProductImage = (string) $detail->image;
203
-                $OrderDetail->ProductCategory = (string) $detail->category_code;
199
+                $OrderDetail->Quantity = (int)$detail->product_quantity;
200
+                $OrderDetail->ProductName = (string)$detail->product_name;
201
+                $OrderDetail->ProductCode = (string)$detail->product_code;
202
+                $OrderDetail->ProductImage = (string)$detail->image;
203
+                $OrderDetail->ProductCategory = (string)$detail->category_code;
204 204
                 $priceModifier = 0;
205 205
 
206 206
                 // parse OrderOptions
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
                     if ($option->product_option_name == 'product_id') {
211 211
 
212 212
                         // if product is found, set relation to OrderDetail
213
-                        $OrderProduct = ProductPage::get()->byID((int) $option->product_option_value);
213
+                        $OrderProduct = ProductPage::get()->byID((int)$option->product_option_value);
214 214
                         if ($OrderProduct) $OrderDetail->ProductID = $OrderProduct->ID;
215 215
 
216
-                    } else {
216
+                    }else {
217 217
 
218 218
                         $OrderOption = OrderOption::create();
219
-                        $OrderOption->Name = (string) $option->product_option_name;
220
-                        $OrderOption->Value = (string) $option->product_option_value;
219
+                        $OrderOption->Name = (string)$option->product_option_name;
220
+                        $OrderOption->Value = (string)$option->product_option_value;
221 221
                         $OrderOption->write();
222 222
                         $OrderDetail->OrderOptions()->add($OrderOption);
223 223
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
                 }
228 228
 
229
-                $OrderDetail->Price = (float) $detail->product_price + (float) $priceModifier;
229
+                $OrderDetail->Price = (float)$detail->product_price + (float)$priceModifier;
230 230
 
231 231
                 // extend OrderDetail parsing, allowing for recording custom fields from FoxyCart
232 232
                 $this->extend('handleOrderItem', $order, $response, $OrderDetail);
Please login to merge, or discard this patch.