Associated (grouped) product sorting
-
08-12-2020 - |
Question
I have several grouped products and cannot determine what is determining the sort order of them in the catalog view. Here are 3 examples:
ID SKU Description Price type
6899 PUBINSURANCEESSENTIALS Insurance Essentials grouped
6900 PUBINSESS2011 Insurance Essentials (Print) $65.00 simple
6901 EPUBINSESS2011 Insurance Essentials (eBook - PDF Format) $45.00 downloadable
ID SKU Description Price type
11317 PUBHISTORY A Tedious Brief History of Insurance grouped
11316 EPUBHIST1EPB A Tedious Brief History of Insurance (eBook - EPUB Format) $15.00 downloadable
11315 EPUBHIST1PDF A Tedious Brief History of Insurance (eBook - PDF Format) $15.00 downloadable
11314 PUBHISTORY2015 A Tedious Brief History of Insurance (Print) $25.00 simple
ID SKU Description Price type
8062 PUBNETINCOMERISKMANAGEMENT Net Income Risk Management grouped
8063 PUBNETRISKMGT12 Net Income Risk Management (Print) $45.00 simple
8064 EPUBNETRISKMGT Net Income Risk Management (eBook - PDF Format) $35.00 downloadable
But, they show like this:
I'm not sure what it is that is causing them to be sorted the way they are. I'd like them to all be sorted the same way. Any ideas?
Magento v1.4.0.1
OTHER TIPS
This answer is based on Magento 1.9. (Since I don't have a copy of Magento 1.4) But still this might be helpful to figure out the cause for your issue.
Carefully look at the function located in Mage_Catalog_Model_Product_Type_Grouped->getAssociatedProducts()
which actually returns the associated product collection.
public function getAssociatedProducts($product = null)
{
if (!$this->getProduct($product)->hasData($this->_keyAssociatedProducts)) {
$associatedProducts = array();
if (!Mage::app()->getStore()->isAdmin()) {
$this->setSaleableStatus($product);
}
$collection = $this->getAssociatedProductCollection($product)
->addAttributeToSelect('*')
->addFilterByRequiredOptions()
->setPositionOrder()
->addStoreFilter($this->getStoreFilter($product))
->addAttributeToFilter('status', array('in' => $this->getStatusFilters($product)));
foreach ($collection as $item) {
$associatedProducts[] = $item;
}
$this->getProduct($product)->setData($this->_keyAssociatedProducts, $associatedProducts);
}
return $this->getProduct($product)->getData($this->_keyAssociatedProducts);
}
And there are two possible ways of overcoming the above issue.
(1). Override the above function and sort associate product collection as you want
This link might help you on overriding the model http://inchoo.net/magento/how_to_override_magento_model_classes/
(2). At the time when associated products are loading in front-end sort them on-the-fly
Find the block associated with rendering these child products and sort the collection there.