I've been trying to something for days and stuck! Need help. I'm trying to manipulate the getloadedproductcollection() method called in list.phtml file in catalog/product. I want to remove the duplicate entries of a product(by name). I tried to apply filters in phtml files but with no success. When looked in the list.php file, couldn't get anything to achieve what I want. Is there any possible way to apply that filter to the product collection on category pages.
I tried getSelect()->group('name')
as it was mentioned on a question in stackoverflow, but it generated error. Can't do distinct()
as it is having no effect. Also tried removeItemByKey(&key)
inside foreach loop, it again generated error.
Can anyone redirect me to right direction, as it strongly feel, it should be possible in an environment like magento.
P.S.: don't want to delete duplicate products from backend as they are necessity.
Reason for duplicate products: I'm having variations of products in weight, volume, or other units, which can't be managed with configurable products, as there is no rule for defining these values in advance, they may be ranging from 1kg to 100kg for example. Therefore, I created an attribute for their respective units and products having same name are differentiated using their respective units. That's why I'm having duplicate entries.