2015-12-09 81 views
1

我想指定一個CSS類以應用於我的自定義選項。這將允許我在產品視圖頁面上使用更強大的JavaScript選擇器。Magento自定義選項 - 在下拉菜單中將CSS className添加到自定義選項

我試了很多,但沒有得到如何添加。

enter image description here

對於這個我想\塊\產品\查看\選項\型號\ select.php

及以下線路增加這個選項

$select->addOption(
        $_value->getOptionTypeId(), 
        $_value->getTitle() . ' ' . $priceStr . '', 
        array('price' => $this->helper('core')->currencyByStore($_value->getPrice(true), $store, false)), 
        array('class' => 'testsfs') 
       ); 
在法師\目錄改變

但沒有得到我可以如何將我的自定義類添加到此選項。 我希望有人幫助我。

謝謝。

回答

0

終於找到了解決辦法。 只需要在數組中添加'class'=>'myClass'。

$select->addOption(
        $_value->getOptionTypeId(), 
        $_value->getTitle() . ' ' . $priceStr . '', 
        array('price' => $this->helper('core')->currencyByStore($_value->getPrice(true), $store, false), 'class' => 'myClass') 
       ); 
相關問題