@@ -50,39 +50,39 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | class FoxyStripeDropdownField extends DropdownField{ |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Mark certain elements as disabled, |
|
| 55 | - * regardless of the {@link setDisabled()} settings. |
|
| 56 | - * |
|
| 57 | - * @param array $items Collection of array keys, as defined in the $source array |
|
| 58 | - */ |
|
| 59 | - public function setDisabledItems($items){ |
|
| 60 | - $controller = Controller::curr(); |
|
| 61 | - $code = $controller->data()->Code; |
|
| 62 | - $updated = []; |
|
| 63 | - if(is_array($items) && !empty($items)){ |
|
| 64 | - foreach($items as $item){ |
|
| 65 | - array_push($updated, ProductPage::getGeneratedValue($code, $this->getName(), $item, 'value')); |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - $this->disabledItems = $updated; |
|
| 69 | - return $this; |
|
| 70 | - } |
|
| 53 | + /** |
|
| 54 | + * Mark certain elements as disabled, |
|
| 55 | + * regardless of the {@link setDisabled()} settings. |
|
| 56 | + * |
|
| 57 | + * @param array $items Collection of array keys, as defined in the $source array |
|
| 58 | + */ |
|
| 59 | + public function setDisabledItems($items){ |
|
| 60 | + $controller = Controller::curr(); |
|
| 61 | + $code = $controller->data()->Code; |
|
| 62 | + $updated = []; |
|
| 63 | + if(is_array($items) && !empty($items)){ |
|
| 64 | + foreach($items as $item){ |
|
| 65 | + array_push($updated, ProductPage::getGeneratedValue($code, $this->getName(), $item, 'value')); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + $this->disabledItems = $updated; |
|
| 69 | + return $this; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @param array $source |
|
| 74 | - */ |
|
| 75 | - public function setSource($source) { |
|
| 76 | - $controller = Controller::curr(); |
|
| 77 | - $code = $controller->data()->Code; |
|
| 78 | - $updated = []; |
|
| 79 | - if(is_array($source) && !empty($source)){ |
|
| 80 | - foreach($source as $key => $val){ |
|
| 81 | - $updated[ProductPage::getGeneratedValue($code, $this->getName(), $key, 'value')] = $val; |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - $this->source = $updated; |
|
| 85 | - return $this; |
|
| 86 | - } |
|
| 72 | + /** |
|
| 73 | + * @param array $source |
|
| 74 | + */ |
|
| 75 | + public function setSource($source) { |
|
| 76 | + $controller = Controller::curr(); |
|
| 77 | + $code = $controller->data()->Code; |
|
| 78 | + $updated = []; |
|
| 79 | + if(is_array($source) && !empty($source)){ |
|
| 80 | + foreach($source as $key => $val){ |
|
| 81 | + $updated[ProductPage::getGeneratedValue($code, $this->getName(), $key, 'value')] = $val; |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + $this->source = $updated; |
|
| 85 | + return $this; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @package forms |
| 49 | 49 | * @subpackage fields-basic |
| 50 | 50 | */ |
| 51 | -class FoxyStripeDropdownField extends DropdownField{ |
|
| 51 | +class FoxyStripeDropdownField extends DropdownField { |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Mark certain elements as disabled, |
@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @param array $items Collection of array keys, as defined in the $source array |
| 58 | 58 | */ |
| 59 | - public function setDisabledItems($items){ |
|
| 59 | + public function setDisabledItems($items) { |
|
| 60 | 60 | $controller = Controller::curr(); |
| 61 | 61 | $code = $controller->data()->Code; |
| 62 | 62 | $updated = []; |
| 63 | - if(is_array($items) && !empty($items)){ |
|
| 64 | - foreach($items as $item){ |
|
| 63 | + if (is_array($items) && !empty($items)) { |
|
| 64 | + foreach ($items as $item) { |
|
| 65 | 65 | array_push($updated, ProductPage::getGeneratedValue($code, $this->getName(), $item, 'value')); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | $controller = Controller::curr(); |
| 77 | 77 | $code = $controller->data()->Code; |
| 78 | 78 | $updated = []; |
| 79 | - if(is_array($source) && !empty($source)){ |
|
| 80 | - foreach($source as $key => $val){ |
|
| 79 | + if (is_array($source) && !empty($source)) { |
|
| 80 | + foreach ($source as $key => $val) { |
|
| 81 | 81 | $updated[ProductPage::getGeneratedValue($code, $this->getName(), $key, 'value')] = $val; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -25,10 +25,10 @@ |
||
| 25 | 25 | $response = FoxyCart::putCustomer($this->owner); |
| 26 | 26 | |
| 27 | 27 | // Grab customer_id record from FoxyCart response, store in Member |
| 28 | - if($response){ |
|
| 29 | - $foxyResponse = new SimpleXMLElement($response); |
|
| 30 | - $this->owner->Customer_ID = (int) $foxyResponse->customer_id; |
|
| 31 | - } |
|
| 28 | + if($response){ |
|
| 29 | + $foxyResponse = new SimpleXMLElement($response); |
|
| 30 | + $this->owner->Customer_ID = (int) $foxyResponse->customer_id; |
|
| 31 | + } |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -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 | |
@@ -2,30 +2,30 @@ |
||
| 2 | 2 | |
| 3 | 3 | class StoreSettingsTest 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 | - $siteConf = SiteConfig::current_site_config(); |
|
| 11 | - $siteConf->StoreName = 'foxystripe'; |
|
| 10 | + $siteConf = SiteConfig::current_site_config(); |
|
| 11 | + $siteConf->StoreName = 'foxystripe'; |
|
| 12 | 12 | $siteConf->requireDefaultRecords(); |
| 13 | - $siteConf->write(); |
|
| 14 | - } |
|
| 13 | + $siteConf->write(); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - function testStoreKey(){ |
|
| 17 | - $pref = FoxyCart::getKeyPrefix(); |
|
| 18 | - $siteConf = SiteConfig::current_site_config(); |
|
| 16 | + function testStoreKey(){ |
|
| 17 | + $pref = FoxyCart::getKeyPrefix(); |
|
| 18 | + $siteConf = SiteConfig::current_site_config(); |
|
| 19 | 19 | |
| 20 | - $this->assertTrue(ctype_alnum($siteConf->StoreKey)); |
|
| 20 | + $this->assertTrue(ctype_alnum($siteConf->StoreKey)); |
|
| 21 | 21 | $this->assertEquals(strlen($siteConf->StoreKey), 60); |
| 22 | 22 | $this->assertEquals(substr($siteConf->StoreKey, 0, 6), $pref); |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - function testStoreName(){ |
|
| 26 | - $siteConf = SiteConfig::current_site_config(); |
|
| 25 | + function testStoreName(){ |
|
| 26 | + $siteConf = SiteConfig::current_site_config(); |
|
| 27 | 27 | |
| 28 | 28 | $this->assertEquals($siteConf->StoreName, 'foxystripe'); |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | } |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class StoreSettingsTest extends FS_Test{ |
|
| 3 | +class StoreSettingsTest extends FS_Test { |
|
| 4 | 4 | |
| 5 | 5 | protected static $use_draft_site = true; |
| 6 | 6 | |
| 7 | - function setUp(){ |
|
| 7 | + function setUp() { |
|
| 8 | 8 | parent::setUp(); |
| 9 | 9 | |
| 10 | 10 | $siteConf = SiteConfig::current_site_config(); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $siteConf->write(); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - function testStoreKey(){ |
|
| 16 | + function testStoreKey() { |
|
| 17 | 17 | $pref = FoxyCart::getKeyPrefix(); |
| 18 | 18 | $siteConf = SiteConfig::current_site_config(); |
| 19 | 19 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->assertEquals(substr($siteConf->StoreKey, 0, 6), $pref); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - function testStoreName(){ |
|
| 25 | + function testStoreName() { |
|
| 26 | 26 | $siteConf = SiteConfig::current_site_config(); |
| 27 | 27 | |
| 28 | 28 | $this->assertEquals($siteConf->StoreName, 'foxystripe'); |
@@ -41,14 +41,18 @@ |
||
| 41 | 41 | |
| 42 | 42 | $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); |
| 43 | 43 | $versionsPostPublish = array(); |
| 44 | - foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 44 | + foreach($versions as $versionRow) { |
|
| 45 | + $versionsPostPublish[] = $versionRow; |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $product2->delete(); |
| 47 | 49 | $this->assertTrue(!$product2->isPublished()); |
| 48 | 50 | |
| 49 | 51 | $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); |
| 50 | 52 | $versionsPostDelete = array(); |
| 51 | - foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 53 | + foreach($versions as $versionRow) { |
|
| 54 | + $versionsPostDelete[] = $versionRow; |
|
| 55 | + } |
|
| 52 | 56 | |
| 53 | 57 | $this->assertTrue($versionsPostPublish == $versionsPostDelete); |
| 54 | 58 | |
@@ -2,242 +2,242 @@ |
||
| 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(); |
|
| 14 | + /*$productHolder = ProductHolder::create(); |
|
| 15 | 15 | $productHolder->Title = 'Product Holder'; |
| 16 | 16 | $productHolder->write();*/ |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - function testProductCreation(){ |
|
| 19 | + function testProductCreation(){ |
|
| 20 | 20 | |
| 21 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 22 | - $default = $this->objFromFixture('ProductCategory', 'default'); |
|
| 23 | - $holder = $this->objFromFixture('ProductHolder', 'default'); |
|
| 24 | - $product1 = $this->objFromFixture('ProductPage', 'product1'); |
|
| 21 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 22 | + $default = $this->objFromFixture('ProductCategory', 'default'); |
|
| 23 | + $holder = $this->objFromFixture('ProductHolder', 'default'); |
|
| 24 | + $product1 = $this->objFromFixture('ProductPage', 'product1'); |
|
| 25 | 25 | |
| 26 | - $product1->doPublish(); |
|
| 27 | - $this->assertTrue($product1->isPublished()); |
|
| 26 | + $product1->doPublish(); |
|
| 27 | + $this->assertTrue($product1->isPublished()); |
|
| 28 | 28 | |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - function testProductDeletion(){ |
|
| 31 | + function testProductDeletion(){ |
|
| 32 | 32 | |
| 33 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 34 | - $holder = $this->objFromFixture('ProductHolder', 'default'); |
|
| 35 | - $holder->doPublish(); |
|
| 36 | - $product2 = $this->objFromFixture('ProductPage', 'product2'); |
|
| 37 | - $productID = $product2->ID; |
|
| 33 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 34 | + $holder = $this->objFromFixture('ProductHolder', 'default'); |
|
| 35 | + $holder->doPublish(); |
|
| 36 | + $product2 = $this->objFromFixture('ProductPage', 'product2'); |
|
| 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'); |
|
| 59 | + $this->logInWithPermission('ADMIN'); |
|
| 60 | 60 | |
| 61 | - $holder = $this->objFromFixture('ProductHolder', 'default'); |
|
| 62 | - $holder->doPublish(); |
|
| 61 | + $holder = $this->objFromFixture('ProductHolder', 'default'); |
|
| 62 | + $holder->doPublish(); |
|
| 63 | 63 | |
| 64 | - $product = $this->objFromFixture('ProductPage', 'product1'); |
|
| 65 | - $product->Title = " Test with leading space"; |
|
| 66 | - $product->doPublish(); |
|
| 64 | + $product = $this->objFromFixture('ProductPage', 'product1'); |
|
| 65 | + $product->Title = " Test with leading space"; |
|
| 66 | + $product->doPublish(); |
|
| 67 | 67 | |
| 68 | - $this->assertTrue($product->Title == 'Test with leading space'); |
|
| 68 | + $this->assertTrue($product->Title == 'Test with leading space'); |
|
| 69 | 69 | |
| 70 | - } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - function testProductTitleTrailingWhiteSpace(){ |
|
| 72 | + function testProductTitleTrailingWhiteSpace(){ |
|
| 73 | 73 | |
| 74 | - $this->logInWithPermission('ADMIN'); |
|
| 74 | + $this->logInWithPermission('ADMIN'); |
|
| 75 | 75 | |
| 76 | - $holder = $this->objFromFixture('ProductHolder', 'default'); |
|
| 77 | - $holder->doPublish(); |
|
| 76 | + $holder = $this->objFromFixture('ProductHolder', 'default'); |
|
| 77 | + $holder->doPublish(); |
|
| 78 | 78 | |
| 79 | - $product = $this->objFromFixture('ProductPage', 'product1'); |
|
| 80 | - $product->Title = "Test with trailing space "; |
|
| 81 | - $product->doPublish(); |
|
| 79 | + $product = $this->objFromFixture('ProductPage', 'product1'); |
|
| 80 | + $product->Title = "Test with trailing space "; |
|
| 81 | + $product->doPublish(); |
|
| 82 | 82 | |
| 83 | - $this->assertTrue($product->Title == 'Test with trailing space'); |
|
| 83 | + $this->assertTrue($product->Title == 'Test with trailing space'); |
|
| 84 | 84 | |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - function testProductCategoryCreation(){ |
|
| 87 | + function testProductCategoryCreation(){ |
|
| 88 | 88 | |
| 89 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 90 | - $category = $this->objFromFixture('ProductCategory', 'apparel'); |
|
| 91 | - $category->write(); |
|
| 92 | - $categoryID = $category->ID; |
|
| 89 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 90 | + $category = $this->objFromFixture('ProductCategory', 'apparel'); |
|
| 91 | + $category->write(); |
|
| 92 | + $categoryID = $category->ID; |
|
| 93 | 93 | |
| 94 | - $productCategory = ProductCategory::get()->filter(array('Code'=>'APPAREL'))->first(); |
|
| 94 | + $productCategory = ProductCategory::get()->filter(array('Code'=>'APPAREL'))->first(); |
|
| 95 | 95 | |
| 96 | - $this->assertTrue($categoryID == $productCategory->ID); |
|
| 96 | + $this->assertTrue($categoryID == $productCategory->ID); |
|
| 97 | 97 | |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - function testProductCategoryDeletion(){ |
|
| 100 | + function testProductCategoryDeletion(){ |
|
| 101 | 101 | |
| 102 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 102 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 103 | 103 | |
| 104 | - $category = $this->objFromFixture('ProductCategory', 'default'); |
|
| 105 | - $category->write(); |
|
| 104 | + $category = $this->objFromFixture('ProductCategory', 'default'); |
|
| 105 | + $category->write(); |
|
| 106 | 106 | |
| 107 | - $this->assertFalse($category->canDelete()); |
|
| 107 | + $this->assertFalse($category->canDelete()); |
|
| 108 | 108 | |
| 109 | - $category2 = $this->objFromFixture('ProductCategory', 'apparel'); |
|
| 110 | - $category2->write(); |
|
| 111 | - $category2ID = $category2->ID; |
|
| 109 | + $category2 = $this->objFromFixture('ProductCategory', 'apparel'); |
|
| 110 | + $category2->write(); |
|
| 111 | + $category2ID = $category2->ID; |
|
| 112 | 112 | |
| 113 | - $this->assertTrue($category2->canDelete()); |
|
| 113 | + $this->assertTrue($category2->canDelete()); |
|
| 114 | 114 | |
| 115 | - $this->logOut(); |
|
| 115 | + $this->logOut(); |
|
| 116 | 116 | |
| 117 | - $this->logInWithPermission('ADMIN'); |
|
| 117 | + $this->logInWithPermission('ADMIN'); |
|
| 118 | 118 | |
| 119 | - $this->assertFalse($category->canDelete()); |
|
| 120 | - $this->assertTrue($category2->canDelete()); |
|
| 119 | + $this->assertFalse($category->canDelete()); |
|
| 120 | + $this->assertTrue($category2->canDelete()); |
|
| 121 | 121 | |
| 122 | - $this->logOut(); |
|
| 123 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 122 | + $this->logOut(); |
|
| 123 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 124 | 124 | |
| 125 | - $category2->delete(); |
|
| 125 | + $category2->delete(); |
|
| 126 | 126 | |
| 127 | - $this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID'))); |
|
| 127 | + $this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID'))); |
|
| 128 | 128 | |
| 129 | - } |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - function testOptionGroupCreation(){ |
|
| 131 | + function testOptionGroupCreation(){ |
|
| 132 | 132 | |
| 133 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 133 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 134 | 134 | |
| 135 | - $group = $this->objFromFixture('OptionGroup', 'size'); |
|
| 136 | - $group->write(); |
|
| 135 | + $group = $this->objFromFixture('OptionGroup', 'size'); |
|
| 136 | + $group->write(); |
|
| 137 | 137 | |
| 138 | - $this->assertNotNull(OptionGroup::get()->first()); |
|
| 138 | + $this->assertNotNull(OptionGroup::get()->first()); |
|
| 139 | 139 | |
| 140 | - } |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - function testOptionGroupDeletion(){ |
|
| 142 | + function testOptionGroupDeletion(){ |
|
| 143 | 143 | |
| 144 | - $this->logInWithPermission('ADMIN'); |
|
| 145 | - $group = $this->objFromFixture('OptionGroup', 'color'); |
|
| 146 | - $group->write(); |
|
| 147 | - $groupID = $group->ID; |
|
| 144 | + $this->logInWithPermission('ADMIN'); |
|
| 145 | + $group = $this->objFromFixture('OptionGroup', 'color'); |
|
| 146 | + $group->write(); |
|
| 147 | + $groupID = $group->ID; |
|
| 148 | 148 | |
| 149 | - $this->assertTrue($group->canDelete()); |
|
| 149 | + $this->assertTrue($group->canDelete()); |
|
| 150 | 150 | |
| 151 | - $this->logOut(); |
|
| 152 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 151 | + $this->logOut(); |
|
| 152 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 153 | 153 | |
| 154 | - $this->assertTrue($group->canDelete()); |
|
| 155 | - $group->delete(); |
|
| 154 | + $this->assertTrue($group->canDelete()); |
|
| 155 | + $group->delete(); |
|
| 156 | 156 | |
| 157 | - $this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID'))); |
|
| 157 | + $this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID'))); |
|
| 158 | 158 | |
| 159 | - } |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - function testOptionItemCreation(){ |
|
| 161 | + function testOptionItemCreation(){ |
|
| 162 | 162 | |
| 163 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 163 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 164 | 164 | |
| 165 | - $optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first(); |
|
| 165 | + $optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first(); |
|
| 166 | 166 | |
| 167 | - $option = $this->objFromFixture('OptionItem', 'large'); |
|
| 168 | - $option->ProductOptionGroupID = $optionGroup->ID; |
|
| 169 | - $option->write(); |
|
| 167 | + $option = $this->objFromFixture('OptionItem', 'large'); |
|
| 168 | + $option->ProductOptionGroupID = $optionGroup->ID; |
|
| 169 | + $option->write(); |
|
| 170 | 170 | |
| 171 | - $optionID = $option->ID; |
|
| 171 | + $optionID = $option->ID; |
|
| 172 | 172 | |
| 173 | - $optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first(); |
|
| 173 | + $optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first(); |
|
| 174 | 174 | |
| 175 | - $this->assertEquals($optionID, $optionItem->ID); |
|
| 175 | + $this->assertEquals($optionID, $optionItem->ID); |
|
| 176 | 176 | |
| 177 | - } |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | - function testOptionItemDeletion(){ |
|
| 179 | + function testOptionItemDeletion(){ |
|
| 180 | 180 | |
| 181 | - $this->logInWithPermission('ADMIN'); |
|
| 181 | + $this->logInWithPermission('ADMIN'); |
|
| 182 | 182 | |
| 183 | - $optionGroup = $this->objFromFixture('OptionGroup', 'size'); |
|
| 184 | - $optionGroup->write(); |
|
| 183 | + $optionGroup = $this->objFromFixture('OptionGroup', 'size'); |
|
| 184 | + $optionGroup->write(); |
|
| 185 | 185 | |
| 186 | - $option = $this->objFromFixture('OptionItem', 'small'); |
|
| 187 | - $option->write(); |
|
| 186 | + $option = $this->objFromFixture('OptionItem', 'small'); |
|
| 187 | + $option->write(); |
|
| 188 | 188 | |
| 189 | - $optionID = $option->ID; |
|
| 189 | + $optionID = $option->ID; |
|
| 190 | 190 | |
| 191 | - $this->assertTrue($option->canDelete()); |
|
| 191 | + $this->assertTrue($option->canDelete()); |
|
| 192 | 192 | |
| 193 | - $this->logOut(); |
|
| 194 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 193 | + $this->logOut(); |
|
| 194 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 195 | 195 | |
| 196 | - $this->assertTrue($option->canDelete()); |
|
| 197 | - $option->delete(); |
|
| 196 | + $this->assertTrue($option->canDelete()); |
|
| 197 | + $option->delete(); |
|
| 198 | 198 | |
| 199 | - $this->assertFalse(in_array($optionID, OptionItem::get()->column('ID'))); |
|
| 199 | + $this->assertFalse(in_array($optionID, OptionItem::get()->column('ID'))); |
|
| 200 | 200 | |
| 201 | - } |
|
| 201 | + } |
|
| 202 | 202 | |
| 203 | - public function testProductDraftOptionDeletion(){ |
|
| 203 | + public function testProductDraftOptionDeletion(){ |
|
| 204 | 204 | |
| 205 | - self::$use_draft_site = false;//make sure we can publish |
|
| 205 | + self::$use_draft_site = false;//make sure we can publish |
|
| 206 | 206 | |
| 207 | - $this->logInWithPermission('ADMIN'); |
|
| 207 | + $this->logInWithPermission('ADMIN'); |
|
| 208 | 208 | |
| 209 | - $holder = $this->objFromFixture('ProductHolder', 'default');//build holder page, ProductPage can't be on root level |
|
| 210 | - $holder->doPublish(); |
|
| 209 | + $holder = $this->objFromFixture('ProductHolder', 'default');//build holder page, ProductPage can't be on root level |
|
| 210 | + $holder->doPublish(); |
|
| 211 | 211 | |
| 212 | - $product = $this->objFromFixture('ProductPage', 'product1');//build product page |
|
| 213 | - $product->doPublish(); |
|
| 212 | + $product = $this->objFromFixture('ProductPage', 'product1');//build product page |
|
| 213 | + $product->doPublish(); |
|
| 214 | 214 | |
| 215 | - $productID = $product->ID; |
|
| 215 | + $productID = $product->ID; |
|
| 216 | 216 | |
| 217 | 217 | |
| 218 | - $optionGroup = $this->objFromFixture('OptionGroup', 'size');//build the group for the options |
|
| 219 | - $optionGroup->write(); |
|
| 220 | - $option = $this->objFromFixture('OptionItem', 'small');//build first option |
|
| 221 | - $option->write(); |
|
| 222 | - $option2 = $this->objFromFixture('OptionItem', 'large');//build second option |
|
| 223 | - $option2->write(); |
|
| 218 | + $optionGroup = $this->objFromFixture('OptionGroup', 'size');//build the group for the options |
|
| 219 | + $optionGroup->write(); |
|
| 220 | + $option = $this->objFromFixture('OptionItem', 'small');//build first option |
|
| 221 | + $option->write(); |
|
| 222 | + $option2 = $this->objFromFixture('OptionItem', 'large');//build second option |
|
| 223 | + $option2->write(); |
|
| 224 | 224 | |
| 225 | - $this->assertTrue($product->isPublished());//check that product is published |
|
| 225 | + $this->assertTrue($product->isPublished());//check that product is published |
|
| 226 | 226 | |
| 227 | - $product->deleteFromStage('Stage');//remove product from draft site |
|
| 227 | + $product->deleteFromStage('Stage');//remove product from draft site |
|
| 228 | 228 | |
| 229 | - $this->assertTrue($product->isPublished());//check product is still published |
|
| 229 | + $this->assertTrue($product->isPublished());//check product is still published |
|
| 230 | 230 | |
| 231 | - $testOption = $this->objFromFixture('OptionItem', 'large'); |
|
| 231 | + $testOption = $this->objFromFixture('OptionItem', 'large'); |
|
| 232 | 232 | |
| 233 | - $this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0)));//make sure the first option still exists |
|
| 233 | + $this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0)));//make sure the first option still exists |
|
| 234 | 234 | |
| 235 | - $product->doRestoreToStage();//restore page to draft site |
|
| 236 | - $product->doUnpublish();//unpublish page |
|
| 237 | - $product->deleteFromStage('Stage');//remove product from draft site |
|
| 235 | + $product->doRestoreToStage();//restore page to draft site |
|
| 236 | + $product->doUnpublish();//unpublish page |
|
| 237 | + $product->deleteFromStage('Stage');//remove product from draft site |
|
| 238 | 238 | |
| 239 | - $checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first();//query same option as above |
|
| 239 | + $checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first();//query same option as above |
|
| 240 | 240 | |
| 241 | - $this->assertEquals($checkDeleted->ID, 0);//check that the ID is 0 (empty object/non-existent) |
|
| 242 | - } |
|
| 241 | + $this->assertEquals($checkDeleted->ID, 0);//check that the ID is 0 (empty object/non-existent) |
|
| 242 | + } |
|
| 243 | 243 | } |
| 244 | 244 | \ No newline at end of file |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class ProductPageTest extends FS_Test{ |
|
| 3 | +class ProductPageTest extends FS_Test { |
|
| 4 | 4 | |
| 5 | 5 | protected static $use_draft_site = true; |
| 6 | 6 | |
| 7 | - function setUp(){ |
|
| 7 | + function setUp() { |
|
| 8 | 8 | parent::setUp(); |
| 9 | 9 | |
| 10 | 10 | $groupForItem = OptionGroup::create(); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $productHolder->write();*/ |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - function testProductCreation(){ |
|
| 19 | + function testProductCreation() { |
|
| 20 | 20 | |
| 21 | 21 | $this->logInWithPermission('Product_CANCRUD'); |
| 22 | 22 | $default = $this->objFromFixture('ProductCategory', 'default'); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - function testProductDeletion(){ |
|
| 31 | + function testProductDeletion() { |
|
| 32 | 32 | |
| 33 | 33 | $this->logInWithPermission('Product_CANCRUD'); |
| 34 | 34 | $holder = $this->objFromFixture('ProductHolder', 'default'); |
@@ -39,22 +39,22 @@ discard block |
||
| 39 | 39 | $product2->doPublish(); |
| 40 | 40 | $this->assertTrue($product2->isPublished()); |
| 41 | 41 | |
| 42 | - $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); |
|
| 42 | + $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '.$productID); |
|
| 43 | 43 | $versionsPostPublish = array(); |
| 44 | - foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 44 | + foreach ($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 45 | 45 | |
| 46 | 46 | $product2->delete(); |
| 47 | 47 | $this->assertTrue(!$product2->isPublished()); |
| 48 | 48 | |
| 49 | - $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); |
|
| 49 | + $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '.$productID); |
|
| 50 | 50 | $versionsPostDelete = array(); |
| 51 | - foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 51 | + foreach ($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 52 | 52 | |
| 53 | 53 | $this->assertTrue($versionsPostPublish == $versionsPostDelete); |
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - function testProductTitleLeadingWhiteSpace(){ |
|
| 57 | + function testProductTitleLeadingWhiteSpace() { |
|
| 58 | 58 | |
| 59 | 59 | $this->logInWithPermission('ADMIN'); |
| 60 | 60 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - function testProductTitleTrailingWhiteSpace(){ |
|
| 72 | + function testProductTitleTrailingWhiteSpace() { |
|
| 73 | 73 | |
| 74 | 74 | $this->logInWithPermission('ADMIN'); |
| 75 | 75 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - function testProductCategoryCreation(){ |
|
| 87 | + function testProductCategoryCreation() { |
|
| 88 | 88 | |
| 89 | 89 | $this->logInWithPermission('Product_CANCRUD'); |
| 90 | 90 | $category = $this->objFromFixture('ProductCategory', 'apparel'); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - function testProductCategoryDeletion(){ |
|
| 100 | + function testProductCategoryDeletion() { |
|
| 101 | 101 | |
| 102 | 102 | $this->logInWithPermission('Product_CANCRUD'); |
| 103 | 103 | |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $category2->delete(); |
| 126 | 126 | |
| 127 | - $this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID'))); |
|
| 127 | + $this->assertFalse(in_array($category2ID, ProductCategory::get()->column('ID'))); |
|
| 128 | 128 | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - function testOptionGroupCreation(){ |
|
| 131 | + function testOptionGroupCreation() { |
|
| 132 | 132 | |
| 133 | 133 | $this->logInWithPermission('Product_CANCRUD'); |
| 134 | 134 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - function testOptionGroupDeletion(){ |
|
| 142 | + function testOptionGroupDeletion() { |
|
| 143 | 143 | |
| 144 | 144 | $this->logInWithPermission('ADMIN'); |
| 145 | 145 | $group = $this->objFromFixture('OptionGroup', 'color'); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - function testOptionItemCreation(){ |
|
| 161 | + function testOptionItemCreation() { |
|
| 162 | 162 | |
| 163 | 163 | $this->logInWithPermission('Product_CANCRUD'); |
| 164 | 164 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - function testOptionItemDeletion(){ |
|
| 179 | + function testOptionItemDeletion() { |
|
| 180 | 180 | |
| 181 | 181 | $this->logInWithPermission('ADMIN'); |
| 182 | 182 | |
@@ -200,44 +200,44 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - public function testProductDraftOptionDeletion(){ |
|
| 203 | + public function testProductDraftOptionDeletion() { |
|
| 204 | 204 | |
| 205 | - self::$use_draft_site = false;//make sure we can publish |
|
| 205 | + self::$use_draft_site = false; //make sure we can publish |
|
| 206 | 206 | |
| 207 | 207 | $this->logInWithPermission('ADMIN'); |
| 208 | 208 | |
| 209 | - $holder = $this->objFromFixture('ProductHolder', 'default');//build holder page, ProductPage can't be on root level |
|
| 209 | + $holder = $this->objFromFixture('ProductHolder', 'default'); //build holder page, ProductPage can't be on root level |
|
| 210 | 210 | $holder->doPublish(); |
| 211 | 211 | |
| 212 | - $product = $this->objFromFixture('ProductPage', 'product1');//build product page |
|
| 212 | + $product = $this->objFromFixture('ProductPage', 'product1'); //build product page |
|
| 213 | 213 | $product->doPublish(); |
| 214 | 214 | |
| 215 | 215 | $productID = $product->ID; |
| 216 | 216 | |
| 217 | 217 | |
| 218 | - $optionGroup = $this->objFromFixture('OptionGroup', 'size');//build the group for the options |
|
| 218 | + $optionGroup = $this->objFromFixture('OptionGroup', 'size'); //build the group for the options |
|
| 219 | 219 | $optionGroup->write(); |
| 220 | - $option = $this->objFromFixture('OptionItem', 'small');//build first option |
|
| 220 | + $option = $this->objFromFixture('OptionItem', 'small'); //build first option |
|
| 221 | 221 | $option->write(); |
| 222 | - $option2 = $this->objFromFixture('OptionItem', 'large');//build second option |
|
| 222 | + $option2 = $this->objFromFixture('OptionItem', 'large'); //build second option |
|
| 223 | 223 | $option2->write(); |
| 224 | 224 | |
| 225 | - $this->assertTrue($product->isPublished());//check that product is published |
|
| 225 | + $this->assertTrue($product->isPublished()); //check that product is published |
|
| 226 | 226 | |
| 227 | - $product->deleteFromStage('Stage');//remove product from draft site |
|
| 227 | + $product->deleteFromStage('Stage'); //remove product from draft site |
|
| 228 | 228 | |
| 229 | - $this->assertTrue($product->isPublished());//check product is still published |
|
| 229 | + $this->assertTrue($product->isPublished()); //check product is still published |
|
| 230 | 230 | |
| 231 | 231 | $testOption = $this->objFromFixture('OptionItem', 'large'); |
| 232 | 232 | |
| 233 | - $this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0)));//make sure the first option still exists |
|
| 233 | + $this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0))); //make sure the first option still exists |
|
| 234 | 234 | |
| 235 | - $product->doRestoreToStage();//restore page to draft site |
|
| 236 | - $product->doUnpublish();//unpublish page |
|
| 237 | - $product->deleteFromStage('Stage');//remove product from draft site |
|
| 235 | + $product->doRestoreToStage(); //restore page to draft site |
|
| 236 | + $product->doUnpublish(); //unpublish page |
|
| 237 | + $product->deleteFromStage('Stage'); //remove product from draft site |
|
| 238 | 238 | |
| 239 | - $checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first();//query same option as above |
|
| 239 | + $checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first(); //query same option as above |
|
| 240 | 240 | |
| 241 | - $this->assertEquals($checkDeleted->ID, 0);//check that the ID is 0 (empty object/non-existent) |
|
| 241 | + $this->assertEquals($checkDeleted->ID, 0); //check that the ID is 0 (empty object/non-existent) |
|
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | \ No newline at end of file |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | * Products function. |
| 124 | 124 | * |
| 125 | 125 | * @access public |
| 126 | - * @return array |
|
| 126 | + * @return PaginatedList |
|
| 127 | 127 | */ |
| 128 | 128 | public function ProductList($limit = 10) |
| 129 | 129 | { |
@@ -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 | |
@@ -23,11 +23,11 @@ |
||
| 23 | 23 | { |
| 24 | 24 | $object = $this->objFromFixture('OptionGroup', 'size'); |
| 25 | 25 | $orig = $object->Title; |
| 26 | - $object->Title = '2' . $orig; |
|
| 26 | + $object->Title = '2'.$orig; |
|
| 27 | 27 | $this->setExpectedException('ValidationException'); |
| 28 | 28 | $object->write(); |
| 29 | 29 | |
| 30 | - $object->Title = $orig . '&'; |
|
| 30 | + $object->Title = $orig.'&'; |
|
| 31 | 31 | $this->setExpectedException('ValidationException'); |
| 32 | 32 | $object->write(); |
| 33 | 33 | } |
@@ -285,7 +285,7 @@ |
||
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
| 288 | - * @return mixed|string |
|
| 288 | + * @return string |
|
| 289 | 289 | */ |
| 290 | 290 | public function getGeneratedTitle() |
| 291 | 291 | { |
@@ -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 | |
@@ -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 | /** |