Completed
Pull Request — master (#304)
by Jason
09:34
created
tests/ProductPageTest.php 1 patch
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -2,194 +2,194 @@
 block discarded – undo
2 2
 
3 3
 class ProductPageTest extends FS_Test{
4 4
 
5
-	protected static $use_draft_site = true;
5
+    protected static $use_draft_site = true;
6 6
 
7
-	function setUp(){
8
-		parent::setUp();
7
+    function setUp(){
8
+        parent::setUp();
9 9
 
10
-		$groupForItem = OptionGroup::create();
11
-		$groupForItem->Title = 'Sample-Group';
12
-		$groupForItem->write();
10
+        $groupForItem = OptionGroup::create();
11
+        $groupForItem->Title = 'Sample-Group';
12
+        $groupForItem->write();
13 13
 
14
-		$productHolder = ProductHolder::create();
15
-		$productHolder->Title = 'Product Holder';
16
-		$productHolder->write();
17
-	}
14
+        $productHolder = ProductHolder::create();
15
+        $productHolder->Title = 'Product Holder';
16
+        $productHolder->write();
17
+    }
18 18
 
19
-	function testProductCreation(){
19
+    function testProductCreation(){
20 20
 
21
-		$this->logInWithPermission('Product_CANCRUD');
22
-		$default = $this->objFromFixture('ProductCategory', 'default');
23
-		$default->write();
24
-		$product1 = $this->objFromFixture('ProductPage', 'product1');
25
-		$product1->ParentID = ProductHolder::get()->first()->ID;
21
+        $this->logInWithPermission('Product_CANCRUD');
22
+        $default = $this->objFromFixture('ProductCategory', 'default');
23
+        $default->write();
24
+        $product1 = $this->objFromFixture('ProductPage', 'product1');
25
+        $product1->ParentID = ProductHolder::get()->first()->ID;
26 26
 
27
-		$product1->doPublish();
28
-		$this->assertTrue($product1->isPublished());
27
+        $product1->doPublish();
28
+        $this->assertTrue($product1->isPublished());
29 29
 
30
-	}
30
+    }
31 31
 
32
-	function testProductDeletion(){
32
+    function testProductDeletion(){
33 33
 
34
-		$this->logInWithPermission('Product_CANCRUD');
35
-		$product2 = $this->objFromFixture('ProductPage', 'product2');
36
-		$product2->ParentID = ProductHolder::get()->first()->ID;
37
-		$productID = $product2->ID;
34
+        $this->logInWithPermission('Product_CANCRUD');
35
+        $product2 = $this->objFromFixture('ProductPage', 'product2');
36
+        $product2->ParentID = ProductHolder::get()->first()->ID;
37
+        $productID = $product2->ID;
38 38
 
39
-		$product2->doPublish();
40
-		$this->assertTrue($product2->isPublished());
39
+        $product2->doPublish();
40
+        $this->assertTrue($product2->isPublished());
41 41
 
42
-		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
43
-		$versionsPostPublish = array();
44
-		foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow;
42
+        $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
43
+        $versionsPostPublish = array();
44
+        foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow;
45 45
 
46
-		$product2->delete();
47
-		$this->assertTrue(!$product2->isPublished());
46
+        $product2->delete();
47
+        $this->assertTrue(!$product2->isPublished());
48 48
 
49
-		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
50
-		$versionsPostDelete = array();
51
-		foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow;
49
+        $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
50
+        $versionsPostDelete = array();
51
+        foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow;
52 52
 
53
-		$this->assertTrue($versionsPostPublish == $versionsPostDelete);
53
+        $this->assertTrue($versionsPostPublish == $versionsPostDelete);
54 54
 
55
-	}
55
+    }
56 56
 
57
-	function testProductTitleLeadingWhiteSpace(){
57
+    function testProductTitleLeadingWhiteSpace(){
58 58
 
59
-		$this->logInWithPermission('ADMIN');
60
-		$product = $this->objFromFixture('ProductPage', 'product1');
61
-		$product->Title = " Test with leading space";
62
-		$product->ParentID = ProductHolder::get()->first()->ID;
63
-		$product->doPublish();
59
+        $this->logInWithPermission('ADMIN');
60
+        $product = $this->objFromFixture('ProductPage', 'product1');
61
+        $product->Title = " Test with leading space";
62
+        $product->ParentID = ProductHolder::get()->first()->ID;
63
+        $product->doPublish();
64 64
 
65
-		$this->assertTrue($product->Title == 'Test with leading space');
65
+        $this->assertTrue($product->Title == 'Test with leading space');
66 66
 
67
-	}
67
+    }
68 68
 
69
-	function testProductTitleTrailingWhiteSpace(){
69
+    function testProductTitleTrailingWhiteSpace(){
70 70
 
71
-		$this->logInWithPermission('ADMIN');
72
-		$product = $this->objFromFixture('ProductPage', 'product1');
73
-		$product->Title = "Test with trailing space ";
74
-		$product->ParentID = ProductHolder::get()->first()->ID;
75
-		$product->doPublish();
71
+        $this->logInWithPermission('ADMIN');
72
+        $product = $this->objFromFixture('ProductPage', 'product1');
73
+        $product->Title = "Test with trailing space ";
74
+        $product->ParentID = ProductHolder::get()->first()->ID;
75
+        $product->doPublish();
76 76
 
77
-		$this->assertTrue($product->Title == 'Test with trailing space');
77
+        $this->assertTrue($product->Title == 'Test with trailing space');
78 78
 
79
-	}
79
+    }
80 80
 
81
-	function testProductCategoryCreation(){
81
+    function testProductCategoryCreation(){
82 82
 
83
-		$this->logInWithPermission('Product_CANCRUD');
84
-		$category = $this->objFromFixture('ProductCategory', 'apparel');
85
-		$category->write();
86
-		$categoryID = $category->ID;
83
+        $this->logInWithPermission('Product_CANCRUD');
84
+        $category = $this->objFromFixture('ProductCategory', 'apparel');
85
+        $category->write();
86
+        $categoryID = $category->ID;
87 87
 
88
-		$productCategory = ProductCategory::get()->filter(array('Code'=>'APPAREL'))->first();
88
+        $productCategory = ProductCategory::get()->filter(array('Code'=>'APPAREL'))->first();
89 89
 
90
-		$this->assertTrue($categoryID == $productCategory->ID);
90
+        $this->assertTrue($categoryID == $productCategory->ID);
91 91
 
92
-	}
92
+    }
93 93
 
94
-	function testProductCategoryDeletion(){
94
+    function testProductCategoryDeletion(){
95 95
 
96
-		$this->logInWithPermission('Product_CANCRUD');
97
-		$category = $this->objFromFixture('ProductCategory', 'default');
98
-		$category->write();
96
+        $this->logInWithPermission('Product_CANCRUD');
97
+        $category = $this->objFromFixture('ProductCategory', 'default');
98
+        $category->write();
99 99
 
100
-		$this->assertFalse($category->canDelete());
100
+        $this->assertFalse($category->canDelete());
101 101
 
102
-		$category2 = $this->objFromFixture('ProductCategory', 'apparel');
103
-		$category2->write();
104
-		$category2ID = $category2->ID;
102
+        $category2 = $this->objFromFixture('ProductCategory', 'apparel');
103
+        $category2->write();
104
+        $category2ID = $category2->ID;
105 105
 
106
-		$this->assertTrue($category2->canDelete());
106
+        $this->assertTrue($category2->canDelete());
107 107
 
108
-		$this->logOut();
108
+        $this->logOut();
109 109
 
110
-		$this->logInWithPermission('ADMIN');
110
+        $this->logInWithPermission('ADMIN');
111 111
 
112
-		$this->assertFalse($category->canDelete());
113
-		$this->assertTrue($category2->canDelete());
112
+        $this->assertFalse($category->canDelete());
113
+        $this->assertTrue($category2->canDelete());
114 114
 
115
-		$this->logOut();
116
-		$this->logInWithPermission('Product_CANCRUD');
115
+        $this->logOut();
116
+        $this->logInWithPermission('Product_CANCRUD');
117 117
 
118
-		$category2->delete();
118
+        $category2->delete();
119 119
 
120
-		$this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID')));
120
+        $this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID')));
121 121
 
122
-	}
122
+    }
123 123
 
124
-	function testOptionGroupCreation(){
124
+    function testOptionGroupCreation(){
125 125
 
126
-		$this->logInWithPermission('Product_CANCRUD');
127
-		$group = $this->objFromFixture('OptionGroup', 'size');
128
-		$group->write();
126
+        $this->logInWithPermission('Product_CANCRUD');
127
+        $group = $this->objFromFixture('OptionGroup', 'size');
128
+        $group->write();
129 129
 
130
-		$this->assertNotNull(OptionGroup::get()->first());
130
+        $this->assertNotNull(OptionGroup::get()->first());
131 131
 
132
-	}
132
+    }
133 133
 
134
-	function testOptionGroupDeletion(){
134
+    function testOptionGroupDeletion(){
135 135
 
136
-		$this->logInWithPermission('ADMIN');
137
-		$group = $this->objFromFixture('OptionGroup', 'color');
138
-		$group->write();
139
-		$groupID = $group->ID;
136
+        $this->logInWithPermission('ADMIN');
137
+        $group = $this->objFromFixture('OptionGroup', 'color');
138
+        $group->write();
139
+        $groupID = $group->ID;
140 140
 
141
-		$this->assertTrue($group->canDelete());
141
+        $this->assertTrue($group->canDelete());
142 142
 
143
-		$this->logOut();
144
-		$this->logInWithPermission('Product_CANCRUD');
143
+        $this->logOut();
144
+        $this->logInWithPermission('Product_CANCRUD');
145 145
 
146
-		$this->assertTrue($group->canDelete());
147
-		$group->delete();
146
+        $this->assertTrue($group->canDelete());
147
+        $group->delete();
148 148
 
149
-		$this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID')));
149
+        $this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID')));
150 150
 
151
-	}
151
+    }
152 152
 
153
-	function testOptionItemCreation(){
153
+    function testOptionItemCreation(){
154 154
 
155
-		$this->logInWithPermission('Product_CANCRUD');
156
-		$optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first();
157
-		$option = $this->objFromFixture('OptionItem', 'large');
158
-		$option->ProductOptionGroupID = $optionGroup->ID;
159
-		$option->write();
160
-		$optionID = $option->ID;
155
+        $this->logInWithPermission('Product_CANCRUD');
156
+        $optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first();
157
+        $option = $this->objFromFixture('OptionItem', 'large');
158
+        $option->ProductOptionGroupID = $optionGroup->ID;
159
+        $option->write();
160
+        $optionID = $option->ID;
161 161
 
162
-		$optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first();
162
+        $optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first();
163 163
 
164
-		$this->assertEquals($optionID, $optionItem->ID);
164
+        $this->assertEquals($optionID, $optionItem->ID);
165 165
 
166
-	}
166
+    }
167 167
 
168
-	function testOptionItemDeletion(){
168
+    function testOptionItemDeletion(){
169 169
 
170
-		$this->logInWithPermission('ADMIN');
171
-		$optionGroup = (OptionGroup::get()->first())
172
-			? OptionGroup::get()->first()
173
-			: OptionGroup::create();
174
-		if($optionGroup->ID == 0){
175
-			$optionGroup->Title = 'Size';
176
-			$optionGroup->write();
177
-		}
178
-		$option = $this->objFromFixture('OptionItem', 'small');
179
-		$option->ProductOptionGroupID = $optionGroup->ID;
180
-		$option->write();
181
-		$optionID = $option->ID;
170
+        $this->logInWithPermission('ADMIN');
171
+        $optionGroup = (OptionGroup::get()->first())
172
+            ? OptionGroup::get()->first()
173
+            : OptionGroup::create();
174
+        if($optionGroup->ID == 0){
175
+            $optionGroup->Title = 'Size';
176
+            $optionGroup->write();
177
+        }
178
+        $option = $this->objFromFixture('OptionItem', 'small');
179
+        $option->ProductOptionGroupID = $optionGroup->ID;
180
+        $option->write();
181
+        $optionID = $option->ID;
182 182
 
183
-		$this->assertTrue($option->canDelete());
183
+        $this->assertTrue($option->canDelete());
184 184
 
185
-		$this->logOut();
186
-		$this->logInWithPermission('Product_CANCRUD');
185
+        $this->logOut();
186
+        $this->logInWithPermission('Product_CANCRUD');
187 187
 
188
-		$this->assertTrue($option->canDelete());
189
-		$option->delete();
188
+        $this->assertTrue($option->canDelete());
189
+        $option->delete();
190 190
 
191
-		$this->assertFalse(in_array($optionID, OptionItem::get()->column('ID')));
191
+        $this->assertFalse(in_array($optionID, OptionItem::get()->column('ID')));
192 192
 
193
-	}
193
+    }
194 194
 
195 195
 }
Please login to merge, or discard this patch.
code/extensions/FoxyStripeSiteConfig.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -4,30 +4,30 @@  discard block
 block discarded – undo
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
-		'StoreKey' => 'Varchar(60)',
11
+        'StoreKey' => 'Varchar(60)',
12 12
         'ReceiptURL' => 'Varchar(255)',
13 13
         'StoreEmail' => 'Varchar(255)',
14 14
         'FromEmail' => 'Varchar(255)',
15
-		'MultiGroup' => 'Boolean',
16
-		'ProductLimit' => 'Int',
17
-		//'CartValidation' => 'Boolean',
18
-		'MaxQuantity' => 'Int',
15
+        'MultiGroup' => 'Boolean',
16
+        'ProductLimit' => 'Int',
17
+        //'CartValidation' => 'Boolean',
18
+        'MaxQuantity' => 'Int',
19 19
         'client_id' => 'Varchar(255)',
20 20
         'client_secret' => 'Varchar(255)',
21 21
         'access_token' => 'Varchar(255)',
22 22
         'refresh_token' => 'Varchar(255)',
23
-	);
23
+    );
24 24
 
