Изменение настраиваемых атрибутов продуктов имя параметра по умолчанию


enter image description here

Я хочу изменить текст "Выберите опцию...". Я думаю, что это связано с приложением/дизайном/интерфейсом/базой/по умолчанию/шаблоном/каталогом/продуктом/видом/типом/параметрами/настраиваемыми.файл phtml.

Все знают этот код, но я все равно хочу вставить его сюда.

<?php
$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
    <dl>
    <?php foreach($_attributes as $_attribute): ?>
        <dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
        <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
            <div class="input-box">
                <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
                    <option><?php echo $this->__('Choose an Option...') ?></option>
                  </select>
              </div>
        </dd>
    <?php endforeach; ?>
    </dl>
    <script type="text/javascript">
        var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
    </script>
<?php endif;?>

Я изменил строку <option><?php echo $this->__('Choose an Option...') ?></option> на <option>Test</option> для тестирования, но ничего не изменилось.

Author: Ibrahim Mumcu, 2014-04-03

3 answers

Когда страница загружается и когда вы выбираете один параметр, остальные выбранные параметры перестраиваются, и первый параметр берется из массива конфигурации, созданного в Mage_Catalog_Block_Product_View_Type_Configurable::getJsonConfig().

Найдите эту строку:

'chooseText'        => Mage::helper('catalog')->__('Choose an Option...'), 
 2
Author: Marius, 2014-04-03 20:35:11

Я нашел ответ на stackoverflow. Отлично сработало для меня. через

Просто измените каталог/продукт/вид/тип/параметры/настраиваемый.файл phtml:

<?php
$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
    <dl>
    <?php foreach($_attributes as $_attribute): ?>
        <dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
        <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
            <div class="input-box">
                <?php $chooseText = $this->__('Select %s', $_attribute->getLabel()); ?>
                <select data-choose-text="<?php echo $chooseText; ?>" name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
                    <option><?php echo $chooseText; ?></option>
                </select>
              </div>
        </dd>
    <?php endforeach; ?>
    </dl>
    <script type="text/javascript">
        Product.ConfigDefaultText = new Class.create(Product.Config, {
            fillSelect: function($super, element) {
                $super(element);
                var chooseDefaultText = element.getAttribute('data-choose-text');
                $(element).options[0] = new Option(chooseDefaultText, '');
            }
        });
        var spConfig = new Product.ConfigDefaultText(<?php echo $this->getJsonConfig() ?>);
    </script>
<?php endif;?>
 2
Author: Ibrahim Mumcu, 2017-05-23 12:37:16

Самый простой способ - активировать встроенный перевод (Система-Конфигурация-Расширенный-Разработчик - Встроенный перевод с поддержкой интерфейса) (помните, чтобы выбрать представление магазина, в котором вы хотите отредактировать), затем перейдите на свою страницу и нажмите на маленький синий значок над раскрывающимся списком и отредактируйте.

 0
Author: Paul Ionescu II, 2014-08-18 16:05:49