@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | // Retrieve validator, if one has been setup (e.g. via data extensions). |
| 89 | 89 | if ($config->hasMethod('getCMSValidator')) { |
| 90 | 90 | $validator = $config->getCMSValidator(); |
| 91 | - } else { |
|
| 91 | + }else { |
|
| 92 | 92 | $validator = null; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | $actions, |
| 102 | 102 | $validator |
| 103 | 103 | )->setHTMLID('Form_EditForm'); |
| 104 | - $form->setValidationResponseCallback(function (ValidationResult $errors) use ($negotiator, $form) { |
|
| 104 | + $form->setValidationResponseCallback(function(ValidationResult $errors) use ($negotiator, $form) { |
|
| 105 | 105 | $request = $this->getRequest(); |
| 106 | 106 | if ($request->isAjax() && $negotiator) { |
| 107 | 107 | $result = $form->forTemplate(); |
| 108 | 108 | |
| 109 | 109 | return $negotiator->respond($request, array( |
| 110 | - 'CurrentForm' => function () use ($result) { |
|
| 110 | + 'CurrentForm' => function() use ($result) { |
|
| 111 | 111 | return $result; |
| 112 | 112 | }, |
| 113 | 113 | )); |
@@ -300,7 +300,7 @@ |
||
| 300 | 300 | FormAction::create('save_foxystripe_setting', _t('FoxyStripeSetting.SAVE', 'Save')) |
| 301 | 301 | ->addExtraClass('btn-primary font-icon-save') |
| 302 | 302 | ); |
| 303 | - } else { |
|
| 303 | + }else { |
|
| 304 | 304 | $actions = FieldList::create(); |
| 305 | 305 | } |
| 306 | 306 | $this->extend('updateCMSActions', $actions); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | ); |
| 170 | 170 | |
| 171 | 171 | // Cateogry Dropdown field w/ add new |
| 172 | - $source = function () { |
|
| 172 | + $source = function() { |
|
| 173 | 173 | return ProductCategory::get()->map()->toArray(); |
| 174 | 174 | }; |
| 175 | 175 | $catField = DropdownField::create('CategoryID', _t('ProductPage.Category', 'FoxyCart Category'), $source()) |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $product = self::get()->byID($this->ID); |
| 304 | 304 | if (isset($product->ParentID)) { |
| 305 | 305 | $origParent = $product->ParentID; |
| 306 | - } else { |
|
| 306 | + }else { |
|
| 307 | 307 | $origParent = null; |
| 308 | 308 | } |
| 309 | 309 | $currentParent = $this->ParentID; |
@@ -380,8 +380,7 @@ discard block |
||
| 380 | 380 | $optionName = ($optionName !== null) ? preg_replace('/\s/', '_', $optionName) : $optionName; |
| 381 | 381 | |
| 382 | 382 | return (FoxyStripeSetting::current_foxystripe_setting()->CartValidation) |
| 383 | - ? \FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : |
|
| 384 | - $optionValue; |
|
| 383 | + ? \FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : $optionValue; |
|
| 385 | 384 | } |
| 386 | 385 | |
| 387 | 386 | // get FoxyCart Store Name for JS call |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $this->parseOrderDetails($response); |
| 212 | 212 | |
| 213 | 213 | return true; |
| 214 | - } else { |
|
| 214 | + }else { |
|
| 215 | 215 | return false; |
| 216 | 216 | } |
| 217 | 217 | } |
@@ -223,14 +223,14 @@ discard block |
||
| 223 | 223 | { |
| 224 | 224 | foreach ($response->transactions->transaction as $transaction) { |
| 225 | 225 | // Record transaction data from FoxyCart Datafeed: |
| 226 | - $this->Store_ID = (int) $transaction->store_id; |
|
| 227 | - $this->TransactionDate = (string) $transaction->transaction_date; |
|
| 228 | - $this->ProductTotal = (float) $transaction->product_total; |
|
| 229 | - $this->TaxTotal = (float) $transaction->tax_total; |
|
| 230 | - $this->ShippingTotal = (float) $transaction->shipping_total; |
|
| 231 | - $this->OrderTotal = (float) $transaction->order_total; |
|
| 232 | - $this->ReceiptURL = (string) $transaction->receipt_url; |
|
| 233 | - $this->OrderStatus = (string) $transaction->status; |
|
| 226 | + $this->Store_ID = (int)$transaction->store_id; |
|
| 227 | + $this->TransactionDate = (string)$transaction->transaction_date; |
|
| 228 | + $this->ProductTotal = (float)$transaction->product_total; |
|
| 229 | + $this->TaxTotal = (float)$transaction->tax_total; |
|
| 230 | + $this->ShippingTotal = (float)$transaction->shipping_total; |
|
| 231 | + $this->OrderTotal = (float)$transaction->order_total; |
|
| 232 | + $this->ReceiptURL = (string)$transaction->receipt_url; |
|
| 233 | + $this->OrderStatus = (string)$transaction->status; |
|
| 234 | 234 | |
| 235 | 235 | $this->extend('handleOrderInfo', $order, $response); |
| 236 | 236 | } |
@@ -249,18 +249,18 @@ discard block |
||
| 249 | 249 | if (Member::get()->filter('Email', $transaction->customer_email)->First()) { |
| 250 | 250 | $customer = Member::get()->filter('Email', $transaction->customer_email)->First(); |
| 251 | 251 | // if new customer, create account with data from FoxyCart |
| 252 | - } else { |
|
| 252 | + }else { |
|
| 253 | 253 | // set PasswordEncryption to 'none' so imported, encrypted password is not encrypted again |
| 254 | 254 | Config::modify()->set(Security::class, 'password_encryption_algorithm', 'none'); |
| 255 | 255 | |
| 256 | 256 | // create new Member, set password info from FoxyCart |
| 257 | 257 | $customer = Member::create(); |
| 258 | - $customer->Customer_ID = (int) $transaction->customer_id; |
|
| 259 | - $customer->FirstName = (string) $transaction->customer_first_name; |
|
| 260 | - $customer->Surname = (string) $transaction->customer_last_name; |
|
| 261 | - $customer->Email = (string) $transaction->customer_email; |
|
| 262 | - $customer->Password = (string) $transaction->customer_password; |
|
| 263 | - $customer->Salt = (string) $transaction->customer_password_salt; |
|
| 258 | + $customer->Customer_ID = (int)$transaction->customer_id; |
|
| 259 | + $customer->FirstName = (string)$transaction->customer_first_name; |
|
| 260 | + $customer->Surname = (string)$transaction->customer_last_name; |
|
| 261 | + $customer->Email = (string)$transaction->customer_email; |
|
| 262 | + $customer->Password = (string)$transaction->customer_password; |
|
| 263 | + $customer->Salt = (string)$transaction->customer_password_salt; |
|
| 264 | 264 | $customer->PasswordEncryption = 'none'; |
| 265 | 265 | |
| 266 | 266 | // record member record |
@@ -297,11 +297,11 @@ discard block |
||
| 297 | 297 | foreach ($transaction->transaction_details->transaction_detail as $detail) { |
| 298 | 298 | $OrderDetail = OrderDetail::create(); |
| 299 | 299 | |
| 300 | - $OrderDetail->Quantity = (int) $detail->product_quantity; |
|
| 301 | - $OrderDetail->ProductName = (string) $detail->product_name; |
|
| 302 | - $OrderDetail->ProductCode = (string) $detail->product_code; |
|
| 303 | - $OrderDetail->ProductImage = (string) $detail->image; |
|
| 304 | - $OrderDetail->ProductCategory = (string) $detail->category_code; |
|
| 300 | + $OrderDetail->Quantity = (int)$detail->product_quantity; |
|
| 301 | + $OrderDetail->ProductName = (string)$detail->product_name; |
|
| 302 | + $OrderDetail->ProductCode = (string)$detail->product_code; |
|
| 303 | + $OrderDetail->ProductImage = (string)$detail->image; |
|
| 304 | + $OrderDetail->ProductCategory = (string)$detail->category_code; |
|
| 305 | 305 | $priceModifier = 0; |
| 306 | 306 | |
| 307 | 307 | // parse OrderOptions |
@@ -309,14 +309,14 @@ discard block |
||
| 309 | 309 | // Find product via product_id custom variable |
| 310 | 310 | if ($option->product_option_name == 'product_id') { |
| 311 | 311 | // if product is found, set relation to OrderDetail |
| 312 | - $OrderProduct = ProductPage::get()->byID((int) $option->product_option_value); |
|
| 312 | + $OrderProduct = ProductPage::get()->byID((int)$option->product_option_value); |
|
| 313 | 313 | if ($OrderProduct) { |
| 314 | 314 | $OrderDetail->ProductID = $OrderProduct->ID; |
| 315 | 315 | } |
| 316 | - } else { |
|
| 316 | + }else { |
|
| 317 | 317 | $OrderOption = OrderOption::create(); |
| 318 | - $OrderOption->Name = (string) $option->product_option_name; |
|
| 319 | - $OrderOption->Value = (string) $option->product_option_value; |
|
| 318 | + $OrderOption->Name = (string)$option->product_option_name; |
|
| 319 | + $OrderOption->Value = (string)$option->product_option_value; |
|
| 320 | 320 | $OrderOption->write(); |
| 321 | 321 | $OrderDetail->OrderOptions()->add($OrderOption); |
| 322 | 322 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - $OrderDetail->Price = (float) $detail->product_price + (float) $priceModifier; |
|
| 327 | + $OrderDetail->Price = (float)$detail->product_price + (float)$priceModifier; |
|
| 328 | 328 | |
| 329 | 329 | // extend OrderDetail parsing, allowing for recording custom fields from FoxyCart |
| 330 | 330 | $this->extend('handleOrderItem', $order, $response, $OrderDetail); |