25 25
     // Set Default values
26 26
     private static $defaults = array(
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'));
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
         // settings tab
36 36
         $fields->addFieldsToTab('Root.FoxyStripe.Settings', array(
37 37
             // Store Details
38
-			HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3),
39
-			LiteralField::create('DetailsIntro', _t(
40
-				'FoxyStripeSiteConfig.DetailsIntro',
38
+            HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3),
39
+            LiteralField::create('DetailsIntro', _t(
40
+                'FoxyStripeSiteConfig.DetailsIntro',
41 41
                 '<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditStore" target="_blank">FoxyCart store settings</a>.'
42 42
             )),
43 43
             TextField::create('StoreTitle')
44 44
                 ->setTitle(_t('FoxyStripeSiteConfig.StoreTitle', 'Store Name'))
45 45
                 ->setDescription(_t('FoxyStripeSiteConfig.StoreTitleDescription', 'The name of your store as you\'d like it displayed to your customers')),
46
-			TextField::create('StoreName')
47
-				->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Domain'))
48
-				->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'This is a unique FoxyCart subdomain for your cart, checkout, and receipt')),
46
+            TextField::create('StoreName')
47
+                ->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Domain'))
48
+                ->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'This is a unique FoxyCart subdomain for your cart, checkout, and receipt')),
49 49
             TextField::create('StoreURL')
