@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $rules = Director::config()->get('rules'); |
| 37 | 37 | $rule = array_search(FoxyStripeController::class, $rules); |
| 38 | - $myURL = Director::absoluteBaseURL() . explode('//', $rule)[0]; |
|
| 38 | + $myURL = Director::absoluteBaseURL().explode('//', $rule)[0]; |
|
| 39 | 39 | $myKey = FoxyCart::getStoreKey(); |
| 40 | 40 | |
| 41 | 41 | $this->updateConfig(); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $email = $emails[count($emails) - 1]; |
| 123 | 123 | return preg_replace_callback( |
| 124 | 124 | "|(\d+)|", |
| 125 | - function ($mathces) { |
|
| 125 | + function($mathces) { |
|
| 126 | 126 | return ++$mathces[1]; |
| 127 | 127 | }, |
| 128 | 128 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function getCMSFields() |
| 71 | 71 | { |
| 72 | - $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 72 | + $this->beforeUpdateCMSFields(function(FieldList $fields) { |
|
| 73 | 73 | if (FoxyStripeSetting::current_foxystripe_setting()->MultiGroup) { |
| 74 | 74 | $config = GridFieldConfig_RelationEditor::create(); |
| 75 | 75 | $config->addComponent(new GridFieldOrderableRows('SortOrder')); |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | if ($config->MultiGroup) { |
| 152 | 152 | $entries = $this->Products()->sort('SortOrder'); |
| 153 | - } else { |
|
| 154 | - $filter = '"ParentID" = ' . $this->ID; |
|
| 153 | + }else { |
|
| 154 | + $filter = '"ParentID" = '.$this->ID; |
|
| 155 | 155 | |
| 156 | 156 | // Build a list of all IDs for ProductGroups that are children |
| 157 | 157 | $holderIDs = $this->ProductGroupIDs(); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | if ($filter) { |
| 163 | 163 | $filter .= ' OR '; |
| 164 | 164 | } |
| 165 | - $filter .= '"ParentID" IN (' . implode(',', $holderIDs) . ')'; |
|
| 165 | + $filter .= '"ParentID" IN ('.implode(',', $holderIDs).')'; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $order = '"SiteTree"."Title" ASC'; |
@@ -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->getProduct()->getIsAvailable()) { |
@@ -178,7 +175,7 @@ discard block |
||
| 178 | 175 | ->setValue( |
| 179 | 176 | ProductPage::getGeneratedValue($code, 'price', $this->product->Price, 'value') |
| 180 | 177 | ) |
| 181 | - );//can't override id |
|
| 178 | + ); //can't override id |
|
| 182 | 179 | if ($this->product->Weight > 0) { |
| 183 | 180 | $fields->push( |
| 184 | 181 | HiddenField::create('weight') |
@@ -221,7 +218,7 @@ discard block |
||
| 221 | 218 | ); |
| 222 | 219 | |
| 223 | 220 | $fields->push( |
| 224 | - HeaderField::create('submitPrice', '$' . $this->product->Price, 4) |
|
| 221 | + HeaderField::create('submitPrice', '$'.$this->product->Price, 4) |
|
| 225 | 222 | ->addExtraClass('submit-price') |
| 226 | 223 | ); |
| 227 | 224 | $fields->push( |
@@ -234,7 +231,7 @@ discard block |
||
| 234 | 231 | } |
| 235 | 232 | |
| 236 | 233 | $this->extend('updatePurchaseFormFields', $fields); |
| 237 | - } else { |
|
| 234 | + }else { |
|
| 238 | 235 | $fields->push(HeaderField::create('unavailableText', 'Currently Out of Stock', 4)); |
| 239 | 236 | } |
| 240 | 237 | |
@@ -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 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $config = FoxyStripeSetting::current_foxystripe_setting(); |
| 114 | 114 | if ($config->CustomSSL) { |
| 115 | 115 | $foxy_domain = self::getFoxyCartStoreName(); |
| 116 | - } else { |
|
| 116 | + }else { |
|
| 117 | 117 | $foxy_domain = self::getFoxyCartStoreName().'.foxycart.com'; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function getCMSFields() |
| 60 | 60 | { |
| 61 | - $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 61 | + $this->beforeUpdateCMSFields(function(FieldList $fields) { |
|
| 62 | 62 | $fields->removeByName('Options'); |
| 63 | 63 | |
| 64 | 64 | $fields->addFieldToTab( |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | )->setEmptyString('') |
| 219 | 219 | ->setDescription(_t('OptionItem.CodeDescription', 'Does code modify or replace base code?')), |
| 220 | 220 | ]); |
| 221 | - } else { |
|
| 221 | + }else { |
|
| 222 | 222 | $fields->addFieldsToTab( |
| 223 | 223 | 'Root.Modifiers', |
| 224 | 224 | [ |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // ProductOptionGroup Dropdown field w/ add new |
| 235 | - $groups = function () { |
|
| 235 | + $groups = function() { |
|
| 236 | 236 | return OptionGroup::get()->map()->toArray(); |
| 237 | 237 | }; |
| 238 | 238 | $groupFields = singleton(OptionGroup::class)->getCMSFields(); |
@@ -339,9 +339,9 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | public function getGeneratedValue() |
| 341 | 341 | { |
| 342 | - $modPrice = ($this->PriceModifier) ? (string) $this->PriceModifier : '0'; |
|
| 342 | + $modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0'; |
|
| 343 | 343 | $modPriceWithSymbol = self::getOptionModifierActionSymbol($this->PriceModifierAction).$modPrice; |
| 344 | - $modWeight = ($this->WeightModifier) ? (string) $this->WeightModifier : '0'; |
|
| 344 | + $modWeight = ($this->WeightModifier) ? (string)$this->WeightModifier : '0'; |
|
| 345 | 345 | $modWeight = self::getOptionModifierActionSymbol($this->WeightModifierAction).$modWeight; |
| 346 | 346 | $modCode = self::getOptionModifierActionSymbol($this->CodeModifierAction).$this->CodeModifier; |
| 347 | 347 | |
@@ -353,14 +353,13 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | public function getGeneratedTitle() |
| 355 | 355 | { |
| 356 | - $modPrice = ($this->PriceModifier) ? (string) $this->PriceModifier : '0'; |
|
| 356 | + $modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0'; |
|
| 357 | 357 | $title = $this->Title; |
| 358 | 358 | $title .= ($this->PriceModifier != 0) ? |
| 359 | 359 | ': ('.self::getOptionModifierActionSymbol( |
| 360 | 360 | $this->PriceModifierAction, |
| 361 | 361 | $returnWithOnlyPlusMinus = true |
| 362 | - ).'$'.$modPrice.')' : |
|
| 363 | - ''; |
|
| 362 | + ).'$'.$modPrice.')' : ''; |
|
| 364 | 363 | |
| 365 | 364 | return $title; |
| 366 | 365 | } |