1

One of the configurable attributes on the product details page is date. Currently these are displayed in the order which they are found in the database.

I need for these to display on the product page in an ascending sorted order. So far I've gotten as far as this file

Mage/Catalog/Model/Product/Type/Configurable.php  

The attributes seem to be called by this method

getConfigurableAttributeCollection($product = null)

which is called from

getConfigurableAttributes($product = null)
 {
    Varien_Profiler::start('CONFIGURABLE:'.__METHOD__);
    if (!$this->getProduct($product)->hasData($this->_configurableAttributes)) {
        $configurableAttributes = $this->getConfigurableAttributeCollection($product)
            ->orderByPosition()
            ->load(); 
        $this->getProduct($product)->setData($this->_configurableAttributes, $configurableAttributes);
    }
    Varien_Profiler::stop('CONFIGURABLE:'.__METHOD__);
    return $this->getProduct($product)->getData($this->_configurableAttributes);
}

I've done various var_dumps() at different points but I am still unsure about where exactly I can or should sort these dates.

2

I was able to catch the data in

shop/app/code/local/Mage/Catalog/Block/Product/View/Type/Configurable.php

I created a new method to perform the changes that I needed and called it like so

   $attributes[145]['options'] = $this->getOrderDateOptions($attributes);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.