Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

sort order (position) ignored to large extent in manage categories / manage products
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

Please compare;

http://www.meanmachines.biz/store/central-locking/remote-central-locking-kits

Each item in this category has been given the corresponding position (1, 2, 3, 4, 5 etc).  This is to overcome the bug which follows below.
When viewed by the root anchor, it looks like this;

http://www.meanmachines.biz/store/central-locking

and when filtered it looks like this;

http://www.meanmachines.biz/store/central-locking?cat=30

As you can see, items 11, 12 ad 13 are coming up to the top when they should follow number 10.

 
Magento Community Magento Community
Magento Community
Magento Community
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

Man I feel like an exterminator.  Every time I attempt to play about with my store I keep finding bugs.
The above bug has been reported here;

http://www.magentocommerce.com/bug-tracking/issue?issue=4561

 
Magento Community Magento Community
Magento Community
Magento Community
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

as requested in the bug report. If I remove the position it is no better, but rather worse.
with them enabled, when viewing the category direct (not via root / filters) the sort order is OK. it is only broken when filtering via layered navigation or when viewing the anchor category.

Image Attachments
0002.JPG
 
Magento Community Magento Community
Magento Community
Magento Community
 
herve@wsa
Member
 
Avatar
Total Posts:  48
Joined:  2008-07-22
United Kingdom
 

Hi there,

I had this issue this morning and found an easy (programming way though) to handle this.
I believe the bug is due to an alias used in the query that looks after the reordering of the products.
--> the alias that is wrong is cat_index_position

I did change one function in the file:
magento/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php

The function changed is: _applyProductLimitations

/**
     * Apply limitation filters to collection
     *
     * Method allow use one time category product index table (or product website table)
     * for different combinations of store_id/category_id/visibility filter states
     *
     * Mehod support multiple changes in one collection object for this parameters
     *
     * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
     */
    protected function _applyProductLimitations()
    
{
        $this
->_prepareProductLimitationFilters();
        
$this->_productLimitationJoinWebsite();
        
$filters $this->_productLimitationFilters;

        if (!isset(
$filters['category_id']) && !isset($filters['visibility'])) {
            
return $this;
        
}

        $conditions 
= array(
            
'cat_index.product_id=e.entity_id',
            
$this->getConnection()->quoteInto('cat_index.store_id=?'$filters['store_id'])
        );
        if (isset(
$filters['visibility'])) {
            $conditions[] 
$this->getConnection()
                ->
quoteInto('cat_index.visibility IN(?)'$filters['visibility']);
        
}
        $conditions[] 
$this->getConnection()
            ->
quoteInto('cat_index.category_id=?'$filters['category_id']);
        if (isset(
$filters['category_is_anchor'])) {
            $conditions[] 
$this->getConnection()
                ->
quoteInto('cat_index.is_parent=?'$filters['category_is_anchor']);
        
}

        $joinCond 
join(' AND '$conditions);
        
$fromPart $this->getSelect()->getPart(Zend_Db_Select::FROM);
        if (isset(
$fromPart['cat_index'])) {
            $fromPart[
'cat_index']['joinCondition'$joinCond;
            
$this->getSelect()->setPart(Zend_Db_Select::FROM$fromPart);
        
}
        
else {
            $this
->getSelect()->join(
                array(
'cat_index' => $this->getTable('catalog/category_product_index')),
                
$joinCond,
                array(
'position' => 'position')
            );
        
}

        Mage
::dispatchEvent('catalog_product_collection_apply_limitations_after', array(
            
'collection'    => $this
        
));

        return 
$this;
    
}

This function should be included in a module outside the core in order not to corrupt the magento core file.
essentially we need to change array(’cat_index_position’ => ‘position’) to array(’position’ => ‘position’)

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ashley01
Jr. Member
 
Total Posts:  15
Joined:  2010-05-06
 

Hi, this is a technical matter. it is tough that i will overcome with this.

_______________________

\"Want to get-on Google\’s first page in 48 hours and flood your site with traffic?
Try Traffic Geyser, the internet\’s #1 video marketing software at Traffic Geyser \”

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ashley01
Jr. Member
 
Total Posts:  15
Joined:  2010-05-06
 

Hi, i think i cannot go through this. is there any easy step?

____________________

“Want to get-on Google’s first page in 48 hours and flood your site with traffic?
Try Traffic Geyser, the internet’s #1 video marketing software at Traffic Geyser

 
Magento Community Magento Community
Magento Community
Magento Community
 
mag_ce
Jr. Member
 
Total Posts:  7
Joined:  2011-07-06
 
herve@wsa - 14 May 2010 01:59 AM

Hi there,

I had this issue this morning and found an easy (programming way though) to handle this.
I believe the bug is due to an alias used in the query that looks after the reordering of the products.
--> the alias that is wrong is cat_index_position

I did change one function in the file:
magento/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php

The function changed is: _applyProductLimitations

/**
     * Apply limitation filters to collection
     *
     * Method allow use one time category product index table (or product website table)
     * for different combinations of store_id/category_id/visibility filter states
     *
     * Mehod support multiple changes in one collection object for this parameters
     *
     * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
     */
    protected function _applyProductLimitations()
    
{
        $this
->_prepareProductLimitationFilters();
        
$this->_productLimitationJoinWebsite();
        
$filters $this->_productLimitationFilters;

        if (!isset(
$filters['category_id']) && !isset($filters['visibility'])) {
            
return $this;
        
}

        $conditions 
= array(
            
'cat_index.product_id=e.entity_id',
            
$this->getConnection()->quoteInto('cat_index.store_id=?'$filters['store_id'])
        );
        if (isset(
$filters['visibility'])) {
            $conditions[] 
$this->getConnection()
                ->
quoteInto('cat_index.visibility IN(?)'$filters['visibility']);
        
}
        $conditions[] 
$this->getConnection()
            ->
quoteInto('cat_index.category_id=?'$filters['category_id']);
        if (isset(
$filters['category_is_anchor'])) {
            $conditions[] 
$this->getConnection()
                ->
quoteInto('cat_index.is_parent=?'$filters['category_is_anchor']);
        
}

        $joinCond 
join(' AND '$conditions);
        
$fromPart $this->getSelect()->getPart(Zend_Db_Select::FROM);
        if (isset(
$fromPart['cat_index'])) {
            $fromPart[
'cat_index']['joinCondition'$joinCond;
            
$this->getSelect()->setPart(Zend_Db_Select::FROM$fromPart);
        
}
        
else {
            $this
->getSelect()->join(
                array(
'cat_index' => $this->getTable('catalog/category_product_index')),
                
$joinCond,
                array(
'position' => 'position')
            );
        
}

        Mage
::dispatchEvent('catalog_product_collection_apply_limitations_after', array(
            
'collection'    => $this
        
));

        return 
$this;
    
}

This function should be included in a module outside the core in order not to corrupt the magento core file.
essentially we need to change array(’cat_index_position’ => ‘position’) to array(’position’ => ‘position’)

This solution is only good while you want to edit the category position, because it also affects how the products are displayed on the front end. (at least in my version - 1.5.1)

It’s not a good solution if you want a store admin to take care of the site.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top