@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | if ($config->RemoteDomain) { |
| 76 | 76 | return $config->RemoteDomain; |
| 77 | 77 | } |
| 78 | - } else { |
|
| 78 | + }else { |
|
| 79 | 79 | if ($config->StoreName) { |
| 80 | 80 | return $config->StoreName; |
| 81 | 81 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $config = FoxyStripeSetting::current_foxystripe_setting(); |
| 94 | 94 | if ($config->CustomSSL) { |
| 95 | 95 | return sprintf('https://%s/cart', self::getFoxyCartStoreName()); |
| 96 | - } else { |
|
| 96 | + }else { |
|
| 97 | 97 | return sprintf('https://%s.foxycart.com/cart', self::getFoxyCartStoreName()); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $fields = parent::getCMSFields(); |
| 206 | 206 | |
| 207 | 207 | // Cateogry Dropdown field w/ add new |
| 208 | - $source = function () { |
|
| 208 | + $source = function() { |
|
| 209 | 209 | return ProductCategory::get()->map()->toArray(); |
| 210 | 210 | }; |
| 211 | 211 | $catField = DropdownField::create('CategoryID', _t('ProductPage.Category', 'FoxyCart Category'), $source()) |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $product = self::get()->byID($this->ID); |
| 343 | 343 | if (isset($product->ParentID)) { |
| 344 | 344 | $origParent = $product->ParentID; |
| 345 | - } else { |
|
| 345 | + }else { |
|
| 346 | 346 | $origParent = null; |
| 347 | 347 | } |
| 348 | 348 | $currentParent = $this->ParentID; |
@@ -429,8 +429,7 @@ discard block |
||
| 429 | 429 | $optionName = ($optionName !== null) ? preg_replace('/\s/', '_', $optionName) : $optionName; |
| 430 | 430 | |
| 431 | 431 | return (FoxyStripeSetting::current_foxystripe_setting()->CartValidation) |
| 432 | - ? \FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : |
|
| 433 | - $optionValue; |
|
| 432 | + ? \FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : $optionValue; |
|
| 434 | 433 | } |
| 435 | 434 | |
| 436 | 435 | /** |
@@ -117,12 +117,10 @@ discard block |
||
| 117 | 117 | $this->setSiteConfig($siteConfig); |
| 118 | 118 | |
| 119 | 119 | $fields = ($fields != null && $fields->exists()) ? |
| 120 | - $this->getProductFields($fields) : |
|
| 121 | - $this->getProductFields(FieldList::create()); |
|
| 120 | + $this->getProductFields($fields) : $this->getProductFields(FieldList::create()); |
|
| 122 | 121 | |
| 123 | 122 | $actions = ($actions != null && $actions->exists()) ? |
| 124 | - $this->getProductActions($actions) : |
|
| 125 | - $this->getProductActions(FieldList::create()); |
|
| 123 | + $this->getProductActions($actions) : $this->getProductActions(FieldList::create()); |
|
| 126 | 124 | $validator = (!empty($validator) || $validator != null) ? $validator : RequiredFields::create(); |
| 127 | 125 | |
| 128 | 126 | parent::__construct($controller, $name, $fields, $actions, $validator); |
@@ -131,7 +129,7 @@ discard block |
||
| 131 | 129 | $this->setAttribute('action', FoxyCart::FormActionURL()); |
| 132 | 130 | $this->disableSecurityToken(); |
| 133 | 131 | |
| 134 | - $this->setHTMLID($this->getTemplateHelper()->generateFormID($this) . "_{$product->ID}"); |
|
| 132 | + $this->setHTMLID($this->getTemplateHelper()->generateFormID($this)."_{$product->ID}"); |
|
| 135 | 133 | } |
| 136 | 134 | |
| 137 | 135 | /** |
@@ -143,8 +141,7 @@ discard block |
||
| 143 | 141 | { |
| 144 | 142 | //Requirements::javascript('dynamic/foxystripe: client/dist/javascript/scripts.min.js'); |
| 145 | 143 | $hiddenTitle = ($this->product->ReceiptTitle) ? |
| 146 | - htmlspecialchars($this->product->ReceiptTitle) : |
|
| 147 | - htmlspecialchars($this->product->Title); |
|
| 144 | + htmlspecialchars($this->product->ReceiptTitle) : htmlspecialchars($this->product->Title); |
|
| 148 | 145 | $code = $this->product->Code; |
| 149 | 146 | |
| 150 | 147 | if ($this->product->Available) { |
@@ -172,7 +169,7 @@ discard block |
||
| 172 | 169 | $code, |
| 173 | 170 | 'price', |
| 174 | 171 | $this->product->Price |
| 175 | - ))->setValue($this->product->Price));//can't override id |
|
| 172 | + ))->setValue($this->product->Price)); //can't override id |
|
| 176 | 173 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue( |
| 177 | 174 | $code, |
| 178 | 175 | 'weight', |
@@ -212,7 +209,7 @@ discard block |
||
| 212 | 209 | ); |
| 213 | 210 | |
| 214 | 211 | $fields->push( |
| 215 | - HeaderField::create('submitPrice', '$' . $this->product->Price, 4) |
|
| 212 | + HeaderField::create('submitPrice', '$'.$this->product->Price, 4) |
|
| 216 | 213 | ->addExtraClass('submit-price') |
| 217 | 214 | ); |
| 218 | 215 | $fields->push( |
@@ -221,7 +218,7 @@ discard block |
||
| 221 | 218 | ); |
| 222 | 219 | |
| 223 | 220 | $this->extend('updatePurchaseFormFields', $fields); |
| 224 | - } else { |
|
| 221 | + }else { |
|
| 225 | 222 | $fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock', 4)); |
| 226 | 223 | } |
| 227 | 224 | |
@@ -267,7 +264,7 @@ discard block |
||
| 267 | 264 | */ |
| 268 | 265 | protected function getProductOptionSet() |
| 269 | 266 | { |
| 270 | - $assignAvailable = function ($self) { |
|
| 267 | + $assignAvailable = function($self) { |
|
| 271 | 268 | /** @var OptionItem $self */ |
| 272 | 269 | $this->extend('updateFoxyStripePurchaseForm', $form); |
| 273 | 270 | $self->Available = ($self->getAvailability()) ? true : false; |
@@ -43,8 +43,7 @@ discard block |
||
| 43 | 43 | // handle POST from FoxyCart API transaction |
| 44 | 44 | if ((isset($_POST['FoxyData']) or isset($_POST['FoxySubscriptionData']))) { |
| 45 | 45 | $FoxyData_encrypted = (isset($_POST['FoxyData'])) ? |
| 46 | - urldecode($_POST['FoxyData']) : |
|
| 47 | - urldecode($_POST['FoxySubscriptionData']); |
|
| 46 | + urldecode($_POST['FoxyData']) : urldecode($_POST['FoxySubscriptionData']); |
|
| 48 | 47 | $FoxyData_decrypted = \rc4crypt::decrypt(FoxyCart::getStoreKey(), $FoxyData_encrypted); |
| 49 | 48 | |
| 50 | 49 | // parse the response and save the order |
@@ -54,7 +53,7 @@ discard block |
||
| 54 | 53 | $this->extend('addIntegrations', $FoxyData_encrypted); |
| 55 | 54 | |
| 56 | 55 | return 'foxy'; |
| 57 | - } else { |
|
| 56 | + }else { |
|
| 58 | 57 | return 'No FoxyData or FoxySubscriptionData received.'; |
| 59 | 58 | } |
| 60 | 59 | } |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | // if FoxyCart order id, then parse order |
| 75 | 74 | if (isset($transaction->id)) { |
| 76 | 75 | ($order = Order::get()->filter('Order_ID', (int)$transaction->id)->First()) ? |
| 77 | - $order = Order::get()->filter('Order_ID', (int)$transaction->id)->First() : |
|
| 78 | - $order = Order::create(); |
|
| 76 | + $order = Order::get()->filter('Order_ID', (int)$transaction->id)->First() : $order = Order::create(); |
|
| 79 | 77 | |
| 80 | 78 | // save base order info |
| 81 | 79 | $order->Order_ID = (int)$transaction->id; |
@@ -134,7 +132,7 @@ discard block |
||
| 134 | 132 | /* todo: make sure local password is updated if changed on FoxyCart |
| 135 | 133 | $this->updatePasswordFromData($customer, $order); |
| 136 | 134 | */ |
| 137 | - } else { |
|
| 135 | + }else { |
|
| 138 | 136 | // create new Member, set password info from FoxyCart |
| 139 | 137 | $customer = Member::create(); |
| 140 | 138 | $customer->Customer_ID = (int)$order->customer_id; |
@@ -161,8 +159,8 @@ discard block |
||
| 161 | 159 | Security::config()->update('password_encryption_algorithm', 'none'); |
| 162 | 160 | |
| 163 | 161 | $customer->PasswordEncryption = $this->getEncryption($order->customer_password_hash_type); |
| 164 | - $customer->Password = (string) $order->customer_password; |
|
| 165 | - $customer->Salt = (string) $order->customer_password_salt; |
|
| 162 | + $customer->Password = (string)$order->customer_password; |
|
| 163 | + $customer->Salt = (string)$order->customer_password_salt; |
|
| 166 | 164 | |
| 167 | 165 | Security::config()->update('password_encryption_algorithm', $password_encryption_algorithm); |
| 168 | 166 | } |
@@ -253,7 +251,7 @@ discard block |
||
| 253 | 251 | } |
| 254 | 252 | |
| 255 | 253 | return ProductPage::get() |
| 256 | - ->filter('ID', (int) $productOptions->product_option_value) |
|
| 254 | + ->filter('ID', (int)$productOptions->product_option_value) |
|
| 257 | 255 | ->First(); |
| 258 | 256 | } |
| 259 | 257 | } |
@@ -303,18 +301,18 @@ discard block |
||
| 303 | 301 | // to do: consider a login/registration form here if not logged in |
| 304 | 302 | if ($Member = Security::getCurrentUser()) { |
| 305 | 303 | $Member = Security::getCurrentUser(); |
| 306 | - } else { |
|
| 304 | + }else { |
|
| 307 | 305 | $Member = new Member(); |
| 308 | 306 | $Member->Customer_ID = 0; |
| 309 | 307 | } |
| 310 | 308 | |
| 311 | - $auth_token = sha1($Member->Customer_ID . '|' . $timestampNew . '|' . FoxyCart::getStoreKey()); |
|
| 309 | + $auth_token = sha1($Member->Customer_ID.'|'.$timestampNew.'|'.FoxyCart::getStoreKey()); |
|
| 312 | 310 | |
| 313 | 311 | $config = FoxyStripeSetting::current_foxystripe_setting(); |
| 314 | 312 | if ($config->CustomSSL) { |
| 315 | 313 | $link = FoxyCart::getFoxyCartStoreName(); |
| 316 | - } else { |
|
| 317 | - $link = FoxyCart::getFoxyCartStoreName() . '.foxycart.com'; |
|
| 314 | + }else { |
|
| 315 | + $link = FoxyCart::getFoxyCartStoreName().'.foxycart.com'; |
|
| 318 | 316 | } |
| 319 | 317 | |
| 320 | 318 | $redirect_complete = 'https://'.$link.'/checkout?fc_auth_token='.$auth_token.'&fcsid='.$fcsid. |