Magento 更改“选择收音机”上的文本

Magento 更改“选择收音机”上的文本,magento,select,checkbox,Magento,Select,Checkbox,嗨,我需要一些关于这个脚本的帮助。我需要在选择单选标签的productcode div上显示sku 是一些行$jinputattribute和input:radio,我无法修复 实际上,这可以根据可选择的尺寸或颜色获得sku php代码 <?php $_product = $this->getProduct(); $_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes(

嗨,我需要一些关于这个脚本的帮助。我需要在选择单选标签的productcode div上显示sku

是一些行$jinputattribute和input:radio,我无法修复

实际上,这可以根据可选择的尺寸或颜色获得sku

php代码

<?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>

            <div class="input-box">
                <?php $configs = $this->getRegularConfig()?>
                <?php foreach($configs['attributes'] as $config):?>
                    <?php foreach($config['options'] as $value):?>
                        <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
                        <label class="label-radio-configurable" id="<?php echo (float)$value['price'] + (float) $_product->getPrice();?>">
                        <input type="radio" name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]"
                                id="attribute<?php echo $_attribute->getAttributeId() ?>"
                                class="validate-custom-configurable"
                                value="<?php echo $value['id']?>"/>
                            <?php echo $value['label']?> (+ $<?php printf("%.2f", $value['price'])?>)
                        </label>
                    <?php endforeach;?>
                <?php endforeach;?>
                 </dd>
              </div>

    <?php endforeach; ?>
    </dl>
<?php endif;?>
JS脚本

<div id="productcode"></div>

<?php
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$col = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
?>

<script type="text/javascript">

var Skus =new Array();

<?php
$count = 1;
$itemId = array();
foreach($col as $simple_product){
$itemId[] = array($simple_product->getSelectLabel() => $simple_product->getSku());
}

foreach($itemId as $val){
foreach($val as $k => $v){
echo 'Skus['.$count.'] = "'.$v.'";'. "\n";
$count++;
}
};

?>

$j(document).ready(function(){

$j("#productcode").html("Code: " +Skus[1]);

$j("input#attribute<?php echo $_attribute->getAttributeId() ?>").change(function(){
var position = $j("#attribute<?php echo $_attribute->getAttributeId() ?> input").index($j("#attribute<?php echo $_attribute->getAttributeId() ?> input:radio));

$j("#productcode").html(Skus[position] ? "Code: " +Skus[position] : "Code: " +Skus[1]);
});

});

</script>
使用jQuery代替j

因为jquery冲突

请在jquery文件中编写以下代码

jQuery.noConflict();

不,只是不要将内容从JS加载到Div。因为我需要将JS Div与选择器收音机匹配。谢谢,但是在inser jQuery.noConflict上;这不会根据下拉选择排列sku。
jQuery.noConflict();