50 50
                 ->setTitle(_t('FoxyStripeSiteConfig.StoreURL', 'Store URL'))
51 51
                 ->setDescription(_t('FoxyStripeSiteConfig.StoreURLDescription', 'The URL of your online store')),
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 ->setTitle(_t('FoxyStripeSiteConfig.FromEmail', 'From Email'))
60 60
                 ->setDescription(_t('FoxyStripeSiteConfig.FromEmailDescription', 'Used for when you want to specify a different from email than your store\'s email address')),
61 61
 
62
-			// Advanced Settings
62
+            // Advanced Settings
63 63
             /*
64 64
 			HeaderField::create('AdvanceHeader', _t('FoxyStripeSiteConfig.AdvancedHeader', 'Advanced Settings'), 3),
65 65
 			LiteralField::create('AdvancedIntro', _t(
@@ -83,72 +83,72 @@  discard block
 block discarded – undo
83 83
         ));
84 84
 
85 85
         // configuration warning
86
-		if(FoxyCart::store_name_warning()!==null){
87
-			$fields->insertBefore(LiteralField::create(
86
+        if(FoxyCart::store_name_warning()!==null){
87
+            $fields->insertBefore(LiteralField::create(
88 88
                 "StoreSubDomainHeaderWarning",
89 89
                 _t(
90 90
                     'FoxyStripeSiteConfig.StoreSubDomainHeadingWarning',
91 91
                     "<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>"
92 92
                 )
93 93
             ), 'StoreDetails');
94
-		}
94
+        }
95 95
 
96 96
         // products tab
97
-		$fields->addFieldsToTab('Root.FoxyStripe.Products', array(
98
-			HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3),
99
-			CheckboxField::create('MultiGroup')
100
-				->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups'))
101
-				->setDescription(_t(
97
+        $fields->addFieldsToTab('Root.FoxyStripe.Products', array(
98
+            HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3),
99
+            CheckboxField::create('MultiGroup')
100
+                ->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups'))
101
+                ->setDescription(_t(
102 102
                     'FoxyStripeSiteConfig.MultiGroupDescription',
103 103
                     'Allows products to be shown in multiple Product Groups'
104 104
                 )),
105
-			HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3),
106
-			NumericField::create('ProductLimit')
107
-				->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page'))
108
-				->setDescription(_t(
105
+            HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3),
106
+            NumericField::create('ProductLimit')
107
+                ->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page'))
108
+                ->setDescription(_t(
109 109
                     'FoxyStripeSiteConfig.ProductLimitDescription',
110 110
                     'Number of Products to show per page on a Product Group'
111 111
                 )),
112
-			HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3),
113
-			NumericField::create('MaxQuantity')
114
-				->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity'))
115
-				->setDescription(_t(
112
+            HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3),
113
+            NumericField::create('MaxQuantity')
114
+                ->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity'))
115
+                ->setDescription(_t(
116 116
                     'FoxyStripeSiteConfig.MaxQuantityDescription',
117 117
                     'Sets max quantity for product form dropdown (add to cart form - default 10)'
118 118
                 ))
119
-		));
119
+        ));
120 120
 
121 121
         // categories tab
122
-		$fields->addFieldsToTab('Root.FoxyStripe.Categories', array(
123
-			HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3),
124
-			LiteralField::create('CategoryDescrip', _t(
122
+        $fields->addFieldsToTab('Root.FoxyStripe.Categories', array(
123
+            HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3),
124
+            LiteralField::create('CategoryDescrip', _t(
125 125
                 'FoxyStripeSiteConfig.CategoryDescrip',
126 126
                 '<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>'
127 127
             )),
128
-			GridField::create(
128
+            GridField::create(
129 129
                 'ProductCategory',
130 130
                 _t('FoxyStripeSiteConfig.ProductCategory', 'FoxyCart Categories'),
131 131
                 ProductCategory::get(),
132 132
                 GridFieldConfig_RecordEditor::create()
133 133
             )
134
-		));
134
+        ));
135 135
 
136 136
         // option groups tab
137
-		$fields->addFieldsToTab('Root.FoxyStripe.Groups', array(
138
-			HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3),
139
-			LiteralField::create('OptionGroupsDescrip', _t(
137
+        $fields->addFieldsToTab('Root.FoxyStripe.Groups', array(
138
+            HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3),
139
+            LiteralField::create('OptionGroupsDescrip', _t(
140 140
                 'FoxyStripeSiteConfig.OptionGroupsDescrip',
141 141
                 '<p>Product Option Groups allow you to name a set of product options.</p>'
142 142
             )),
143
-			GridField::create(
143
+            GridField::create(
144 144
                 'OptionGroup',
145 145
                 _t('FoxyStripeSiteConfig.OptionGroup', 'Product Option Groups'),
146 146
                 OptionGroup::get(),
147 147
                 GridFieldConfig_RecordEditor::create()
148 148
             )
149
-		));
149
+        ));
150 150
 
151
-		// api tab
151
+        // api tab
152 152
         $fields->addFieldsToTab('Root.FoxyStripe.API', [
153 153
             HeaderField::create('APIHD', 'FoxyCart API Settings', 3),
154 154
             TextField::create('client_id', 'FoxyCart Client ID'),
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             TextField::create('refresh_token', 'FoxyCart Refresh Token'),
158 158
         ]);
159 159
 
160
-	}
160
+    }
161 161
 
162 162
     private static function getSSOLink() {
163 163
         return Director::absoluteBaseURL()."foxystripe/sso/";
Please login to merge, or discard this patch.
code/objects/ProductCategory.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 class ProductCategory extends DataObject {
6 6
 
7 7
     private static $db = array(
8
-		'Title' => 'Varchar(255)',
9
-		'Code' => 'Varchar(50)',
8
+        'Title' => 'Varchar(255)',
9
+        'Code' => 'Varchar(50)',
10 10
         'DeliveryType' => 'Varchar(50)',
11 11
         'MaxDownloads' => 'Int',
12 12
         'MaxDownloadsTime' => 'Int',
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         'DiscountName' => 'Varchar(50)',
24 24
         'DiscountDetails' => 'Varchar(200)',
25 25
         'CustomsValue' => 'Currency',
26
-	);
26
+    );
27 27
 
28 28
     private static $singular_name = 'FoxyCart Category';
29 29
     private static $plural_name = 'FoxyCart Categories';
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
         'Code' => 'Code'
35 35
     );
36 36
 
37
-	private static $indexes = array(
38
-		'Code' => true
39
-	);
37
+    private static $indexes = array(
38
+        'Code' => true
39
+    );
40 40
 
41 41
     public function getCMSFields() {
42 42
 
@@ -153,41 +153,41 @@  discard block
 block discarded – undo
153 153
         */
154 154
 
155 155
         return $fields;
156
-	}
156
+    }
157 157
 
158
-	public function requireDefaultRecords() {
159
-		parent::requireDefaultRecords();
160
-		$allCats = DataObject::get('ProductCategory');
161
-		if(!$allCats->count()){
162
-			$cat = new ProductCategory();
163
-			$cat->Title = 'Default';
164
-			$cat->Code = 'DEFAULT';
165
-			$cat->write();
166
-		}
167
-	}
158
+    public function requireDefaultRecords() {
159
+        parent::requireDefaultRecords();
160
+        $allCats = DataObject::get('ProductCategory');
161
+        if(!$allCats->count()){
162
+            $cat = new ProductCategory();
163
+            $cat->Title = 'Default';
164
+            $cat->Code = 'DEFAULT';
165
+            $cat->write();
166
+        }
167
+    }
168 168
 
169
-	public function canView($member = false) {
170
-		return true;
171
-	}
169
+    public function canView($member = false) {
170
+        return true;
171
+    }
172 172
 
173
-	public function canEdit($member = null) {
174
-		return Permission::check('Product_CANCRUD', 'any', $member);
175
-	}
173
+    public function canEdit($member = null) {
174
+        return Permission::check('Product_CANCRUD', 'any', $member);
175
+    }
176 176
 
