Where Can I Sort Date Attribute
-
16-10-2019 - |
문제
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.
해결책
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);
제휴하지 않습니다 magento.stackexchange