日付属性をどこでソートできますか
-
16-10-2019 - |
質問
Productの詳細ページの構成可能な属性の1つは日付です。現在、これらはデータベースにある順序で表示されます。
これらは、昇順の並べ替えられた順序で製品ページに表示する必要があります。これまでのところ、私はこのファイルまで到達しました
Mage/Catalog/Model/Product/Type/Configurable.php
属性はこの方法で呼び出されているようです
getConfigurableAttributeCollection($product = null)
それはから呼ばれます
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);
}
さまざまなポイントでさまざまなvar_dumps()を実行しましたが、これらの日付を正確に並べ替えることができるかどうかはまだわかりません。
解決
データをキャッチできました
shop/app/code/local/Mage/Catalog/Block/Product/View/Type/Configurable.php
必要な変更を実行し、そのように呼んだ新しい方法を作成しました
$attributes[145]['options'] = $this->getOrderDateOptions($attributes);
所属していません magento.stackexchange