177
-	public function canDelete($member = null) {
177
+    public function canDelete($member = null) {
178 178
 
179
-		//don't allow deletion of DEFAULT category
180
-		return ($this->Code == 'DEFAULT') ? false : Permission::check('Product_CANCRUD', 'any', $member);
181
-	}
179
+        //don't allow deletion of DEFAULT category
180
+        return ($this->Code == 'DEFAULT') ? false : Permission::check('Product_CANCRUD', 'any', $member);
181
+    }
182 182
 
183
-	public function canCreate($member = null) {
184
-		return Permission::check('Product_CANCRUD', 'any', $member);
185
-	}
183
+    public function canCreate($member = null) {
184
+        return Permission::check('Product_CANCRUD', 'any', $member);
185
+    }
186 186
 
187 187
     /**
188 188
      * @return array
189 189
      */
190
-	public function getShippingOptions()
190
+    public function getShippingOptions()
191 191
     {
192 192
         return [
193 193
             'shipped' => 'Shipped using live shipping rates',
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     /**
236 236
      * @return array
237 237
      */
238
-	public function getDataMap()
238
+    public function getDataMap()
239 239
     {
240 240
         return [
241 241
             'name' => $this->Title,
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     /**
263 263
      *
264 264
      */
265
-	public function onAfterWrite()
265
+    public function onAfterWrite()
266 266
     {
267 267
         parent::onAfterWrite();
268 268
 
Please login to merge, or discard this patch.