1

私は試した:

<option value="<?php echo $this->getOrderUrl('topsellings', 'desc') ?>"<?php if ($this->isOrderCurrent('topsellings') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
    Most Popular
</option>

<option value="<?php echo $this->getOrderUrl('special_price', 'desc') ?>"<?php if ($this->isOrderCurrent('special_price') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
    On Sale
</option>

しかし、それを取得できません。サイトはこちらをご覧ください。私は何が欠けていますか?

4

2 に答える 2

0

フィールドの属性値を設定するとused_for_sort_by、テンプレートはこの変更を取得する必要があり、テンプレート コードを変更する必要はありません。これは、セットアップ スクリプトを介して実行するか、属性管理部分の管理セクションを介して簡単に設定できます。

の関数getAttributesUsedForSortByは、Mage_Catalog_Model_Configこのフラグが true に設定されているすべての属性を検索します。デフォルトのテンプレートは、次の理由により自動的に更新されます。

<?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
    <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
        <?php echo $this->__($_order) ?>
    </option>
<?php endforeach; ?>
于 2013-11-13T13:12:00.943 に答える