0
A
回答
2
嗨創建文件夾的應用程序\代碼\本地\法師\目錄\座\產品\查看\選項\型號
,並創建文件Select.php
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magento.com for more information.
*
* @category Mage
* @package Mage_Catalog
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* Product options text type block
*
* @category Mage
* @package Mage_Catalog
* @author Magento Core Team <[email protected]>
*/
class Mage_Catalog_Block_Product_View_Options_Type_Select
extends Mage_Catalog_Block_Product_View_Options_Abstract
{
/**
* Return html for control element
*
* @return string
*/
public function getValuesHtml()
{
$_option = $this->getOption();
$configValue = $this->getProduct()->getPreconfiguredValues()->getData('options/' . $_option->getId());
$store = $this->getProduct()->getStore();
if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN
|| $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE) {
$require = ($_option->getIsRequire()) ? ' required-entry' : '';
$extraParams = '';
$select = $this->getLayout()->createBlock('core/html_select')
->setData(array(
'id' => 'select_'.$_option->getId(),
'class' => $require.' product-custom-option'
));
if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
$select->setName('options['.$_option->getid().']')
->addOption('', $this->__('-- Please Select --'));
}
else {
$select->setName('options['.$_option->getid().'][]');
$select->setClass('multiselect'.$require.' product-custom-option');
}
foreach ($_option->getValues() as $_value) {
$priceStr = $this->_formatPrice(array(
'is_percent' => ($_value->getPriceType() == 'percent'),
'pricing_value' => $_value->getPrice(($_value->getPriceType() == 'percent'))
), false);
$select->addOption(
$_value->getOptionTypeId(),
$_value->getTitle(),
array('price' => $this->helper('core')->currencyByStore($_value->getPrice(true), $store, false))
);
}
if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE) {
$extraParams = ' multiple="multiple"';
}
if (!$this->getSkipJsReloadPrice()) {
$extraParams .= ' onchange="opConfig.reloadPrice()"';
}
$select->setExtraParams($extraParams);
if ($configValue) {
$select->setValue($configValue);
}
return $select->getHtml();
}
if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO
|| $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX
) {
$selectHtml = '<ul id="options-'.$_option->getId().'-list" class="options-list">';
$require = ($_option->getIsRequire()) ? ' validate-one-required-by-name' : '';
$arraySign = '';
switch ($_option->getType()) {
case Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO:
$type = 'radio';
$class = 'radio';
if (!$_option->getIsRequire()) {
$selectHtml .= '<li><input type="radio" id="options_' . $_option->getId() . '" class="'
. $class . ' product-custom-option" name="options[' . $_option->getId() . ']"'
. ($this->getSkipJsReloadPrice() ? '' : ' onclick="opConfig.reloadPrice()"')
. ' value="" checked="checked" /><span class="label"><label for="options_'
. $_option->getId() . '">' . $this->__('None') . '</label></span></li>';
}
break;
case Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX:
$type = 'checkbox';
$class = 'checkbox';
$arraySign = '[]';
break;
}
$count = 1;
foreach ($_option->getValues() as $_value) {
$count++;
$priceStr = $this->_formatPrice(array(
'is_percent' => ($_value->getPriceType() == 'percent'),
'pricing_value' => $_value->getPrice($_value->getPriceType() == 'percent')
));
$htmlValue = $_value->getOptionTypeId();
if ($arraySign) {
$checked = (is_array($configValue) && in_array($htmlValue, $configValue)) ? 'checked' : '';
} else {
$checked = $configValue == $htmlValue ? 'checked' : '';
}
$selectHtml .= '<li>' . '<input type="' . $type . '" class="' . $class . ' ' . $require
. ' product-custom-option"'
. ($this->getSkipJsReloadPrice() ? '' : ' onclick="opConfig.reloadPrice()"')
. ' name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId()
. '_' . $count . '" value="' . $htmlValue . '" ' . $checked . ' price="'
. $this->helper('core')->currencyByStore($_value->getPrice(true), $store, false) . '" />'
. '<span class="label"><label for="options_' . $_option->getId() . '_' . $count . '">'
. $this->escapeHtml($_value->getTitle()) . ' ' . '</label></span>';
if ($_option->getIsRequire()) {
$selectHtml .= '<script type="text/javascript">' . '$(\'options_' . $_option->getId() . '_'
. $count . '\').advaiceContainer = \'options-' . $_option->getId() . '-container\';'
. '$(\'options_' . $_option->getId() . '_' . $count
. '\').callbackFunction = \'validateOptionsCallback\';' . '</script>';
}
$selectHtml .= '</li>';
}
$selectHtml .= '</ul>';
return $selectHtml;
}
}
}
相關問題
- 1. 想要刪除「 - 請選擇 - 」選項進入magento的自定義選項
- 2. Magento刪除產品自定義選項
- 3. Magento Bundle選擇選項定價問題
- 4. Magento自定義選項 - 清除輸入字段問題
- 5. 輸入選擇2刪除選定
- 6. Magento - 自定義選項的價格錯誤
- 7. magento - 購物車中的自定義選項價格
- 8. magento的自定義選項
- 9. magento輸出自定義選項
- 10. 從在Magento結賬車項目的選項刪除價格
- 11. MAGENTO自定義選項網格
- 12. Magento簡單的產品自定義選項價格作爲產品價格
- 13. Magento 1.6自定義選項不更新價格
- 14. Magento自定義選項價格作爲默認
- 15. Magento:多種貨幣轉換自定義選項價格
- 16. 自定義選項價格計算
- 17. 自定義過濾器從AngularJS 1.x中的另一個選擇框中刪除選定的選項
- 18. 從Magento中的自定義選項中刪除htmlescape。哪個文件顯示自定義選項?
- 19. Magento自定義選項
- 20. 自定義選項Magento
- 21. 自定義選擇選項
- 22. 如何從magento中的自定義選項中刪除需求
- 23. 批量刪除所需的參數自定義選項magento
- 24. 帶選項的HTML選擇表單輸入自定義值
- 25. 我如何取消選擇magento中的自定義選項?
- 26. 自定義多種選擇輸入
- 27. jQuery的刪除基於文本輸入選擇選項
- 28. Magento添加類別選擇選項卡自定義插件
- 29. 自定義選擇選項的外觀
- 30. 刪除自定義選項卡上的額外格式
能否請您發表您已經嘗試 –
嗨感謝您的通知代碼,即時通訊非常NE w到magento,我不知道哪個文件我需要爲此編輯:(對不起, –
檢查http://magento.stackexchange.com/questions/83300/remove-price-change-from-custom-product-dropdown/ 83304 –