@@ -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 | } |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | |
5 | 5 | class FoxyStripeSiteConfig extends DataExtension{ |
6 | 6 | |
7 | - private static $db = array( |
|
8 | - 'StoreTitle' => 'Varchar(255)', |
|
9 | - 'StoreName' => 'Varchar(255)', |
|
7 | + private static $db = array( |
|
8 | + 'StoreTitle' => 'Varchar(255)', |
|
9 | + 'StoreName' => 'Varchar(255)', |
|
10 | 10 | 'StoreURL' => 'Varchar(255)', |
11 | 11 | 'ReceiptURL' => 'Varchar(255)', |
12 | 12 | 'StoreEmail' => 'Varchar(255)', |
@@ -24,21 +24,21 @@ discard block |
||
24 | 24 | 'UseSingleSignOn' => 'Boolean', |
25 | 25 | 'AllowMultiship' => 'Boolean', |
26 | 26 | 'StoreTimezone' => 'TimeZone', |
27 | - 'MultiGroup' => 'Boolean', |
|
28 | - 'ProductLimit' => 'Int', |
|
29 | - 'MaxQuantity' => 'Int', |
|
27 | + 'MultiGroup' => 'Boolean', |
|
28 | + 'ProductLimit' => 'Int', |
|
29 | + 'MaxQuantity' => 'Int', |
|
30 | 30 | 'client_id' => 'Varchar(255)', |
31 | 31 | 'client_secret' => 'Varchar(255)', |
32 | 32 | 'access_token' => 'Varchar(255)', |
33 | 33 | 'refresh_token' => 'Varchar(255)', |
34 | - ); |
|
34 | + ); |
|
35 | 35 | |
36 | 36 | // Set Default values |
37 | 37 | private static $defaults = array( |
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')); |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | // settings tab |
47 | 47 | $fields->addFieldsToTab('Root.FoxyStripe.Settings', array( |
48 | 48 | // Store Details |
49 | - HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3), |
|
50 | - LiteralField::create('DetailsIntro', _t( |
|
51 | - 'FoxyStripeSiteConfig.DetailsIntro', |
|
49 | + HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3), |
|
50 | + LiteralField::create('DetailsIntro', _t( |
|
51 | + 'FoxyStripeSiteConfig.DetailsIntro', |
|
52 | 52 | '<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditStore" target="_blank">FoxyCart store settings</a>.' |
53 | 53 | )), |
54 | 54 | TextField::create('StoreTitle') |
55 | 55 | ->setTitle(_t('FoxyStripeSiteConfig.StoreTitle', 'Store Name')) |
56 | 56 | ->setDescription(_t('FoxyStripeSiteConfig.StoreTitleDescription', 'The name of your store as you\'d like it displayed to your customers')), |
57 | - TextField::create('StoreName') |
|
58 | - ->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Domain')) |
|
59 | - ->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'This is a unique FoxyCart subdomain for your cart, checkout, and receipt')), |
|
57 | + TextField::create('StoreName') |
|
58 | + ->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Domain')) |
|
59 | + ->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'This is a unique FoxyCart subdomain for your cart, checkout, and receipt')), |
|
60 | 60 | TextField::create('StoreURL') |
61 | 61 | ->setTitle(_t('FoxyStripeSiteConfig.StoreURL', 'Store URL')) |
62 | 62 | ->setDescription(_t('FoxyStripeSiteConfig.StoreURLDescription', 'The URL of your online store')), |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | CheckboxField::create('AllowMultiship', 'Allow multiple shipments per order') |
92 | 92 | |
93 | 93 | |
94 | - // Advanced Settings |
|
94 | + // Advanced Settings |
|
95 | 95 | /* |
96 | 96 | HeaderField::create('AdvanceHeader', _t('FoxyStripeSiteConfig.AdvancedHeader', 'Advanced Settings'), 3), |
97 | 97 | LiteralField::create('AdvancedIntro', _t( |
@@ -115,72 +115,72 @@ discard block |
||
115 | 115 | )); |
116 | 116 | |
117 | 117 | // configuration warning |
118 | - if(FoxyCart::store_name_warning()!==null){ |
|
119 | - $fields->insertBefore(LiteralField::create( |
|
118 | + if(FoxyCart::store_name_warning()!==null){ |
|
119 | + $fields->insertBefore(LiteralField::create( |
|
120 | 120 | "StoreSubDomainHeaderWarning", |
121 | 121 | _t( |
122 | 122 | 'FoxyStripeSiteConfig.StoreSubDomainHeadingWarning', |
123 | 123 | "<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>" |
124 | 124 | ) |
125 | 125 | ), 'StoreDetails'); |
126 | - } |
|
126 | + } |
|
127 | 127 | |
128 | 128 | // products tab |
129 | - $fields->addFieldsToTab('Root.FoxyStripe.Products', array( |
|
130 | - HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3), |
|
131 | - CheckboxField::create('MultiGroup') |
|
132 | - ->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups')) |
|
133 | - ->setDescription(_t( |
|
129 | + $fields->addFieldsToTab('Root.FoxyStripe.Products', array( |
|
130 | + HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3), |
|
131 | + CheckboxField::create('MultiGroup') |
|
132 | + ->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups')) |
|
133 | + ->setDescription(_t( |
|
134 | 134 | 'FoxyStripeSiteConfig.MultiGroupDescription', |
135 | 135 | 'Allows products to be shown in multiple Product Groups' |
136 | 136 | )), |
137 | - HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3), |
|
138 | - NumericField::create('ProductLimit') |
|
139 | - ->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page')) |
|
140 | - ->setDescription(_t( |
|
137 | + HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3), |
|
138 | + NumericField::create('ProductLimit') |
|
139 | + ->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page')) |
|
140 | + ->setDescription(_t( |
|
141 | 141 | 'FoxyStripeSiteConfig.ProductLimitDescription', |
142 | 142 | 'Number of Products to show per page on a Product Group' |
143 | 143 | )), |
144 | - HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3), |
|
145 | - NumericField::create('MaxQuantity') |
|
146 | - ->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity')) |
|
147 | - ->setDescription(_t( |
|
144 | + HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3), |
|
145 | + NumericField::create('MaxQuantity') |
|
146 | + ->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity')) |
|
147 | + ->setDescription(_t( |
|
148 | 148 | 'FoxyStripeSiteConfig.MaxQuantityDescription', |
149 | 149 | 'Sets max quantity for product form dropdown (add to cart form - default 10)' |
150 | 150 | )) |
151 | - )); |
|
151 | + )); |
|
152 | 152 | |
153 | 153 | // categories tab |
154 | - $fields->addFieldsToTab('Root.FoxyStripe.Categories', array( |
|
155 | - HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3), |
|
156 | - LiteralField::create('CategoryDescrip', _t( |
|
154 | + $fields->addFieldsToTab('Root.FoxyStripe.Categories', array( |
|
155 | + HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3), |
|
156 | + LiteralField::create('CategoryDescrip', _t( |
|
157 | 157 | 'FoxyStripeSiteConfig.CategoryDescrip', |
158 | 158 | '<p>FoxyCart Categories offer a way to give products additional behaviors that cannot be accomplished by product options alone, including category specific coupon codes, shipping and handling fees, and email receipts. <a href="https://wiki.foxycart.com/v/2.0/categories" target="_blank">Learn More</a></p><p>Categories you\'ve created in FoxyStripe must also be created in your <a href="https://admin.foxycart.com/admin.php?ThisAction=ManageProductCategories" target="_blank">FoxyCart Categories</a> admin panel.</p>' |
159 | 159 | )), |
160 | - GridField::create( |
|
160 | + GridField::create( |
|
161 | 161 | 'ProductCategory', |
162 | 162 | _t('FoxyStripeSiteConfig.ProductCategory', 'FoxyCart Categories'), |
163 | 163 | ProductCategory::get(), |
164 | 164 | GridFieldConfig_RecordEditor::create() |
165 | 165 | ) |
166 | - )); |
|
166 | + )); |
|
167 | 167 | |
168 | 168 | // option groups tab |
169 | - $fields->addFieldsToTab('Root.FoxyStripe.Groups', array( |
|
170 | - HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3), |
|
171 | - LiteralField::create('OptionGroupsDescrip', _t( |
|
169 | + $fields->addFieldsToTab('Root.FoxyStripe.Groups', array( |
|
170 | + HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3), |
|
171 | + LiteralField::create('OptionGroupsDescrip', _t( |
|
172 | 172 | 'FoxyStripeSiteConfig.OptionGroupsDescrip', |
173 | 173 | '<p>Product Option Groups allow you to name a set of product options.</p>' |
174 | 174 | )), |
175 | - GridField::create( |
|
175 | + GridField::create( |
|
176 | 176 | 'OptionGroup', |
177 | 177 | _t('FoxyStripeSiteConfig.OptionGroup', 'Product Option Groups'), |
178 | 178 | OptionGroup::get(), |
179 | 179 | GridFieldConfig_RecordEditor::create() |
180 | 180 | ) |
181 | - )); |
|
181 | + )); |
|
182 | 182 | |
183 | - // api tab |
|
183 | + // api tab |
|
184 | 184 | $fields->addFieldsToTab('Root.FoxyStripe.API', [ |
185 | 185 | HeaderField::create('APIHD', 'FoxyCart API Settings', 3), |
186 | 186 | TextField::create('client_id', 'FoxyCart Client ID'), |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | TextField::create('refresh_token', 'FoxyCart Refresh Token'), |
190 | 190 | ]); |
191 | 191 | |
192 | - } |
|
192 | + } |
|
193 | 193 | |
194 | 194 | private static function getSSOLink() { |
195 | 195 | return Director::absoluteBaseURL()."foxystripe/sso/"; |