Skip to content

Conversation

mayankzalavadia
Copy link
Contributor

Pull Request For Magento 2.2.0: A solution for Product Repeat Issue after filter on category listing page.

Description

I have traced the issues and finally, I have found the problem. This issues #11139 is occurring just because of product position. When some products position are same on collection at that time we have faced this issue. For more detail about this issues please check #11139

Fixed Issues (if relevant)

  1. Product Repeat Isuue after filter on category listing page. #11139: Product Repeat Isuue after filter on category listing page.

Manual testing scenarios

  1. Please check Product Repeat Isuue after filter on category listing page. #11139

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

}
if ($this->getCurrentOrder()) {
$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
if (($this->getCurrentOrder()) == 'position') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One set of round brackets seem to be redundant here. Additionally, please use strict comparison

$this->_collection->addAttributeToSort(
$this->getCurrentOrder(),
$this->getCurrentDirection()
)->addAttributeToSort('entity_id', $this->getCurrentDirection());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming that this collection contains products – using entity_id directly is discouraged, as this may break on certain scenarios in Magento Commerce (formerly EE) with staging feature enabled.
This may be resolved using metadata for the entity from MetadataPool and getting proper link field for the entity in question. You may search code for such examples (something I've found right away: \Magento\ConfigurableProduct\Model\ResourceModel\Indexer\Stock\Configurable::_getStockStatusSelect.

Copy link
Contributor Author

@mayankzalavadia mayankzalavadia Oct 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ishakhsuvarov Then you suggest us a proper solutions for this issue. Please let me know what exactly I need to change in above code.

@ishakhsuvarov ishakhsuvarov self-assigned this Oct 13, 2017
@ishakhsuvarov ishakhsuvarov added this to the October 2017 milestone Oct 13, 2017
@ishakhsuvarov ishakhsuvarov added Release Line: 2.2 2.2.x Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 13, 2017
@ishakhsuvarov
Copy link
Contributor

@mayankzalavadia Please consider covering the updated flow with the test

@mayankzalavadia
Copy link
Contributor Author

@ishakhsuvarov Then you suggest us a proper solution for this issue. Please let me know what exactly I need to change in above code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Progress: accept Release Line: 2.2 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants