@@ -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' => 'Varchar(100)', |
| 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')), |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | TextField::create('StoreLogoURL', 'Logo URL') |
| 79 | 79 | ->setAttribute('placeholder', 'http://') |
| 80 | 80 | |
| 81 | - // Advanced Settings |
|
| 81 | + // Advanced Settings |
|
| 82 | 82 | /* |
| 83 | 83 | HeaderField::create('AdvanceHeader', _t('FoxyStripeSiteConfig.AdvancedHeader', 'Advanced Settings'), 3), |
| 84 | 84 | LiteralField::create('AdvancedIntro', _t( |
@@ -122,72 +122,72 @@ discard block |
||
| 122 | 122 | ]); |
| 123 | 123 | |
| 124 | 124 | // configuration warning |
| 125 | - if(FoxyCart::store_name_warning()!==null){ |
|
| 126 | - $fields->insertBefore(LiteralField::create( |
|
| 125 | + if(FoxyCart::store_name_warning()!==null){ |
|
| 126 | + $fields->insertBefore(LiteralField::create( |
|
| 127 | 127 | "StoreSubDomainHeaderWarning", |
| 128 | 128 | _t( |
| 129 | 129 | 'FoxyStripeSiteConfig.StoreSubDomainHeadingWarning', |
| 130 | 130 | "<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>" |
| 131 | 131 | ) |
| 132 | 132 | ), 'StoreDetails'); |
| 133 | - } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | 135 | // products tab |
| 136 | - $fields->addFieldsToTab('Root.FoxyStripe.Products', array( |
|
| 137 | - HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3), |
|
| 138 | - CheckboxField::create('MultiGroup') |
|
| 139 | - ->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups')) |
|
| 140 | - ->setDescription(_t( |
|
| 136 | + $fields->addFieldsToTab('Root.FoxyStripe.Products', array( |
|
| 137 | + HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3), |
|
| 138 | + CheckboxField::create('MultiGroup') |
|
| 139 | + ->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups')) |
|
| 140 | + ->setDescription(_t( |
|
| 141 | 141 | 'FoxyStripeSiteConfig.MultiGroupDescription', |
| 142 | 142 | 'Allows products to be shown in multiple Product Groups' |
| 143 | 143 | )), |
| 144 | - HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3), |
|
| 145 | - NumericField::create('ProductLimit') |
|
| 146 | - ->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page')) |
|
| 147 | - ->setDescription(_t( |
|
| 144 | + HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3), |
|
| 145 | + NumericField::create('ProductLimit') |
|
| 146 | + ->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page')) |
|
| 147 | + ->setDescription(_t( |
|
| 148 | 148 | 'FoxyStripeSiteConfig.ProductLimitDescription', |
| 149 | 149 | 'Number of Products to show per page on a Product Group' |
| 150 | 150 | )), |
| 151 | - HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3), |
|
| 152 | - NumericField::create('MaxQuantity') |
|
| 153 | - ->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity')) |
|
| 154 | - ->setDescription(_t( |
|
| 151 | + HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3), |
|
| 152 | + NumericField::create('MaxQuantity') |
|
| 153 | + ->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity')) |
|
| 154 | + ->setDescription(_t( |
|
| 155 | 155 | 'FoxyStripeSiteConfig.MaxQuantityDescription', |
| 156 | 156 | 'Sets max quantity for product form dropdown (add to cart form - default 10)' |
| 157 | 157 | )) |
| 158 | - )); |
|
| 158 | + )); |
|
| 159 | 159 | |
| 160 | 160 | // categories tab |
| 161 | - $fields->addFieldsToTab('Root.FoxyStripe.Categories', array( |
|
| 162 | - HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3), |
|
| 163 | - LiteralField::create('CategoryDescrip', _t( |
|
| 161 | + $fields->addFieldsToTab('Root.FoxyStripe.Categories', array( |
|
| 162 | + HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3), |
|
| 163 | + LiteralField::create('CategoryDescrip', _t( |
|
| 164 | 164 | 'FoxyStripeSiteConfig.CategoryDescrip', |
| 165 | 165 | '<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>' |
| 166 | 166 | )), |
| 167 | - GridField::create( |
|
| 167 | + GridField::create( |
|
| 168 | 168 | 'ProductCategory', |
| 169 | 169 | _t('FoxyStripeSiteConfig.ProductCategory', 'FoxyCart Categories'), |
| 170 | 170 | ProductCategory::get(), |
| 171 | 171 | GridFieldConfig_RecordEditor::create() |
| 172 | 172 | ) |
| 173 | - )); |
|
| 173 | + )); |
|
| 174 | 174 | |
| 175 | 175 | // option groups tab |
| 176 | - $fields->addFieldsToTab('Root.FoxyStripe.Groups', array( |
|
| 177 | - HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3), |
|
| 178 | - LiteralField::create('OptionGroupsDescrip', _t( |
|
| 176 | + $fields->addFieldsToTab('Root.FoxyStripe.Groups', array( |
|
| 177 | + HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3), |
|
| 178 | + LiteralField::create('OptionGroupsDescrip', _t( |
|
| 179 | 179 | 'FoxyStripeSiteConfig.OptionGroupsDescrip', |
| 180 | 180 | '<p>Product Option Groups allow you to name a set of product options.</p>' |
| 181 | 181 | )), |
| 182 | - GridField::create( |
|
| 182 | + GridField::create( |
|
| 183 | 183 | 'OptionGroup', |
| 184 | 184 | _t('FoxyStripeSiteConfig.OptionGroup', 'Product Option Groups'), |
| 185 | 185 | OptionGroup::get(), |
| 186 | 186 | GridFieldConfig_RecordEditor::create() |
| 187 | 187 | ) |
| 188 | - )); |
|
| 188 | + )); |
|
| 189 | 189 | |
| 190 | - // api tab |
|
| 190 | + // api tab |
|
| 191 | 191 | $fields->addFieldsToTab('Root.FoxyStripe.API', [ |
| 192 | 192 | HeaderField::create('APIHD', 'FoxyCart API Settings', 3), |
| 193 | 193 | TextField::create('client_id', 'FoxyCart Client ID'), |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | TextField::create('refresh_token', 'FoxyCart Refresh Token'), |
| 197 | 197 | ]); |
| 198 | 198 | |
| 199 | - } |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | 201 | private static function getSSOLink() { |
| 202 | 202 | return Director::absoluteBaseURL()."foxystripe/sso/"; |