Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1106807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:50:49+00:00 2026-05-17T01:50:49+00:00

I am currently trying to make a special sort function for a Magento category

  • 0

I am currently trying to make a special sort function for a Magento category page.

I have several attributes, which I need to use for sorting:

The first attribute is named designers. This attribute is set on a configurable product.

The next attributes are named colour and size. These are not set on the configurable product itself, but on the ”simple products”, that I combine to make the configurable product.

$attributes_designers = $this->getRequest()->getParam('designers');   
$attributes_colors = $this->getRequest()->getParam('color');
$attributes_sizes = $this->getRequest()->getParam('size');

$currentCategory =  Mage::getModel('catalog/layer')->getCurrentCategory(); 
$_productCollection = $currentCategory->getProductCollection();

if(count($attributes_designers)>0 and !in_array("ALL",$attributes_designers)) {        
    $_productCollection->addAttributeToFilter('designer',$attributes_designers);
}
if(count($attributes_colors)>0 and !in_array("ALL",$attributes_colors)) {        
    $_productCollection->addAttributeToFilter('color',$attributes_colors);
}
if(count($attributes_sizes)>0 and !in_array("ALL",$attributes_sizes)) {        
    $_productCollection->addAttributeToFilter('size',$attributes_sizes);
}
if(isset($_GET['order'])) $_productCollection->setOrder($this->getRequest()->getParam('order'), $this->getRequest()->getParam('dir'));

$_productCollection->load();

Unfortunately I’m unable to get the attribute colour and size working, since they are not set on the configurable product, but it’s children.

Does anyone have an idea how to get this working?

Thanks in advance

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:50:49+00:00Added an answer on May 17, 2026 at 1:50 am

    Two things:

    • I assume you know this, but just to make sure: You can easily make any of your attributes sortable by editing the attribute in Catalog >> Attributes >> Manage Attributes, editing one and the bottom option is called “Used for Sorting in Product Listing” – which you should set to “Yes”.
    • As you have found out, Magento isn’t going to want to sort a configurable product by any values in the simple products that have been associated to it. This actually makes plenty of sense. If you are trying to sort by color, and you have a configurable product with 2 simple products, one of which has the color of “Apple Red” and the other with “Zealot Black”, then how would it sort that? It simply cannot make logical sense to do what you are hoping. It only sorts based on attributes assigned to the configurable product.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to make a set of conversion functions which, through one call,
i'm currently trying to make a asp.net mvc3 app. in the sample application which
I am currently trying to make a broadcast receiver which will invoke after android
I'm currently trying to make an application which could digitally sign any kind of
I'm currently trying to make the function below work correctly. Recently added the IF
I am currently trying to make my existing ASP.NET WebForms application use a Site.Master
I'm currently trying to make an orientation calculator in java and I'm having a
I am currently trying to make a sectioned table like this: Section 1: Entry
I am currently trying to make a dropbox-esque application from a tutorial and I
I am currently trying to make an application that allows the user to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.