This seems to be a limitation of the way that customer group pricing has been implemented. To fix what is absolutely a bug, I suspect that customer group prices may have to be extracted from tier pricing.
Am I missing something? Is there any way to recreate the Magento 1 standard functionality of having the normal price set per customer group and then catalog rules applying a discount on this?
I have a client chasing this and no idea how to go about making this work without the basic functionality being fixed. The workarounds would be:
@maderlock We've created internal ticket MAGETWO-70131 to address this issue.
Same problem here. I even upgraded to Magento 2.1.8.
I am new here, how do I look up MAGETWO-70131 ????
@SeanUSA you can't look up that ticket directly, but once it gets fixed, we'll comment here and you can use that id to look up relevant commits in the codebase.
I see this is marked as being merged. Can this please get a 2.1.x release as it's a 2.1 issue, as I raised this issue due to a major problem we're having on a 2.1 site?
What we're looking for is something like this:
magento-engcom-team added to TODO in branch [2.1-develop]
Please?
@maderlock, thank you for your report.
We've created internal ticket(s) MAGETWO-70131 to track progress on the issue.
@magento-engcom-team, does your last message indicate that you are planning to release a fix for 2.1?
@magento-engcom-team, @okorshenko, are you able to provide any update on this please?
We are nearing the end of a large M2 project, and this is causing us significant issues.
Many thanks.
Hi @mustdobetter
The ticket MAGETWO-70131 is still open in the backlog for 2.2.x
There is no ticket for 2.1 for now. If someone will submit a PR to fix this issue for 2.1, we will accept it and deliver with patch release
Hi @okorshenko, thanks for the update. Before embarking on a fix for this issue, my concern is that, as @maderlock eluded to, the tiered pricing functionality actually needs to be separated from the customer group pricing, effectively allowing it work in a similar way to Magento 1. This is more of a fundamental change to how these features work, rather than a fix for existing functionality. Are you able to comment on this, and advise what route you'll be taking in 2.2.x? I'm keen not to waste time working on a solution that is not inline with your expectations or future plans.
Hi,
Does anybody have an update where this bug is at in terms of being fixed?
Thanks
Hey @mustdobetter --- It's been several months. Did you by chance come up with a work-around in lieu of a core fix?
@langstn, unfortunately not. Instead we decided to work around this by fundamentally changing the feature we were developing.
I need to solve this bug... some workaround?
I'm losing it trying to understand how the price is calculated...
I tried to create the work around:
Overriding the file: magento/module-catalog-rule/Model/Indexer/IndexBuilder.php
/**
* @param int $websiteId
* @param Product|null $product
* @return \Zend_Db_Statement_Interface
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function getRuleProductsStmt($websiteId, \Magento\Catalog\Model\Product $product = null)
{
/**
* Sort order is important
* It used for check stop price rule condition.
* website_id customer_group_id product_id sort_order
* 1 1 1 0
* 1 1 1 1
* 1 1 1 2
* if row with sort order 1 will have stop flag we should exclude
* all next rows for same product id from price calculation
*/
$select = $this->connection->select()->from(
['rp' => $this->getTable('catalogrule_product')]
)->order(
['rp.website_id', 'rp.customer_group_id', 'rp.product_id', 'rp.sort_order', 'rp.rule_id']
);
if ($product && $product->getEntityId()) {
$select->where('rp.product_id=?', $product->getEntityId());
}
/**
* Join default price and websites prices to result
*/
$priceAttr = $this->eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'price');
$priceTable = $priceAttr->getBackend()->getTable();
$attributeId = $priceAttr->getId();
$linkField = $this->getMetadataPool()->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class)->getLinkField();
$select->join(
['e' => $this->getTable('catalog_product_entity')],
sprintf('e.entity_id = rp.product_id'),
[]
);
$joinCondition = '%1$s.' . $linkField . '=e.' . $linkField . ' AND (%1$s.attribute_id='
. $attributeId
. ') and %1$s.store_id=%2$s';
$select->join(
['pp_default' => $priceTable],
sprintf($joinCondition, 'pp_default', \Magento\Store\Model\Store::DEFAULT_STORE_ID),
[]
);
$website = $this->storeManager->getWebsite($websiteId);
$defaultGroup = $website->getDefaultGroup();
if ($defaultGroup instanceof \Magento\Store\Model\Group) {
$storeId = $defaultGroup->getDefaultStoreId();
} else {
$storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
}
$select->joinInner(
['product_website' => $this->getTable('catalog_product_website')],
'product_website.product_id=rp.product_id '
. 'AND product_website.website_id = rp.website_id '
. 'AND product_website.website_id='
. $websiteId,
[]
);
$tableAlias = 'pp' . $websiteId;
$select->joinLeft(
[$tableAlias => $priceTable],
sprintf($joinCondition, $tableAlias, $storeId),
[]
);
// tier prices LEFT JOIN `catalog_product_entity_tier_price`
$select->joinLeft(
['tp' => 'catalog_product_entity_tier_price'],
'tp.entity_id = rp.product_id AND tp.customer_group_id = rp.customer_group_id',
[]
);
// COALESCE tier price
$select->columns([
'default_price' => new \Zend_Db_Expr('COALESCE(tp.value, pp1.value, pp_default.value)')
]);
return $this->connection->query($select);
}
Basically, adding the left join tier price.... But I really don't know if it breaks something else.
Hi @somat211. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. Verify that the issue is reproducible on 2.2-develop branch. Details
- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x
[ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.
The related internal Jira ticket MC-18463, MAGETWO-70131 was closed as wontfix.
Final price is currently calculated in the system by using the next formula:
Min(Regular Price, Special Price, Group Price, Regular Price with Catalog Price Rule Discount)
which is more consistent then proposed in the ticket.
rtret