From ef8049b841cd99a4c212a4429024fbb1e540caf2 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 20 Sep 2015 22:35:15 +0300 Subject: [PATCH 01/30] MAGETWO-42501: PCF: removing grouped price --- .../Model/Export/AdvancedPricing.php | 19 - .../Model/Import/AdvancedPricing.php | 39 +- .../AdvancedPricing/Validator/GroupPrice.php | 160 --------- .../Validator/GroupPriceTest.php | 334 ------------------ .../Validator/TierPriceTest.php | 4 +- .../AdvancedPricing/Validator/WebsiteTest.php | 13 - .../Unit/Model/Import/AdvancedPricingTest.php | 54 +-- .../AdvancedPricingImportExport/etc/di.xml | 1 - .../Catalog/Product/Edit/Tab/Attributes.php | 13 - .../Magento/Bundle/Model/Product/Price.php | 72 ---- .../Bundle/Model/Resource/Indexer/Price.php | 112 +----- .../Bundle/Pricing/Price/GroupPrice.php | 73 ---- .../Test/Unit/Model/Product/PriceTest.php | 8 - .../Unit/Pricing/Price/GroupPriceTest.php | 221 ------------ app/code/Magento/Bundle/etc/di.xml | 1 - .../Api/Data/ProductGroupPriceInterface.php | 62 ---- .../Catalog/Api/Data/ProductInterface.php | 15 - .../ProductGroupPriceManagementInterface.php | 46 --- .../Adminhtml/Product/Edit/Tab/Attributes.php | 7 - .../Product/Edit/Tab/Price/Group.php | 73 ---- .../Indexer/Product/Price/AbstractAction.php | 50 --- .../Indexer/Product/Price/Action/Full.php | 1 - app/code/Magento/Catalog/Model/Product.php | 32 -- .../Product/Attribute/Backend/GroupPrice.php | 83 ----- .../Catalog/Model/Product/GroupPrice.php | 86 ----- .../Model/Product/GroupPriceManagement.php | 159 --------- .../Catalog/Model/Product/PriceModifier.php | 39 -- .../Catalog/Model/Product/Type/Price.php | 123 ------- .../Catalog/Model/ProductRepository.php | 4 - .../Product/Attribute/Backend/GroupPrice.php | 26 -- .../Product/Indexer/Price/DefaultPrice.php | 32 -- .../Catalog/Pricing/Price/GroupPrice.php | 111 ------ .../Backend/GroupPrice/AbstractTest.php | 1 - .../Attribute/Backend/GroupPriceTest.php | 31 -- .../Product/GroupPriceManagementTest.php | 318 ----------------- .../Unit/Model/Product/PriceModifierTest.php | 45 --- .../Unit/Model/Product/Type/PriceTest.php | 93 ----- .../Catalog/Test/Unit/Model/ProductTest.php | 50 --- .../Test/Unit/Pricing/Price/BasePriceTest.php | 10 - .../Unit/Pricing/Price/GroupPriceTest.php | 250 ------------- app/code/Magento/Catalog/etc/di.xml | 3 - app/code/Magento/Catalog/etc/webapi.xml | 20 -- .../catalog/product/edit/price/group.phtml | 163 --------- .../Model/Import/Product.php | 54 --- .../Import/Product/RowValidatorInterface.php | 6 - .../Import/Product/Validator/GroupPrice.php | 89 ----- .../Magento/CatalogImportExport/etc/di.xml | 1 - .../Model/Indexer/IndexBuilder.php | 11 - .../Unit/Model/Indexer/IndexBuilderTest.php | 52 --- .../Product/Indexer/Price/Configurable.php | 3 +- .../Pricing/Price/BasePrice.php | 1 - .../Model/Resource/Indexer/Price.php | 2 - .../Api/ProductGroupPriceManagementTest.php | 118 ------- .../Api/ProductRepositoryInterfaceTest.php | 73 ---- .../AssertBundleItemsOnProductPage.php | 5 - .../AssertGroupedPriceOnBundleProductPage.php | 41 --- .../Bundle/Test/Fixture/BundleProduct.xml | 1 - ...AssertProductGroupedPriceOnProductPage.php | 107 ------ .../Test/Constraint/AssertProductInCart.php | 5 - .../Test/Constraint/AssertProductView.php | 5 - .../Test/Fixture/CatalogProductSimple.xml | 1 - .../Test/Fixture/CatalogProductVirtual.xml | 1 - .../Repository/Product/GroupPriceOptions.xml | 34 -- .../Test/Fixture/ConfigurableProduct.xml | 1 - .../Test/Fixture/DownloadableProduct.xml | 1 - .../Adminhtml/Product/NewActionTest.php | 38 -- .../Catalog/_files/product_group_prices.php | 14 - .../_files/product_export_data.php | 2 - .../Test/Unit/Price/CollectionTest.php | 1 - .../Pricing/Test/Unit/Price/PoolTest.php | 4 - 70 files changed, 16 insertions(+), 3712 deletions(-) delete mode 100644 app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/GroupPrice.php delete mode 100644 app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/GroupPriceTest.php delete mode 100644 app/code/Magento/Bundle/Pricing/Price/GroupPrice.php delete mode 100644 app/code/Magento/Bundle/Test/Unit/Pricing/Price/GroupPriceTest.php delete mode 100644 app/code/Magento/Catalog/Api/Data/ProductGroupPriceInterface.php delete mode 100644 app/code/Magento/Catalog/Api/ProductGroupPriceManagementInterface.php delete mode 100644 app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php delete mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice.php delete mode 100644 app/code/Magento/Catalog/Model/Product/GroupPrice.php delete mode 100644 app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php delete mode 100644 app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/GroupPrice.php delete mode 100644 app/code/Magento/Catalog/Pricing/Price/GroupPrice.php delete mode 100644 app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPriceTest.php delete mode 100644 app/code/Magento/Catalog/Test/Unit/Model/Product/GroupPriceManagementTest.php delete mode 100644 app/code/Magento/Catalog/Test/Unit/Pricing/Price/GroupPriceTest.php delete mode 100644 app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml delete mode 100644 app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/GroupPrice.php delete mode 100644 dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductGroupPriceManagementTest.php delete mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertGroupedPriceOnBundleProductPage.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductGroupedPriceOnProductPage.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/GroupPriceOptions.xml delete mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/NewActionTest.php diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php index 3a2950d1de063..3fd289a3e0c6b 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php @@ -47,11 +47,6 @@ class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product */ protected $_passTierPrice = 0; - /** - * @var int - */ - protected $_passGroupPrice = 0; - /** * List of items websites * @@ -246,14 +241,6 @@ public function filterAttributeCollection(\Magento\Eav\Model\Resource\Entity\Att ) { $this->_passTierPrice = 1; } - if ($attribute->getAttributeCode() == ImportAdvancedPricing::COL_GROUP_PRICE - && in_array( - $attribute->getId(), - $this->_parameters[\Magento\ImportExport\Model\Export::FILTER_ELEMENT_SKIP] - ) - ) { - $this->_passGroupPrice = 1; - } } $collection->removeItemByKey($attribute->getId()); } @@ -277,12 +264,6 @@ protected function getExportData() $rawData = $this->collectRawData(); $productIds = array_keys($rawData); if (isset($productIds)) { - if (!$this->_passGroupPrice) { - $exportData = array_merge( - $exportData, - $this->getTierAndGroupPrices($productIds, ImportAdvancedPricing::TABLE_GROUPED_PRICE) - ); - } if (!$this->_passTierPrice) { $exportData = array_merge( $exportData, diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php index 6a2f7632c11f3..f32fc8751d4ed 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php @@ -179,7 +179,6 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract * @param ImportProduct $importProduct * @param AdvancedPricing\Validator $validator * @param AdvancedPricing\Validator\Website $websiteValidator - * @param AdvancedPricing\Validator\GroupPrice $groupPriceValidator * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( @@ -198,8 +197,7 @@ public function __construct( \Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver, ImportProduct $importProduct, AdvancedPricing\Validator $validator, - AdvancedPricing\Validator\Website $websiteValidator, - AdvancedPricing\Validator\GroupPrice $groupPriceValidator + AdvancedPricing\Validator\Website $websiteValidator ) { $this->_localeDate = $localeDate; $this->jsonHelper = $jsonHelper; @@ -215,7 +213,6 @@ public function __construct( $this->_validators[self::VALIDATOR_MAIN] = $validator->init($this); $this->_oldSkus = $this->retrieveOldSkus(); $this->_validators[self::VALIDATOR_WEBSITE] = $websiteValidator; - $this->_validators[self::VALIDATOR_GROUP_PRICE] = $groupPriceValidator; $this->errorAggregator = $errorAggregator; $this->_catalogProductEntity = $this->_resourceFactory->create()->getTable('catalog_product_entity'); @@ -228,7 +225,7 @@ public function __construct( * Validator object getter. * * @param string $type - * @return AdvancedPricing\Validator|AdvancedPricing\Validator\Website|AdvancedPricing\Validator\GroupPrice + * @return AdvancedPricing\Validator|AdvancedPricing\Validator\Website */ protected function _getValidator($type) { @@ -333,7 +330,6 @@ public function deleteAdvancedPricing() } } if ($listSku) { - $this->deleteProductTierAndGroupPrices(array_unique($listSku), self::TABLE_GROUPED_PRICE); $this->deleteProductTierAndGroupPrices(array_unique($listSku), self::TABLE_TIER_PRICE); $this->setUpdatedAt($listSku); } @@ -367,7 +363,6 @@ protected function saveAndReplaceAdvancedPrices() $listSku = []; while ($bunch = $this->_dataSourceModel->getNextBunch()) { $tierPrices = []; - $groupPrices = []; foreach ($bunch as $rowNum => $rowData) { if (!$this->validateRow($rowData, $rowNum)) { $this->addRowError(ValidatorInterface::ERROR_SKU_IS_EMPTY, $rowNum); @@ -391,33 +386,19 @@ protected function saveAndReplaceAdvancedPrices() 'website_id' => $this->getWebsiteId($rowData[self::COL_TIER_PRICE_WEBSITE]) ]; } - if (!empty($rowData[self::COL_GROUP_PRICE_WEBSITE])) { - $groupPrices[$rowSku][] = [ - 'all_groups' => self::DEFAULT_ALL_GROUPS_GROUPED_PRICE_VALUE, - 'customer_group_id' => $this->getCustomerGroupId( - $rowData[self::COL_GROUP_PRICE_CUSTOMER_GROUP] - ), - 'value' => $rowData[self::COL_GROUP_PRICE], - 'website_id' => $this->getWebSiteId($rowData[self::COL_GROUP_PRICE_WEBSITE]) - ]; - } } if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) { if ($listSku) { - $this->processCountNewPrices($tierPrices, $groupPrices); - if ($this->deleteProductTierAndGroupPrices(array_unique($listSku), self::TABLE_GROUPED_PRICE) - && $this->deleteProductTierAndGroupPrices(array_unique($listSku), self::TABLE_TIER_PRICE)) { - $this->saveProductPrices($tierPrices, self::TABLE_TIER_PRICE) - ->saveProductPrices($groupPrices, self::TABLE_GROUPED_PRICE); + $this->processCountNewPrices($tierPrices); + if ($this->deleteProductTierAndGroupPrices(array_unique($listSku), self::TABLE_TIER_PRICE)) { + $this->saveProductPrices($tierPrices, self::TABLE_TIER_PRICE); $this->setUpdatedAt($listSku); } } } elseif (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $behavior) { $this->processCountExistingPrices($tierPrices, self::TABLE_TIER_PRICE) - ->processCountExistingPrices($groupPrices, self::TABLE_GROUPED_PRICE) - ->processCountNewPrices($tierPrices, $groupPrices); - $this->saveProductPrices($tierPrices, self::TABLE_TIER_PRICE) - ->saveProductPrices($groupPrices, self::TABLE_GROUPED_PRICE); + ->processCountNewPrices($tierPrices); + $this->saveProductPrices($tierPrices, self::TABLE_TIER_PRICE); if ($listSku) { $this->setUpdatedAt($listSku); } @@ -598,17 +579,13 @@ protected function incrementCounterUpdated($prices, $existingPrice) * Count new prices * * @param array $tierPrices - * @param array $groupPrices * @return $this */ - protected function processCountNewPrices(array $tierPrices, array $groupPrices) + protected function processCountNewPrices(array $tierPrices) { foreach ($tierPrices as $productPrices) { $this->countItemsCreated += count($productPrices); } - foreach ($groupPrices as $productPrices) { - $this->countItemsCreated += count($productPrices); - } $this->countItemsCreated -= $this->countItemsUpdated; return $this; diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/GroupPrice.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/GroupPrice.php deleted file mode 100644 index d3a59957e9e5e..0000000000000 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/GroupPrice.php +++ /dev/null @@ -1,160 +0,0 @@ -storeResolver = $storeResolver; - parent::__construct($groupRepository, $searchCriteriaBuilder); - } - - /** - * {@inheritdoc} - */ - public function init($context) - { - foreach ($this->groupRepository->getList($this->searchCriteriaBuilder->create())->getItems() as $group) { - $this->customerGroups[$group->getCode()] = $group->getId(); - } - $this->context = $context; - } - - /** - * @param string $attribute - * @return void - */ - protected function addDecimalError($attribute) - { - $this->_addMessages( - [ - sprintf( - $this->context->retrieveMessageTemplate( - RowValidatorInterface::ERROR_INVALID_ATTRIBUTE_DECIMAL - ), - $attribute - ) - ] - ); - } - - /** - * @return void - */ - protected function initCustomerGroups() - { - if (!$this->customerGroups) { - $this->init($this->context); - } - } - - /** - * Validate value - * - * @param array $value - * @return bool - */ - public function isValid($value) - { - $this->_clearMessages(); - $this->initCustomerGroups(); - if (!$this->isValidValueAndLength($value)) { - return true; - } - if (!isset($value[AdvancedPricing::COL_GROUP_PRICE_WEBSITE]) - || !isset($value[AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP]) - || $this->hasEmptyColumns($value)) { - $this->_addMessages([self::ERROR_GROUP_PRICE_DATA_INCOMPLETE]); - return false; - } elseif ( - $value[AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP] == AdvancedPricing::VALUE_ALL_GROUPS - || !isset($this->customerGroups[$value[AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP]]) - ) { - $this->_addMessages([self::ERROR_INVALID_GROUP_PRICE_GROUP]); - return false; - } - if (!is_numeric($value[AdvancedPricing::COL_GROUP_PRICE]) - || $value[AdvancedPricing::COL_GROUP_PRICE] < 0 - ) { - $this->addDecimalError(AdvancedPricing::COL_GROUP_PRICE); - return false; - } - return true; - } - - /** - * Get existing customers groups - * - * @return array - */ - public function getCustomerGroups() - { - if (!$this->customerGroups) { - $this->init($this->context); - } - return $this->customerGroups; - } - - /** - * Check if at list one value and length are valid - * - * @param array $value - * @return bool - */ - protected function isValidValueAndLength(array $value) - { - $isValid = false; - foreach ($this->_groupPriceColumns as $column) { - if (isset($value[$column]) && strlen($value[$column])) { - $isValid = true; - } - } - return $isValid; - } - - /** - * Check if value has empty columns - * - * @param array $value - * @return bool - */ - protected function hasEmptyColumns(array $value) - { - $hasEmptyValues = false; - foreach ($this->_groupPriceColumns as $column) { - if (!strlen($value[$column])) { - $hasEmptyValues = true; - } - } - return $hasEmptyValues; - } -} diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/GroupPriceTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/GroupPriceTest.php deleted file mode 100644 index c5acdc18a935d..0000000000000 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/GroupPriceTest.php +++ /dev/null @@ -1,334 +0,0 @@ -groupRepository = $this->getMockBuilder('\Magento\Customer\Api\GroupRepositoryInterface') - ->disableOriginalConstructor() - ->setMethods(['getList']) - ->getMockForAbstractClass(); - $this->searchCriteriaBuilder = $this->getMock( - '\Magento\Framework\Api\SearchCriteriaBuilder', - [], - [], - '', - false - ); - $this->storeResolver = $this->getMock( - '\Magento\CatalogImportExport\Model\Import\Product\StoreResolver', - [], - [], - '', - false - ); - - $this->groupPrice = $this->getMock( - 'Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\GroupPrice', - ['isValidValueAndLength', 'hasEmptyColumns', '_addMessages'], - [ - $this->groupRepository, - $this->searchCriteriaBuilder, - $this->storeResolver, - ], - '' - ); - } - - public function testInitInternalCalls() - { - $searchCriteria = $this->getMock('Magento\Framework\Api\SearchCriteria', [], [], '', false); - $this->searchCriteriaBuilder->expects($this->any())->method('create')->willReturn($searchCriteria); - $groupSearchResult = $this->getMockForAbstractClass( - '\Magento\Customer\Api\Data\GroupSearchResultsInterface', - [], - '', - false - ); - $this->groupRepository - ->expects($this->any()) - ->method('getList') - ->with($searchCriteria) - ->willReturn($groupSearchResult); - - $groupTest = $this->getMockBuilder('\Magento\Customer\Api\Data\GroupInterface') - ->disableOriginalConstructor() - ->setMethods(['getCode', 'getId']) - ->getMockForAbstractClass(); - $groupTest->expects($this->once())->method('getCode'); - $groupTest->expects($this->any())->method('getId'); - $groups = [$groupTest]; - $groupSearchResult->expects($this->any())->method('getItems')->willReturn($groups); - - $this->groupPrice->init(null); - } - - public function testInitAddToCustomerGroups() - { - $searchCriteria = $this->getMock('Magento\Framework\Api\SearchCriteria', [], [], '', false); - $this->searchCriteriaBuilder->expects($this->any())->method('create')->willReturn($searchCriteria); - $groupSearchResult = $this->getMockForAbstractClass( - '\Magento\Customer\Api\Data\GroupSearchResultsInterface', - [], - '', - false - ); - $this->groupRepository - ->expects($this->any()) - ->method('getList') - ->with($searchCriteria) - ->willReturn($groupSearchResult); - - $groupTest = $this->getMockBuilder('\Magento\Customer\Api\Data\GroupInterface') - ->disableOriginalConstructor() - ->setMethods(['getCode', 'getId']) - ->getMockForAbstractClass(); - - $expectedCode = 'code'; - $expectedId = 'id'; - $expectedCustomerGroups = [ - $expectedCode => $expectedId, - ]; - $groupTest->expects($this->once())->method('getCode')->willReturn($expectedCode); - $groupTest->expects($this->any())->method('getId')->willReturn($expectedId); - $groups = [$groupTest]; - $groupSearchResult->expects($this->any())->method('getItems')->willReturn($groups); - $this->groupPrice->init(null); - $this->assertEquals($expectedCustomerGroups, $this->getPropertyValue($this->groupPrice, 'customerGroups')); - } - - public function testIsValidInitCall() - { - $groupPrice = $this->groupPrice = $this->getMock( - 'Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\GroupPrice', - ['init', '_clearMessages'], - [ - $this->groupRepository, - $this->searchCriteriaBuilder, - $this->storeResolver, - ], - '' - ); - $groupPrice->expects($this->once())->method('_clearMessages'); - $this->setPropertyValue($groupPrice, 'customerGroups', false); - $groupPrice->expects($this->once())->method('init'); - - $groupPrice->isValid([]); - } - - /** - * @dataProvider isValidResultFalseDataProvider - * - * @param array $value - * @param array $hasEmptyColumns - * @param array $customerGroups - */ - public function testIsValidResultFalse($value, $hasEmptyColumns, $customerGroups) - { - $this->groupPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(true); - $this->groupPrice->expects($this->any())->method('hasEmptyColumns')->willReturn($hasEmptyColumns); - $this->setPropertyValue($this->groupPrice, 'customerGroups', $customerGroups); - - $result = $this->groupPrice->isValid($value); - $this->assertFalse($result); - } - - public function testIsValidResultTrue() - { - $this->groupPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(false); - $this->setPropertyValue($this->groupPrice, 'customerGroups', true); - - $result = $this->groupPrice->isValid([]); - $this->assertTrue($result); - } - - /** - * @dataProvider isValidAddMessagesCallDataProvider - * - * @param array $value - * @param bool $hasEmptyColumns - * @param array $customerGroups - * @param array $expectedMessages - */ - public function testIsValidAddMessagesCall($value, $hasEmptyColumns, $customerGroups, $expectedMessages) - { - $this->groupPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(true); - $this->groupPrice->expects($this->any())->method('hasEmptyColumns')->willReturn($hasEmptyColumns); - $this->setPropertyValue($this->groupPrice, 'customerGroups', $customerGroups); - - $this->groupPrice->expects($this->once())->method('_addMessages')->with($expectedMessages); - $this->groupPrice->isValid($value); - } - - public function testGetCustomerGroupsInitCall() - { - $groupPrice = $this->groupPrice = $this->getMock( - 'Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\GroupPrice', - ['init'], - [ - $this->groupRepository, - $this->searchCriteriaBuilder, - $this->storeResolver, - ], - '' - ); - $this->setPropertyValue($groupPrice, 'customerGroups', false); - $groupPrice->expects($this->once())->method('init'); - - $groupPrice->getCustomerGroups(); - } - - public function isValidResultFalseDataProvider() - { - return [ - // First if condition cases. - [ - '$value' => [ - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => null, - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => 'value', - ], - '$hasEmptyColumns' => null, - '$customerGroups' => [ - 'value' => 'value' - ], - ], - [ - '$value' => [ - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'value', - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => null, - ], - '$hasEmptyColumns' => null, - '$customerGroups' => [ - 'value' - ], - ], - [ - '$value' => [ - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'value', - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => 'value', - ], - '$hasEmptyColumns' => true, - '$customerGroups' => [ - 'value' => 'value' - ], - ], - // Second if condition cases. - [ - '$value' => [ - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'value', - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => AdvancedPricing::VALUE_ALL_GROUPS, - ], - '$hasEmptyColumns' => false, - '$customerGroups' => [ - 'group price customer value' => 'value' - ], - ], - [ - '$value' => [ - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'value', - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => 'group price customer value', - ], - '$hasEmptyColumns' => false, - '$customerGroups' => [ - 'group price customer value' => null - ], - ], - ]; - } - - public function isValidAddMessagesCallDataProvider() - { - return [ - // First if condition cases. - [ - '$value' => [ - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => null, - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => 'value', - AdvancedPricing::VALUE_ALL_GROUPS => 'value', - ], - '$hasEmptyColumns' => null, - '$customerGroups' => [ - 'value' => 'value' - ], - '$expectedMessages' => [AdvancedPricing\Validator::ERROR_GROUP_PRICE_DATA_INCOMPLETE], - ], - // Second if condition cases. - [ - '$value' => [ - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'value', - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => 'value', - AdvancedPricing::VALUE_ALL_GROUPS => 'not ALL GROUPS', - ], - '$hasEmptyColumns' => false, - '$customerGroups' => [ - 'value' => null - ], - '$expectedMessages' => [AdvancedPricing\Validator::ERROR_INVALID_GROUP_PRICE_GROUP], - ], - ]; - } - - /** - * Get any object property value. - * - * @param $object - * @param $property - */ - protected function getPropertyValue($object, $property) - { - $reflection = new \ReflectionClass(get_class($object)); - $reflectionProperty = $reflection->getProperty($property); - $reflectionProperty->setAccessible(true); - - return $reflectionProperty->getValue($object); - } - - /** - * Set object property value. - * - * @param $object - * @param $property - * @param $value - */ - protected function setPropertyValue(&$object, $property, $value) - { - $reflection = new \ReflectionClass(get_class($object)); - $reflectionProperty = $reflection->getProperty($property); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($object, $value); - - return $object; - } -} diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php index a2d5480898e5d..e377b07424693 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php @@ -135,7 +135,7 @@ public function testInitAddToCustomerGroups() public function testIsValidInitCall() { $tierPrice = $this->tierPrice = $this->getMock( - 'Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\GroupPrice', + 'Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TearPrice', ['init', '_clearMessages'], [ $this->groupRepository, @@ -161,7 +161,7 @@ public function testIsValidInitCall() public function testIsValidResultFalse($value, $hasEmptyColumns, $customerGroups) { $tierPrice = $this->getMock( - 'Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\GroupPrice', + 'Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TearPrice', ['init', '_clearMessages', 'isValidValueAndLength', 'hasEmptyColumns'], [ $this->groupRepository, diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php index 2d2c33661e257..c0dc253b1bd65 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php @@ -66,21 +66,18 @@ public function testInit() * @param array $value * @param string $allWebsites * @param string $colTierPriceWebsite - * @param string $colGroupPriceWebsite * @param bool $expectedResult */ public function testIsValidReturn( $value, $allWebsites, $colTierPriceWebsite, - $colGroupPriceWebsite, $expectedResult ) { $this->website->expects($this->once())->method('_clearMessages'); $this->website->expects($this->any())->method('getAllWebsitesValue')->willReturn($allWebsites); $this->storeResolver->method('getWebsiteCodeToId')->willReturnMap([ [$value[AdvancedPricing::COL_TIER_PRICE_WEBSITE], $colTierPriceWebsite], - [$value[AdvancedPricing::COL_GROUP_PRICE_WEBSITE], $colGroupPriceWebsite], ]); $result = $this->website->isValid($value); @@ -95,14 +92,12 @@ public function testIsValidReturnAddMessagesCall() ]; $allWebsitesValue = 'not tier|group price website value'; $colTierPriceWebsite = false; - $colGroupPriceWebsite = 'value'; $expectedMessages = [AdvancedPricing\Validator\Website::ERROR_INVALID_WEBSITE]; $this->website->expects($this->once())->method('_clearMessages'); $this->website->expects($this->any())->method('getAllWebsitesValue')->willReturn($allWebsitesValue); $this->storeResolver->method('getWebsiteCodeToId')->willReturnMap([ [$value[AdvancedPricing::COL_TIER_PRICE_WEBSITE], $colTierPriceWebsite], - [$value[AdvancedPricing::COL_GROUP_PRICE_WEBSITE], $colGroupPriceWebsite], ]); $this->website->expects($this->any())->method('_addMessages')->with($expectedMessages); @@ -146,7 +141,6 @@ public function isValidReturnDataProvider() ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => false, - '$colGroupPriceWebsite' => 'value', '$expectedResult' => false, ], [ @@ -158,7 +152,6 @@ public function isValidReturnDataProvider() ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => false, - '$colGroupPriceWebsite' => 'value', '$expectedResult' => false, ], [ @@ -170,7 +163,6 @@ public function isValidReturnDataProvider() ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => 'value', - '$colGroupPriceWebsite' => false, '$expectedResult' => false, ], [ @@ -182,7 +174,6 @@ public function isValidReturnDataProvider() ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => 'value', - '$colGroupPriceWebsite' => false, '$expectedResult' => false, ], // True cases. @@ -193,7 +184,6 @@ public function isValidReturnDataProvider() ], '$allWebsites' => 'tier value', '$colTierPriceWebsite' => 'value', - '$colGroupPriceWebsite' => 'value', '$expectedResult' => true, ], [ @@ -203,7 +193,6 @@ public function isValidReturnDataProvider() ], '$allWebsites' => 'group value', '$colTierPriceWebsite' => 'value', - '$colGroupPriceWebsite' => 'value', '$expectedResult' => true, ], [ @@ -213,7 +202,6 @@ public function isValidReturnDataProvider() ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => 'value', - '$colGroupPriceWebsite' => 'value', '$expectedResult' => true, ], [ @@ -223,7 +211,6 @@ public function isValidReturnDataProvider() ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => 'value', - '$colGroupPriceWebsite' => 'value', '$expectedResult' => true, ], ]; diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php index 4b000863e3738..3957e1727e6d4 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php @@ -51,11 +51,6 @@ class AdvancedPricingTest extends \Magento\ImportExport\Test\Unit\Model\Import\A */ protected $websiteValidator; - /** - * @var AdvancedPricing\Validator\GroupPrice |\PHPUnit_Framework_MockObject_MockObject - */ - protected $groupPriceValidator; - /** * @var \Magento\ImportExport\Model\Resource\Helper |\PHPUnit_Framework_MockObject_MockObject */ @@ -234,13 +229,6 @@ public function setUp() '', false ); - $this->groupPriceValidator = $this->getMock( - '\Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\GroupPrice', - [], - [], - '', - false - ); $this->stringObject = $this->getMock( '\Magento\Framework\Stdlib\StringUtils', [], @@ -406,8 +394,7 @@ public function testSaveAndReplaceAdvancedPricesAppendBehaviourDataAndCalls( $groupCustomerGroupId, $tierWebsiteId, $groupWebsiteId, - $expectedTierPrices, - $expectedGroupPrices + $expectedTierPrices ) { $this->advancedPricing ->expects($this->any()) @@ -448,7 +435,6 @@ public function testSaveAndReplaceAdvancedPricesReplaceBehaviourInternalCalls() ], ]; $expectedTierPrices = []; - $expectedGroupPrices = []; $listSku = [ $skuVal ]; @@ -487,10 +473,6 @@ public function testSaveAndReplaceAdvancedPricesReplaceBehaviourInternalCalls() [ $expectedTierPrices, AdvancedPricing::TABLE_TIER_PRICE - ], - [ - $expectedGroupPrices, - AdvancedPricing::TABLE_GROUPED_PRICE, ] ) ->will($this->returnSelf()); @@ -595,16 +577,6 @@ public function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider() ], ], ], - '$expectedGroupPrices' => [ - 'sku value' => [ - [ - 'all_groups' => AdvancedPricing::DEFAULT_ALL_GROUPS_GROUPED_PRICE_VALUE, - 'customer_group_id' => 'group customer group id value',//$groupCustomerGroupId - 'value' => 'group price value', - 'website_id' => 'group website id value', - ], - ], - ], ], [// tier customer group is equal to all group '$data' => [ @@ -636,16 +608,6 @@ public function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider() ], ], ], - '$expectedGroupPrices' => [ - 'sku value' => [ - [ - 'all_groups' => AdvancedPricing::DEFAULT_ALL_GROUPS_GROUPED_PRICE_VALUE, - 'customer_group_id' => 'group customer group id value',//$groupCustomerGroupId - 'value' => 'group price value', - 'website_id' => 'group website id value', - ], - ], - ], ], [ '$data' => [ @@ -667,16 +629,6 @@ public function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider() '$tierWebsiteId' => 'tier website id value', '$groupWebsiteId' => 'group website id value', '$expectedTierPrices' => [], - '$expectedGroupPrices' => [ - 'sku value' => [ - [ - 'all_groups' => AdvancedPricing::DEFAULT_ALL_GROUPS_GROUPED_PRICE_VALUE, - 'customer_group_id' => 'group customer group id value',//$groupCustomerGroupId - 'value' => 'group price value', - 'website_id' => 'group website id value', - ], - ], - ], ], [ '$data' => [ @@ -708,7 +660,6 @@ public function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider() ], ] ], - '$expectedGroupPrices' => [], ], ]; // @codingStandardsIgnoreEnd @@ -850,8 +801,7 @@ private function getAdvancedPricingMock($methods = []) $this->storeResolver, $this->importProduct, $this->validator, - $this->websiteValidator, - $this->groupPriceValidator + $this->websiteValidator ], '' ); diff --git a/app/code/Magento/AdvancedPricingImportExport/etc/di.xml b/app/code/Magento/AdvancedPricingImportExport/etc/di.xml index cf59e93023c01..9871308ef1a35 100644 --- a/app/code/Magento/AdvancedPricingImportExport/etc/di.xml +++ b/app/code/Magento/AdvancedPricingImportExport/etc/di.xml @@ -12,7 +12,6 @@ - Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\GroupPrice Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TierPrice Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\Website diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php index 06367ff6da556..3786a2605e588 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php @@ -126,19 +126,6 @@ function changeTaxClassId() { ) ); } - - $groupPrice = $this->getForm()->getElement('group_price'); - if ($groupPrice) { - $groupPrice->setRenderer( - $this->getLayout()->createBlock( - 'Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group' - )->setPriceColumnHeader( - __('Percent Discount') - )->setPriceValidation( - 'validate-greater-than-zero validate-number-range number-range-0.00-100.00' - ) - ); - } } /** diff --git a/app/code/Magento/Bundle/Model/Product/Price.php b/app/code/Magento/Bundle/Model/Product/Price.php index 9c0163fcc4cb9..cb8129123140e 100644 --- a/app/code/Magento/Bundle/Model/Product/Price.php +++ b/app/code/Magento/Bundle/Model/Product/Price.php @@ -47,8 +47,6 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param PriceCurrencyInterface $priceCurrency * @param GroupManagementInterface $groupManagement - * @param \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory - * @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Helper\Data $catalogData * @@ -62,7 +60,6 @@ public function __construct( \Magento\Framework\Event\ManagerInterface $eventManager, PriceCurrencyInterface $priceCurrency, GroupManagementInterface $groupManagement, - \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory, \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Helper\Data $catalogData @@ -76,7 +73,6 @@ public function __construct( $eventManager, $priceCurrency, $groupManagement, - $groupPriceFactory, $tierPriceFactory, $config ); @@ -447,68 +443,11 @@ public function getSelectionFinalTotalPrice( return min( $price, - $this->_applyGroupPrice($bundleProduct, $price), $this->_applyTierPrice($bundleProduct, $bundleQty, $price), $this->_applySpecialPrice($bundleProduct, $price) ); } - /** - * Apply group price for bundle product - * - * @param \Magento\Catalog\Model\Product $product - * @param float $finalPrice - * @return float - */ - protected function _applyGroupPrice($product, $finalPrice) - { - $result = $finalPrice; - $groupPrice = $product->getGroupPrice(); - - if (is_numeric($groupPrice)) { - $groupPrice = $finalPrice - $finalPrice * ($groupPrice / 100); - $result = min($finalPrice, $groupPrice); - } - - return $result; - } - - /** - * Get product group price - * - * @param \Magento\Catalog\Model\Product $product - * @return float|null - */ - public function getGroupPrice($product) - { - $groupPrices = $product->getData('group_price'); - - if ($groupPrices === null) { - $attribute = $product->getResource()->getAttribute('group_price'); - if ($attribute) { - $attribute->getBackend()->afterLoad($product); - $groupPrices = $product->getData('group_price'); - } - } - - if ($groupPrices === null || !is_array($groupPrices)) { - return null; - } - - $customerGroup = $this->_getCustomerGroupId($product); - - $matchedPrice = 0; - - foreach ($groupPrices as $groupPrice) { - if ($groupPrice['cust_group'] == $customerGroup && $groupPrice['website_price'] > $matchedPrice) { - $matchedPrice = $groupPrice['website_price']; - break; - } - } - - return $matchedPrice; - } - /** * Apply tier price for bundle * @@ -625,16 +564,6 @@ public function getTierPrice($qty, $product) return $prices ? $prices : []; } - /** - * Check is group price value fixed or percent of original price - * - * @return bool - */ - public function isGroupPriceFixed() - { - return false; - } - /** * Calculate and apply special price * @@ -675,7 +604,6 @@ public function getLowestPrice($bundleProduct, $price, $bundleQty = 1) $price = (float)$price; return min( $price, - $this->_applyGroupPrice($bundleProduct, $price), $this->_applyTierPrice($bundleProduct, $bundleQty, $price), $this->_applySpecialPrice($bundleProduct, $price) ); diff --git a/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php b/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php index 651fd339fcc27..6471dd8fcc8c5 100644 --- a/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php +++ b/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php @@ -145,11 +145,6 @@ protected function _prepareBundlePriceByType($priceType, $entityIds = null) 'tp.entity_id = e.entity_id AND tp.website_id = cw.website_id' . ' AND tp.customer_group_id = cg.customer_group_id', [] - )->joinLeft( - ['gp' => $this->_getGroupPriceIndexTable()], - 'gp.entity_id = e.entity_id AND gp.website_id = cw.website_id' . - ' AND gp.customer_group_id = cg.customer_group_id', - [] )->where( 'e.type_id=?', $this->getTypeId() @@ -198,12 +193,6 @@ protected function _prepareBundlePriceByType($priceType, $entityIds = null) '0' ); - $groupPriceExpr = $connection->getCheckSql( - 'gp.price IS NOT NULL AND gp.price > 0 AND gp.price < 100', - 'gp.price', - '0' - ); - $tierExpr = new \Zend_Db_Expr("tp.min_price"); if ($priceType == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED) { @@ -217,20 +206,15 @@ protected function _prepareBundlePriceByType($priceType, $entityIds = null) 'ROUND(' . $price . ' - ' . '(' . $price . ' * (' . $tierExpr . ' / 100)), 4)', 'NULL' ); - $groupPrice = $connection->getCheckSql( - $groupPriceExpr . ' > 0', - 'ROUND(' . $price . ' - ' . '(' . $price . ' * (' . $groupPriceExpr . ' / 100)), 4)', - 'NULL' - ); + $finalPrice = $connection->getCheckSql( - "{$groupPrice} IS NOT NULL AND {$groupPrice} < {$finalPrice}", - $groupPrice, + "{$tierPrice} < {$finalPrice}", + $tierPrice, $finalPrice ); } else { $finalPrice = new \Zend_Db_Expr("0"); $tierPrice = $connection->getCheckSql($tierExpr . ' IS NOT NULL', '0', 'NULL'); - $groupPrice = $connection->getCheckSql($groupPriceExpr . ' > 0', $groupPriceExpr, 'NULL'); } $select->columns( @@ -244,9 +228,6 @@ protected function _prepareBundlePriceByType($priceType, $entityIds = null) 'max_price' => $finalPrice, 'tier_price' => $tierPrice, 'base_tier' => $tierPrice, - 'group_price' => $groupPrice, - 'base_group_price' => $groupPrice, - 'group_price_percent' => new \Zend_Db_Expr('gp.price'), ] ); @@ -323,15 +304,6 @@ protected function _calculateBundleOptionPrice() ) . ' + MIN(i.tier_price)', 'NULL' ); - $groupPrice = $connection->getCheckSql( - 'MIN(i.group_price_percent) IS NOT NULL', - $connection->getCheckSql( - 'SUM(io.group_price) = 0', - 'SUM(io.alt_group_price)', - 'SUM(io.group_price)' - ) . ' + MIN(i.group_price)', - 'NULL' - ); $select = $connection->select()->from( ['io' => $this->_getBundleOptionTable()], @@ -352,7 +324,6 @@ protected function _calculateBundleOptionPrice() 'max_price' => $maxPrice, 'tier_price' => $tierPrice, 'base_tier' => 'MIN(i.base_tier)', - 'group_price' => $groupPrice, 'base_group_price' => 'MIN(i.base_group_price)', ] ); @@ -448,21 +419,6 @@ protected function _calculateBundleSelectionPrice($priceType) 'ROUND(idx.min_price * (i.base_tier / 100), 4)* bs.selection_qty', 'NULL' ); - $groupExpr = $connection->getCheckSql( - 'i.base_group_price IS NOT NULL', - 'ROUND(idx.min_price * (i.base_group_price / 100), 4)* bs.selection_qty', - 'NULL' - ); - $groupPriceExpr = new \Zend_Db_Expr( - $connection->getCheckSql( - 'i.base_group_price IS NOT NULL AND i.base_group_price > 0 AND i.base_group_price < 100', - 'ROUND(idx.min_price - idx.min_price * (i.base_group_price / 100), 4)', - 'idx.min_price' - ) . ' * bs.selection_qty' - ); - $priceExpr = new \Zend_Db_Expr( - $connection->getCheckSql("{$groupPriceExpr} < {$priceExpr}", $groupPriceExpr, $priceExpr) - ); } $select = $connection->select()->from( @@ -520,7 +476,6 @@ protected function _prepareBundlePrice($entityIds = null) return $this; } $this->_prepareTierPriceIndex($entityIds); - $this->_prepareGroupPriceIndex($entityIds); $this->_prepareBundlePriceTable(); $this->_prepareBundlePriceByType(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED, $entityIds); $this->_prepareBundlePriceByType(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC, $entityIds); @@ -593,65 +548,4 @@ protected function _prepareTierPriceIndex($entityIds = null) return $this; } - - /** - * Prepare percentage group price for bundle products - * - * @param int|array $entityIds - * @return $this - */ - protected function _prepareGroupPriceIndex($entityIds = null) - { - $connection = $this->getConnection(); - - // remove index by bundle products - $select = $connection->select()->from( - ['i' => $this->_getGroupPriceIndexTable()], - null - )->join( - ['e' => $this->getTable('catalog_product_entity')], - 'i.entity_id=e.entity_id', - [] - )->where( - 'e.type_id=?', - $this->getTypeId() - ); - $query = $select->deleteFromSelect('i'); - $connection->query($query); - - $select = $connection->select()->from( - ['gp' => $this->getTable('catalog_product_entity_group_price')], - ['entity_id'] - )->join( - ['e' => $this->getTable('catalog_product_entity')], - 'gp.entity_id=e.entity_id', - [] - )->join( - ['cg' => $this->getTable('customer_group')], - 'gp.all_groups = 1 OR (gp.all_groups = 0 AND gp.customer_group_id = cg.customer_group_id)', - ['customer_group_id'] - )->join( - ['cw' => $this->getTable('store_website')], - 'gp.website_id = 0 OR gp.website_id = cw.website_id', - ['website_id'] - )->where( - 'cw.website_id != 0' - )->where( - 'e.type_id=?', - $this->getTypeId() - )->columns( - new \Zend_Db_Expr('MIN(gp.value)') - )->group( - ['gp.entity_id', 'cg.customer_group_id', 'cw.website_id'] - ); - - if (!empty($entityIds)) { - $select->where('gp.entity_id IN(?)', $entityIds); - } - - $query = $select->insertFromSelect($this->_getGroupPriceIndexTable()); - $connection->query($query); - - return $this; - } } diff --git a/app/code/Magento/Bundle/Pricing/Price/GroupPrice.php b/app/code/Magento/Bundle/Pricing/Price/GroupPrice.php deleted file mode 100644 index 3989c5c179138..0000000000000 --- a/app/code/Magento/Bundle/Pricing/Price/GroupPrice.php +++ /dev/null @@ -1,73 +0,0 @@ -percent === null) { - $percent = parent::getValue(); - $this->percent = ($percent) ? max(0, min(100, 100 - $percent)) : null; - } - return $this->percent; - } - - /** - * Returns pice value - * - * @return float|bool - */ - public function getValue() - { - if ($this->value !== null) { - return $this->value; - } - - $groupPrice = $this->getDiscountPercent(); - if ($groupPrice) { - $regularPrice = $this->getRegularPrice(); - $this->value = $regularPrice * ($groupPrice / 100); - } else { - $this->value = false; - } - return $this->value; - } - - /** - * Returns regular price - * - * @return bool|float - */ - protected function getRegularPrice() - { - return $this->priceInfo->getPrice(RegularPrice::PRICE_CODE)->getValue(); - } - - /** - * @return bool - */ - public function isPercentageDiscount() - { - return true; - } -} diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php index d2ad3414e6759..6807d089307a8 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php @@ -77,13 +77,6 @@ protected function setUp() $this->priceCurrency = $this->getMockBuilder('Magento\Framework\Pricing\PriceCurrencyInterface')->getMock(); $this->groupManagement = $this->getMockBuilder('Magento\Customer\Api\GroupManagementInterface') ->getMockForAbstractClass(); - $gpFactory = $this->getMock( - 'Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory', - ['create'], - [], - '', - false - ); $tpFactory = $this->getMock( 'Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory', ['create'], @@ -104,7 +97,6 @@ protected function setUp() 'eventManager' => $this->eventManagerMock, 'priceCurrency' => $this->priceCurrency, 'groupManagement' => $this->groupManagement, - 'groupPriceFactory' => $gpFactory, 'tierPriceFactory' => $tpFactory, 'config' => $scopeConfig, 'catalogData' => $this->catalogHelperMock diff --git a/app/code/Magento/Bundle/Test/Unit/Pricing/Price/GroupPriceTest.php b/app/code/Magento/Bundle/Test/Unit/Pricing/Price/GroupPriceTest.php deleted file mode 100644 index cca5cb8a6efb1..0000000000000 --- a/app/code/Magento/Bundle/Test/Unit/Pricing/Price/GroupPriceTest.php +++ /dev/null @@ -1,221 +0,0 @@ -productMock = $this->getMock( - 'Magento\Catalog\Model\Product', - ['__wakeup', 'getCustomerGroupId', 'getPriceInfo', 'getResource', 'getData'], - [], - '', - false - ); - $this->productResourceMock = $this->getMock( - 'Magento\Catalog\Model\Resource\Product', - [], - [], - '', - false - ); - $this->calculatorMock = $this->getMock( - 'Magento\Framework\Pricing\Adjustment\Calculator', - [], - [], - '', - false - ); - $this->customerSessionMock = $this->getMock( - 'Magento\Customer\Model\Session', - [], - [], - '', - false - ); - $this->customerMock = $this->getMock( - 'Magento\Customer\Model\Customer', - [], - [], - '', - false - ); - $this->attributeMock = $this->getMock( - 'Magento\Catalog\Model\Entity\Attribute', - [], - [], - '', - false - ); - $this->backendMock = $this->getMock( - 'Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice', - [], - [], - '', - false - ); - $this->priceInfoMock = $this->getMock( - 'Magento\Framework\Pricing\PriceInfo\Base', - ['getPrice'], - [], - '', - false - ); - $this->regularPrice = $this->getMock( - 'Magento\Catalog\Pricing\Price\RegularPrice', - [], - [], - '', - false - ); - $this->productMock->expects($this->once()) - ->method('getPriceInfo') - ->will($this->returnValue($this->priceInfoMock)); - - $this->priceCurrencyMock = $this->getMock('\Magento\Framework\Pricing\PriceCurrencyInterface'); - - $this->groupPrice = new \Magento\Bundle\Pricing\Price\GroupPrice( - $this->productMock, - 1, - $this->calculatorMock, - $this->priceCurrencyMock, - $this->customerSessionMock - ); - } - - public function testGetValue() - { - $this->priceInfoMock->expects($this->once()) - ->method('getPrice') - ->with($this->equalTo('regular_price')) - ->will($this->returnValue($this->regularPrice)); - $this->regularPrice->expects($this->once()) - ->method('getValue') - ->will($this->returnValue(100)); - $this->productMock->expects($this->once()) - ->method('getCustomerGroupId') - ->will($this->returnValue(null)); - $this->customerSessionMock->expects($this->once()) - ->method('getCustomerGroupId') - ->will($this->returnValue(3)); - $this->productMock->expects($this->once()) - ->method('getResource') - ->will($this->returnValue($this->productResourceMock)); - $this->productResourceMock->expects($this->once()) - ->method('getAttribute') - ->with($this->equalTo('group_price')) - ->will($this->returnValue($this->attributeMock)); - $this->attributeMock->expects($this->once()) - ->method('getBackend') - ->will($this->returnValue($this->backendMock)); - $this->backendMock->expects($this->once()) - ->method('afterLoad') - ->with($this->equalTo($this->productMock)) - ->will($this->returnValue($this->backendMock)); - $this->priceCurrencyMock->expects($this->never()) - ->method('convertAndRound'); - $this->productMock->expects($this->once()) - ->method('getData') - ->with( - $this->equalTo('group_price'), - $this->equalTo(null) - ) - ->will( - $this->returnValue( - [ - [ - 'cust_group' => 3, - 'website_price' => 80, - ], - ] - - ) - ); - $this->assertEquals(20, $this->groupPrice->getValue()); - $this->assertEquals(20, $this->groupPrice->getValue()); - } - - public function testGetValueNotGroupPrice() - { - $this->productMock->expects($this->once()) - ->method('getCustomerGroupId') - ->will($this->returnValue(null)); - $this->customerSessionMock->expects($this->once()) - ->method('getCustomerGroupId') - ->will($this->returnValue(3)); - $this->productMock->expects($this->once()) - ->method('getResource') - ->will($this->returnValue($this->productResourceMock)); - $this->productResourceMock->expects($this->once()) - ->method('getAttribute') - ->with($this->equalTo('group_price')) - ->will($this->returnValue(null)); - - $this->assertFalse($this->groupPrice->getValue()); - } -} diff --git a/app/code/Magento/Bundle/etc/di.xml b/app/code/Magento/Bundle/etc/di.xml index 858d153d85dd8..734e754aa246f 100644 --- a/app/code/Magento/Bundle/etc/di.xml +++ b/app/code/Magento/Bundle/etc/di.xml @@ -44,7 +44,6 @@ Magento\Bundle\Pricing\Price\BundleRegularPrice Magento\Bundle\Pricing\Price\FinalPrice Magento\Bundle\Pricing\Price\TierPrice - Magento\Bundle\Pricing\Price\GroupPrice Magento\Bundle\Pricing\Price\SpecialPrice Magento\Catalog\Pricing\Price\CustomOptionPrice Magento\Catalog\Pricing\Price\BasePrice diff --git a/app/code/Magento/Catalog/Api/Data/ProductGroupPriceInterface.php b/app/code/Magento/Catalog/Api/Data/ProductGroupPriceInterface.php deleted file mode 100644 index d52f42e4f147a..0000000000000 --- a/app/code/Magento/Catalog/Api/Data/ProductGroupPriceInterface.php +++ /dev/null @@ -1,62 +0,0 @@ -getElement('group_price'); - if ($groupPrice) { - $groupPrice->setRenderer( - $this->getLayout()->createBlock('Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group') - ); - } - // Add new attribute controls if it is not an image tab if (!$form->getElement( 'media_gallery' diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php deleted file mode 100644 index 28f5959e9f870..0000000000000 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php +++ /dev/null @@ -1,73 +0,0 @@ -getCustomerGroups($a['cust_group']) < $this->getCustomerGroups($b['cust_group']) ? -1 : 1; - } - return 0; - } - - /** - * Prepare global layout - * - * Add "Add Group Price" button to layout - * - * @return $this - */ - protected function _prepareLayout() - { - $button = $this->getLayout()->createBlock( - 'Magento\Backend\Block\Widget\Button' - )->setData( - [ - 'label' => __('Add Group Price'), - 'onclick' => 'return groupPriceControl.addItem()', - 'class' => 'add', - ] - ); - $button->setName('add_group_price_item_button'); - - $this->setChild('add_button', $button); - return parent::_prepareLayout(); - } -} diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php index 84a1c9dfc8b28..947ce75e627a9 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php @@ -251,55 +251,6 @@ protected function _prepareTierPriceIndex($entityIds = null) return $this; } - /** - * Prepare group price index table - * - * @param int|array $entityIds the entity ids limitation - * @return \Magento\Catalog\Model\Indexer\Product\Price\AbstractAction - */ - protected function _prepareGroupPriceIndex($entityIds = null) - { - $table = $this->_defaultIndexerResource->getTable('catalog_product_index_group_price'); - $this->_emptyTable($table); - - $websiteExpression = $this->_connection->getCheckSql( - 'gp.website_id = 0', - 'ROUND(gp.value * cwd.rate, 4)', - 'gp.value' - ); - $select = $this->_connection->select()->from( - ['gp' => $this->_defaultIndexerResource->getTable(['catalog_product_entity', 'group_price'])], - ['entity_id'] - )->join( - ['cg' => $this->_defaultIndexerResource->getTable('customer_group')], - 'gp.all_groups = 1 OR (gp.all_groups = 0 AND gp.customer_group_id = cg.customer_group_id)', - ['customer_group_id'] - )->join( - ['cw' => $this->_defaultIndexerResource->getTable('store_website')], - 'gp.website_id = 0 OR gp.website_id = cw.website_id', - ['website_id'] - )->join( - ['cwd' => $this->_defaultIndexerResource->getTable('catalog_product_index_website')], - 'cw.website_id = cwd.website_id', - [] - )->where( - 'cw.website_id != 0' - )->columns( - new \Zend_Db_Expr("MIN({$websiteExpression})") - )->group( - ['gp.entity_id', 'cg.customer_group_id', 'cw.website_id'] - ); - - if (!empty($entityIds)) { - $select->where('gp.entity_id IN(?)', $entityIds); - } - - $query = $select->insertFromSelect($table); - $this->_connection->query($query); - - return $this; - } - /** * Retrieve price indexers per product type * @@ -445,7 +396,6 @@ protected function _reindexRows($changedIds = []) $this->_copyRelationIndexData($compositeIds, $notCompositeIds); } $this->_prepareTierPriceIndex($compositeIds + $notCompositeIds); - $this->_prepareGroupPriceIndex($compositeIds + $notCompositeIds); $indexers = $this->getTypeIndexers(); foreach ($indexers as $indexer) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Action/Full.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Action/Full.php index ac9c4391efaa1..bb79da054188c 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Action/Full.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Action/Full.php @@ -25,7 +25,6 @@ public function execute($ids = null) $this->_emptyTable($this->_defaultIndexerResource->getIdxTable()); $this->_prepareWebsiteDateTable(); $this->_prepareTierPriceIndex(); - $this->_prepareGroupPriceIndex(); foreach ($this->getTypeIndexers() as $indexer) { $indexer->reindexAll(); diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index dd0f5ec4ead4f..eaec9d9f2455a 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -1059,38 +1059,6 @@ public function getPriceInfo() return $this->_priceInfo; } - /** - * Get product group price for the customer - * - * @return float - */ - public function getGroupPrice() - { - return $this->getPriceModel()->getGroupPrice($this); - } - - /** - * Gets list of product group prices - * - * @return \Magento\Catalog\Api\Data\ProductGroupPriceInterface[]|null - */ - public function getGroupPrices() - { - return $this->getPriceModel()->getGroupPrices($this); - } - - /** - * Sets list of product group prices - * - * @param \Magento\Catalog\Api\Data\ProductGroupPriceInterface[] $groupPrices - * @return $this - */ - public function setGroupPrices(array $groupPrices = null) - { - $this->getPriceModel()->setGroupPrices($this, $groupPrices); - return $this; - } - /** * Gets list of product tier prices * diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice.php deleted file mode 100644 index 4631e7f7ac30c..0000000000000 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice.php +++ /dev/null @@ -1,83 +0,0 @@ -_productAttributeBackendGroupPrice = $productAttributeBackendGroupPrice; - parent::__construct( - $currencyFactory, - $storeManager, - $catalogData, - $config, - $localeFormat, - $catalogProductType, - $groupManagement - ); - } - - /** - * Retrieve resource instance - * - * @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice - */ - protected function _getResource() - { - return $this->_productAttributeBackendGroupPrice; - } - - /** - * Error message when duplicates - * - * @return \Magento\Framework\Phrase - */ - protected function _getDuplicateErrorMessage() - { - return __('We found a duplicate website group price customer group.'); - } - - /** - * By default attribute value is considered non-scalar that can be stored in a generic way - * - * @return bool - */ - public function isScalar() - { - return false; - } -} diff --git a/app/code/Magento/Catalog/Model/Product/GroupPrice.php b/app/code/Magento/Catalog/Model/Product/GroupPrice.php deleted file mode 100644 index 740a2b1b976b4..0000000000000 --- a/app/code/Magento/Catalog/Model/Product/GroupPrice.php +++ /dev/null @@ -1,86 +0,0 @@ -getData(self::KEY_CUSTOMER_GROUP_ID); - } - - /** - * Retrieve price value - * - * @return float - */ - public function getValue() - { - return $this->getData(self::KEY_VALUE); - } - - /** - * Set customer group id - * - * @param int $customerGroupId - * @return $this - */ - public function setCustomerGroupId($customerGroupId) - { - return $this->setData(self::KEY_CUSTOMER_GROUP_ID, $customerGroupId); - } - - /** - * Set price value - * - * @param float $value - * @return $this - */ - public function setValue($value) - { - return $this->setData(self::KEY_VALUE, $value); - } - - /** - * {@inheritdoc} - * - * @return \Magento\Catalog\Api\Data\ProductGroupPriceExtensionInterface|null - */ - public function getExtensionAttributes() - { - return $this->_getExtensionAttributes(); - } - - /** - * {@inheritdoc} - * - * @param \Magento\Catalog\Api\Data\ProductGroupPriceExtensionInterface $extensionAttributes - * @return $this - */ - public function setExtensionAttributes( - \Magento\Catalog\Api\Data\ProductGroupPriceExtensionInterface $extensionAttributes - ) { - return $this->_setExtensionAttributes($extensionAttributes); - } -} diff --git a/app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php b/app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php deleted file mode 100644 index 9dca54ee7ebd5..0000000000000 --- a/app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php +++ /dev/null @@ -1,159 +0,0 @@ -productRepository = $productRepository; - $this->groupPriceFactory = $groupPriceFactory; - $this->groupRepository = $groupRepository; - $this->priceModifier = $priceModifier; - $this->config = $config; - $this->storeManager = $storeManager; - } - - /** - * {@inheritdoc} - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function add($sku, $customerGroupId, $price) - { - if (!\Zend_Validate::is($price, 'Float') || $price <= 0 || !\Zend_Validate::is($price, 'Float')) { - throw new InputException(__('Please provide valid data')); - } - $customerGroup = $this->groupRepository->getById($customerGroupId); - $product = $this->productRepository->get($sku, true); - $groupPrices = $product->getData('group_price'); - $websiteIdentifier = 0; - $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); - if ($value != 0) { - $websiteIdentifier = $this->storeManager->getWebsite()->getId(); - } - $found = false; - foreach ($groupPrices as &$currentPrice) { - if (intval($currentPrice['cust_group']) === $customerGroupId - && intval($currentPrice['website_id']) === intval($websiteIdentifier) - ) { - $currentPrice['price'] = $price; - $found = true; - break; - } - } - if (!$found) { - $groupPrices[] = [ - 'cust_group' => $customerGroup->getId(), - 'website_id' => $websiteIdentifier, - 'price' => $price, - ]; - } - - $product->setData('group_price', $groupPrices); - $errors = $product->validate(); - if (is_array($errors) && count($errors)) { - $errorAttributeCodes = implode(', ', array_keys($errors)); - throw new InputException( - __('Values of following attributes are invalid: %1', $errorAttributeCodes) - ); - } - try { - $this->productRepository->save($product); - } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not save group price')); - } - return true; - } - - /** - * {@inheritdoc} - */ - public function remove($sku, $customerGroupId) - { - $product = $this->productRepository->get($sku, true); - $websiteIdentifier = 0; - $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); - if ($value != 0) { - $websiteIdentifier = $this->storeManager->getWebsite()->getId(); - } - $this->priceModifier->removeGroupPrice($product, $customerGroupId, $websiteIdentifier); - return true; - } - - /** - * {@inheritdoc} - */ - public function getList($sku, $websiteId = null) - { - $product = $this->productRepository->get($sku, true); - $priceKey = 'website_price'; - $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); - if ($value == 0) { - $priceKey = 'price'; - } - - $prices = []; - foreach ($product->getData('group_price') as $price) { - /** @var \Magento\Catalog\Api\Data\ProductGroupPriceInterface $groupPrice */ - $groupPrice = $this->groupPriceFactory->create(); - $groupPrice->setCustomerGroupId($price['all_groups'] ? 'all' : $price['cust_group']) - ->setValue($price[$priceKey]); - $prices[] = $groupPrice; - } - return $prices; - } -} diff --git a/app/code/Magento/Catalog/Model/Product/PriceModifier.php b/app/code/Magento/Catalog/Model/Product/PriceModifier.php index 4197e2c6f5a86..83ec7a6c95a8f 100644 --- a/app/code/Magento/Catalog/Model/Product/PriceModifier.php +++ b/app/code/Magento/Catalog/Model/Product/PriceModifier.php @@ -25,45 +25,6 @@ public function __construct( $this->productRepository = $productRepository; } - /** - * @param \Magento\Catalog\Model\Product $product - * @param int $customerGroupId - * @param int $websiteId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @throws \Magento\Framework\Exception\CouldNotSaveException - * @return void - */ - public function removeGroupPrice(\Magento\Catalog\Model\Product $product, $customerGroupId, $websiteId) - { - $prices = $product->getData('group_price'); - if ($prices === null) { - throw new NoSuchEntityException(__('This product doesn\'t have group price')); - } - $groupPriceQty = count($prices); - - foreach ($prices as $key => $groupPrice) { - if ($groupPrice['cust_group'] == $customerGroupId - && intval($groupPrice['website_id']) === intval($websiteId) - ) { - unset($prices[$key]); - } - } - if ($groupPriceQty == count($prices)) { - throw new NoSuchEntityException( - __( - 'Product hasn\'t group price with such data: customerGroupId = \'%1\', website = %2.', - [$customerGroupId, $websiteId] - ) - ); - } - $product->setData('group_price', $prices); - try { - $this->productRepository->save($product); - } catch (\Exception $exception) { - throw new CouldNotSaveException(__('Invalid data provided for group price')); - } - } - /** * @param \Magento\Catalog\Model\Product $product * @param int|string $customerGroupId diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php index 10414b85e006a..9f80e550c5579 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -70,11 +70,6 @@ class Price */ protected $_groupManagement; - /** - * @var \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory - */ - protected $groupPriceFactory; - /** * @var \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory */ @@ -93,8 +88,6 @@ class Price * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param PriceCurrencyInterface $priceCurrency * @param GroupManagementInterface $groupManagement - * @param \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory - * @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $config * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -107,7 +100,6 @@ public function __construct( \Magento\Framework\Event\ManagerInterface $eventManager, PriceCurrencyInterface $priceCurrency, GroupManagementInterface $groupManagement, - \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory, \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory, \Magento\Framework\App\Config\ScopeConfigInterface $config ) { @@ -118,7 +110,6 @@ public function __construct( $this->_eventManager = $eventManager; $this->priceCurrency = $priceCurrency; $this->_groupManagement = $groupManagement; - $this->groupPriceFactory = $groupPriceFactory; $this->tierPriceFactory = $tierPriceFactory; $this->config = $config; } @@ -146,7 +137,6 @@ public function getBasePrice($product, $qty = null) { $price = (float) $product->getPrice(); return min( - $this->_applyGroupPrice($product, $price), $this->_applyTierPrice($product, $qty, $price), $this->_applySpecialPrice($product, $price) ); @@ -191,47 +181,6 @@ public function getChildFinalPrice($product, $productQty, $childProduct, $childP return $this->getFinalPrice($childProductQty, $childProduct); } - /** - * Apply group price for product - * - * @param Product $product - * @param float $finalPrice - * @return float - */ - protected function _applyGroupPrice($product, $finalPrice) - { - $groupPrice = $product->getGroupPrice(); - if (is_numeric($groupPrice)) { - $finalPrice = min($finalPrice, $groupPrice); - } - return $finalPrice; - } - - /** - * Gets list of product group prices - * - * @param Product $product - * @return \Magento\Catalog\Api\Data\ProductGroupPriceInterface[] - */ - public function getGroupPrices($product) - { - $prices = []; - $groupPrices = $this->getExistingPrices($product, 'group_price'); - foreach ($groupPrices as $price) { - /** @var \Magento\Catalog\Api\Data\ProductGroupPriceInterface $groupPrice */ - $groupPrice = $this->groupPriceFactory->create(); - $groupPrice->setCustomerGroupId($price['cust_group']); - if (array_key_exists('website_price', $price)) { - $value = $price['website_price']; - } else { - $value = $price['price']; - } - $groupPrice->setValue($value); - $prices[] = $groupPrice; - } - return $prices; - } - /** * Gets the 'group_price' array from the product * @@ -259,39 +208,6 @@ protected function getExistingPrices($product, $key, $returnRawData = false) return $prices; } - /** - * Sets list of product group prices - * - * @param Product $product - * @param \Magento\Catalog\Api\Data\ProductGroupPriceInterface[] $groupPrices - * @return $this - */ - public function setGroupPrices($product, array $groupPrices = null) - { - // null array means leave everything as is - if ($groupPrices === null) { - return $this; - } - - $websiteId = $this->getWebsiteForPriceScope(); - $allGroupsId = $this->getAllCustomerGroupsId(); - - // build the new array of group prices - $prices = []; - foreach ($groupPrices as $price) { - $prices[] = [ - 'website_id' => $websiteId, - 'cust_group' => $price->getCustomerGroupId(), - 'website_price' => $price->getValue(), - 'price' => $price->getValue(), - 'all_groups' => ($price->getCustomerGroupId() == $allGroupsId) - ]; - } - $product->setData('group_price', $prices); - - return $this; - } - /** * Returns the website to use for group or tier prices, based on the price scope setting * @@ -308,35 +224,6 @@ protected function getWebsiteForPriceScope() return $websiteId; } - /** - * Get product group price for the customer - * - * @param Product $product - * @return float - * @deprecated see \Magento\Catalog\Pricing\Price\GroupPrice (MAGETWO-31468) - */ - public function getGroupPrice($product) - { - $groupPrices = $this->getGroupPrices($product); - - if (empty($groupPrices)) { - return $product->getPrice(); - } - - $customerGroup = $this->_getCustomerGroupId($product); - - $matchedPrice = $product->getPrice(); - foreach ($groupPrices as $groupPrice) { - /** @var \Magento\Catalog\Api\Data\ProductGroupPriceInterface $groupPrice */ - if ($groupPrice->getCustomerGroupId() == $customerGroup && $groupPrice->getValue() < $matchedPrice) { - $matchedPrice = $groupPrice->getValue(); - break; - } - } - - return $matchedPrice; - } - /** * Apply tier price for product if not return price that was before * @@ -707,16 +594,6 @@ public function calculateSpecialPrice( * @return bool */ public function isTierPriceFixed() - { - return $this->isGroupPriceFixed(); - } - - /** - * Check is group price value fixed or percent of original price - * - * @return bool - */ - public function isGroupPriceFixed() { return true; } diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index aa8a3027a9d37..360a491ca8a20 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -546,7 +546,6 @@ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveO $productOptions = $product->getProductOptions(); } $isDeleteOptions = $product->getIsDeleteOptions(); - $groupPrices = $product->getData('group_price'); $tierPrices = $product->getData('tier_price'); $productId = $this->resourceModel->getIdBySku($product->getSku()); @@ -584,9 +583,6 @@ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveO $product->setProductOptions($productOptions); $product->setCanSaveCustomOptions(true); } - if ($groupPrices !== null) { - $product->setData('group_price', $groupPrices); - } if ($tierPrices !== null) { $product->setData('tier_price', $tierPrices); } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/GroupPrice.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/GroupPrice.php deleted file mode 100644 index a7dc53782db16..0000000000000 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/GroupPrice.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ -class GroupPrice extends AbstractGroupPrice -{ - /** - * Initialize connection and define main table - * - * @return void - */ - protected function _construct() - { - $this->_init('catalog_product_entity_group_price', 'value_id'); - } -} diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php index e1ff4568ae04f..ae3530da85bd4 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php @@ -258,11 +258,6 @@ protected function _prepareFinalPriceData($entityIds = null) 'tp.entity_id = e.entity_id AND tp.website_id = cw.website_id' . ' AND tp.customer_group_id = cg.customer_group_id', [] - )->joinLeft( - ['gp' => $this->_getGroupPriceIndexTable()], - 'gp.entity_id = e.entity_id AND gp.website_id = cw.website_id' . - ' AND gp.customer_group_id = cg.customer_group_id', - [] )->where( 'e.type_id = ?', $this->getTypeId() @@ -286,7 +281,6 @@ protected function _prepareFinalPriceData($entityIds = null) $specialFrom = $this->_addAttributeToSelect($select, 'special_from_date', 'e.entity_id', 'cs.store_id'); $specialTo = $this->_addAttributeToSelect($select, 'special_to_date', 'e.entity_id', 'cs.store_id'); $currentDate = $connection->getDatePartSql('cwd.website_date'); - $groupPrice = $connection->getCheckSql('gp.price IS NULL', "{$price}", 'gp.price'); $specialFromDate = $connection->getDatePartSql($specialFrom); $specialToDate = $connection->getDatePartSql($specialTo); @@ -300,7 +294,6 @@ protected function _prepareFinalPriceData($entityIds = null) $specialPrice, $price ); - $finalPrice = $connection->getCheckSql("{$groupPrice} < {$finalPrice}", $groupPrice, $finalPrice); $select->columns( [ @@ -310,8 +303,6 @@ protected function _prepareFinalPriceData($entityIds = null) 'max_price' => $finalPrice, 'tier_price' => new \Zend_Db_Expr('tp.min_price'), 'base_tier' => new \Zend_Db_Expr('tp.min_price'), - 'group_price' => new \Zend_Db_Expr('gp.price'), - 'base_group_price' => new \Zend_Db_Expr('gp.price'), ] ); @@ -442,12 +433,6 @@ protected function _applyCustomOption() $tierPriceValue = $connection->getCheckSql("MIN(o.is_require) > 0", $tierPriceMin, 0); $tierPrice = $connection->getCheckSql("MIN(i.base_tier) IS NOT NULL", $tierPriceValue, "NULL"); - $groupPriceRound = new \Zend_Db_Expr("ROUND(i.base_group_price * ({$optPriceValue} / 100), 4)"); - $groupPriceExpr = $connection->getCheckSql("{$optPriceType} = 'fixed'", $optPriceValue, $groupPriceRound); - $groupPriceMin = new \Zend_Db_Expr("MIN({$groupPriceExpr})"); - $groupPriceValue = $connection->getCheckSql("MIN(o.is_require) > 0", $groupPriceMin, 0); - $groupPrice = $connection->getCheckSql("MIN(i.base_group_price) IS NOT NULL", $groupPriceValue, "NULL"); - $maxPriceRound = new \Zend_Db_Expr("ROUND(i.price * ({$optPriceValue} / 100), 4)"); $maxPriceExpr = $connection->getCheckSql("{$optPriceType} = 'fixed'", $optPriceValue, $maxPriceRound); $maxPrice = $connection->getCheckSql( @@ -461,7 +446,6 @@ protected function _applyCustomOption() 'min_price' => $minPrice, 'max_price' => $maxPrice, 'tier_price' => $tierPrice, - 'group_price' => $groupPrice, ] ); @@ -511,17 +495,11 @@ protected function _applyCustomOption() $tierPriceValue = $connection->getCheckSql("{$tierPriceExpr} > 0 AND o.is_require > 0", $tierPriceExpr, 0); $tierPrice = $connection->getCheckSql("i.base_tier IS NOT NULL", $tierPriceValue, "NULL"); - $groupPriceRound = new \Zend_Db_Expr("ROUND(i.base_group_price * ({$optPriceValue} / 100), 4)"); - $groupPriceExpr = $connection->getCheckSql("{$optPriceType} = 'fixed'", $optPriceValue, $groupPriceRound); - $groupPriceValue = $connection->getCheckSql("{$groupPriceExpr} > 0 AND o.is_require > 0", $groupPriceExpr, 0); - $groupPrice = $connection->getCheckSql("i.base_group_price IS NOT NULL", $groupPriceValue, "NULL"); - $select->columns( [ 'min_price' => $minPrice, 'max_price' => $maxPrice, 'tier_price' => $tierPrice, - 'group_price' => $groupPrice, ] ); @@ -619,16 +597,6 @@ protected function _getTierPriceIndexTable() return $this->getTable('catalog_product_index_tier_price'); } - /** - * Retrieve table name for product group price index - * - * @return string - */ - protected function _getGroupPriceIndexTable() - { - return $this->getTable('catalog_product_index_group_price'); - } - /** * Retrieve temporary index table name * diff --git a/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php b/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php deleted file mode 100644 index aafc7fd055a9d..0000000000000 --- a/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php +++ /dev/null @@ -1,111 +0,0 @@ -customerSession = $customerSession; - } - - /** - * @return float|bool - */ - public function getValue() - { - if ($this->value === null) { - $this->value = false; - $customerGroup = $this->getCustomerGroupId(); - foreach ($this->getStoredGroupPrice() as $groupPrice) { - if ($groupPrice['cust_group'] == $customerGroup) { - $this->value = (float) $groupPrice['website_price']; - if (!$this->isPercentageDiscount()) { - $this->value = $this->priceCurrency->convertAndRound($this->value); - } - break; - } - } - } - return $this->value; - } - - /** - * @return int - */ - protected function getCustomerGroupId() - { - if ($this->product->getCustomerGroupId() !== null) { - return (int) $this->product->getCustomerGroupId(); - } - return (int) $this->customerSession->getCustomerGroupId(); - } - - /** - * @return array - */ - protected function getStoredGroupPrice() - { - if (null === $this->storedGroupPrice) { - $resource = $this->product->getResource(); - $attribute = $resource->getAttribute('group_price'); - if ($attribute) { - $attribute->getBackend()->afterLoad($this->product); - $this->storedGroupPrice = $this->product->getData('group_price'); - } - if (null === $this->storedGroupPrice || !is_array($this->storedGroupPrice)) { - $this->storedGroupPrice = []; - } - } - return $this->storedGroupPrice; - } - - /** - * @return bool - */ - public function isPercentageDiscount() - { - return false; - } -} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php index 01eb34bdefbbd..67d6f0f9e3e0f 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php @@ -72,7 +72,6 @@ public function testGetAffectedFields() $this->_model->setAttribute($attribute); $object = new \Magento\Framework\DataObject(); - $object->setGroupPrice([['price_id' => 10]]); $object->setId(555); $this->assertEquals( diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPriceTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPriceTest.php deleted file mode 100644 index 3b12c10fbfb11..0000000000000 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPriceTest.php +++ /dev/null @@ -1,31 +0,0 @@ -objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - - $this->model = $this->objectHelper->getObject('Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice'); - } - - public function testIsScaler() - { - $this->assertFalse($this->model->isScalar(), 'Attribute GroupPrice should not be scaler'); - } -} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/GroupPriceManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/GroupPriceManagementTest.php deleted file mode 100644 index bb32c95449715..0000000000000 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/GroupPriceManagementTest.php +++ /dev/null @@ -1,318 +0,0 @@ -productRepositoryMock = $this->getMock( - '\Magento\Catalog\Model\ProductRepository', - [], - [], - '', - false - ); - $this->priceFactoryMock = $this->getMock( - 'Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory', - ['create'], - [], - '', - false - ); - $this->storeManagerMock = $this->getMockBuilder('\Magento\Store\Model\StoreManagerInterface') - ->setMethods(['getWebsite']) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $this->groupServiceMock = $this->getMock('\Magento\Customer\Api\GroupRepositoryInterface'); - - $this->priceModifierMock = - $this->getMock('Magento\Catalog\Model\Product\PriceModifier', [], [], '', false); - $this->websiteMock = - $this->getMock('Magento\Store\Model\Website', ['getId', '__wakeup'], [], '', false); - $this->productMock = $this->getMock( - 'Magento\Catalog\Model\Product', - ['getData', 'setData', 'validate', 'save', 'getIdBySku', 'load', '__wakeup'], - [], - '', - false - ); - $this->websiteMock = - $this->getMock('Magento\Store\Model\Website', ['getId', '__wakeup'], [], '', false); - $this->productRepositoryMock->expects($this->any())->method('get')->with('product_sku') - ->will($this->returnValue($this->productMock)); - $this->configMock = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'); - $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); - $this->groupPriceManagement = new GroupPriceManagement( - $this->productRepositoryMock, - $this->priceFactoryMock, - $this->groupServiceMock, - $this->priceModifierMock, - $this->configMock, - $this->storeManagerMock - ); - } - - /** - * @param string $configValue - * @param array $groupData - * @param array $expected - * @dataProvider getListDataProvider - */ - public function testGetList($configValue, $groupData, $expected) - { - $this->productRepositoryMock->expects($this->once())->method('get')->with('product_sku', true) - ->will($this->returnValue($this->productMock)); - $this->productMock - ->expects($this->once()) - ->method('getData') - ->with('group_price') - ->will($this->returnValue([$groupData])); - $this->configMock - ->expects($this->once()) - ->method('getValue') - ->with('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) - ->will($this->returnValue($configValue)); - $priceMock = $this->getMock('\Magento\Catalog\Api\Data\ProductGroupPriceInterface'); - $priceMock->expects($this->once()) - ->method('setCustomerGroupId') - ->with($expected['customer_group_id']) - ->willReturnSelf(); - $priceMock->expects($this->once()) - ->method('setValue') - ->with($expected['value']) - ->willReturnSelf(); - $this->priceFactoryMock - ->expects($this->once()) - ->method('create') - ->will($this->returnValue($priceMock)); - $prices = $this->groupPriceManagement->getList('product_sku'); - $this->assertCount(1, $prices); - $this->assertEquals($priceMock, $prices[0]); - } - - public function getListDataProvider() - { - return [ - [ - 1, - ['website_price' => 10, 'price' => 5, 'all_groups' => 1], - ['customer_group_id' => 'all', 'value' => 10] - ], - [ - 0, - ['website_price' => 10, 'price' => 5, 'all_groups' => 0, 'cust_group' => 1], - ['customer_group_id' => 1, 'value' => 5] - ] - ]; - } - - public function testSuccessRemoveGroupPrice() - { - $this->storeManagerMock - ->expects($this->never()) - ->method('getWebsite'); - $this->configMock - ->expects($this->once()) - ->method('getValue') - ->with('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) - ->will($this->returnValue(0)); - $this->priceModifierMock->expects($this->once())->method('removeGroupPrice')->with($this->productMock, 4, 0); - - $this->assertEquals(true, $this->groupPriceManagement->remove('product_sku', 4)); - } - - /** - * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage No such entity. - */ - public function testRemoveGroupPriceFromNonExistingProduct() - { - $this->productRepositoryMock->expects($this->once())->method('get') - ->will($this->throwException(new NoSuchEntityException())); - $this->priceModifierMock->expects($this->never())->method('removeGroupPrice'); - $this->storeManagerMock - ->expects($this->never()) - ->method('getWebsite'); - $this->groupPriceManagement->remove('product_sku', null, 10); - } - - public function testSuccessRemoveGroupPriceFromWebsiteLevel() - { - $this->storeManagerMock - ->expects($this->once()) - ->method('getWebsite') - ->will($this->returnValue($this->websiteMock)); - $this->websiteMock->expects($this->once())->method('getId')->will($this->returnValue(1)); - $this->configMock - ->expects($this->once()) - ->method('getValue') - ->with('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) - ->will($this->returnValue(1)); - $this->priceModifierMock->expects($this->once())->method('removeGroupPrice')->with($this->productMock, 4, 1); - - $this->assertEquals(true, $this->groupPriceManagement->remove('product_sku', 4)); - } - - public function testSetNewPriceWithGlobalPriceScope() - { - $group = $this->getMock('\Magento\Customer\Model\Data\Group', [], [], '', false); - $group->expects($this->once())->method('getId')->will($this->returnValue(1)); - $this->groupServiceMock->expects($this->once())->method('getById')->will($this->returnValue($group)); - $this->productMock - ->expects($this->once()) - ->method('getData') - ->with('group_price') - ->will($this->returnValue([['cust_group' => 2, 'website_id' => 0, 'price' => 50]])); - $this->configMock - ->expects($this->once()) - ->method('getValue') - ->with('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) - ->will($this->returnValue(1)); - - $this->productMock->expects($this->once())->method('setData')->with( - 'group_price', - [ - ['cust_group' => 2, 'website_id' => 0, 'price' => 50], - ['cust_group' => 1, 'website_id' => 0, 'price' => 100] - ] - ); - - $this->storeManagerMock->expects($this->once())->method('getWebsite') - ->will($this->returnValue($this->websiteMock)); - $this->websiteMock->expects($this->once())->method('getId') - ->will($this->returnValue(0)); - - $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock); - $this->groupPriceManagement->add('product_sku', 1, 100); - } - - public function testSetUpdatedPriceWithGlobalPriceScope() - { - $group = $this->getMock('\Magento\Customer\Model\Data\Group', [], [], '', false); - $this->groupServiceMock->expects($this->once())->method('getById')->will($this->returnValue($group)); - $this->productMock - ->expects($this->once()) - ->method('getData') - ->with('group_price') - ->will($this->returnValue([['cust_group' => 2, 'website_id' => 0, 'price' => 50]])); - $this->configMock - ->expects($this->once()) - ->method('getValue') - ->with('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) - ->will($this->returnValue(0)); - - $this->productMock->expects($this->once())->method('setData')->with( - 'group_price', - [ - ['cust_group' => 2, 'website_id' => 0, 'price' => 100], - ] - ); - $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock); - $this->groupPriceManagement->add('product_sku', 2, 100); - } - - /** - * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Values of following attributes are invalid: attr1, attr2 - */ - public function testSetThrowsExceptionIfDoesntValidate() - { - $group = $this->getMock('\Magento\Customer\Model\Data\Group', [], [], '', false); - $group->expects($this->once())->method('getId')->will($this->returnValue(1)); - $this->productMock - ->expects($this->once()) - ->method('getData') - ->with('group_price') - ->will($this->returnValue([])); - - $this->groupServiceMock->expects($this->once())->method('getById')->will($this->returnValue($group)); - $this->productMock->expects($this->once())->method('validate')->will( - $this->returnValue( - ['attr1' => '', 'attr2' => ''] - ) - ); - $this->productRepositoryMock->expects($this->never())->method('save'); - $this->groupPriceManagement->add('product_sku', 2, 100); - } - - /** - * @expectedException \Magento\Framework\Exception\CouldNotSaveException - */ - public function testSetThrowsExceptionIfCantSave() - { - $group = $this->getMock('\Magento\Customer\Model\Data\Group', [], [], '', false); - $group->expects($this->once())->method('getId')->will($this->returnValue(1)); - $this->productMock - ->expects($this->once()) - ->method('getData') - ->with('group_price') - ->will($this->returnValue([])); - - $this->groupServiceMock->expects($this->once())->method('getById')->will($this->returnValue($group)); - $this->productRepositoryMock->expects($this->once()) - ->method('save') - ->will($this->throwException(new \Exception())); - $this->groupPriceManagement->add('product_sku', 2, 100); - } - - /** - * @expectedException \Magento\Framework\Exception\InputException - */ - public function testAddWithInvalidData() - { - $this->groupPriceManagement->add('product_sku', 1, '10string'); - } -} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php index fe3ddb73eef8f..b5faf10b921ba 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php @@ -61,51 +61,6 @@ protected function setUp() ]; } - public function testSuccessfullyRemoveGroupPriceSpecifiedForOneGroup() - { - $this->productMock - ->expects($this->once()) - ->method('getData') - ->with('group_price') - ->will($this->returnValue($this->prices)); - $expectedPrices = [1 => $this->prices[1]]; - $this->productMock->expects($this->once())->method('setData')->with('group_price', $expectedPrices); - $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock); - $this->priceModifier->removeGroupPrice($this->productMock, 1, 1); - } - - /** - * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedMessage This product doesn't have group price - */ - public function testRemoveWhenGroupPricesNotExists() - { - $this->productMock - ->expects($this->once()) - ->method('getData') - ->with('group_price') - ->will($this->returnValue([])); - $this->productMock->expects($this->never())->method('setData'); - $this->productRepositoryMock->expects($this->never())->method('save'); - $this->priceModifier->removeGroupPrice($this->productMock, 1, 1); - } - - /** - * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedMessage For current customerGroupId = '10' any group price exist'. - */ - public function testRemoveGroupPriceForNonExistingCustomerGroup() - { - $this->productMock - ->expects($this->once()) - ->method('getData') - ->with('group_price') - ->will($this->returnValue($this->prices)); - $this->productMock->expects($this->never())->method('setData'); - $this->productRepositoryMock->expects($this->never())->method('save'); - $this->priceModifier->removeGroupPrice($this->productMock, 10, 1); - } - /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException * @expectedMessage This product doesn't have tier price diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php index 7ebf31ca90699..d9358751f8e42 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php @@ -36,11 +36,6 @@ class PriceTest extends \PHPUnit_Framework_TestCase */ protected $product; - /** - * @var \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject - */ - protected $gpFactory; - /** * @var \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject */ @@ -66,16 +61,6 @@ protected function setUp() $this->objectManagerHelper = new ObjectManagerHelper($this); $this->product = $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product'); - $this->gpFactory = $this->getMockForAbstractClass( - 'Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory', - [], - '', - false, - true, - true, - ['create'] - ); - $this->tpFactory = $this->getMockForAbstractClass( 'Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory', [], @@ -125,7 +110,6 @@ protected function setUp() $this->model = $this->objectManagerHelper->getObject( 'Magento\Catalog\Model\Product\Type\Price', [ - 'groupPriceFactory' => $this->gpFactory, 'tierPriceFactory' => $this->tpFactory, 'config' => $this->scopeConfigMock, 'storeManager' => $storeMangerMock, @@ -135,7 +119,6 @@ protected function setUp() } /** - * testGetGroupPricesWithNull * testGetTierPricesWithNull * * @dataProvider nullPricesDataProvider @@ -157,86 +140,10 @@ public function testGetPricesWithNull($key, $getter) public function nullPricesDataProvider() { return [ - 'testGetGroupPricesWithNull' => [$this::KEY_GROUP_PRICE, 'setGroupPrices'], 'testGetTierPricesWithNull' => [$this::KEY_TIER_PRICE, 'setTierPrices'] ]; } - /** - * testGetGroupPrices - * testSetGroupPrices - * - * @dataProvider pricesDataProvider - */ - public function testGroupPrices($priceScope, $expectedWebsiteId) - { - // establish the behavior of the mocks - $this->scopeConfigMock->expects($this->any()) - ->method('getValue') - ->will($this->returnValue($priceScope)); - $this->websiteMock->expects($this->any()) - ->method('getId') - ->will($this->returnValue($expectedWebsiteId)); - $this->gpFactory->expects($this->any()) - ->method('create') - ->will($this->returnCallback(function () { - return $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product\GroupPrice'); - })); - - // create sample GroupPrice objects that would be coming from a REST call - $gp1 = $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product\GroupPrice'); - $gp1->setValue(10); - $gp1->setCustomerGroupId(1); - $gp2 = $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product\GroupPrice'); - $gp2->setValue(20); - $gp2->setCustomerGroupId(2); - $gps = [$gp1, $gp2]; - - // force the product to have null group prices - $this->product->setData($this::KEY_GROUP_PRICE, null); - $this->assertNull($this->product->getData($this::KEY_GROUP_PRICE)); - - // set the product with the GroupPrice objects - $this->model->setGroupPrices($this->product, $gps); - - // test the data actually set on the product - $gpArray = $this->product->getData($this::KEY_GROUP_PRICE); - $this->assertNotNull($gpArray); - $this->assertTrue(is_array($gpArray)); - $this->assertEquals(sizeof($gps), sizeof($gpArray)); - - for ($i = 0; $i < sizeof($gps); $i++) { - $gpData = $gpArray[$i]; - $this->assertEquals($expectedWebsiteId, $gpData['website_id'], 'Website Id does not match'); - $this->assertEquals($gps[$i]->getValue(), $gpData['price'], 'Price/Value does not match'); - $this->assertEquals($gps[$i]->getValue(), $gpData['website_price'], 'WebsitePrice/Value does not match'); - $this->assertEquals( - $gps[$i]->getCustomerGroupId(), - $gpData['cust_group'], - 'Customer group Id does not match' - ); - } - - // test with the data retrieved as a REST object - $gpRests = $this->model->getGroupPrices($this->product); - $this->assertNotNull($gpRests); - $this->assertTrue(is_array($gpRests)); - $this->assertEquals(sizeof($gps), sizeof($gpRests)); - - for ($i = 0; $i < sizeof($gps); $i++) { - $this->assertEquals( - $gps[$i]->getValue(), - $gpRests[$i]->getValue(), - 'REST: Price/Value does not match' - ); - $this->assertEquals( - $gps[$i]->getCustomerGroupId(), - $gpRests[$i]->getCustomerGroupId(), - 'REST: Customer group Id does not match' - ); - } - } - /** * @return array */ diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php index 97f42ea1d09ab..b8ce308ee4138 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php @@ -1213,56 +1213,6 @@ public function testGetCustomAttributes() $this->assertEquals("blue", $this->model->getCustomAttribute($colorAttributeCode)->getValue()); } - /** - * @dataProvider priceDataProvider - */ - public function testGetGroupPrices($originalGroupPrices) - { - $this->invokeGetGroupOrTierPrices($originalGroupPrices, 'getGroupPrices'); - } - - /** - * @dataProvider priceDataProvider - */ - public function testGetTierPrices($originalGroupPrices) - { - $this->invokeGetGroupOrTierPrices($originalGroupPrices, 'getTierPrices'); - } - - protected function invokeGetGroupOrTierPrices($originalPrices, $getter) - { - // the priceModel's getter method will return the originalPrices - $priceModelMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Type\Price') - ->disableOriginalConstructor() - ->setMethods([$getter]) - ->getMock(); - $priceModelMock->expects($this->any()) - ->method($getter) - ->will($this->returnValue($originalPrices)); - - // the catalogProductType's priceFactory method will return the above priceModel - $catalogProductTypeMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Type') - ->disableOriginalConstructor() - ->setMethods(['priceFactory']) - ->getMock(); - $catalogProductTypeMock->expects(($this->any())) - ->method('priceFactory') - ->will($this->returnValue($priceModelMock)); - - // the productModel - $productModel = $this->objectManagerHelper->getObject( - 'Magento\Catalog\Model\Product', - [ - 'catalogProductType' => $catalogProductTypeMock - ] - ); - - $expectedResultIsEmpty = (empty($originalPrices) ? true : false); - $groupPrices = $productModel->$getter(); - $actualResultIsEmpty = (empty($groupPrices) ? true : false); - $this->assertEquals($expectedResultIsEmpty, $actualResultIsEmpty); - } - /** * @return array */ diff --git a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php index 234ae5b6429e9..0927a9b0be5a2 100644 --- a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php @@ -38,11 +38,6 @@ class BasePriceTest extends \PHPUnit_Framework_TestCase */ protected $regularPriceMock; - /** - * @var \Magento\Catalog\Pricing\Price\GroupPrice|\PHPUnit_Framework_MockObject_MockObject - */ - protected $groupPriceMock; - /** * @var \Magento\Catalog\Pricing\Price\SpecialPrice|\PHPUnit_Framework_MockObject_MockObject */ @@ -62,7 +57,6 @@ public function setUp() $this->saleableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $this->priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); $this->regularPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\RegularPrice', [], [], '', false); - $this->groupPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\GroupPrice', [], [], '', false); $this->specialPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\SpecialPrice', [], [], '', false); $this->calculatorMock = $this->getMock('Magento\Framework\Pricing\Adjustment\Calculator', [], [], '', false); @@ -71,7 +65,6 @@ public function setUp() ->will($this->returnValue($this->priceInfoMock)); $this->prices = [ 'regular_price' => $this->regularPriceMock, - 'group_price' => $this->groupPriceMock, 'special_price' => $this->specialPriceMock, ]; @@ -98,9 +91,6 @@ public function testGetValue($specialPriceValue, $expectedResult) $this->regularPriceMock->expects($this->exactly(3)) ->method('getValue') ->will($this->returnValue(100)); - $this->groupPriceMock->expects($this->exactly(2)) - ->method('getValue') - ->will($this->returnValue(99)); $this->specialPriceMock->expects($this->any()) ->method('getValue') ->will($this->returnValue($specialPriceValue)); diff --git a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/GroupPriceTest.php b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/GroupPriceTest.php deleted file mode 100644 index 79be369b15188..0000000000000 --- a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/GroupPriceTest.php +++ /dev/null @@ -1,250 +0,0 @@ -productMock = $this->getMock( - 'Magento\Catalog\Model\Product', - ['__wakeup', 'getCustomerGroupId', 'getPriceInfo', 'getResource', 'getData'], - [], - '', - false - ); - $this->productResourceMock = $this->getMock( - 'Magento\Catalog\Model\Resource\Product', - [], - [], - '', - false - ); - $this->calculatorMock = $this->getMock( - 'Magento\Framework\Pricing\Adjustment\Calculator', - [], - [], - '', - false - ); - $this->customerSessionMock = $this->getMock( - 'Magento\Customer\Model\Session', - [], - [], - '', - false - ); - $this->customerMock = $this->getMock( - 'Magento\Customer\Model\Customer', - [], - [], - '', - false - ); - $this->attributeMock = $this->getMock( - 'Magento\Catalog\Model\Entity\Attribute', - [], - [], - '', - false - ); - $this->backendMock = $this->getMock( - 'Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice', - [], - [], - '', - false - ); - - $this->priceCurrencyMock = $this->getMock('\Magento\Framework\Pricing\PriceCurrencyInterface'); - - $this->groupPrice = new \Magento\Catalog\Pricing\Price\GroupPrice( - $this->productMock, - 1, - $this->calculatorMock, - $this->priceCurrencyMock, - $this->customerSessionMock - ); - } - - /** - * test get group price, customer group in session - */ - public function testGroupPriceCustomerGroupInSession() - { - $groupPrice = 80; - $convertedValue = 56.24; - $this->productMock->expects($this->once()) - ->method('getCustomerGroupId') - ->will($this->returnValue(null)); - $this->customerSessionMock->expects($this->once()) - ->method('getCustomerGroupId') - ->will($this->returnValue(3)); - $this->productMock->expects($this->once()) - ->method('getResource') - ->will($this->returnValue($this->productResourceMock)); - $this->productResourceMock->expects($this->once()) - ->method('getAttribute') - ->with($this->equalTo('group_price')) - ->will($this->returnValue($this->attributeMock)); - $this->attributeMock->expects($this->once()) - ->method('getBackend') - ->will($this->returnValue($this->backendMock)); - $this->backendMock->expects($this->once()) - ->method('afterLoad') - ->with($this->equalTo($this->productMock)) - ->will($this->returnValue($this->backendMock)); - $this->productMock->expects($this->once()) - ->method('getData') - ->with( - $this->equalTo('group_price'), - $this->equalTo(null) - ) - ->will($this->returnValue( - [ - [ - 'cust_group' => 3, - 'website_price' => $groupPrice, - ], - ] - - )); - $this->priceCurrencyMock->expects($this->once()) - ->method('convertAndRound') - ->with($groupPrice) - ->will($this->returnValue($convertedValue)); - $this->assertEquals($convertedValue, $this->groupPrice->getValue()); - } - - /** - * test get group price, customer group in session - * - * @param int $customerGroup - * @dataProvider dataProviderGroupPriceCustomerGroupInProduct - */ - public function testGroupPriceCustomerGroupInProduct($customerGroup) - { - $groupPrice = 80; - $convertedPrice = 56.23; - $this->productMock->expects($this->exactly(2)) - ->method('getCustomerGroupId') - ->will($this->returnValue($customerGroup)); - $this->productMock->expects($this->once()) - ->method('getResource') - ->will($this->returnValue($this->productResourceMock)); - $this->productResourceMock->expects($this->once()) - ->method('getAttribute') - ->with($this->equalTo('group_price')) - ->will($this->returnValue($this->attributeMock)); - $this->attributeMock->expects($this->once()) - ->method('getBackend') - ->will($this->returnValue($this->backendMock)); - $this->backendMock->expects($this->once()) - ->method('afterLoad') - ->with($this->equalTo($this->productMock)) - ->will($this->returnValue($this->backendMock)); - $this->productMock->expects($this->once()) - ->method('getData') - ->with( - $this->equalTo('group_price'), - $this->equalTo(null) - ) - ->will($this->returnValue( - [ - [ - 'cust_group' => $customerGroup, - 'website_price' => $groupPrice, - ], - ] - - )); - $this->priceCurrencyMock->expects($this->once()) - ->method('convertAndRound') - ->with($groupPrice) - ->will($this->returnValue($convertedPrice)); - $this->assertEquals($convertedPrice, $this->groupPrice->getValue()); - } - - public function dataProviderGroupPriceCustomerGroupInProduct() - { - return [ - [0], - [3], - ]; - } - - /** - * test get group price, attribute is not set - */ - public function testGroupPriceAttributeIsNotSet() - { - $this->productMock->expects($this->exactly(2)) - ->method('getCustomerGroupId') - ->will($this->returnValue(3)); - $this->productMock->expects($this->once()) - ->method('getResource') - ->will($this->returnValue($this->productResourceMock)); - $this->productResourceMock->expects($this->once()) - ->method('getAttribute') - ->with($this->equalTo('group_price')) - ->will($this->returnValue(null)); - $this->assertFalse($this->groupPrice->getValue()); - } -} diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index caa0844fbb8f2..c24aae6f5ab60 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -303,7 +303,6 @@ Magento\Catalog\Pricing\Price\RegularPrice Magento\Catalog\Pricing\Price\FinalPrice Magento\Catalog\Pricing\Price\TierPrice - Magento\Catalog\Pricing\Price\GroupPrice Magento\Catalog\Pricing\Price\SpecialPrice Magento\Catalog\Pricing\Price\BasePrice Magento\Catalog\Pricing\Price\CustomOptionPrice @@ -456,8 +455,6 @@ - - diff --git a/app/code/Magento/Catalog/etc/webapi.xml b/app/code/Magento/Catalog/etc/webapi.xml index ec8458cd8c9a7..de7ed51f6a191 100644 --- a/app/code/Magento/Catalog/etc/webapi.xml +++ b/app/code/Magento/Catalog/etc/webapi.xml @@ -227,26 +227,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml deleted file mode 100644 index d9f179b7ab50d..0000000000000 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml +++ /dev/null @@ -1,163 +0,0 @@ - -getElement(); -$_htmlId = $block->getElement()->getHtmlId(); -$_htmlClass = $block->getElement()->getClass(); -$_htmlName = $block->getElement()->getName(); -$_readonly = $block->getElement()->getReadonly(); -$_priceValueValidation = $block->getPriceValidation('validate-zero-or-greater'); - -$_showWebsite = $block->isMultiWebsites(); -?> -
- -
- - - - - - - - - - - - - - - -
style="display: none;">getPriceColumnHeader(__('Price')); ?>
getAddButtonHtml(); ?>
- - -
-
diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index dc2fefaa9f83e..da6fb8b468409 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1329,7 +1329,6 @@ protected function _saveProducts() $this->websitesCache = []; $this->categoriesCache = []; $tierPrices = []; - $groupPrices = []; $mediaGallery = []; $uploadedGalleryFiles = []; $previousType = null; @@ -1417,18 +1416,6 @@ protected function _saveProducts() ]; } - // 4.2. Group prices phase - if (!empty($rowData['_group_price_website'])) { - $groupPrices[$rowSku][] = [ - 'all_groups' => $rowData['_group_price_customer_group'] == self::VALUE_ALL, - 'customer_group_id' => $rowData['_group_price_customer_group'] == - self::VALUE_ALL ? 0 : $rowData['_group_price_customer_group'], - 'value' => $rowData['_group_price_price'], - 'website_id' => self::VALUE_ALL == $rowData['_group_price_website'] || - $priceIsGlobal ? 0 : $this->storeResolver->getWebsiteCodeToId($rowData['_group_price_website']), - ]; - } - if (!$this->validateRow($rowData, $rowNum)) { continue; } @@ -1618,8 +1605,6 @@ protected function _saveProducts() $this->categoriesCache )->_saveProductTierPrices( $tierPrices - )->_saveProductGroupPrices( - $groupPrices )->_saveMediaGallery( $mediaGallery )->_saveProductAttributes( @@ -1703,45 +1688,6 @@ protected function _saveProductTierPrices(array $tierPriceData) return $this; } - /** - * Save product group prices. - * - * @param array $groupPriceData - * @return $this - */ - protected function _saveProductGroupPrices(array $groupPriceData) - { - static $tableName = null; - - if (!$tableName) { - $tableName = $this->_resourceFactory->create()->getTable('catalog_product_entity_group_price'); - } - if ($groupPriceData) { - $groupPriceIn = []; - $delProductId = []; - - foreach ($groupPriceData as $delSku => $groupPriceRows) { - $productId = $this->skuProcessor->getNewSku($delSku)['entity_id']; - $delProductId[] = $productId; - - foreach ($groupPriceRows as $row) { - $row['entity_id'] = $productId; - $groupPriceIn[] = $row; - } - } - if (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND != $this->getBehavior()) { - $this->_connection->delete( - $tableName, - $this->_connection->quoteInto('entity_id IN (?)', $delProductId) - ); - } - if ($groupPriceIn) { - $this->_connection->insertOnDuplicate($tableName, $groupPriceIn, ['value']); - } - } - return $this; - } - /** * Returns an object for upload a media files * diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php index c639fcc4acf25..916775c4152c7 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php @@ -47,12 +47,6 @@ interface RowValidatorInterface extends \Magento\Framework\Validator\ValidatorIn const ERROR_TIER_DATA_INCOMPLETE = 'tierPriceDataIsIncomplete'; - const ERROR_INVALID_GROUP_PRICE_SITE = 'groupPriceWebsiteInvalid'; - - const ERROR_INVALID_GROUP_PRICE_GROUP = 'groupPriceGroupInvalid'; - - const ERROR_GROUP_PRICE_DATA_INCOMPLETE = 'groupPriceDataIsIncomplete'; - const ERROR_SKU_NOT_FOUND_FOR_DELETE = 'skuNotFoundToDelete'; const ERROR_SUPER_PRODUCTS_SKU_NOT_FOUND = 'superProductsSkuNotFound'; diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/GroupPrice.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/GroupPrice.php deleted file mode 100644 index 56d6aebd0441b..0000000000000 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/GroupPrice.php +++ /dev/null @@ -1,89 +0,0 @@ -storeResolver = $storeResolver; - parent::__construct($groupRepository, $searchCriteriaBuilder); - } - - /** - * {@inheritdoc} - */ - public function init($context) - { - return parent::init($context); - } - - /** - * {@inheritdoc} - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - */ - public function isValid($value) - { - $this->_clearMessages(); - if (isset( - $value['_group_price_website'] - ) && strlen( - $value['_group_price_website'] - ) || isset( - $value['_group_price_customer_group'] - ) && strlen( - $value['_group_price_customer_group'] - ) || isset( - $value['_group_price_price'] - ) && strlen( - $value['_group_price_price'] - ) - ) { - if (!isset( - $value['_group_price_website'] - ) || !isset( - $value['_group_price_customer_group'] - ) || !strlen( - $value['_group_price_website'] - ) || !strlen( - $value['_group_price_customer_group'] - ) || !strlen( - $value['_group_price_price'] - ) - ) { - $this->_addMessages([self::ERROR_GROUP_PRICE_DATA_INCOMPLETE]); - return false; - } elseif ($value['_group_price_website'] != self::VALUE_ALL - && !$this->storeResolver->getWebsiteCodeToId($value['_group_price_website']) - ) { - $this->_addMessages([self::ERROR_INVALID_GROUP_PRICE_SITE]); - return false; - } elseif ($value['_group_price_customer_group'] != self::VALUE_ALL && !isset( - $this->customerGroups[$value['_group_price_customer_group']] - ) - ) { - $this->_addMessages([self::ERROR_INVALID_GROUP_PRICE_GROUP]); - return false; - } - } - return true; - } -} diff --git a/app/code/Magento/CatalogImportExport/etc/di.xml b/app/code/Magento/CatalogImportExport/etc/di.xml index 55daa1e2d6f1f..1af0ab15f6144 100644 --- a/app/code/Magento/CatalogImportExport/etc/di.xml +++ b/app/code/Magento/CatalogImportExport/etc/di.xml @@ -18,7 +18,6 @@ - Magento\CatalogImportExport\Model\Import\Product\Validator\GroupPrice Magento\CatalogImportExport\Model\Import\Product\Validator\Media Magento\CatalogImportExport\Model\Import\Product\Validator\SuperProductsSku Magento\CatalogImportExport\Model\Import\Product\Validator\TierPrice diff --git a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php index 3f7477dbd79c7..667116c7574de 100644 --- a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php @@ -595,17 +595,6 @@ protected function getRuleProductsStmt($websiteId, $productId = null) $select->where('rp.product_id=?', $productId); } - /** - * Join group price to result - */ - $groupPriceAttr = $this->eavConfig->getAttribute(Product::ENTITY, 'group_price'); - $select->joinLeft( - ['gp' => $groupPriceAttr->getBackend()->getResource()->getMainTable()], - 'gp.entity_id=rp.product_id AND gp.customer_group_id=rp.customer_group_id AND ' - . $this->connection->getCheckSql('gp.website_id=0', 'TRUE', 'gp.website_id=rp.website_id'), - 'value' - ); - /** * Join default price and websites prices to result */ diff --git a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php index 3687d55d4710f..eec3b040c92d8 100644 --- a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php +++ b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php @@ -196,56 +196,4 @@ protected function setUp() $this->productFactory ); } - - /** - * Test UpdateCatalogRuleGroupWebsiteData - * - * @covers \Magento\CatalogRule\Model\Indexer\IndexBuilder::updateCatalogRuleGroupWebsiteData - * @return void - */ - public function testUpdateCatalogRuleGroupWebsiteData() - { - $groupPriceAttrMock = $this->getMock( - 'Magento\Catalog\Model\Entity\Attribute', - ['getBackend'], - [], - '', - false - ); - $backendModelMock = $this->getMock( - 'Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice', - ['getResource'], - [], - '', - false - ); - $resourceMock = $this->getMock( - 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice', - ['getMainTable'], - [], - '', - false - ); - $resourceMock->expects($this->once()) - ->method('getMainTable') - ->will($this->returnValue('catalog_product_entity_group_price')); - $backendModelMock->expects($this->once()) - ->method('getResource') - ->will($this->returnValue($resourceMock)); - $groupPriceAttrMock->expects($this->once()) - ->method('getBackend') - ->will($this->returnValue($backendModelMock)); - $this->eavConfig->expects($this->at(0)) - ->method('getAttribute') - ->with(\Magento\Catalog\Model\Product::ENTITY, 'group_price') - ->will($this->returnValue($groupPriceAttrMock)); - $this->eavConfig->expects($this->at(1)) - ->method('getAttribute') - ->with(\Magento\Catalog\Model\Product::ENTITY, 'price') - ->will($this->returnValue($this->attribute)); - - $this->select->expects($this->once())->method('insertFromSelect')->with('catalogrule_group_website'); - - $this->indexBuilder->reindexByIds([1]); - } } diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php index f90e8896b2551..313c73e6b5a36 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php @@ -135,10 +135,9 @@ protected function _applyConfigurableOption() ); $priceColumn = $this->_addAttributeToSelect($select, 'price', 'l.product_id', 0, null, true); $tierPriceColumn = $connection->getCheckSql("MIN(i.tier_price) IS NOT NULL", "i.tier_price", 'NULL'); - $groupPriceColumn = $connection->getCheckSql("MIN(i.group_price) IS NOT NULL", "i.group_price", 'NULL'); $select->columns( - ['price' => $priceColumn, 'tier_price' => $tierPriceColumn, 'group_price' => $groupPriceColumn] + ['price' => $priceColumn, 'tier_price' => $tierPriceColumn] ); $query = $select->insertFromSelect($coaTable); diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Price/BasePrice.php b/app/code/Magento/ConfigurableProduct/Pricing/Price/BasePrice.php index 7674b0ad7bf79..76f2ef5cdd900 100644 --- a/app/code/Magento/ConfigurableProduct/Pricing/Price/BasePrice.php +++ b/app/code/Magento/ConfigurableProduct/Pricing/Price/BasePrice.php @@ -50,7 +50,6 @@ protected function getMinimumAdditionalPrice() if (null === $this->minimumAdditionalPrice) { $priceCodes = [ \Magento\Catalog\Pricing\Price\SpecialPrice::PRICE_CODE, - \Magento\Catalog\Pricing\Price\GroupPrice::PRICE_CODE, \Magento\Catalog\Pricing\Price\TierPrice::PRICE_CODE, ]; $this->minimumAdditionalPrice = false; diff --git a/app/code/Magento/Downloadable/Model/Resource/Indexer/Price.php b/app/code/Magento/Downloadable/Model/Resource/Indexer/Price.php index 83e2405804151..3a06503673745 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Indexer/Price.php +++ b/app/code/Magento/Downloadable/Model/Resource/Indexer/Price.php @@ -133,7 +133,6 @@ protected function _applyDownloadableLink() $connection->query($query); $ifTierPrice = $connection->getCheckSql('i.tier_price IS NOT NULL', '(i.tier_price + id.min_price)', 'NULL'); - $ifGroupPrice = $connection->getCheckSql('i.group_price IS NOT NULL', '(i.group_price + id.min_price)', 'NULL'); $select = $connection->select()->join( ['id' => $table], @@ -145,7 +144,6 @@ protected function _applyDownloadableLink() 'min_price' => new \Zend_Db_Expr('i.min_price + id.min_price'), 'max_price' => new \Zend_Db_Expr('i.max_price + id.max_price'), 'tier_price' => new \Zend_Db_Expr($ifTierPrice), - 'group_price' => new \Zend_Db_Expr($ifGroupPrice), ] ); diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductGroupPriceManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductGroupPriceManagementTest.php deleted file mode 100644 index 716a9ac564048..0000000000000 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductGroupPriceManagementTest.php +++ /dev/null @@ -1,118 +0,0 @@ - [ - 'resourcePath' => self::RESOURCE_PATH . $productSku . '/group-prices', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, - ], - 'soap' => [ - 'service' => self::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => self::SERVICE_NAME . 'GetList', - ], - ]; - $groupPriceList = $this->_webApiCall($serviceInfo, ['sku' => $productSku]); - $this->assertCount(2, $groupPriceList); - $this->assertEquals(9, $groupPriceList[0]['value']); - $this->assertEquals(7, $groupPriceList[1]['value']); - } - - /** - * @magentoApiDataFixture Magento/Catalog/_files/product_group_prices.php - */ - public function testDelete() - { - $productSku = 'simple_with_group_price'; - $customerGroupId = \Magento\Customer\Model\GroupManagement::NOT_LOGGED_IN_ID; - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH . $productSku . "/group-prices/" . $customerGroupId, - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE, - ], - 'soap' => [ - 'service' => self::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => self::SERVICE_NAME . 'Remove', - ], - ]; - $requestData = ['sku' => $productSku, 'customerGroupId' => $customerGroupId]; - $this->assertTrue($this->_webApiCall($serviceInfo, $requestData)); - } - - /** - * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php - */ - public function testAdd() - { - $productSku = 'simple'; - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => '/V1/products/' . $productSku . '/group-prices/1/price/10', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => [ - 'service' => self::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => self::SERVICE_NAME . 'Add', - ], - ]; - $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'customerGroupId' => 1, 'price' => 10]); - $objectManager = \Magento\TestFramework\ObjectManager::getInstance(); - /** @var \Magento\Catalog\Api\ProductGroupPriceManagementInterface $service */ - $service = $objectManager->get('Magento\Catalog\Api\ProductGroupPriceManagementInterface'); - $prices = $service->getList($productSku); - $this->assertCount(1, $prices); - $this->assertEquals(10, $prices[0]->getValue()); - $this->assertEquals(1, $prices[0]->getCustomerGroupId()); - } - - /** - * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php - * @magentoApiDataFixture Magento/Store/_files/website.php - */ - public function testAddForDifferentWebsite() - { - $productSku = 'simple'; - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => '/V1/products/' . $productSku . '/group-prices/1/price/10', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => [ - 'service' => self::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => self::SERVICE_NAME . 'Add', - ], - - ]; - $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'customerGroupId' => 1, 'price' => 10]); - $objectManager = \Magento\TestFramework\ObjectManager::getInstance(); - /** @var \Magento\Catalog\Api\ProductGroupPriceManagementInterface $service */ - $service = $objectManager->get('Magento\Catalog\Api\ProductGroupPriceManagementInterface'); - $prices = $service->getList($productSku); - $this->assertCount(1, $prices); - $this->assertEquals(10, $prices[0]->getValue()); - $this->assertEquals(1, $prices[0]->getCustomerGroupId()); - } -} diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php index d33e1456bc363..6ecbea9b5bfaf 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php @@ -623,79 +623,6 @@ protected function deleteProduct($sku) $this->_webApiCall($serviceInfo, ['sku' => $sku]) : $this->_webApiCall($serviceInfo); } - public function testGroupPrices() - { - // create a product with group prices - $custGroup1 = \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID; - $custGroup2 = \Magento\Customer\Model\Group::CUST_GROUP_ALL; - $productData = $this->getSimpleProductData(); - $productData[self::KEY_GROUP_PRICES] = [ - [ - 'customer_group_id' => $custGroup1, - 'value' => 3.14 - ], - [ - 'customer_group_id' => $custGroup2, - 'value' => 3.45, - ] - ]; - $this->saveProduct($productData); - $response = $this->getProduct($productData[ProductInterface::SKU]); - - $this->assertArrayHasKey(self::KEY_GROUP_PRICES, $response); - $groupPrices = $response[self::KEY_GROUP_PRICES]; - $this->assertNotNull($groupPrices, "CREATE: expected to have group prices"); - $this->assertCount(2, $groupPrices, "CREATE: expected to have 2 'group_prices' objects"); - $this->assertEquals(3.14, $groupPrices[0]['value']); - $this->assertEquals($custGroup1, $groupPrices[0]['customer_group_id']); - $this->assertEquals(3.45, $groupPrices[1]['value']); - $this->assertEquals($custGroup2, $groupPrices[1]['customer_group_id']); - - // update the product's group prices: update 1st group price, (delete the 2nd group price), add a new one - $custGroup3 = 1; - $groupPrices[0]['value'] = 3.33; - $groupPrices[1] = [ - 'customer_group_id' => $custGroup3, - 'value' => 2.10, - ]; - $response[self::KEY_GROUP_PRICES] = $groupPrices; - $response = $this->updateProduct($response); - - $this->assertArrayHasKey(self::KEY_GROUP_PRICES, $response); - $groupPrices = $response[self::KEY_GROUP_PRICES]; - $this->assertNotNull($groupPrices, "UPDATE 1: expected to have group prices"); - $this->assertCount(2, $groupPrices, "UPDATE 1: expected to have 2 'group_prices' objects"); - $this->assertEquals(3.33, $groupPrices[0]['value']); - $this->assertEquals($custGroup1, $groupPrices[0]['customer_group_id']); - $this->assertEquals(2.10, $groupPrices[1]['value']); - $this->assertEquals($custGroup3, $groupPrices[1]['customer_group_id']); - - // update the product without any mention of group prices; no change expected for group pricing - $response = $this->getProduct($productData[ProductInterface::SKU]); - unset($response[self::KEY_GROUP_PRICES]); - $response = $this->updateProduct($response); - - $this->assertArrayHasKey(self::KEY_GROUP_PRICES, $response); - $groupPrices = $response[self::KEY_GROUP_PRICES]; - $this->assertNotNull($groupPrices, "UPDATE 2: expected to have group prices"); - $this->assertCount(2, $groupPrices, "UPDATE 2: expected to have 2 'group_prices' objects"); - $this->assertEquals(3.33, $groupPrices[0]['value']); - $this->assertEquals($custGroup1, $groupPrices[0]['customer_group_id']); - $this->assertEquals(2.10, $groupPrices[1]['value']); - $this->assertEquals($custGroup3, $groupPrices[1]['customer_group_id']); - - // update the product with empty group prices; expect to have the existing group prices removed - $response = $this->getProduct($productData[ProductInterface::SKU]); - $response[self::KEY_GROUP_PRICES] = []; - $response = $this->updateProduct($response); - $this->assertArrayHasKey(self::KEY_GROUP_PRICES, $response, "expected to have the 'group_prices' key"); - $this->assertEmpty($response[self::KEY_GROUP_PRICES], "expected to have an empty array of 'group_prices'"); - - // delete the product with group prices; expect that all goes well - $response = $this->deleteProduct($productData[ProductInterface::SKU]); - $this->assertTrue($response); - } - public function testTierPrices() { // create a product with tier prices diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php index d0e6e7a7f2f69..17fa6eaa8d0f8 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php @@ -70,11 +70,6 @@ protected function prepareBundleOptions(BundleProduct $product) ? $assignedProduct['data']['selection_price_value'] : $bundleSelections['products'][$optionKey][$productKey]->getPrice(); - if ($product->hasData('group_price')) { - $groupedPrice = $product->getGroupPrice(); - $price -= $price / 100 * reset($groupedPrice)['price']; - } - $optionData['options'][$productKey] = [ 'title' => $assignedProduct['search_data']['name'], 'price' => number_format($price, 2), diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertGroupedPriceOnBundleProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertGroupedPriceOnBundleProductPage.php deleted file mode 100644 index 7d721ba3a304e..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertGroupedPriceOnBundleProductPage.php +++ /dev/null @@ -1,41 +0,0 @@ - [ - 'price_regular_price' => $view->getPriceBlock()->getPrice(), - 'price_from' => $view->getPriceBlock()->getPriceFrom(), - ], - 'fixture' => $product->getDataFieldConfig('price')['source']->getPriceData()['price_from'], - ]; - - $groupPrice['onPage'] = isset($groupPrice['onPage']['price_regular_price']) - ? str_replace('As low as $', '', $groupPrice['onPage']['price_regular_price']) - : str_replace('$', '', $groupPrice['onPage']['price_from']); - - return $groupPrice; - } -} diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/BundleProduct.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/BundleProduct.xml index 2cff47a580a63..8cd33885a7ddf 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/BundleProduct.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/BundleProduct.xml @@ -36,7 +36,6 @@ - diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductGroupedPriceOnProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductGroupedPriceOnProductPage.php deleted file mode 100644 index 62756906c842a..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductGroupedPriceOnProductPage.php +++ /dev/null @@ -1,107 +0,0 @@ -open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); - - //Process assertions - $this->assertPrice($product, $catalogProductView->getViewBlock()); - } - - /** - * Set $errorMessage for grouped price assert - * - * @param string $errorMessage - * @return void - */ - public function setErrorMessage($errorMessage) - { - $this->errorMessage = $errorMessage; - } - - /** - * Verify product special price on product view page - * - * @param FixtureInterface $product - * @param View $productViewBlock - * @param string $customerGroup [optional] - * @return void - */ - public function assertPrice(FixtureInterface $product, View $productViewBlock, $customerGroup = 'NOT LOGGED IN') - { - $this->customerGroup = $customerGroup; - $groupPrice = $this->getGroupedPrice($productViewBlock, $product); - \PHPUnit_Framework_Assert::assertEquals($groupPrice['fixture'], $groupPrice['onPage'], $this->errorMessage); - } - - /** - * Get grouped price with fixture product and product page - * - * @param View $view - * @param FixtureInterface $product - * @return array - */ - protected function getGroupedPrice(View $view, FixtureInterface $product) - { - $fields = $product->getData(); - $groupPrice['onPage'] = $view->getPriceBlock()->getSpecialPrice(); - $groupPrice['fixture'] = number_format( - $fields['group_price'][array_search($this->customerGroup, $fields['group_price'])]['price'], - 2 - ); - - return $groupPrice; - } - - /** - * Returns a string representation of the object - * - * @return string - */ - public function toString() - { - return 'Assert that displayed grouped price on product page equals passed from fixture.'; - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php index a90a36c207883..a32cc115d534b 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php @@ -64,15 +64,10 @@ protected function assertOnShoppingCart(FixtureInterface $product, CheckoutCart ? $checkoutData['options']['custom_options'] : []; $fixturePrice = $product->getPrice(); - $groupPrice = $product->getGroupPrice(); $specialPrice = $product->getSpecialPrice(); $cartItem = $checkoutCart->getCartBlock()->getCartItem($product); $formPrice = $cartItem->getPrice(); - if ($groupPrice) { - $groupPrice = reset($groupPrice); - $fixturePrice = $groupPrice['price']; - } if ($specialPrice) { $fixturePrice = $specialPrice; } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductView.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductView.php index 1766ff0ee6677..1414d6c21d1ef 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductView.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductView.php @@ -72,11 +72,6 @@ protected function assertOnProductView(CatalogProductSimple $product, CatalogPro $priceComparing = $specialPrice; } - if ($groupPrice = $product->getGroupPrice()) { - $groupPrice = reset($groupPrice); - $priceComparing = $groupPrice['price']; - } - if ($priceComparing && isset($price['price_special_price'])) { \PHPUnit_Framework_Assert::assertEquals( number_format($priceComparing, 2), diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml index e295d379e33d2..3978d53c2c9cf 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml @@ -35,7 +35,6 @@ - diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductVirtual.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductVirtual.xml index edcfc39f2c5b0..00daf26a837e8 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductVirtual.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductVirtual.xml @@ -36,7 +36,6 @@ - diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/GroupPriceOptions.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/GroupPriceOptions.xml deleted file mode 100644 index c55de6d823b8c..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/GroupPriceOptions.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - 20 - All Websites [USD] - NOT LOGGED IN - - - - - - 90 - All Websites [USD] - NOT LOGGED IN - - - - - - 90.99 - All Websites [USD] - General - - - - diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct.xml index 96623e3492dae..44fc2695de344 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct.xml @@ -36,7 +36,6 @@ - diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct.xml index 3d250fc3f2f46..0eabd581071c1 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct.xml @@ -34,7 +34,6 @@ - diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/NewActionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/NewActionTest.php deleted file mode 100644 index b87d11c2c90a3..0000000000000 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/NewActionTest.php +++ /dev/null @@ -1,38 +0,0 @@ -dispatch('backend/catalog/product/new/set/4/type/' . \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE); - $lines = explode(PHP_EOL, $this->getResponse()->getBody()); - foreach ($lines as $index => $line) { - if ($line && strpos($line, 'name="product[group_price][<%- data.index %>][cust_group]"') !== false) { - break; - } - } - $this->assertContains('name="product[group_price][<%- data.index %>][cust_group]"', $lines[$index]); - $this->assertContains('', $lines[$index + 1]); - $this->assertContains('', $lines[$index + 2]); - $this->assertContains('', $lines[$index + 3]); - $this->assertContains('', $lines[$index + 4]); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_group_prices.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_group_prices.php index 6f8e557f6cb0c..5127d8fd0a660 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_group_prices.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_group_prices.php @@ -18,20 +18,6 @@ ->setWeight(1) ->setShortDescription("Short description") ->setTaxClassId(0) - ->setGroupPrice( - [ - [ - 'website_id' => 0, - 'cust_group' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, - 'price' => 9, - ], - [ - 'website_id' => 0, - 'cust_group' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, - 'price' => 7, - ], - ] - ) ->setDescription('Description with html tag') ->setMetaTitle('meta title') ->setMetaKeyword('meta keyword') diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data.php index 86d5916e5446f..5320f53e15e11 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data.php @@ -37,8 +37,6 @@ 'simple' )->setPrice( 10 -)->setGroupPrice( - [0 => ['website_id' => 0, 'cust_group' => 0, 'price' => 9]] )->setTierPrice( [0 => ['website_id' => 0, 'cust_group' => 0, 'price_qty' => 3, 'price' => 8]] )->setVisibility( diff --git a/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/CollectionTest.php b/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/CollectionTest.php index 5b9917a935c1c..3b6a28728b876 100644 --- a/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/CollectionTest.php +++ b/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/CollectionTest.php @@ -53,7 +53,6 @@ public function setUp() [ 'regular_price' => 'RegularPrice', 'special_price' => 'SpecialPrice', - 'group_price' => 'GroupPrice', ] ); diff --git a/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/PoolTest.php b/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/PoolTest.php index 3bee8c2edb8c2..c7fe5ba818d22 100644 --- a/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/PoolTest.php +++ b/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/PoolTest.php @@ -43,7 +43,6 @@ public function setUp() 'special_price' => 'SpecialPrice', ]; $this->target = [ - 'group_price' => 'TargetGroupPrice', 'regular_price' => 'TargetRegularPrice', ]; $this->targetPool = new Pool($this->target); @@ -58,7 +57,6 @@ public function testMergedConfiguration() $expected = new Pool([ 'regular_price' => 'RegularPrice', 'special_price' => 'SpecialPrice', - 'group_price' => 'TargetGroupPrice', ]); $this->assertEquals($expected, $this->pool); } @@ -70,7 +68,6 @@ public function testGet() { $this->assertEquals('RegularPrice', $this->pool->get('regular_price')); $this->assertEquals('SpecialPrice', $this->pool->get('special_price')); - $this->assertEquals('TargetGroupPrice', $this->pool->get('group_price')); } /** @@ -80,7 +77,6 @@ public function testArrayAccess() { $this->assertEquals('RegularPrice', $this->pool['regular_price']); $this->assertEquals('SpecialPrice', $this->pool['special_price']); - $this->assertEquals('TargetGroupPrice', $this->pool['group_price']); $this->pool['fake_price'] = 'FakePrice'; $this->assertEquals('FakePrice', $this->pool['fake_price']); $this->assertTrue(isset($this->pool['fake_price'])); From cdb91959b5a0049b02d17b0593873e3d19758d37 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Mon, 21 Sep 2015 10:04:41 +0300 Subject: [PATCH 02/30] MAGETWO-42501: PCF: removing grouped price --- .../Model/Export/AdvancedPricing.php | 17 +------------- .../Model/Import/AdvancedPricing.php | 16 ------------- .../AdvancedPricing/Validator/Website.php | 3 --- .../Unit/Model/Import/AdvancedPricingTest.php | 18 --------------- .../Bundle/Model/Resource/Indexer/Price.php | 23 +------------------ app/code/Magento/Bundle/Setup/InstallData.php | 1 - .../Edit/Action/Attribute/Tab/Attributes.php | 1 - app/code/Magento/Catalog/Model/Product.php | 1 - .../Product/Indexer/Price/DefaultPrice.php | 7 ------ .../Unit/Model/Product/Type/PriceTest.php | 1 - .../Catalog/etc/catalog_attributes.xml | 1 - app/code/Magento/Catalog/etc/di.xml | 1 - .../Magento/Catalog/etc/eav_attributes.xml | 3 --- app/code/Magento/Catalog/etc/mview.xml | 2 -- .../base/layout/catalog_product_prices.xml | 3 --- .../view/adminhtml/web/product/product.css | 3 --- .../Api/ProductRepositoryInterfaceTest.php | 1 - .../Block/Adminhtml/Product/ProductForm.xml | 3 --- .../Fixtures/ConfigurableProductsFixture.php | 6 ----- 19 files changed, 2 insertions(+), 109 deletions(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php index 3fd289a3e0c6b..e20806f897c51 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php @@ -54,7 +54,6 @@ class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product */ protected $_priceWebsite = [ ImportAdvancedPricing::COL_TIER_PRICE_WEBSITE, - ImportAdvancedPricing::COL_GROUP_PRICE_WEBSITE, ]; /** @@ -64,7 +63,6 @@ class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product */ protected $_priceCustomerGroup = [ ImportAdvancedPricing::COL_TIER_PRICE_CUSTOMER_GROUP, - ImportAdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP, ]; /** @@ -74,9 +72,6 @@ class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product */ protected $templateExportData = [ ImportAdvancedPricing::COL_SKU => '', - ImportAdvancedPricing::COL_GROUP_PRICE_WEBSITE => '', - ImportAdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => '', - ImportAdvancedPricing::COL_GROUP_PRICE => '', ImportAdvancedPricing::COL_TIER_PRICE_WEBSITE => '', ImportAdvancedPricing::COL_TIER_PRICE_CUSTOMER_GROUP => '', ImportAdvancedPricing::COL_TIER_PRICE_QTY => '', @@ -333,17 +328,7 @@ protected function getTierAndGroupPrices(array $listSku, $table) if (isset($this->_parameters[\Magento\ImportExport\Model\Export::FILTER_ELEMENT_GROUP])) { $exportFilter = $this->_parameters[\Magento\ImportExport\Model\Export::FILTER_ELEMENT_GROUP]; } - if ($table == ImportAdvancedPricing::TABLE_GROUPED_PRICE) { - $selectFields = [ - ImportAdvancedPricing::COL_SKU => 'cpe.sku', - ImportAdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'ap.website_id', - ImportAdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => 'ap.customer_group_id', - ImportAdvancedPricing::COL_GROUP_PRICE => 'ap.value' - ]; - if (isset($exportFilter) && !empty($exportFilter)) { - $price = $exportFilter['group_price']; - } - } elseif ($table == ImportAdvancedPricing::TABLE_TIER_PRICE) { + if ($table == ImportAdvancedPricing::TABLE_TIER_PRICE) { $selectFields = [ ImportAdvancedPricing::COL_SKU => 'cpe.sku', ImportAdvancedPricing::COL_TIER_PRICE_WEBSITE => 'ap.website_id', diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php index f32fc8751d4ed..d3b29dc614c4b 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php @@ -32,16 +32,8 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract const COL_TIER_PRICE = 'tier_price'; - const COL_GROUP_PRICE_WEBSITE = 'group_price_website'; - - const COL_GROUP_PRICE_CUSTOMER_GROUP = 'group_price_customer_group'; - - const COL_GROUP_PRICE = 'group_price'; - const TABLE_TIER_PRICE = 'catalog_product_entity_tier_price'; - const TABLE_GROUPED_PRICE = 'catalog_product_entity_group_price'; - const DEFAULT_ALL_GROUPS_GROUPED_PRICE_VALUE = '0'; const ENTITY_TYPE_CODE = 'advanced_pricing'; @@ -50,8 +42,6 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract const VALIDATOR_WEBSITE = 'validator_website'; - const VALIDATOR_GROUP_PRICE = 'validator_group_price'; - /** * Validation failure message template definitions * @@ -65,9 +55,6 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract ValidatorInterface::ERROR_INVALID_TIER_PRICE_SITE => 'Tier Price data website is invalid', ValidatorInterface::ERROR_INVALID_TIER_PRICE_GROUP => 'Tier Price customer group is invalid', ValidatorInterface::ERROR_TIER_DATA_INCOMPLETE => 'Tier Price data is incomplete', - ValidatorInterface::ERROR_INVALID_GROUP_PRICE_SITE => 'Group Price data website is invalid', - ValidatorInterface::ERROR_INVALID_GROUP_PRICE_GROUP => 'Group Price customer group is invalid', - ValidatorInterface::ERROR_GROUP_PRICE_DATA_INCOMPLETE => 'Group Price data is incomplete', ValidatorInterface::ERROR_INVALID_ATTRIBUTE_DECIMAL => 'Value for \'%s\' attribute contains incorrect value, acceptable values are in decimal format', ]; @@ -90,9 +77,6 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract self::COL_TIER_PRICE_CUSTOMER_GROUP, self::COL_TIER_PRICE_QTY, self::COL_TIER_PRICE, - self::COL_GROUP_PRICE_WEBSITE, - self::COL_GROUP_PRICE_CUSTOMER_GROUP, - self::COL_GROUP_PRICE, ]; /** diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/Website.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/Website.php index 322a5b1956816..ff66ecafcc095 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/Website.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/Website.php @@ -72,9 +72,6 @@ public function isValid($value) if (isset($value[AdvancedPricing::COL_TIER_PRICE]) && !empty($value[AdvancedPricing::COL_TIER_PRICE])) { $valid *= $this->isWebsiteValid($value, AdvancedPricing::COL_TIER_PRICE_WEBSITE); } - if (isset($value[AdvancedPricing::COL_GROUP_PRICE]) && !empty($value[AdvancedPricing::COL_GROUP_PRICE])) { - $valid *= $this->isWebsiteValid($value, AdvancedPricing::COL_GROUP_PRICE_WEBSITE); - } if (!$valid) { $this->_addMessages([self::ERROR_INVALID_WEBSITE]); } diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php index 3957e1727e6d4..f685fea4c65c9 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php @@ -405,12 +405,10 @@ public function testSaveAndReplaceAdvancedPricesAppendBehaviourDataAndCalls( $this->advancedPricing->expects($this->any())->method('getCustomerGroupId')->willReturnMap([ [$data[0][AdvancedPricing::COL_TIER_PRICE_CUSTOMER_GROUP], $tierCustomerGroupId], - [$data[0][AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP], $groupCustomerGroupId] ]); $this->advancedPricing->expects($this->any())->method('getWebSiteId')->willReturnMap([ [$data[0][AdvancedPricing::COL_TIER_PRICE_WEBSITE], $tierWebsiteId], - [$data[0][AdvancedPricing::COL_GROUP_PRICE_WEBSITE], $groupWebsiteId] ]); $this->advancedPricing->expects($this->any())->method('saveProductPrices')->will($this->returnSelf()); @@ -556,10 +554,6 @@ public function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider() AdvancedPricing::COL_TIER_PRICE_CUSTOMER_GROUP => 'tier price customer group value - not all groups ', AdvancedPricing::COL_TIER_PRICE_QTY => 'tier price qty value', AdvancedPricing::COL_TIER_PRICE => 'tier price value', - //group - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group price website value', - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => 'group price customer group value - not all groups ', - AdvancedPricing::COL_GROUP_PRICE => 'group price value', ], ], '$tierCustomerGroupId' => 'tier customer group id value', @@ -587,10 +581,6 @@ public function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider() AdvancedPricing::COL_TIER_PRICE_CUSTOMER_GROUP => AdvancedPricing::VALUE_ALL_GROUPS, AdvancedPricing::COL_TIER_PRICE_QTY => 'tier price qty value', AdvancedPricing::COL_TIER_PRICE => 'tier price value', - //group - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group price website value', - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => 'group price customer group value', - AdvancedPricing::COL_GROUP_PRICE => 'group price value', ], ], '$tierCustomerGroupId' => 'tier customer group id value', @@ -618,10 +608,6 @@ public function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider() AdvancedPricing::COL_TIER_PRICE_CUSTOMER_GROUP => 'tier price customer group value - not all groups', AdvancedPricing::COL_TIER_PRICE_QTY => 'tier price qty value', AdvancedPricing::COL_TIER_PRICE => 'tier price value', - //group - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group price website value', - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => 'group price customer group value', - AdvancedPricing::COL_GROUP_PRICE => 'group price value', ], ], '$tierCustomerGroupId' => 'tier customer group id value', @@ -639,10 +625,6 @@ public function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider() AdvancedPricing::COL_TIER_PRICE_CUSTOMER_GROUP => 'tier price customer group value - not all groups', AdvancedPricing::COL_TIER_PRICE_QTY => 'tier price qty value', AdvancedPricing::COL_TIER_PRICE => 'tier price value', - //group - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => null, - AdvancedPricing::COL_GROUP_PRICE_CUSTOMER_GROUP => 'group price customer group value', - AdvancedPricing::COL_GROUP_PRICE => 'group price value', ], ], '$tierCustomerGroupId' => 'tier customer group id value', diff --git a/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php b/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php index 6471dd8fcc8c5..a766f993cddcc 100644 --- a/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php +++ b/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php @@ -281,8 +281,6 @@ protected function _calculateBundleOptionPrice() 'max_price' => $connection->getCheckSql('i.group_type = 1', 'SUM(i.price)', 'MAX(i.price)'), 'tier_price' => $connection->getCheckSql('i.is_required = 1', 'MIN(i.tier_price)', '0'), 'alt_tier_price' => $connection->getCheckSql('i.is_required = 0', 'MIN(i.tier_price)', '0'), - 'group_price' => $connection->getCheckSql('i.is_required = 1', 'MIN(i.group_price)', '0'), - 'alt_group_price' => $connection->getCheckSql('i.is_required = 0', 'MIN(i.group_price)', '0'), ] ); @@ -324,7 +322,6 @@ protected function _calculateBundleOptionPrice() 'max_price' => $maxPrice, 'tier_price' => $tierPrice, 'base_tier' => 'MIN(i.base_tier)', - 'base_group_price' => 'MIN(i.base_group_price)', ] ); @@ -386,25 +383,8 @@ protected function _calculateBundleSelectionPrice($priceType) 'NULL' ); - $groupExpr = $connection->getCheckSql( - 'i.base_group_price IS NOT NULL', - $connection->getCheckSql( - $selectionPriceType . ' = 1', - $priceExpr, - $connection->getCheckSql( - 'i.group_price_percent > 0', - 'ROUND(' . - $selectionPriceValue . - ' - (' . - $selectionPriceValue . - ' * (i.group_price_percent / 100)),4)', - $selectionPriceValue - ) - ) . ' * bs.selection_qty', - 'NULL' - ); $priceExpr = new \Zend_Db_Expr( - $connection->getCheckSql("{$groupExpr} < {$priceExpr}", $groupExpr, $priceExpr) + $connection->getCheckSql("{$tierExpr} < {$priceExpr}", $tierExpr, $priceExpr) ); } else { $priceExpr = new \Zend_Db_Expr( @@ -454,7 +434,6 @@ protected function _calculateBundleSelectionPrice($priceType) 'is_required' => 'bo.required', 'price' => $priceExpr, 'tier_price' => $tierExpr, - 'group_price' => $groupExpr, ] ); diff --git a/app/code/Magento/Bundle/Setup/InstallData.php b/app/code/Magento/Bundle/Setup/InstallData.php index b24e8b68dbc71..16a1409304e42 100644 --- a/app/code/Magento/Bundle/Setup/InstallData.php +++ b/app/code/Magento/Bundle/Setup/InstallData.php @@ -51,7 +51,6 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface 'cost', 'tier_price', 'weight', - 'group_price', ]; foreach ($fieldList as $field) { $applyTo = explode( diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php index 3f5f4d9f3a94c..cd132d6424533 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php @@ -70,7 +70,6 @@ protected function _prepareForm() [ 'category_ids', 'gallery', - 'group_price', 'image', 'media_gallery', 'quantity_and_stock_status', diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index eaec9d9f2455a..9a26e047613b7 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -314,7 +314,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements ProductInterface::STORE_ID, 'media_gallery', 'tier_price', - 'group_price', ]; /** diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php index ae3530da85bd4..7c7ddf7536910 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php @@ -515,7 +515,6 @@ protected function _applyCustomOption() 'min_price' => 'SUM(min_price)', 'max_price' => 'SUM(max_price)', 'tier_price' => 'SUM(tier_price)', - 'group_price' => 'SUM(group_price)' ] )->group( ['entity_id', 'customer_group_id', 'website_id'] @@ -539,11 +538,6 @@ protected function _applyCustomOption() 'i.tier_price + io.tier_price', 'NULL' ), - 'group_price' => $connection->getCheckSql( - 'i.group_price IS NOT NULL', - 'i.group_price + io.group_price', - 'NULL' - ), ] ); $query = $select->crossUpdateFromSelect($table); @@ -572,7 +566,6 @@ protected function _movePriceDataToIndexTable() 'min_price' => 'min_price', 'max_price' => 'max_price', 'tier_price' => 'tier_price', - 'group_price' => 'group_price', ]; $connection = $this->getConnection(); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php index d9358751f8e42..30d57127245e4 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php @@ -16,7 +16,6 @@ */ class PriceTest extends \PHPUnit_Framework_TestCase { - const KEY_GROUP_PRICE = 'group_price'; const KEY_TIER_PRICE = 'tier_price'; const PRICE_SCOPE_GLOBAL = 0; const PRICE_SCOPE_WEBSITE = 1; diff --git a/app/code/Magento/Catalog/etc/catalog_attributes.xml b/app/code/Magento/Catalog/etc/catalog_attributes.xml index 50470a73308b4..3047ea441e2e3 100644 --- a/app/code/Magento/Catalog/etc/catalog_attributes.xml +++ b/app/code/Magento/Catalog/etc/catalog_attributes.xml @@ -47,7 +47,6 @@ - diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index c24aae6f5ab60..b5c4d3168295d 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -68,7 +68,6 @@ Magento\Catalog\Model\Session\Proxy - group_price_changed tier_price_changed diff --git a/app/code/Magento/Catalog/etc/eav_attributes.xml b/app/code/Magento/Catalog/etc/eav_attributes.xml index 3ba4dfae9d8b0..37623d9894b7f 100644 --- a/app/code/Magento/Catalog/etc/eav_attributes.xml +++ b/app/code/Magento/Catalog/etc/eav_attributes.xml @@ -26,9 +26,6 @@ - - - diff --git a/app/code/Magento/Catalog/etc/mview.xml b/app/code/Magento/Catalog/etc/mview.xml index 2c84b4d8d9fde..21f1c8d6ad46e 100644 --- a/app/code/Magento/Catalog/etc/mview.xml +++ b/app/code/Magento/Catalog/etc/mview.xml @@ -35,7 +35,6 @@
-
@@ -49,7 +48,6 @@
-
diff --git a/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml b/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml index 8e700eac76263..135f43cdce6d9 100644 --- a/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml +++ b/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml @@ -17,9 +17,6 @@ Magento_Catalog::product/price/special_price.phtml - - Magento_Catalog::product/price/group_price.phtml - Magento_Catalog::product/price/tier_prices.phtml diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/product/product.css b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/product/product.css index ae623978703f5..0383db2fac0f0 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/product/product.css +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/product/product.css @@ -163,9 +163,6 @@ #product_options_container .data-table td, #attribute-tier_price-container .data-table td, -#attribute-group_price-container .data-table td { - vertical-align: top; -} #product_options_container .data-table td.opt-price-type, #product_options_container .data-table td.select-opt-price-type, diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php index 6ecbea9b5bfaf..315edbbbe4b4a 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php @@ -15,7 +15,6 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract const SERVICE_VERSION = 'V1'; const RESOURCE_PATH = '/V1/products'; - const KEY_GROUP_PRICES = 'group_prices'; const KEY_TIER_PRICES = 'tier_prices'; /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml index 7e94d4691cf15..49b856c8752b4 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml @@ -78,9 +78,6 @@ product - - select - select diff --git a/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php b/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php index a5b6ad9b38dcf..0fbdc3c99f3d0 100644 --- a/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php +++ b/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php @@ -124,9 +124,6 @@ protected function getHeaders() '_tier_price_customer_group', '_tier_price_qty', '_tier_price_price', - '_group_price_website', - '_group_price_customer_group', - '_group_price_price', '_media_attribute_id', '_media_image', '_media_label', @@ -249,9 +246,6 @@ protected function getRows($productCategory, $productWebsite) '_tier_price_customer_group' => '', '_tier_price_qty' => '', '_tier_price_price' => '', - '_group_price_website' => '', - '_group_price_customer_group' => '', - '_group_price_price' => '', '_media_attribute_id' => '', '_media_image' => '', '_media_label' => '', From 2e7a23464c4888c97a5bee368f02b7c9e74d2ef3 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sat, 26 Sep 2015 21:20:04 +0300 Subject: [PATCH 03/30] MAGETWO-42501: PCF: removing grouped price --- .../Unit/Model/Export/AdvancedPricingTest.php | 6 --- .../Validator/TierPriceTest.php | 46 ------------------- .../AdvancedPricing/Validator/WebsiteTest.php | 13 ------ .../Unit/Model/Import/AdvancedPricingTest.php | 7 +-- .../Backend/GroupPrice/AbstractTest.php | 2 +- .../Test/Unit/Setup/CategorySetupTest.php | 1 - .../Model/Export/Product/Type/Simple.php | 1 - .../Model/Import/Product.php | 3 -- app/code/Magento/CatalogRule/etc/mview.xml | 1 - .../Product/Indexer/Price/Configurable.php | 4 -- .../ConfigurableProduct/Setup/InstallData.php | 1 - .../Downloadable/Setup/InstallData.php | 1 - .../Product/Indexer/Price/Grouped.php | 1 - .../Api/ConfigurableProductManagementTest.php | 1 - .../Constraint/AssertBundleInCategory.php | 2 +- .../Test/Constraint/AssertBundlePriceType.php | 5 +- .../Test/Constraint/AssertBundlePriceView.php | 2 +- .../Product/Edit/AdvancedPricingTab.php | 1 - .../Handler/CatalogProductSimple/Curl.php | 3 -- .../Test/Repository/CatalogProductSimple.xml | 38 --------------- 20 files changed, 5 insertions(+), 134 deletions(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php index 49555974a3684..82a892d1b6181 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php @@ -414,9 +414,6 @@ public function testExportCurrentPageCalls() $data = [ [ 'sku' => 'simpletest', - 'group_price_website' => $webSite, - 'group_price_customer_group' => $userGroup, - 'group_price' => '100', 'tier_price_website' => $webSite, 'tier_price_customer_group' => $userGroup, 'tier_price_qty' => '2', @@ -426,9 +423,6 @@ public function testExportCurrentPageCalls() $this->advancedPricing->expects($this->once())->method('getExportData')->willReturn($data); $exportData = [ 'sku' => 'simpletest', - 'group_price_website' => $webSite, - 'group_price_customer_group' => $userGroup, - 'group_price' => '100', 'tier_price_website' => $webSite, 'tier_price_customer_group' => $userGroup, 'tier_price_qty' => '2', diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php index e377b07424693..42cd38395955e 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php @@ -132,52 +132,6 @@ public function testInitAddToCustomerGroups() $this->assertEquals($expectedCustomerGroups, $this->getPropertyValue($this->tierPrice, 'customerGroups')); } - public function testIsValidInitCall() - { - $tierPrice = $this->tierPrice = $this->getMock( - 'Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TearPrice', - ['init', '_clearMessages'], - [ - $this->groupRepository, - $this->searchCriteriaBuilder, - $this->storeResolver, - ], - '' - ); - $tierPrice->expects($this->once())->method('_clearMessages'); - $this->setPropertyValue($tierPrice, 'customerGroups', false); - $tierPrice->expects($this->once())->method('init'); - - $tierPrice->isValid([]); - } - - /** - * @dataProvider isValidResultFalseDataProvider - * - * @param array $value - * @param bool $hasEmptyColumns - * @param array $customerGroups - */ - public function testIsValidResultFalse($value, $hasEmptyColumns, $customerGroups) - { - $tierPrice = $this->getMock( - 'Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TearPrice', - ['init', '_clearMessages', 'isValidValueAndLength', 'hasEmptyColumns'], - [ - $this->groupRepository, - $this->searchCriteriaBuilder, - $this->storeResolver, - ], - '' - ); - $tierPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(true); - $tierPrice->expects($this->any())->method('hasEmptyColumns')->willReturn($hasEmptyColumns); - $this->setPropertyValue($tierPrice, 'customerGroups', $customerGroups); - - $result = $tierPrice->isValid($value); - $this->assertFalse($result); - } - public function testIsValidResultTrue() { $this->tierPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(false); diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php index c0dc253b1bd65..5d50517203168 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php @@ -88,7 +88,6 @@ public function testIsValidReturnAddMessagesCall() { $value = [ AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value', - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group value', ]; $allWebsitesValue = 'not tier|group price website value'; $colTierPriceWebsite = false; @@ -135,9 +134,7 @@ public function isValidReturnDataProvider() [ '$value' => [ AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value', - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group value', AdvancedPricing::COL_TIER_PRICE => 'value', - AdvancedPricing::COL_GROUP_PRICE => 'group value', ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => false, @@ -146,9 +143,7 @@ public function isValidReturnDataProvider() [ '$value' => [ AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value', - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group value', AdvancedPricing::COL_TIER_PRICE => 'tier value', - AdvancedPricing::COL_GROUP_PRICE => 'value', ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => false, @@ -157,9 +152,7 @@ public function isValidReturnDataProvider() [ '$value' => [ AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value', - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group value', AdvancedPricing::COL_TIER_PRICE => 'value', - AdvancedPricing::COL_GROUP_PRICE => ' group value', ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => 'value', @@ -168,9 +161,7 @@ public function isValidReturnDataProvider() [ '$value' => [ AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value', - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group value', AdvancedPricing::COL_TIER_PRICE => 'tier value', - AdvancedPricing::COL_GROUP_PRICE => 'value', ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => 'value', @@ -180,7 +171,6 @@ public function isValidReturnDataProvider() [ '$value' => [ AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value', - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group value', ], '$allWebsites' => 'tier value', '$colTierPriceWebsite' => 'value', @@ -189,7 +179,6 @@ public function isValidReturnDataProvider() [ '$value' => [ AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value', - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group value', ], '$allWebsites' => 'group value', '$colTierPriceWebsite' => 'value', @@ -198,7 +187,6 @@ public function isValidReturnDataProvider() [ '$value' => [ AdvancedPricing::COL_TIER_PRICE_WEBSITE => false, - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => 'group value', ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => 'value', @@ -207,7 +195,6 @@ public function isValidReturnDataProvider() [ '$value' => [ AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value', - AdvancedPricing::COL_GROUP_PRICE_WEBSITE => false, ], '$allWebsites' => 'not tier|group price website value', '$colTierPriceWebsite' => 'value', diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php index f685fea4c65c9..632388d1eefd4 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php @@ -453,10 +453,6 @@ public function testSaveAndReplaceAdvancedPricesReplaceBehaviourInternalCalls() ->expects($this->any()) ->method('deleteProductTierAndGroupPrices') ->withConsecutive( - [ - $listSku, - AdvancedPricing::TABLE_GROUPED_PRICE - ], [ $listSku, AdvancedPricing::TABLE_TIER_PRICE, @@ -498,10 +494,9 @@ public function testDeleteAdvancedPricingFormListSkuToDelete() $this->advancedPricing->expects($this->any())->method('validateRow')->willReturn(true); $expectedSkuList = ['sku value']; $this->advancedPricing - ->expects($this->exactly(2)) + ->expects($this->once()) ->method('deleteProductTierAndGroupPrices') ->withConsecutive( - [$expectedSkuList, AdvancedPricing::TABLE_GROUPED_PRICE], [$expectedSkuList, AdvancedPricing::TABLE_TIER_PRICE] )->will($this->returnSelf()); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php index 67d6f0f9e3e0f..0d441f025c1fc 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php @@ -67,7 +67,7 @@ public function testGetAffectedFields() $attribute->expects($this->any())->method('getBackendTable')->will($this->returnValue('table')); - $attribute->expects($this->any())->method('getName')->will($this->returnValue('group_price')); + $attribute->expects($this->any())->method('getName')->will($this->returnValue('tear_price')); $this->_model->setAttribute($attribute); diff --git a/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php b/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php index 4d6d8b722021b..6130294814ad8 100644 --- a/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php @@ -76,7 +76,6 @@ public function testGetDefaultEntitiesContainAllAttributes() 'thumbnail', 'media_gallery', 'old_id', - 'group_price', 'tier_price', 'color', 'news_from_date', diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product/Type/Simple.php b/app/code/Magento/CatalogImportExport/Model/Export/Product/Type/Simple.php index 5b42a3b6e1913..dba9af98c9df7 100644 --- a/app/code/Magento/CatalogImportExport/Model/Export/Product/Type/Simple.php +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product/Type/Simple.php @@ -32,7 +32,6 @@ class Simple extends \Magento\CatalogImportExport\Model\Export\Product\Type\Abst protected $_disabledAttrs = [ 'old_id', 'tier_price', - 'group_price', 'category_ids', ]; } diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index da6fb8b468409..c770b5e787090 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -308,9 +308,6 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity '_tier_price_qty', '_tier_price_price', '_related_sku', - '_group_price_website', - '_group_price_customer_group', - '_group_price_price', '_related_position', '_crosssell_sku', '_crosssell_position', diff --git a/app/code/Magento/CatalogRule/etc/mview.xml b/app/code/Magento/CatalogRule/etc/mview.xml index 4fbb8a21147cc..4ae7eb54cc967 100644 --- a/app/code/Magento/CatalogRule/etc/mview.xml +++ b/app/code/Magento/CatalogRule/etc/mview.xml @@ -17,7 +17,6 @@
-
diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php index 313c73e6b5a36..391a608b7c35c 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php @@ -149,10 +149,7 @@ protected function _applyConfigurableOption() 'parent_id', 'customer_group_id', 'website_id', - $connection->getCheckSql("MIN(group_price) IS NOT NULL", "group_price", 'MIN(price)'), - $connection->getCheckSql("MIN(group_price) IS NOT NULL", "group_price", 'MAX(price)'), 'MIN(tier_price)', - 'MIN(group_price)' ] )->group( ['parent_id', 'customer_group_id', 'website_id'] @@ -173,7 +170,6 @@ protected function _applyConfigurableOption() 'min_price' => new \Zend_Db_Expr('i.min_price - i.orig_price + io.min_price'), 'max_price' => new \Zend_Db_Expr('i.max_price - i.orig_price + io.max_price'), 'tier_price' => 'io.tier_price', - 'group_price' => 'io.group_price' ] ); diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php index 9a886fb83ab80..1d6705846db6e 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php @@ -44,7 +44,6 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); $attributes = [ 'country_of_manufacture', - 'group_price', 'minimal_price', 'msrp', 'msrp_display_actual_price_type', diff --git a/app/code/Magento/Downloadable/Setup/InstallData.php b/app/code/Magento/Downloadable/Setup/InstallData.php index f6f376617e0fe..ef18bb25f1d18 100644 --- a/app/code/Magento/Downloadable/Setup/InstallData.php +++ b/app/code/Magento/Downloadable/Setup/InstallData.php @@ -155,7 +155,6 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface 'minimal_price', 'cost', 'tier_price', - 'group_price', 'weight', ]; diff --git a/app/code/Magento/GroupedProduct/Model/Resource/Product/Indexer/Price/Grouped.php b/app/code/Magento/GroupedProduct/Model/Resource/Product/Indexer/Price/Grouped.php index 545522b98ab7b..7605bda8a0ae9 100644 --- a/app/code/Magento/GroupedProduct/Model/Resource/Product/Indexer/Price/Grouped.php +++ b/app/code/Magento/GroupedProduct/Model/Resource/Product/Indexer/Price/Grouped.php @@ -96,7 +96,6 @@ protected function _prepareGroupedProductPriceData($entityIds = null) 'min_price' => new \Zend_Db_Expr('MIN(' . $minCheckSql . ')'), 'max_price' => new \Zend_Db_Expr('MAX(' . $maxCheckSql . ')'), 'tier_price' => new \Zend_Db_Expr('NULL'), - 'group_price' => new \Zend_Db_Expr('NULL') ] )->group( ['e.entity_id', 'cg.customer_group_id', 'cw.website_id'] diff --git a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ConfigurableProductManagementTest.php b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ConfigurableProductManagementTest.php index 4522abb56de22..37b5113ea7540 100644 --- a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ConfigurableProductManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ConfigurableProductManagementTest.php @@ -71,7 +71,6 @@ public function testGetVariation() 'value' => $attributeOptionValue ] ], - 'group_prices' => [], 'tier_prices' => [] ] ]; diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleInCategory.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleInCategory.php index a70183ca9d5dd..f800f5847c3a6 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleInCategory.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleInCategory.php @@ -31,7 +31,7 @@ protected function assertPrice(FixtureInterface $bundle, CatalogCategoryView $ca //Price from/to verification $priceBlock = $catalogCategoryView->getListProductBlock()->getProductItem($bundle)->getPriceBlock(); - if ($bundle->hasData('special_price') || $bundle->hasData('group_price')) { + if ($bundle->hasData('special_price')) { $priceLow = $priceBlock->getPrice(); } else { $priceLow = ($bundle->getPriceView() == 'Price Range') diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php index a4346357991c5..b923974961594 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php @@ -79,10 +79,7 @@ protected function assertPrice( $checkoutCartView->open(); $cartItem = $checkoutCartView->getCartBlock()->getCartItem($product); $specialPrice = 0; - if (isset($bundleData['group_price'])) { - $specialPrice = - $bundleData['group_price'][array_search($customerGroup, $bundleData['group_price'])]['price'] / 100; - } + $optionPrice = []; $fillData = $product->getCheckoutData(); diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php index 3a714a0115e86..cb28099f1918b 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php @@ -49,7 +49,7 @@ protected function assertPrice(BundleProduct $product, CatalogProductView $catal $priceView = $product->getPriceView(); $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); - if ($product->hasData('special_price') || $product->hasData('group_price')) { + if ($product->hasData('special_price')) { $priceLow = $priceBlock->getPrice(); } else { $priceLow = ($priceView == 'Price Range') ? $priceBlock->getPriceFrom() : $priceBlock->getPrice(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab.php index e7f1c90383658..8b7671c7d7194 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab.php @@ -20,7 +20,6 @@ class AdvancedPricingTab extends ProductTab * @var array */ protected $childrenForm = [ - 'group_price' => 'AdvancedPricingTab\OptionGroup', 'tier_price' => 'AdvancedPricingTab\OptionTier', ]; diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php index 56d819a6ed398..eac75ae85a342 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php @@ -204,9 +204,6 @@ protected function prepareData(FixtureInterface $fixture, $prefix = null) if (isset($fields['tier_price'])) { $fields['tier_price'] = $this->preparePriceData($fields['tier_price']); } - if (isset($fields['group_price'])) { - $fields['group_price'] = $this->preparePriceData($fields['group_price']); - } if (isset($fields['fpt'])) { $attributeLabel = $fixture->getDataFieldConfig('attribute_set_id')['source'] ->getAttributeSet()->getDataFieldConfig('assigned_attributes')['source'] diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml index 831681a82f09b..bd622130ea911 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml @@ -517,44 +517,6 @@ 9 - - - default - - Simple Product %isolation% - sku_simple_product_%isolation% - - 100 - - 1 - - not_logged_in_20 - - simple-product-%isolation% - - - - - default - - Simple Product %isolation% - sku_simple_product_%isolation% - - 100 - - 1 - - general_90_99 - - - default_subcategory - - - Main Website - - simple-product-%isolation% - - default From 7c007f0206f384ea528259ffe17a2d506798c293 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 09:54:40 +0300 Subject: [PATCH 04/30] MAGETWO-42501: PCF: removing grouped price --- app/code/Magento/Bundle/Model/Product/Price.php | 4 ++++ .../Attribute/Backend/GroupPrice/AbstractGroupPrice.php | 2 +- .../Magento/Bundle/Test/Constraint/AssertBundlePriceType.php | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Bundle/Model/Product/Price.php b/app/code/Magento/Bundle/Model/Product/Price.php index cb8129123140e..a2c0430d00d43 100644 --- a/app/code/Magento/Bundle/Model/Product/Price.php +++ b/app/code/Magento/Bundle/Model/Product/Price.php @@ -40,6 +40,8 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price protected $_catalogData = null; /** + * Price constructor. + * * @param \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate @@ -47,6 +49,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param PriceCurrencyInterface $priceCurrency * @param GroupManagementInterface $groupManagement + * @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Helper\Data $catalogData * @@ -94,6 +97,7 @@ public function getIsPricesCalculatedByIndex() * * @param \Magento\Catalog\Model\Product $product * @return float + * * @deprecated (MAGETWO-31476) */ public function getPrice($product) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php index 9d51374069419..91bfe6adbeec5 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php @@ -107,7 +107,7 @@ protected function _getWebsiteCurrencyRates() /** * Retrieve resource instance * - * @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice + * @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice */ abstract protected function _getResource(); diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php index b923974961594..be0f886de0a7a 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php @@ -69,7 +69,6 @@ protected function assertPrice( CheckoutCart $checkoutCartView, BundleProduct $originalProduct = null ) { - $customerGroup = 'NOT LOGGED IN'; $bundleData = $product->getData(); $this->productPriceType = $originalProduct !== null ? $originalProduct->getPriceType() From 4b54579ff0343a72871914ed833ddb715a3ef092 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 10:44:01 +0300 Subject: [PATCH 05/30] MAGETWO-42501: PCF: removing grouped price --- .../Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php index 91bfe6adbeec5..93d670a2e9cf6 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php @@ -436,7 +436,7 @@ public function getAffectedFields($object) /** * Get resource model instance * - * @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice + * @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice\AbstractGroupPrice */ public function getResource() { From be4f7c6299c39803663988bd204ae5919c5d2102 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 10:52:13 +0300 Subject: [PATCH 06/30] MAGETWO-42501: PCF: removing grouped price --- app/code/Magento/Catalog/Model/Product/Type/Price.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php index 9f80e550c5579..d0d27c694288b 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -81,6 +81,7 @@ class Price protected $config; /** + * Price constructor. * @param \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate @@ -88,6 +89,7 @@ class Price * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param PriceCurrencyInterface $priceCurrency * @param GroupManagementInterface $groupManagement + * @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $config * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -174,6 +176,7 @@ public function getFinalPrice($qty, $product) * @param Product $childProduct * @param float $childProductQty * @return float + * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function getChildFinalPrice($product, $productQty, $childProduct, $childProductQty) From eb4eed0883a1dc8babf09c5b83bee9a1209e2b9b Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 10:53:52 +0300 Subject: [PATCH 07/30] MAGETWO-42501: PCF: removing grouped price --- app/code/Magento/Catalog/Setup/CategorySetup.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Catalog/Setup/CategorySetup.php b/app/code/Magento/Catalog/Setup/CategorySetup.php index 77a0d20c1ee5c..9a10844011b8f 100644 --- a/app/code/Magento/Catalog/Setup/CategorySetup.php +++ b/app/code/Magento/Catalog/Setup/CategorySetup.php @@ -581,7 +581,6 @@ public function getDefaultEntities() 'type' => 'decimal', 'label' => 'Group Price', 'input' => 'text', - 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice', 'required' => false, 'sort_order' => 2, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, From 57153797077b57220570e9cc9d3725b188342e42 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 13:09:43 +0300 Subject: [PATCH 08/30] MAGETWO-42501: PCF: removing grouped price --- .../Magento/Bundle/Setup/UpgradeSchema.php | 50 +++++++++++++++++ app/code/Magento/Bundle/etc/module.xml | 2 +- .../Magento/Catalog/Setup/UpgradeData.php | 31 +++++++++++ .../Magento/Catalog/Setup/UpgradeSchema.php | 53 +++++++++++++++++++ app/code/Magento/Catalog/etc/module.xml | 2 +- 5 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Bundle/Setup/UpgradeSchema.php create mode 100644 app/code/Magento/Catalog/Setup/UpgradeData.php create mode 100644 app/code/Magento/Catalog/Setup/UpgradeSchema.php diff --git a/app/code/Magento/Bundle/Setup/UpgradeSchema.php b/app/code/Magento/Bundle/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..9281d4006f9cb --- /dev/null +++ b/app/code/Magento/Bundle/Setup/UpgradeSchema.php @@ -0,0 +1,50 @@ +startSetup(); + $connection = $setup->getConnection(); + if (version_compare($context->getVersion(), '2.0.1', '<')) { + + $fields = [ + ['table' => 'catalog_product_index_price_bundle_opt_idx', 'column' => 'alt_group_price'], + ['table' => 'catalog_product_index_price_bundle_opt_tmp', 'column' => 'alt_group_price'], + ['table' => 'catalog_product_index_price_bundle_idx', 'column' => 'base_group_price'], + ['table' => 'catalog_product_index_price_bundle_tmp', 'column' => 'base_group_price'], + ['table' => 'catalog_product_index_price_bundle_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_bundle_opt_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_bundle_opt_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_bundle_sel_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_bundle_sel_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_bundle_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_bundle_idx', 'column' => 'group_price_percent'], + ['table' => 'catalog_product_index_price_bundle_tmp', 'column' => 'group_price_percent'], + ]; + + foreach ($fields as $filedInfo) { + $connection->dropColumn($setup->getTable($filedInfo['table']), + $filedInfo['column']); + } + } + + $setup->endSetup(); + } +} diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml index 5f435d51c45dd..133212807a9be 100644 --- a/app/code/Magento/Bundle/etc/module.xml +++ b/app/code/Magento/Bundle/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Catalog/Setup/UpgradeData.php b/app/code/Magento/Catalog/Setup/UpgradeData.php new file mode 100644 index 0000000000000..75ec3928f1516 --- /dev/null +++ b/app/code/Magento/Catalog/Setup/UpgradeData.php @@ -0,0 +1,31 @@ +startSetup(); + if (version_compare($context->getVersion(), '2.0.1', '<')) { + + } + $setup->endSetup(); + } +} diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..cb14e600857bc --- /dev/null +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -0,0 +1,53 @@ +startSetup(); + $connection = $setup->getConnection(); + if (version_compare($context->getVersion(), '2.0.1', '<')) { + + $fields = [ + ['table' => 'catalog_product_index_price_final_idx', 'column' => 'base_group_price'], + ['table' => 'catalog_product_index_price_final_tmp', 'column' => 'base_group_price'], + ['table' => 'catalog_product_index_price', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_cfg_opt_agr_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_cfg_opt_agr_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_cfg_opt_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_cfg_opt_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_final_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_final_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_opt_agr_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_opt_agr_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_opt_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_opt_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_tmp', 'column' => 'group_price'], + ]; + + foreach ($fields as $filedInfo) { + $connection->dropColumn($setup->getTable($filedInfo['table']), + $filedInfo['column']); + } + } + + $setup->endSetup(); + } +} diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index ed2f204b24e5c..ace5d6f78eb07 100644 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + From 36e95222844f23c7a9ba36b1e2759229d9025d73 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 15:07:33 +0300 Subject: [PATCH 09/30] MAGETWO-42501: PCF: removing grouped price --- app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php index b618d4713ad17..a4627d0c12c75 100644 --- a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php @@ -636,10 +636,7 @@ protected function getRuleProductsStmt($websiteId, $productId = null) [] ); $select->columns([ - 'default_price' => $this->connection->getIfNullSql( - 'gp.value', - $this->connection->getIfNullSql($tableAlias . '.value', 'pp_default.value') - ), + 'default_price' =>$this->connection->getIfNullSql($tableAlias . '.value', 'pp_default.value'), ]); return $this->connection->query($select); From 4d33b7864d680fbf909fafea028f355055ef6fa2 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 18:41:10 +0300 Subject: [PATCH 10/30] MAGETWO-42501: PCF: removing grouped price --- .../Block/Adminhtml/Product/Attribute/Edit/Tab/FrontTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/FrontTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/FrontTest.php index 97fae046b884b..c008ac20750a8 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/FrontTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/FrontTest.php @@ -56,7 +56,6 @@ public function toHtmlDataProvider() ['visibility'], ['url_key'], ['status'], - ['group_price'], ['price_type'], ['category_ids'], ['media_gallery'], From 2b661a00ab786e3060e99d71e175688c99c4bdb9 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 18:42:45 +0300 Subject: [PATCH 11/30] MAGETWO-42501: PCF: removing grouped price --- .../Model/Resource/Product/Indexer/Price/Configurable.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php index 391a608b7c35c..1a3dd7d1e1369 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Indexer/Price/Configurable.php @@ -149,6 +149,8 @@ protected function _applyConfigurableOption() 'parent_id', 'customer_group_id', 'website_id', + 'MIN(price)', + 'MAX(price)', 'MIN(tier_price)', ] )->group( From a3d67e7e1ccd358e191def8dce51d9d6a2ef0640 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 20:07:52 +0300 Subject: [PATCH 12/30] MAGETWO-42501: PCF: removing grouped price --- app/code/Magento/Catalog/Pricing/Price/TierPrice.php | 6 +++++- .../Catalog/Test/Unit/Pricing/Price/BasePriceTest.php | 10 ++++++++++ .../Catalog/Test/Unit/Setup/CategorySetupTest.php | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Pricing/Price/TierPrice.php b/app/code/Magento/Catalog/Pricing/Price/TierPrice.php index 1a7e1dcc8c24b..0f436c1e1f438 100644 --- a/app/code/Magento/Catalog/Pricing/Price/TierPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/TierPrice.php @@ -160,7 +160,11 @@ function (&$priceData) { protected function filterTierPrices(array $priceList) { $qtyCache = []; - foreach ($priceList as $priceKey => $price) { + foreach ($priceList as $priceKey => &$price) { + if (isset($price['price_qty']) && $price['price_qty'] == 1) { + unset($priceList[$priceKey]); + continue; + } /* filter price by customer group */ if ($price['cust_group'] != $this->customerGroup && $price['cust_group'] != $this->groupManagement->getAllCustomersGroup()->getId()) { diff --git a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php index 0927a9b0be5a2..016da871736d3 100644 --- a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php @@ -38,6 +38,11 @@ class BasePriceTest extends \PHPUnit_Framework_TestCase */ protected $regularPriceMock; + /** + * @var \Magento\Catalog\Pricing\Price\TierPrice|\PHPUnit_Framework_MockObject_MockObject + */ + protected $tearPriceMock; + /** * @var \Magento\Catalog\Pricing\Price\SpecialPrice|\PHPUnit_Framework_MockObject_MockObject */ @@ -57,6 +62,7 @@ public function setUp() $this->saleableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $this->priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); $this->regularPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\RegularPrice', [], [], '', false); + $this->tearPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\TierPrice', [], [], '', false); $this->specialPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\SpecialPrice', [], [], '', false); $this->calculatorMock = $this->getMock('Magento\Framework\Pricing\Adjustment\Calculator', [], [], '', false); @@ -65,6 +71,7 @@ public function setUp() ->will($this->returnValue($this->priceInfoMock)); $this->prices = [ 'regular_price' => $this->regularPriceMock, + 'group_price' => $this->tearPriceMock, 'special_price' => $this->specialPriceMock, ]; @@ -91,6 +98,9 @@ public function testGetValue($specialPriceValue, $expectedResult) $this->regularPriceMock->expects($this->exactly(3)) ->method('getValue') ->will($this->returnValue(100)); + $this->tearPriceMock->expects($this->exactly(2)) + ->method('getValue') + ->will($this->returnValue(99)); $this->specialPriceMock->expects($this->any()) ->method('getValue') ->will($this->returnValue($specialPriceValue)); diff --git a/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php b/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php index 6130294814ad8..4d6d8b722021b 100644 --- a/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php @@ -76,6 +76,7 @@ public function testGetDefaultEntitiesContainAllAttributes() 'thumbnail', 'media_gallery', 'old_id', + 'group_price', 'tier_price', 'color', 'news_from_date', From 2206a45791ad90a1cbc10aeb7e6936d5b29d4f5e Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 21:30:47 +0300 Subject: [PATCH 13/30] MAGETWO-42501: PCF: removing grouped price --- .../Controller/Adminhtml/Import/_files/catalog_product.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/catalog_product.csv b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/catalog_product.csv index 76a3e1128efd9..667a2f4f215da 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/catalog_product.csv +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/catalog_product.csv @@ -1,3 +1,3 @@ -sku,_store,_attribute_set,product_type,categories,_product_websites,color,cost,country_of_manufacture,created_at,custom_design,custom_design_from,custom_design_to,custom_layout_update,description,gallery,gift_message_available,gift_wrapping_available,gift_wrapping_price,has_options,image,image_label,is_returnable,manufacturer,meta_description,meta_keyword,meta_title,minimal_price,msrp,msrp_display_actual_price_type,name,news_from_date,news_to_date,options_container,page_layout,price,quantity_and_stock_status,related_tgtr_position_behavior,related_tgtr_position_limit,required_options,short_description,small_image,small_image_label,special_from_date,special_price,special_to_date,status,tax_class_id,thumbnail,thumbnail_label,updated_at,upsell_tgtr_position_behavior,upsell_tgtr_position_limit,url_key,url_path,visibility,weight,qty,min_qty,use_config_min_qty,is_qty_decimal,backorders,use_config_backorders,min_sale_qty,use_config_min_sale_qty,max_sale_qty,use_config_max_sale_qty,is_in_stock,notify_stock_qty,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,website_id,_related_sku,_related_position,_crosssell_sku,_crosssell_position,_upsell_sku,_upsell_position,_tier_price_website,_tier_price_customer_group,_tier_price_qty,_tier_price_price,_group_price_website,_group_price_customer_group,_group_price_price,_media_attribute_id,_media_image,_media_label,_media_position,_media_is_disabled,_associated_sku,_associated_default_qty,_associated_position -"simple product 1",,Default,simple,,base,,,,"2014-12-25 19:52:47",,,,,,,,,,0,,,"Use config",,"simple product 1 ","simple product 1","simple product 1",,,,"simple product 1",,,"Block after Info Column",,100.0000,"In Stock",,,0,,,,,,,1,2,,,"2014-12-25 19:52:47",,,simple-product-1,,"catalog, search",,123.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,,1,1,0,1,0.0000,1,0,0,1,,,,,,,,,,,,,,,,,,,,, -"simple product 2",,Default,simple,,base,,,,"2014-12-25 19:53:14",,,,,,,,,,0,,,"Use config",,"simple product 2 ","simple product 2","simple product 2",,,,"simple product 2",,,"Block after Info Column",,200.0000,"In Stock",,,0,,,,,,,1,2,,,"2014-12-25 19:53:14",,,simple-product-2,,"catalog, search",,234.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,,1,1,0,1,0.0000,1,0,0,1,,,,,,,,,,,,,,,,,,,,, +sku,_store,_attribute_set,product_type,categories,_product_websites,color,cost,country_of_manufacture,created_at,custom_design,custom_design_from,custom_design_to,custom_layout_update,description,gallery,gift_message_available,gift_wrapping_available,gift_wrapping_price,has_options,image,image_label,is_returnable,manufacturer,meta_description,meta_keyword,meta_title,minimal_price,msrp,msrp_display_actual_price_type,name,news_from_date,news_to_date,options_container,page_layout,price,quantity_and_stock_status,related_tgtr_position_behavior,related_tgtr_position_limit,required_options,short_description,small_image,small_image_label,special_from_date,special_price,special_to_date,status,tax_class_id,thumbnail,thumbnail_label,updated_at,upsell_tgtr_position_behavior,upsell_tgtr_position_limit,url_key,url_path,visibility,weight,qty,min_qty,use_config_min_qty,is_qty_decimal,backorders,use_config_backorders,min_sale_qty,use_config_min_sale_qty,max_sale_qty,use_config_max_sale_qty,is_in_stock,notify_stock_qty,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,website_id,_related_sku,_related_position,_crosssell_sku,_crosssell_position,_upsell_sku,_upsell_position,_tier_price_website,_tier_price_customer_group,_tier_price_qty,_tier_price_price,_media_attribute_id,_media_image,_media_label,_media_position,_media_is_disabled,_associated_sku,_associated_default_qty,_associated_position +"simple product 1",,Default,simple,,base,,,,"2014-12-25 19:52:47",,,,,,,,,,0,,,"Use config",,"simple product 1 ","simple product 1","simple product 1",,,,"simple product 1",,,"Block after Info Column",,100.0000,"In Stock",,,0,,,,,,,1,2,,,"2014-12-25 19:52:47",,,simple-product-1,,"catalog, search",,123.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,,1,1,0,1,0.0000,1,0,0,1,,,,,,,,,,,,,,,,,, +"simple product 2",,Default,simple,,base,,,,"2014-12-25 19:53:14",,,,,,,,,,0,,,"Use config",,"simple product 2 ","simple product 2","simple product 2",,,,"simple product 2",,,"Block after Info Column",,200.0000,"In Stock",,,0,,,,,,,1,2,,,"2014-12-25 19:53:14",,,simple-product-2,,"catalog, search",,234.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,,1,1,0,1,0.0000,1,0,0,1,,,,,,,,,,,,,,,,,, From 6a0ecaaab08ccd08ee64b28609173adf0d44343b Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 23:01:24 +0300 Subject: [PATCH 14/30] MAGETWO-42501: PCF: removing grouped price --- .../Magento/Bundle/Setup/UpgradeSchema.php | 3 +-- .../Magento/Catalog/Setup/UpgradeData.php | 21 +++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Bundle/Setup/UpgradeSchema.php b/app/code/Magento/Bundle/Setup/UpgradeSchema.php index 9281d4006f9cb..3f9caf16e3d6f 100644 --- a/app/code/Magento/Bundle/Setup/UpgradeSchema.php +++ b/app/code/Magento/Bundle/Setup/UpgradeSchema.php @@ -40,8 +40,7 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con ]; foreach ($fields as $filedInfo) { - $connection->dropColumn($setup->getTable($filedInfo['table']), - $filedInfo['column']); + $connection->dropColumn($setup->getTable($filedInfo['table']), $filedInfo['column']); } } diff --git a/app/code/Magento/Catalog/Setup/UpgradeData.php b/app/code/Magento/Catalog/Setup/UpgradeData.php index 75ec3928f1516..11d720cb07f8f 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeData.php +++ b/app/code/Magento/Catalog/Setup/UpgradeData.php @@ -16,15 +16,32 @@ */ class UpgradeData implements UpgradeDataInterface { + /** + * Category setup factory + * + * @var CategorySetupFactory + */ + private $categorySetupFactory; + + /** + * Init + * + * @param CategorySetupFactory $categorySetupFactory + */ + public function __construct(CategorySetupFactory $categorySetupFactory) + { + $this->categorySetupFactory = $categorySetupFactory; + } + /** * {@inheritdoc} - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { - + $categorySetupManager = $this->categorySetupFactory->create(); + $categorySetupManager->removeAttribute('group_price'); } $setup->endSetup(); } From 0389027fb70139feddf495b4c039c798f01a740c Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 27 Sep 2015 23:40:30 +0300 Subject: [PATCH 15/30] MAGETWO-42501: PCF: removing grouped price --- .../AdvancedPricing/Validator/WebsiteTest.php | 18 ------------------ app/code/Magento/Catalog/Setup/UpgradeData.php | 2 +- .../Backend/GroupPrice/AbstractTest.php | 1 + .../Model/Product/Type/Grouped/PriceTest.php | 6 +++--- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php index 5d50517203168..557634d888673 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php @@ -149,24 +149,6 @@ public function isValidReturnDataProvider() '$colTierPriceWebsite' => false, '$expectedResult' => false, ], - [ - '$value' => [ - AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value', - AdvancedPricing::COL_TIER_PRICE => 'value', - ], - '$allWebsites' => 'not tier|group price website value', - '$colTierPriceWebsite' => 'value', - '$expectedResult' => false, - ], - [ - '$value' => [ - AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value', - AdvancedPricing::COL_TIER_PRICE => 'tier value', - ], - '$allWebsites' => 'not tier|group price website value', - '$colTierPriceWebsite' => 'value', - '$expectedResult' => false, - ], // True cases. [ '$value' => [ diff --git a/app/code/Magento/Catalog/Setup/UpgradeData.php b/app/code/Magento/Catalog/Setup/UpgradeData.php index 11d720cb07f8f..b04132694be73 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeData.php +++ b/app/code/Magento/Catalog/Setup/UpgradeData.php @@ -41,7 +41,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { $categorySetupManager = $this->categorySetupFactory->create(); - $categorySetupManager->removeAttribute('group_price'); + $categorySetupManager->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price'); } $setup->endSetup(); } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php index 0d441f025c1fc..ab33d43f273c1 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php @@ -72,6 +72,7 @@ public function testGetAffectedFields() $this->_model->setAttribute($attribute); $object = new \Magento\Framework\DataObject(); + $object->setTearPrice([['price_id' => 10]]); $object->setId(555); $this->assertEquals( diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/Grouped/PriceTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/Grouped/PriceTest.php index 3e9523d19787a..e8f0e4f22914f 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/Grouped/PriceTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/Grouped/PriceTest.php @@ -64,7 +64,7 @@ public function testGetFinalPrice( $expectedFinalPrice ) { $rawFinalPrice = 10; - $rawPriceCheckStep = 10; + $rawPriceCheckStep = 6; $this->productMock->expects( $this->any() @@ -167,7 +167,7 @@ public function getFinalPriceDataProvider() 'custom_option_null' => [ 'associatedProducts' => [], 'options' => [[], []], - 'expectedPriceCall' => 14, /* product call number to check final price formed correctly */ + 'expectedPriceCall' => 6, /* product call number to check final price formed correctly */ 'expectedFinalPrice' => 10, /* 10(product price) + 2(options count) * 5(qty) * 5(option price) */ ], 'custom_option_exist' => [ @@ -177,7 +177,7 @@ public function getFinalPriceDataProvider() ['associated_product_2', $optionMock], ['associated_product_3', $optionMock], ], - 'expectedPriceCall' => 17, /* product call number to check final price formed correctly */ + 'expectedPriceCall' => 16, /* product call number to check final price formed correctly */ 'expectedFinalPrice' => 35, /* 10(product price) + 2(options count) * 5(qty) * 5(option price) */ ] ]; From 643fd6412c35f22ae8495ba0165e478455e24817 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Mon, 28 Sep 2015 00:02:32 +0300 Subject: [PATCH 16/30] MAGETWO-42501: PCF: removing grouped price --- .../Unit/Model/Indexer/IndexBuilderTest.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php index 5590fffba4226..16f02225711fc 100644 --- a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php +++ b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php @@ -195,4 +195,52 @@ protected function setUp() $this->productFactory ); } + + /** + * Test UpdateCatalogRuleGroupWebsiteData + * + * @covers \Magento\CatalogRule\Model\Indexer\IndexBuilder::updateCatalogRuleGroupWebsiteData + * @return void + */ + public function testUpdateCatalogRuleGroupWebsiteData() + { + $groupPriceAttrMock = $this->getMock( + 'Magento\Catalog\Model\Entity\Attribute', + ['getBackend'], + [], + '', + false + ); + $backendModelMock = $this->getMock( + 'Magento\Catalog\Model\Product\Attribute\Backend\Tierprice', + ['getResource'], + [], + '', + false + ); + $resourceMock = $this->getMock( + 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice', + ['getMainTable'], + [], + '', + false + ); + $resourceMock->expects($this->any()) + ->method('getMainTable') + ->will($this->returnValue('catalog_product_entity_tear_price')); + $backendModelMock->expects($this->any()) + ->method('getResource') + ->will($this->returnValue($resourceMock)); + $groupPriceAttrMock->expects($this->any()) + ->method('getBackend') + ->will($this->returnValue($backendModelMock)); + $this->eavConfig->expects($this->at(0)) + ->method('getAttribute') + ->with(\Magento\Catalog\Model\Product::ENTITY, 'price') + ->will($this->returnValue($this->attribute)); + + $this->select->expects($this->once())->method('insertFromSelect')->with('catalogrule_group_website'); + + $this->indexBuilder->reindexByIds([1]); + } } From 570380d7e27013779cc91e08e41ff008fdc2fa2d Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Mon, 28 Sep 2015 09:09:53 +0300 Subject: [PATCH 17/30] MAGETWO-42501: PCF: removing grouped price --- app/code/Magento/Catalog/Setup/UpgradeSchema.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index cb14e600857bc..2f92ff8a5867c 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -43,8 +43,7 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con ]; foreach ($fields as $filedInfo) { - $connection->dropColumn($setup->getTable($filedInfo['table']), - $filedInfo['column']); + $connection->dropColumn($setup->getTable($filedInfo['table']), $filedInfo['column']); } } From d5535d813c2c86d6ebcff9b9f7aa8af45be82ff0 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Thu, 1 Oct 2015 09:23:18 +0300 Subject: [PATCH 18/30] MAGETWO-42501: PCF: removing grouped price --- .../Model/Export/AdvancedPricing.php | 4 +- .../Model/Import/AdvancedPricing.php | 6 +- .../Unit/Model/Import/AdvancedPricingTest.php | 6 +- .../Magento/Bundle/Setup/InstallSchema.php | 84 ----- .../Backend/GroupPrice/AbstractGroupPrice.php | 18 +- .../Catalog/Model/Product/Type/Price.php | 2 +- .../Catalog/Pricing/Price/TierPrice.php | 9 +- .../Magento/Catalog/Setup/CategorySetup.php | 13 - .../Magento/Catalog/Setup/InstallSchema.php | 296 +----------------- .../Magento/Catalog/Setup/UpgradeData.php | 26 ++ .../Test/Unit/Pricing/Price/BasePriceTest.php | 2 +- .../Test/Unit/Setup/CategorySetupTest.php | 1 - .../Unit/Model/Indexer/IndexBuilderTest.php | 4 +- .../Files/Sample/advanced_pricing.csv | 10 +- .../Api/ProductTierPriceManagementTest.php | 8 +- .../Constraint/AssertBundleProductPage.php | 2 +- .../Catalog/_files/product_group_prices.php | 36 --- .../_files/dependency_test/tables_ce.php | 2 - .../Fixtures/ConfigurableProductsFixture.php | 9 - 19 files changed, 64 insertions(+), 474 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_group_prices.php diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php index e20806f897c51..8d3fc32ba7f27 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php @@ -262,7 +262,7 @@ protected function getExportData() if (!$this->_passTierPrice) { $exportData = array_merge( $exportData, - $this->getTierAndGroupPrices($productIds, ImportAdvancedPricing::TABLE_TIER_PRICE) + $this->getTierPrices($productIds, ImportAdvancedPricing::TABLE_TIER_PRICE) ); } } @@ -323,7 +323,7 @@ protected function correctExportData($exportData) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - protected function getTierAndGroupPrices(array $listSku, $table) + protected function getTierPrices(array $listSku, $table) { if (isset($this->_parameters[\Magento\ImportExport\Model\Export::FILTER_ELEMENT_GROUP])) { $exportFilter = $this->_parameters[\Magento\ImportExport\Model\Export::FILTER_ELEMENT_GROUP]; diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php index d3b29dc614c4b..48eb2f58bbbcd 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php @@ -314,7 +314,7 @@ public function deleteAdvancedPricing() } } if ($listSku) { - $this->deleteProductTierAndGroupPrices(array_unique($listSku), self::TABLE_TIER_PRICE); + $this->deleteProductTierPrices(array_unique($listSku), self::TABLE_TIER_PRICE); $this->setUpdatedAt($listSku); } return $this; @@ -374,7 +374,7 @@ protected function saveAndReplaceAdvancedPrices() if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) { if ($listSku) { $this->processCountNewPrices($tierPrices); - if ($this->deleteProductTierAndGroupPrices(array_unique($listSku), self::TABLE_TIER_PRICE)) { + if ($this->deleteProductTierPrices(array_unique($listSku), self::TABLE_TIER_PRICE)) { $this->saveProductPrices($tierPrices, self::TABLE_TIER_PRICE); $this->setUpdatedAt($listSku); } @@ -428,7 +428,7 @@ protected function saveProductPrices(array $priceData, $table) * @param string $tableName * @return bool */ - protected function deleteProductTierAndGroupPrices(array $listSku, $tableName) + protected function deleteProductTierPrices(array $listSku, $tableName) { if ($tableName && $listSku) { if (!$this->_cachedSkuToDelete) { diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php index 632388d1eefd4..687313f99aa0c 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php @@ -253,7 +253,7 @@ public function setUp() 'saveProductPrices', 'getCustomerGroupId', 'getWebSiteId', - 'deleteProductTierAndGroupPrices', + 'deleteProductTierPrices', 'getBehavior', 'saveAndReplaceAdvancedPrices', 'processCountExistingPrices', @@ -451,7 +451,7 @@ public function testSaveAndReplaceAdvancedPricesReplaceBehaviourInternalCalls() $this->advancedPricing ->expects($this->any()) - ->method('deleteProductTierAndGroupPrices') + ->method('deleteProductTierPrices') ->withConsecutive( [ $listSku, @@ -495,7 +495,7 @@ public function testDeleteAdvancedPricingFormListSkuToDelete() $expectedSkuList = ['sku value']; $this->advancedPricing ->expects($this->once()) - ->method('deleteProductTierAndGroupPrices') + ->method('deleteProductTierPrices') ->withConsecutive( [$expectedSkuList, AdvancedPricing::TABLE_TIER_PRICE] )->will($this->returnSelf()); diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php index 94325c54ff13c..74263a04f76df 100644 --- a/app/code/Magento/Bundle/Setup/InstallSchema.php +++ b/app/code/Magento/Bundle/Setup/InstallSchema.php @@ -549,27 +549,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Base Tier' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) - ->addColumn( - 'group_price_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group Price Percent' - ) ->setComment('Catalog Product Index Price Bundle Idx'); $installer->getConnection()->createTable($table); @@ -670,27 +649,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Base Tier' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) - ->addColumn( - 'group_price_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group Price Percent' - ) ->setOption( 'type', \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY @@ -767,13 +725,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->setComment('Catalog Product Index Price Bundle Sel Idx'); $installer->getConnection()->createTable($table); @@ -846,13 +797,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->setOption( 'type', \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY @@ -929,20 +873,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Alt Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'alt_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Group Price' - ) ->setComment('Catalog Product Index Price Bundle Opt Idx'); $installer->getConnection()->createTable($table); @@ -1015,20 +945,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Alt Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'alt_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Group Price' - ) ->setOption( 'type', \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php index 93d670a2e9cf6..86c2cf57d4b91 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php @@ -178,9 +178,9 @@ public function validate($object) // if attribute scope is website and edit in store view scope // add global group prices for duplicates find if (!$attribute->isScopeGlobal() && $object->getStoreId()) { - $origGroupPrices = $object->getOrigData($attribute->getName()); - if ($origGroupPrices) { - foreach ($origGroupPrices as $price) { + $origPrices = $object->getOrigData($attribute->getName()); + if ($origPrices) { + foreach ($origPrices as $price) { if ($price['website_id'] == 0) { $compare = join( '-', @@ -312,11 +312,11 @@ public function afterSave($object) $new = []; // prepare original data for compare - $origGroupPrices = $object->getOrigData($this->getAttribute()->getName()); - if (!is_array($origGroupPrices)) { - $origGroupPrices = []; + $origPrices = $object->getOrigData($this->getAttribute()->getName()); + if (!is_array($origPrices)) { + $origPrices = []; } - foreach ($origGroupPrices as $data) { + foreach ($origPrices as $data) { if ($data['website_id'] > 0 || $data['website_id'] == '0' && $isGlobal) { $key = join( '-', @@ -420,9 +420,9 @@ public function afterSave($object) public function getAffectedFields($object) { $data = []; - $groupPrices = (array)$object->getData($this->getAttribute()->getName()); + $prices = (array)$object->getData($this->getAttribute()->getName()); $tableName = $this->_getResource()->getMainTable(); - foreach ($groupPrices as $value) { + foreach ($prices as $value) { $data[$tableName][] = [ 'attribute_id' => $this->getAttribute()->getAttributeId(), 'entity_id' => $object->getId(), diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php index d0d27c694288b..3ae0481599236 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -185,7 +185,7 @@ public function getChildFinalPrice($product, $productQty, $childProduct, $childP } /** - * Gets the 'group_price' array from the product + * Gets the 'tear_price' array from the product * * @param Product $product * @param string $key diff --git a/app/code/Magento/Catalog/Pricing/Price/TierPrice.php b/app/code/Magento/Catalog/Pricing/Price/TierPrice.php index 0f436c1e1f438..3f5737dbf5ad8 100644 --- a/app/code/Magento/Catalog/Pricing/Price/TierPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/TierPrice.php @@ -160,6 +160,7 @@ function (&$priceData) { protected function filterTierPrices(array $priceList) { $qtyCache = []; + $allCustomersGroupId = $this->groupManagement->getAllCustomersGroup()->getId(); foreach ($priceList as $priceKey => &$price) { if (isset($price['price_qty']) && $price['price_qty'] == 1) { unset($priceList[$priceKey]); @@ -167,7 +168,7 @@ protected function filterTierPrices(array $priceList) } /* filter price by customer group */ if ($price['cust_group'] != $this->customerGroup && - $price['cust_group'] != $this->groupManagement->getAllCustomersGroup()->getId()) { + $price['cust_group'] != $allCustomersGroupId) { unset($priceList[$priceKey]); continue; } @@ -227,11 +228,11 @@ protected function applyAdjustment($price) */ protected function canApplyTierPrice(array $currentTierPrice, $prevPriceGroup, $prevQty) { - $custGroupAllId = $this->groupManagement->getAllCustomersGroup()->getId(); + $custGroupAllId = (int)$this->groupManagement->getAllCustomersGroup()->getId(); // Tier price can be applied, if: // tier price is for current customer group or is for all groups - if ($currentTierPrice['cust_group'] !== $this->customerGroup - && $currentTierPrice['cust_group'] !== $custGroupAllId + if ((int)$currentTierPrice['cust_group'] !== $this->customerGroup + && (int)$currentTierPrice['cust_group'] !== $custGroupAllId ) { return false; } diff --git a/app/code/Magento/Catalog/Setup/CategorySetup.php b/app/code/Magento/Catalog/Setup/CategorySetup.php index 9a10844011b8f..0c173c5c2c8df 100644 --- a/app/code/Magento/Catalog/Setup/CategorySetup.php +++ b/app/code/Magento/Catalog/Setup/CategorySetup.php @@ -577,19 +577,6 @@ public function getDefaultEntities() 'group' => 'Images', ], 'old_id' => ['type' => 'int', 'required' => false, 'sort_order' => 6, 'visible' => false], - 'group_price' => [ - 'type' => 'decimal', - 'label' => 'Group Price', - 'input' => 'text', - 'required' => false, - 'sort_order' => 2, - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, - 'apply_to' => 'simple,virtual', - 'group' => 'Prices', - 'is_used_in_grid' => true, - 'is_visible_in_grid' => false, - 'is_filterable_in_grid' => true, - ], 'tier_price' => [ 'type' => 'decimal', 'label' => 'Tier Price', diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php index adc00706d7079..c507f35db6644 100644 --- a/app/code/Magento/Catalog/Setup/InstallSchema.php +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -2987,13 +2987,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->addIndex( $installer->getIdxName('catalog_product_index_price', ['customer_group_id']), ['customer_group_id'] @@ -3217,13 +3210,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->setComment( 'Catalog Product Price Indexer Config Option Aggregate Index Table' ); @@ -3279,13 +3265,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->setOption( 'type', \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY @@ -3345,13 +3324,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->setComment( 'Catalog Product Price Indexer Config Option Index Table' ); @@ -3407,13 +3379,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->setOption( 'type', \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY @@ -3501,20 +3466,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Base Tier' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) ->setComment( 'Catalog Product Price Indexer Final Index Table' ); @@ -3598,20 +3549,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Base Tier' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) + ->setOption( 'type', \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY @@ -3671,13 +3609,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->setComment( 'Catalog Product Price Indexer Option Index Table' ); @@ -3733,13 +3664,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->setOption( 'type', \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY @@ -3806,13 +3730,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->setComment( 'Catalog Product Price Indexer Option Aggregate Index Table' ); @@ -3875,13 +3792,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->setOption( 'type', \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY @@ -4182,13 +4092,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->addIndex( $installer->getIdxName('catalog_product_index_price_idx', ['customer_group_id']), ['customer_group_id'] @@ -4277,13 +4180,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Tier Price' ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) ->addIndex( $installer->getIdxName('catalog_product_index_price_tmp', ['customer_group_id']), ['customer_group_id'] @@ -4369,195 +4265,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getConnection() ->createTable($table); - /** - * Create table 'catalog_product_entity_group_price' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_entity_group_price') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'all_groups', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Applicable To All Customer Groups' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Group ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Website ID' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_group_price', - ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_group_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_group_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_group_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_group_price', - 'entity_id', - 'catalog_product_entity', - 'entity_id' - ), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_group_price', - 'website_id', - 'store_website', - 'website_id' - ), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Group Price Attribute Backend Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_group_price' - */ - - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_group_price') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_group_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_group_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_index_group_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_index_group_price', - 'entity_id', - 'catalog_product_entity', - 'entity_id' - ), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_group_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Group Price Index Table' - ); - $installer->getConnection() - ->createTable($table); - $installer->endSetup(); + $installer->endSetup(); } } diff --git a/app/code/Magento/Catalog/Setup/UpgradeData.php b/app/code/Magento/Catalog/Setup/UpgradeData.php index b04132694be73..19ddafa9f987a 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeData.php +++ b/app/code/Magento/Catalog/Setup/UpgradeData.php @@ -40,6 +40,32 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface { $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { + $select = $setup->getConnection()->select() + ->from( + $setup->getTable('catalog_product_entity_group_price'), + [ + 'value_id', + 'entity_id', + 'all_groups', + 'customer_group_id', + new \Zend_Db_Expr('1'), + 'value', + 'website_id' + ] + ); + $setup->getConnection()->insertFromSelect( + $setup->getTable('catalog_product_entity_group_price'), + $select, + [ + 'value_id', + 'entity_id', + 'all_groups', + 'customer_group_id', + 'qty', + 'value', + 'website_id' + ] + ); $categorySetupManager = $this->categorySetupFactory->create(); $categorySetupManager->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price'); } diff --git a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php index 016da871736d3..d458c8c5a23a9 100644 --- a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php @@ -71,7 +71,7 @@ public function setUp() ->will($this->returnValue($this->priceInfoMock)); $this->prices = [ 'regular_price' => $this->regularPriceMock, - 'group_price' => $this->tearPriceMock, + 'tear_price' => $this->tearPriceMock, 'special_price' => $this->specialPriceMock, ]; diff --git a/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php b/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php index 4d6d8b722021b..6130294814ad8 100644 --- a/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Setup/CategorySetupTest.php @@ -76,7 +76,6 @@ public function testGetDefaultEntitiesContainAllAttributes() 'thumbnail', 'media_gallery', 'old_id', - 'group_price', 'tier_price', 'color', 'news_from_date', diff --git a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php index 16f02225711fc..390543bf74ffc 100644 --- a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php +++ b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php @@ -204,7 +204,7 @@ protected function setUp() */ public function testUpdateCatalogRuleGroupWebsiteData() { - $groupPriceAttrMock = $this->getMock( + $priceAttrMock = $this->getMock( 'Magento\Catalog\Model\Entity\Attribute', ['getBackend'], [], @@ -231,7 +231,7 @@ public function testUpdateCatalogRuleGroupWebsiteData() $backendModelMock->expects($this->any()) ->method('getResource') ->will($this->returnValue($resourceMock)); - $groupPriceAttrMock->expects($this->any()) + $priceAttrMock->expects($this->any()) ->method('getBackend') ->will($this->returnValue($backendModelMock)); $this->eavConfig->expects($this->at(0)) diff --git a/app/code/Magento/ImportExport/Files/Sample/advanced_pricing.csv b/app/code/Magento/ImportExport/Files/Sample/advanced_pricing.csv index bfd24ea9bcc7e..42cdd7017a395 100644 --- a/app/code/Magento/ImportExport/Files/Sample/advanced_pricing.csv +++ b/app/code/Magento/ImportExport/Files/Sample/advanced_pricing.csv @@ -1,5 +1,5 @@ -sku,tier_price_website,tier_price_customer_group,tier_price_qty,tier_price,group_price_website,group_price_customer_group,group_price_price -sku123,website1,General,2,10,,, -sku124,All Websites [USD],ALL GROUPS,3,15,,, -sku123,,,,,website1,General,11 -sku124,,,,,All Websites [USD],General,12 +sku,tier_price_website,tier_price_customer_group,tier_price_qty,tier_price +sku123,website1,General,2,10 +sku124,All Websites [USD],ALL GROUPS,3,15 +sku123,,,, +sku124,,,, diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php index 31e686b2e13db..fd5d27d7a7689 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php @@ -36,15 +36,15 @@ public function testGetList($customerGroupId, $count, $value, $qty) ], ]; - $groupPriceList = $this->_webApiCall( + $tearPriceList = $this->_webApiCall( $serviceInfo, ['sku' => $productSku, 'customerGroupId' => $customerGroupId] ); - $this->assertCount($count, $groupPriceList); + $this->assertCount($count, $tearPriceList); if ($count) { - $this->assertEquals($value, $groupPriceList[0]['value']); - $this->assertEquals($qty, $groupPriceList[0]['qty']); + $this->assertEquals($value, $tearPriceList[0]['value']); + $this->assertEquals($qty, $tearPriceList[0]['qty']); } } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php index 1ccbfd702f4eb..87baeeac0bed1 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php @@ -26,7 +26,7 @@ protected function verifyPrice() $priceView = $this->product->getPriceView(); $priceBlock = $this->productView->getPriceBlock(); - if ($this->product->hasData('special_price') || $this->product->hasData('group_price')) { + if ($this->product->hasData('special_price')) { $priceLow = $priceBlock->getPrice(); } else { $priceLow = ($priceView == 'Price Range') ? $priceBlock->getPriceFrom() : $priceBlock->getPrice(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_group_prices.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_group_prices.php deleted file mode 100644 index 5127d8fd0a660..0000000000000 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_group_prices.php +++ /dev/null @@ -1,36 +0,0 @@ -create('Magento\Catalog\Model\Product'); -$product->isObjectNew(true); -$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) - ->setId(1) - ->setAttributeSetId(4) - ->setWebsiteIds([1]) - ->setName('Simple Product Group Price') - ->setSku('simple_with_group_price') - ->setPrice(10) - ->setWeight(1) - ->setShortDescription("Short description") - ->setTaxClassId(0) - ->setDescription('Description with html tag') - ->setMetaTitle('meta title') - ->setMetaKeyword('meta keyword') - ->setMetaDescription('meta description') - ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) - ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) - ->setCategoryIds([2]) - ->setStockData( - [ - 'use_config_manage_stock' => 1, - 'qty' => 100, - 'is_qty_decimal' => 0, - 'is_in_stock' => 1, - ] - ) - ->save(); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php index c756aa6b43d76..a127d864c33d6 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php @@ -20,7 +20,6 @@ 'catalog_product_entity_int' => 'Magento\Catalog', 'catalog_product_entity_text' => 'Magento\Catalog', 'catalog_product_entity_varchar' => 'Magento\Catalog', - 'catalog_product_entity_group_price' => 'Magento\Catalog', 'catalog_product_bundle_option' => 'Magento\Bundle', 'catalog_product_index_price_bundle_opt_idx' => 'Magento\Bundle', 'catalog_product_index_price_bundle_opt_tmp' => 'Magento\Bundle', @@ -51,7 +50,6 @@ 'catalog_product_flat' => 'Magento\Catalog', 'catalog_product_index_eav' => 'Magento\Catalog', 'catalog_product_index_eav_decimal' => 'Magento\Catalog', - 'catalog_product_index_group_price' => 'Magento\Catalog', 'catalog_product_index_price' => 'Magento\Catalog', 'catalog_product_index_tier_price' => 'Magento\Catalog', 'catalog_product_index_website' => 'Magento\Catalog', diff --git a/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php b/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php index 0fbdc3c99f3d0..9128793574265 100644 --- a/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php +++ b/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php @@ -352,9 +352,6 @@ protected function getRows($productCategory, $productWebsite) '_tier_price_customer_group' => '', '_tier_price_qty' => '', '_tier_price_price' => '', - '_group_price_website' => '', - '_group_price_customer_group' => '', - '_group_price_price' => '', '_media_attribute_id' => '', '_media_image' => '', '_media_label' => '', @@ -458,9 +455,6 @@ protected function getRows($productCategory, $productWebsite) '_tier_price_customer_group' => '', '_tier_price_qty' => '', '_tier_price_price' => '', - '_group_price_website' => '', - '_group_price_customer_group' => '', - '_group_price_price' => '', '_media_attribute_id' => '', '_media_image' => '', '_media_label' => '', @@ -564,9 +558,6 @@ protected function getRows($productCategory, $productWebsite) '_tier_price_customer_group' => '', '_tier_price_qty' => '', '_tier_price_price' => '', - '_group_price_website' => '', - '_group_price_customer_group' => '', - '_group_price_price' => '', '_media_attribute_id' => '', '_media_image' => '', '_media_label' => '', From 286f0c23bec3bce2dd7f80d711e70373ac426f58 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Thu, 1 Oct 2015 09:56:24 +0300 Subject: [PATCH 19/30] MAGETWO-42501: PCF: removing grouped price --- app/code/Magento/Catalog/Setup/UpgradeData.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Setup/UpgradeData.php b/app/code/Magento/Catalog/Setup/UpgradeData.php index 19ddafa9f987a..a2b47e337f2c4 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeData.php +++ b/app/code/Magento/Catalog/Setup/UpgradeData.php @@ -54,8 +54,8 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface ] ); $setup->getConnection()->insertFromSelect( - $setup->getTable('catalog_product_entity_group_price'), $select, + $setup->getTable('catalog_product_entity_group_price'), [ 'value_id', 'entity_id', From 50c0a67d32a076f1af201aea04c979c1b3ec02d5 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Thu, 1 Oct 2015 11:51:24 +0300 Subject: [PATCH 20/30] MAGETWO-42501: PCF: removing grouped price --- .../Magento/Test/Legacy/_files/obsolete_classes.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 6bea00df5021f..3a296efb1d220 100755 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -3852,4 +3852,14 @@ ['Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Super\Config\Grid\Renderer\Inventory'], ['Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Super\Config\Grid\Renderer\Checkbox'], ['Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Super\Config\Grid\Filter\Inventory'], + ['Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\GroupPrice'], + ['Magento\Catalog\Api\Data\ProductGroupPriceInterface'], + ['Magento\Catalog\Api\ProductGroupPriceManagementInterface'], + ['Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group'], + ['Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice'], + ['Magento\Catalog\Model\Product\GroupPrice'], + ['Magento\Catalog\Model\Product\GroupPriceManagement'], + ['Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice'], + ['Magento\Catalog\Pricing\Price\GroupPrice'], + ['Magento\CatalogImportExport\Model\Import\Product\Validator\GroupPrice'], ]; From 3d1b218b2d111dc36ff7c6469f7fd6115fd69c1f Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Thu, 1 Oct 2015 13:07:58 +0300 Subject: [PATCH 21/30] MAGETWO-42501: PCF: removing grouped price --- .../Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php index d2c9e742545cd..f1f84f2d75737 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php @@ -71,7 +71,7 @@ protected function _prepareLayout() $button = $this->getLayout()->createBlock( 'Magento\Backend\Block\Widget\Button' )->setData( - ['label' => __('Add Tier'), 'onclick' => 'return tierPriceControl.addItem()', 'class' => 'add'] + ['label' => __('Add Price'), 'onclick' => 'return tierPriceControl.addItem()', 'class' => 'add'] ); $button->setName('add_tier_price_item_button'); From 03b8f69f45065d98df7bb83a5bd715f19323c310 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Thu, 1 Oct 2015 16:53:26 +0300 Subject: [PATCH 22/30] MAGETWO-42501: PCF: removing grouped price --- .../Model/Import/AdvancedPricing.php | 10 +++++++--- .../Import/AdvancedPricing/Validator/TierPrice.php | 13 +++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php index 48eb2f58bbbcd..3c102ee325527 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php @@ -42,6 +42,8 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract const VALIDATOR_WEBSITE = 'validator_website'; + const VALIDATOR_TEAR_PRICE = 'validator_tear_price'; + /** * Validation failure message template definitions * @@ -181,7 +183,8 @@ public function __construct( \Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver, ImportProduct $importProduct, AdvancedPricing\Validator $validator, - AdvancedPricing\Validator\Website $websiteValidator + AdvancedPricing\Validator\Website $websiteValidator, + AdvancedPricing\Validator\TierPrice $tierPriceValidator ) { $this->_localeDate = $localeDate; $this->jsonHelper = $jsonHelper; @@ -197,6 +200,7 @@ public function __construct( $this->_validators[self::VALIDATOR_MAIN] = $validator->init($this); $this->_oldSkus = $this->retrieveOldSkus(); $this->_validators[self::VALIDATOR_WEBSITE] = $websiteValidator; + $this->_validators[self::VALIDATOR_TEAR_PRICE] = $tierPriceValidator; $this->errorAggregator = $errorAggregator; $this->_catalogProductEntity = $this->_resourceFactory->create()->getTable('catalog_product_entity'); @@ -422,7 +426,7 @@ protected function saveProductPrices(array $priceData, $table) } /** - * Deletes tier prices and group prices. + * Deletes tier prices prices. * * @param array $listSku * @param string $tableName @@ -495,7 +499,7 @@ protected function getWebSiteId($websiteCode) */ protected function getCustomerGroupId($customerGroup) { - $customerGroups = $this->_getValidator(self::VALIDATOR_GROUP_PRICE)->getCustomerGroups(); + $customerGroups = $this->_getValidator(self::VALIDATOR_TEAR_PRICE)->getCustomerGroups(); return $customerGroup == self::VALUE_ALL_GROUPS ? 0 : $customerGroups[$customerGroup]; } diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/TierPrice.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/TierPrice.php index 03ffcc962f554..bac6a0e44d5a6 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/TierPrice.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/TierPrice.php @@ -68,6 +68,19 @@ protected function addDecimalError($attribute) ); } + /** + * Get existing customers groups + * + * @return array + */ + public function getCustomerGroups() + { + if (!$this->customerGroups) { + $this->init($this->context); + } + return $this->customerGroups; + } + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * Validation From 93fd6d82aa4b0c81d6f6c724f9c5e69505580f90 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Thu, 1 Oct 2015 18:08:15 +0300 Subject: [PATCH 23/30] MAGETWO-42501: PCF: removing grouped price --- .../CreateBundleProductEntityTest.xml | 2 - .../Edit/AdvancedPricingTab/OptionGroup.php | 37 ----------- .../Edit/AdvancedPricingTab/OptionGroup.xml | 22 ------- .../Product/CreateSimpleProductEntityTest.xml | 3 - .../CreateVirtualProductEntityTest.xml | 2 - .../UpdateVirtualProductEntityTest.xml | 4 -- .../Test/Repository/DownloadableProduct.xml | 34 ---------- .../CreateDownloadableProductEntityTest.xml | 1 - .../Test/TestCase/TaxCalculationTest.xml | 41 ------------ .../CreateGroupedProductEntityTest.xml | 14 ----- .../Tax/Test/TestCase/TaxCalculationTest.xml | 62 +------------------ .../view/adminhtml/product/product.css | 3 +- 12 files changed, 3 insertions(+), 222 deletions(-) delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionGroup.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionGroup.xml diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml index 9ab9547c3f7e0..1654b19df2435 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml @@ -114,7 +114,6 @@ 10 category_%isolation% Bundle Product Fixed - not_logged_in_20 As Low as Separately all_types_fixed @@ -217,7 +216,6 @@ sku_bundle_dynamic_%isolation% Dynamic dynamic-32 - not_logged_in_20 default_dynamic catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar bundle_default diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionGroup.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionGroup.php deleted file mode 100644 index 36ea46aaff063..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionGroup.php +++ /dev/null @@ -1,37 +0,0 @@ -_rootElement->find($this->buttonFormLocator)->click(); - return parent::fillOptions($fields, $element); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionGroup.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionGroup.xml deleted file mode 100644 index 69c390b054415..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionGroup.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - [id$="_price"] - - - [id$="_website"] - select - - - [id$="_cust_group"] - select - - - diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml index 95424b11ab403..f46eff7dac4b8 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml @@ -98,7 +98,6 @@ drop_down_with_one_option_percent_price simple_drop_down_with_one_option_percent_price MAGETWO-23030 - not_logged_in_90 @@ -118,7 +117,6 @@ drop_down_with_one_option_fixed_price simple_drop_down_with_one_option_fixed_price MAGETWO-23029 - not_logged_in_90 @@ -267,7 +265,6 @@ Simple Product description %isolation% 64 141 - not_logged_in_20 diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml index eebe1b345306a..33a3840920d83 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml @@ -59,7 +59,6 @@ 10 Yes category_%isolation% - not_logged_in_90 Catalog @@ -72,7 +71,6 @@ virtual_sku_%isolation% 9000 Yes - not_logged_in_90 options_suite catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml index f1b1517bda524..6dbb540f7be11 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml @@ -109,7 +109,6 @@ 999 Yes default_subcategory - not_logged_in_90 MAGETWO-23002 In Stock Catalog, Search @@ -147,7 +146,6 @@ 5.00 taxable_goods Yes - not_logged_in_90 Out of Stock Search virtual-product-%isolation% @@ -184,7 +182,6 @@ 99.99 taxable_goods Yes - not_logged_in_90 Out of Stock Catalog, Search virtual-product-%isolation% @@ -203,7 +200,6 @@ 999 Yes default_subcategory - not_logged_in_90 MAGETWO-23002 In Stock Catalog diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Repository/DownloadableProduct.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Repository/DownloadableProduct.xml index 8d84025eee8b4..1ac9e5e6961f2 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Repository/DownloadableProduct.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Repository/DownloadableProduct.xml @@ -125,40 +125,6 @@ - - Downloadable product %isolation% - downloadable_product_%isolation% - downloadable-product-%isolation% - - 30 - - - general_90_99 - - - taxable_goods - - - 1111 - In Stock - - Product online - - default_subcategory - - Catalog, Search - Yes - - Main Website - - - with_two_separately_links - - - downloadable_with_two_bought_links - - - Downloadable product %isolation% downloadable_product_%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml index 67da232884b05..91cdc5c09e463 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml @@ -271,7 +271,6 @@ Yes category %isolation% with_two_separately_links - not_logged_in_20 downloadableproduct-%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/TaxCalculationTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/TaxCalculationTest.xml index d1bc12b23b8e5..77c56abc3d66b 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/TaxCalculationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/TaxCalculationTest.xml @@ -52,26 +52,6 @@ - - total_cat_excl_ship_incl_after_disc_on_incl - downloadableProduct::with_two_separately_links_group_price_and_category - active_sales_rule_for_all_groups_no_coupon - - - customer_less_store_rate - johndoe_unique - - - 30.00 - 35.43 - 35.43 - 35.43 - 35.43 - 19.18 - 1.34 - 17.59 - - - - total_cat_incl_ship_excl_before_disc_on_excl, display_excluding_including_tax downloadableProduct::with_two_separately_links_custom_options_and_category @@ -96,27 +76,6 @@ - - total_cat_incl_ship_excl_before_disc_on_excl, display_including_tax - downloadableProduct::with_two_separately_links_group_price_and_category - active_sales_rule_for_all_groups_no_coupon - - - customer_less_store_rate - johndoe_unique - - - 19.98 - 22.98 - 22.97 - 22.97 - 22.97 - 10.61 - 1.75 - 10.61 - 12.36 - - - - total_cat_incl_ship_excl_before_disc_on_excl downloadableProduct::with_two_separately_links_custom_options_and_category diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.xml index 008eda5b50abe..6166f4dffe39f 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.xml @@ -86,20 +86,6 @@ - - Create with group price products - test-grouped-product-%isolation% - GroupedProduct %isolation% - GroupedProduct_sku%isolation% - In Stock - category_%isolation% - catalogProductSimple::simple_with_group_price,catalogProductSimple::simple_with_group_price - defaultSimpleProduct - No - - - - Create with virtual products test-grouped-product-%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml index 6d1481e76ef1d..7b8599bf26f7f 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml @@ -36,64 +36,6 @@ - - Simple product group price with sales rule, customer tax greater than store tax and catalog price excluding tax - shipping_tax_class_taxable_goods, row_cat_excl_ship_incl_before_disc_on_incl, display_excluding_including_tax - catalogProductSimple::simple_with_group_price_and_category - active_sales_rule_for_all_groups_no_coupon - - - customer_greater_store_rate - johndoe_unique - 3 - 90.99 - 98.61 - 90.99 - 98.61 - 90.99 - 98.61 - 272.97 - 295.83 - 272.97 - 295.83 - 147.92 - 13.86 - 15.02 - 24.02 - 138.91 - 162.93 - - - - - - Simple product group price with sales rule, customer tax less than store tax and catalog price excluding tax - shipping_tax_class_taxable_goods, total_cat_excl_ship_incl_after_disc_on_excl, display_excluding_including_tax - catalogProductSimple::simple_with_group_price_and_category - active_sales_rule_for_all_groups_no_coupon - - - customer_less_store_rate - johndoe_unique - 3 - 90.99 - 98.50 - 90.99 - 98.50 - 90.99 - 98.50 - 272.97 - 295.49 - 272.97 - 295.49 - 136.49 - 13.84 - 14.98 - 12.40 - 150.32 - 162.72 - - - - Simple product special price with sales rule, customer tax less than store tax and catalog price including tax shipping_tax_class_taxable_goods, row_cat_incl_ship_excl_before_disc_on_incl, display_excluding_including_tax @@ -184,7 +126,7 @@ Simple product group price with sales rule, customer tax equals store tax and catalog price excluding tax shipping_tax_class_taxable_goods, unit_cat_excl_ship_excl_after_disc_on_excl, display_excluding_including_tax - catalogProductSimple::simple_with_group_price_and_category + catalogProductSimple::simple_with_tear_price_and_category active_sales_rule_for_all_groups_no_coupon - customer_equals_store_rate @@ -213,7 +155,7 @@ Simple product special price with sales rule, customer tax greater than store tax and catalog price including tax shipping_tax_class_taxable_goods, total_cat_incl_ship_excl_before_disc_on_excl, display_excluding_including_tax - catalogProductSimple::simple_with_group_price_and_category + catalogProductSimple::simple_with_tear_price_and_category active_sales_rule_for_all_groups_no_coupon - customer_greater_store_rate diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/Magento/ModuleA/view/adminhtml/product/product.css b/dev/tests/integration/testsuite/Magento/Framework/View/_files/Magento/ModuleA/view/adminhtml/product/product.css index c7310b1e87937..f3774cd9f0978 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/Magento/ModuleA/view/adminhtml/product/product.css +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/Magento/ModuleA/view/adminhtml/product/product.css @@ -723,8 +723,7 @@ } #product_options_container .data-table td, -#attribute-tier_price-container .data-table td, -#attribute-group_price-container .data-table td { +#attribute-tier_price-container .data-table td { vertical-align: top; } From 4b2e45ba5b299bfa679f035d54d42c4dfce64339 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Fri, 2 Oct 2015 09:32:59 +0300 Subject: [PATCH 24/30] MAGETWO-42501: PCF: removing grouped price --- .../Model/Import/AdvancedPricing.php | 2 +- .../Unit/Model/Import/AdvancedPricingTest.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php index 3c102ee325527..06f9968f41043 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php @@ -165,7 +165,7 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract * @param ImportProduct $importProduct * @param AdvancedPricing\Validator $validator * @param AdvancedPricing\Validator\Website $websiteValidator - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @param AdvancedPricing\Validator\TierPrice $tierPriceValidator * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( \Magento\Framework\Json\Helper\Data $jsonHelper, diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php index 687313f99aa0c..7471ef81011c2 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php @@ -51,6 +51,11 @@ class AdvancedPricingTest extends \Magento\ImportExport\Test\Unit\Model\Import\A */ protected $websiteValidator; + /** + * @var AdvancedPricing\Validator\TearPrice |\PHPUnit_Framework_MockObject_MockObject + */ + protected $tierPriceValidator; + /** * @var \Magento\ImportExport\Model\Resource\Helper |\PHPUnit_Framework_MockObject_MockObject */ @@ -229,6 +234,13 @@ public function setUp() '', false ); + $this->tierPriceValidator = $this->getMock( + '\Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TierPrice', + [], + [], + '', + false + ); $this->stringObject = $this->getMock( '\Magento\Framework\Stdlib\StringUtils', [], @@ -778,7 +790,8 @@ private function getAdvancedPricingMock($methods = []) $this->storeResolver, $this->importProduct, $this->validator, - $this->websiteValidator + $this->websiteValidator, + $this->tierPriceValidator ], '' ); From fe62be6f3c7b4007b868c03b5a4c464e4c95a85d Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Fri, 2 Oct 2015 09:47:03 +0300 Subject: [PATCH 25/30] MAGETWO-42501: PCF: removing grouped price --- .../Tax/Test/TestCase/TaxCalculationTest.xml | 58 ------------------- 1 file changed, 58 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml index 7b8599bf26f7f..8e6e7af60a097 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml @@ -123,64 +123,6 @@ - - Simple product group price with sales rule, customer tax equals store tax and catalog price excluding tax - shipping_tax_class_taxable_goods, unit_cat_excl_ship_excl_after_disc_on_excl, display_excluding_including_tax - catalogProductSimple::simple_with_tear_price_and_category - active_sales_rule_for_all_groups_no_coupon - - - customer_equals_store_rate - johndoe_unique - 3 - 90.99 - 98.50 - 90.99 - 98.50 - 90.99 - 98.50 - 272.97 - 295.50 - 272.97 - 295.50 - 136.49 - 15.00 - 16.24 - 12.49 - 151.48 - 163.97 - - - - - - Simple product special price with sales rule, customer tax greater than store tax and catalog price including tax - shipping_tax_class_taxable_goods, total_cat_incl_ship_excl_before_disc_on_excl, display_excluding_including_tax - catalogProductSimple::simple_with_tear_price_and_category - active_sales_rule_for_all_groups_no_coupon - - - customer_greater_store_rate - johndoe_unique - 3 - 84.06 - 91.10 - 84.06 - 91.10 - 84.06 - 91.10 - 252.18 - 273.30 - 252.18 - 273.30 - 126.09 - 15.00 - 16.26 - 22.38 - 141.09 - 163.47 - - - - Simple product tier price with sales rule, customer tax greater than store tax and catalog price excluding tax shipping_tax_class_taxable_goods, total_cat_excl_ship_incl_after_disc_on_incl, display_excluding_including_tax From 4925cf0b6d08f0e07c64f64b2f6dbed36d8c4ced Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Fri, 2 Oct 2015 12:24:46 +0300 Subject: [PATCH 26/30] MAGETWO-42501: PCF: removing grouped price --- .../Model/Import/AdvancedPricing.php | 3 ++- .../Magento/Framework/Search/Adapter/Mysql/Adapter.php | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php index 06f9968f41043..59334a6f43164 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php @@ -165,7 +165,8 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract * @param ImportProduct $importProduct * @param AdvancedPricing\Validator $validator * @param AdvancedPricing\Validator\Website $websiteValidator - * @param AdvancedPricing\Validator\TierPrice $tierPriceValidator * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @param AdvancedPricing\Validator\TierPrice $tierPriceValidator + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( \Magento\Framework\Json\Helper\Data $jsonHelper, diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php index b2b2955e371e8..0231520cf4414 100644 --- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php +++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php @@ -72,6 +72,11 @@ public function __construct( */ public function query(RequestInterface $request) { + /** @var \Magento\Framework\DB\Adapter\Pdo\Mysql $con */ + $con = $this->resource->getConnection(); + $con->setProfiler([ + 'enabled' => true + ]); $query = $this->mapper->buildQuery($request); $temporaryStorage = $this->temporaryStorageFactory->create(); $table = $temporaryStorage->storeDocumentsFromSelect($query); @@ -83,6 +88,7 @@ public function query(RequestInterface $request) 'documents' => $documents, 'aggregations' => $aggregations, ]; + var_dump($con->getProfiler()->getTotalElapsedSecs()); return $this->responseFactory->create($response); } From 07701ea6fe58027e7caf43d2182a624161223456 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Fri, 2 Oct 2015 12:26:12 +0300 Subject: [PATCH 27/30] MAGETWO-42501: PCF: removing grouped price --- .../Magento/Framework/Search/Adapter/Mysql/Adapter.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php index 0231520cf4414..b2b2955e371e8 100644 --- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php +++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php @@ -72,11 +72,6 @@ public function __construct( */ public function query(RequestInterface $request) { - /** @var \Magento\Framework\DB\Adapter\Pdo\Mysql $con */ - $con = $this->resource->getConnection(); - $con->setProfiler([ - 'enabled' => true - ]); $query = $this->mapper->buildQuery($request); $temporaryStorage = $this->temporaryStorageFactory->create(); $table = $temporaryStorage->storeDocumentsFromSelect($query); @@ -88,7 +83,6 @@ public function query(RequestInterface $request) 'documents' => $documents, 'aggregations' => $aggregations, ]; - var_dump($con->getProfiler()->getTotalElapsedSecs()); return $this->responseFactory->create($response); } From da6d8a7c614e57ede12986f9774e9052b149595e Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Fri, 2 Oct 2015 12:35:23 +0300 Subject: [PATCH 28/30] MAGETWO-42501: PCF: removing grouped price --- .../Magento/Catalog/Setup/UpgradeSchema.php | 225 ++++++++++-------- 1 file changed, 120 insertions(+), 105 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index a9935dc14d788..07a84f756d1f1 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -24,112 +24,9 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con { $setup->startSetup(); - $connection = $setup->getConnection(); if (version_compare($context->getVersion(), '2.0.1', '<')) { - /** Add support video media attribute */ - $this->createValueToEntityTable($setup); - /** - * Add media type property to the Gallery entry table - */ - $setup->getConnection()->addColumn( - $setup->getTable(Media::GALLERY_TABLE), - 'media_type', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'length' => 32, - 'nullable' => false, - 'default' => ImageEntryConverter::MEDIA_TYPE_CODE, - 'comment' => 'Media entry type' - ] - ); - $setup->getConnection()->addColumn( - $setup->getTable(Media::GALLERY_TABLE), - 'disabled', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 'unsigned' => true, - 'nullable' => false, - 'default' => 0, - 'comment' => 'Visibility status' - ] - ); - - /** - * Drop entity Id columns - */ - $setup->getConnection()->dropColumn($setup->getTable(Media::GALLERY_TABLE), 'entity_id'); - - /** - * Drop primary index - */ - $setup->getConnection()->dropForeignKey( - $setup->getTable(Media::GALLERY_VALUE_TABLE), - $setup->getFkName( - Media::GALLERY_VALUE_TABLE, - 'value_id', - Media::GALLERY_TABLE, - 'value_id' - ) - ); - $setup->getConnection()->dropForeignKey( - $setup->getTable(Media::GALLERY_VALUE_TABLE), - $setup->getFkName( - Media::GALLERY_VALUE_TABLE, - 'store_id', - 'store', - 'store_id' - ) - ); - $setup->getConnection()->dropIndex($setup->getTable(Media::GALLERY_VALUE_TABLE), 'primary'); - $setup->getConnection()->addColumn( - $setup->getTable(Media::GALLERY_VALUE_TABLE), - 'record_id', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 'primary' => true, - 'auto_increment' => true, - 'unsigned' => true, - 'nullable' => false, - 'comment' => 'Record Id' - ] - ); - - /** - * Add index 'value_id' - */ - $setup->getConnection()->addIndex( - $setup->getTable(Media::GALLERY_VALUE_TABLE), - $setup->getConnection()->getIndexName( - $setup->getTable(Media::GALLERY_VALUE_TABLE), - 'value_id', - 'index' - ), - 'value_id' - ); - $this->addForeignKeys($setup); - - - $fields = [ - ['table' => 'catalog_product_index_price_final_idx', 'column' => 'base_group_price'], - ['table' => 'catalog_product_index_price_final_tmp', 'column' => 'base_group_price'], - ['table' => 'catalog_product_index_price', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_cfg_opt_agr_idx', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_cfg_opt_agr_tmp', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_cfg_opt_idx', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_cfg_opt_tmp', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_final_idx', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_final_tmp', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_idx', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_opt_agr_idx', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_opt_agr_tmp', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_opt_idx', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_opt_tmp', 'column' => 'group_price'], - ['table' => 'catalog_product_index_price_tmp', 'column' => 'group_price'], - ]; - - foreach ($fields as $filedInfo) { - $connection->dropColumn($setup->getTable($filedInfo['table']), $filedInfo['column']); - } + $this->addSupportVideoMediaAttributes($setup); + $this->removeGroupPrice($setup); } $setup->endSetup(); @@ -236,4 +133,122 @@ protected function addForeignKeys(SchemaSetupInterface $setup) \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ); } + + /** + * @param SchemaSetupInterface $setup + */ + private function addSupportVideoMediaAttributes(SchemaSetupInterface $setup) + { + /** Add support video media attribute */ + $this->createValueToEntityTable($setup); + /** + * Add media type property to the Gallery entry table + */ + $setup->getConnection()->addColumn( + $setup->getTable(Media::GALLERY_TABLE), + 'media_type', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'length' => 32, + 'nullable' => false, + 'default' => ImageEntryConverter::MEDIA_TYPE_CODE, + 'comment' => 'Media entry type' + ] + ); + $setup->getConnection()->addColumn( + $setup->getTable(Media::GALLERY_TABLE), + 'disabled', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 'unsigned' => true, + 'nullable' => false, + 'default' => 0, + 'comment' => 'Visibility status' + ]) + ; + + /** + * Drop entity Id columns + */ + $setup->getConnection()->dropColumn($setup->getTable(Media::GALLERY_TABLE), 'entity_id'); + + /** + * Drop primary index + */ + $setup->getConnection()->dropForeignKey( + $setup->getTable(Media::GALLERY_VALUE_TABLE), + $setup->getFkName( + Media::GALLERY_VALUE_TABLE, + 'value_id', + Media::GALLERY_TABLE, + 'value_id' + ) + ); + $setup->getConnection()->dropForeignKey( + $setup->getTable(Media::GALLERY_VALUE_TABLE), + $setup->getFkName( + Media::GALLERY_VALUE_TABLE, + 'store_id', + 'store', + 'store_id' + ) + ); + $setup->getConnection()->dropIndex($setup->getTable(Media::GALLERY_VALUE_TABLE), 'primary'); + $setup->getConnection()->addColumn( + $setup->getTable(Media::GALLERY_VALUE_TABLE), + 'record_id', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 'primary' => true, + 'auto_increment' => true, + 'unsigned' => true, + 'nullable' => false, + 'comment' => 'Record Id' + ] + ); + + /** + * Add index 'value_id' + */ + $setup->getConnection()->addIndex( + $setup->getTable(Media::GALLERY_VALUE_TABLE), + $setup->getConnection()->getIndexName( + $setup->getTable(Media::GALLERY_VALUE_TABLE), + 'value_id', + 'index' + ), + 'value_id' + ); + $this->addForeignKeys($setup); + } + + /** + * Remove Group Price + * @param SchemaSetupInterface $setup + */ + private function removeGroupPrice(SchemaSetupInterface $setup) + { + $connection = $setup->getConnection(); + $fields = [ + ['table' => 'catalog_product_index_price_final_idx', 'column' => 'base_group_price'], + ['table' => 'catalog_product_index_price_final_tmp', 'column' => 'base_group_price'], + ['table' => 'catalog_product_index_price', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_cfg_opt_agr_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_cfg_opt_agr_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_cfg_opt_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_cfg_opt_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_final_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_final_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_opt_agr_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_opt_agr_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_opt_idx', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_opt_tmp', 'column' => 'group_price'], + ['table' => 'catalog_product_index_price_tmp', 'column' => 'group_price'], + ]; + + foreach ($fields as $filedInfo) { + $connection->dropColumn($setup->getTable($filedInfo['table']), $filedInfo['column']); + } + } } From 0d195751746a47a0fa127f95e1f3623e5e4cda95 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Fri, 2 Oct 2015 12:56:45 +0300 Subject: [PATCH 29/30] MAGETWO-42501: PCF: removing grouped price --- app/code/Magento/Catalog/Setup/UpgradeSchema.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index 07a84f756d1f1..6d70e1ad0b868 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -136,6 +136,7 @@ protected function addForeignKeys(SchemaSetupInterface $setup) /** * @param SchemaSetupInterface $setup + * @return void */ private function addSupportVideoMediaAttributes(SchemaSetupInterface $setup) { @@ -225,6 +226,7 @@ private function addSupportVideoMediaAttributes(SchemaSetupInterface $setup) /** * Remove Group Price * @param SchemaSetupInterface $setup + * @return void */ private function removeGroupPrice(SchemaSetupInterface $setup) { From ce9a578bcebd2d2715370c8484b952c60196df39 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Fri, 2 Oct 2015 13:47:17 +0300 Subject: [PATCH 30/30] MAGETWO-42501: PCF: removing grouped price --- app/code/Magento/Catalog/Setup/UpgradeSchema.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index 6d70e1ad0b868..fe978e80a9807 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -165,8 +165,8 @@ private function addSupportVideoMediaAttributes(SchemaSetupInterface $setup) 'nullable' => false, 'default' => 0, 'comment' => 'Visibility status' - ]) - ; + ] + ); /** * Drop entity Id columns