@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | { |
130 | 130 | $config = SiteConfig::current_site_config(); |
131 | 131 | |
132 | - if ($config->ProductLimit>0) { |
|
132 | + if ($config->ProductLimit > 0) { |
|
133 | 133 | $limit = $config->ProductLimit; |
134 | 134 | } |
135 | 135 | |
136 | 136 | if ($config->MultiGroup) { |
137 | 137 | $entries = $this->Products()->sort('SortOrder'); |
138 | - } else { |
|
139 | - $filter = '"ParentID" = ' . $this->ID; |
|
138 | + }else { |
|
139 | + $filter = '"ParentID" = '.$this->ID; |
|
140 | 140 | |
141 | 141 | // Build a list of all IDs for ProductGroups that are children |
142 | 142 | $holderIDs = $this->ProductGroupIDs(); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | if ($filter) { |
148 | 148 | $filter .= ' OR '; |
149 | 149 | } |
150 | - $filter .= '"ParentID" IN (' . implode(',', $holderIDs) . ")"; |
|
150 | + $filter .= '"ParentID" IN ('.implode(',', $holderIDs).")"; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $order = '"SiteTree"."Title" ASC'; |
@@ -85,8 +85,8 @@ |
||
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 |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'product_id', |
121 | 121 | $this->product->ID))->setValue($this->product->ID)); |
122 | 122 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'price', |
123 | - $this->product->Price))->setValue($this->product->Price));//can't override id |
|
123 | + $this->product->Price))->setValue($this->product->Price)); //can't override id |
|
124 | 124 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'weight', |
125 | 125 | $this->product->Weight))->setValue($this->product->Weight)); |
126 | 126 | |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | |
149 | 149 | $fields->push(DropdownField::create('quantity', 'Quantity', $quantity)); |
150 | 150 | |
151 | - $fields->push(HeaderField::create('submitPrice', '$' . $this->product->Price, 4)->addExtraClass('submit-price')); |
|
151 | + $fields->push(HeaderField::create('submitPrice', '$'.$this->product->Price, 4)->addExtraClass('submit-price')); |
|
152 | 152 | $fields->push(HeaderField::create('unavailableText', 'Selection unavailable', 4)->addExtraClass('hidden unavailable-text')); |
153 | 153 | |
154 | 154 | $this->extend('updatePurchaseFormFields', $fields); |
155 | - } else { |
|
155 | + }else { |
|
156 | 156 | $fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock'), 4); |
157 | 157 | } |
158 | 158 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | protected function getProductOptionSet() |
190 | 190 | { |
191 | 191 | |
192 | - $assignAvailable = function ($self) { |
|
192 | + $assignAvailable = function($self) { |
|
193 | 193 | $this->extend('updateFoxyStripePurchaseForm', $form); |
194 | 194 | $self->Available = ($self->getAvailability()) ? true : false; |
195 | 195 | }; |
@@ -95,7 +95,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | /** |
@@ -90,7 +90,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1,6 +1,6 @@ discard block |
||
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 |
||
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 |
@@ -17,9 +17,8 @@ discard block |
||
17 | 17 | // handle POST from FoxyCart API transaction |
18 | 18 | if ((isset($_POST["FoxyData"]) OR isset($_POST['FoxySubscriptionData']))) { |
19 | 19 | $FoxyData_encrypted = (isset($_POST["FoxyData"])) ? |
20 | - urldecode($_POST["FoxyData"]) : |
|
21 | - urldecode($_POST["FoxySubscriptionData"]); |
|
22 | - $FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(),$FoxyData_encrypted); |
|
20 | + urldecode($_POST["FoxyData"]) : urldecode($_POST["FoxySubscriptionData"]); |
|
21 | + $FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(), $FoxyData_encrypted); |
|
23 | 22 | self::handleDataFeed($FoxyData_encrypted, $FoxyData_decrypted); |
24 | 23 | |
25 | 24 | // extend to allow for additional integrations with Datafeed |
@@ -27,14 +26,14 @@ discard block |
||
27 | 26 | |
28 | 27 | return 'foxy'; |
29 | 28 | |
30 | - } else { |
|
29 | + }else { |
|
31 | 30 | |
32 | 31 | return "No FoxyData or FoxySubscriptionData received."; |
33 | 32 | |
34 | 33 | } |
35 | 34 | } |
36 | 35 | |
37 | - public function handleDataFeed($encrypted, $decrypted){ |
|
36 | + public function handleDataFeed($encrypted, $decrypted) { |
|
38 | 37 | //handle encrypted & decrypted data |
39 | 38 | $orders = new SimpleXMLElement($decrypted); |
40 | 39 | |
@@ -43,12 +42,11 @@ discard block |
||
43 | 42 | |
44 | 43 | if (isset($order->id)) { |
45 | 44 | ($transaction = Order::get()->filter('Order_ID', $order->id)->First()) ? |
46 | - $transaction : |
|
47 | - $transaction = Order::create(); |
|
45 | + $transaction : $transaction = Order::create(); |
|
48 | 46 | } |
49 | 47 | |
50 | 48 | // save base order info |
51 | - $transaction->Order_ID = (int) $order->id; |
|
49 | + $transaction->Order_ID = (int)$order->id; |
|
52 | 50 | $transaction->Response = $decrypted; |
53 | 51 | |
54 | 52 | // record transaction as order |
@@ -103,7 +101,7 @@ discard block |
||
103 | 101 | if (isset($order->customer_email) && $order->is_anonymous == 0) { |
104 | 102 | |
105 | 103 | // if Customer is existing member, associate with current order |
106 | - if(Member::get()->filter('Email', $order->customer_email)->First()) { |
|
104 | + if (Member::get()->filter('Email', $order->customer_email)->First()) { |
|
107 | 105 | |
108 | 106 | $customer = Member::get()->filter('Email', $order->customer_email)->First(); |
109 | 107 | |
@@ -116,7 +114,7 @@ discard block |
||
116 | 114 | $customer->write(); |
117 | 115 | */ |
118 | 116 | |
119 | - } else { |
|
117 | + }else { |
|
120 | 118 | |
121 | 119 | // set PasswordEncryption to 'none' so imported, encrypted password is not encrypted again |
122 | 120 | Config::inst()->update('Security', 'password_encryption_algorithm', 'none'); |
@@ -227,17 +225,17 @@ discard block |
||
227 | 225 | // get current member if logged in. If not, create a 'fake' user with Customer_ID = 0 |
228 | 226 | // fake user will redirect to FC checkout, ask customer to log in |
229 | 227 | // to do: consider a login/registration form here if not logged in |
230 | - if($Member = Member::currentUser()) { |
|
228 | + if ($Member = Member::currentUser()) { |
|
231 | 229 | $Member = Member::currentUser(); |
232 | - } else { |
|
230 | + }else { |
|
233 | 231 | $Member = new Member(); |
234 | 232 | $Member->Customer_ID = 0; |
235 | 233 | } |
236 | 234 | |
237 | - $auth_token = sha1($Member->Customer_ID . '|' . $timestampNew . '|' . FoxyCart::getStoreKey()); |
|
235 | + $auth_token = sha1($Member->Customer_ID.'|'.$timestampNew.'|'.FoxyCart::getStoreKey()); |
|
238 | 236 | |
239 | - $redirect_complete = 'https://' . FoxyCart::getFoxyCartStoreName() . '.foxycart.com/checkout?fc_auth_token=' . $auth_token . |
|
240 | - '&fcsid=' . $fcsid . '&fc_customer_id=' . $Member->Customer_ID . '×tamp=' . $timestampNew; |
|
237 | + $redirect_complete = 'https://'.FoxyCart::getFoxyCartStoreName().'.foxycart.com/checkout?fc_auth_token='.$auth_token. |
|
238 | + '&fcsid='.$fcsid.'&fc_customer_id='.$Member->Customer_ID.'×tamp='.$timestampNew; |
|
241 | 239 | |
242 | 240 | $this->redirect($redirect_complete); |
243 | 241 |
@@ -127,7 +127,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -2,7 +2,7 @@ discard block |
||
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)', |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'ProductLimit' => 10 |
28 | 28 | ); |
29 | 29 | |
30 | - public function updateCMSFields(FieldList $fields){ |
|
30 | + public function updateCMSFields(FieldList $fields) { |
|
31 | 31 | |
32 | 32 | // set TabSet names to avoid spaces from camel case |
33 | 33 | $fields->addFieldToTab('Root', new TabSet('FoxyStripe', 'FoxyStripe')); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | )); |
84 | 84 | |
85 | 85 | // configuration warning |
86 | - if(FoxyCart::store_name_warning()!==null){ |
|
86 | + if (FoxyCart::store_name_warning() !== null) { |
|
87 | 87 | $fields->insertBefore(LiteralField::create( |
88 | 88 | "StoreSubDomainHeaderWarning", |
89 | 89 | _t( |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | |
175 | 175 | $siteConfig = SiteConfig::current_site_config(); |
176 | 176 | |
177 | - if(!$siteConfig->StoreKey) { |
|
177 | + if (!$siteConfig->StoreKey) { |
|
178 | 178 | $key = FoxyCart::setStoreKey(); |
179 | - while(!ctype_alnum($key)){ |
|
179 | + while (!ctype_alnum($key)) { |
|
180 | 180 | $key = FoxyCart::setStoreKey(); |
181 | 181 | } |
182 | 182 | $siteConfig->StoreKey = $key; |
183 | 183 | $siteConfig->write(); |
184 | - DB::alteration_message($siteConfig->ClassName.": created FoxyCart Store Key " . $key, 'created'); |
|
184 | + DB::alteration_message($siteConfig->ClassName.": created FoxyCart Store Key ".$key, 'created'); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | $errors = array_merge($errors, $client->getErrors($result)); |
229 | 229 | if (count($errors)) { |
230 | - \SS_Log::log('FoxyStripeSiteConfig::onBeforeWrite errors - ' . json_encode($errors), \SS_Log::WARN); |
|
230 | + \SS_Log::log('FoxyStripeSiteConfig::onBeforeWrite errors - '.json_encode($errors), \SS_Log::WARN); |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | } |