【问题标题】:Magento : Tier price custom fieldMagento:等级价格自定义字段
【发布时间】:2014-01-16 13:17:30
【问题描述】:

我已经为层级定价修改了 magento 扩展,并在 app->design->adminhtml->default->default->catalog->product->edit->price->tier.phtml 文件中添加了三个文本字段。 三个新字段的数据已成功插入表 catalog_product_entity_tier_price。 数据在前端也是可见的。 但问题是在层框价格中插入的数据和字段不匹配

        <table>
          <thead>
            <tr class="headings">
              <th>Website</th>
              <th>Customer Group</th>
              <th>Qty</th>
              <th>Custom_field_1</th>
              <th>Custom_field_2</th>
              <th>Price</th>
              <th>Custom_field_3</th>
              <th>Action</th>
          </thead>
            </tr>

          <tr>
            <td>Showing Correct</td>
            <td>Showing Correct</td>
            <td>Showing Correct</td>
            <td>Showing Custom_field_2</td>
            <td>Showing Custom_field_3</td>
            <td>Showing Correct</td>
            <td>undefined</td>
            <td>&nbsp;</td>
          </tr>
        </table>
        <p>&nbsp;</p>
       <p>&nbsp;</p>
        <b>And javascript code is</b> 
        <script type="text/javascript">

              var tierPriceRowTemplate = '<tr>'

            + ' <small class="nobr"><?php echo Mage::helper("catalog")->__("and above")?></small></td>'
            + '<td><input class="<?php echo $_htmlClass ?> Custom_field_1" type="text" name="<?php echo $_htmlName ?>[{{index}}][Custom_field_1]" value="{{Custom_field_1}}"  
              id="tier_price_row_{{index}}_Custom_field_1" /></td>'
            + '<td><input class="<?php echo $_htmlClass ?> Custom_field_2" type="text" name="<?php echo $_htmlName ?>[{{index}}][Custom_field_2]" value="{{Custom_field_2}}"       id="tier_price_row_{{index}}_Custom_field_2" /></td>'  
            + '<td><input class="<?php echo $_htmlClass ?> required-entry <?php echo $_priceValueValidation ?>" type="text" name="<?php echo $_htmlName ?>[{{index}}][price]" value="{{price}}"        id="tier_price_row_{{index}}_price" /></td>'
            + '<td><input class="<?php echo $_htmlClass ?> Custom_field_3" type="text" name="<?php echo $_htmlName ?>[{{index}}][Custom_field_3]" value="{{Custom_field_3}}"       id="tier_price_row_{{index}}_Custom_field_3"/></td>';


                var data = {
                    website_id: '<?php echo $this->getDefaultWebsite() ?>',
                    group: '<?php echo $this->getDefaultCustomerGroup() ?>',
                    qty: '',
                    Custom_field_1:'',
                    price: '',
                    Custom_field_2:'',
                    Custom_field_3:'',
                    readOnly: false,
                    index: this.itemsCount++
                };
                //alert(Custom_field_1);

                if(arguments.length >= 4) {

                    data.Custom_field_1 = arguments[4]

                    data.readOnly = arguments[5];
                    data.Custom_field_2      = arguments[7];
                    data.Custom_field_3     = arguments[8];
                }
                if (arguments.length == 5) {
                    data.readOnly = arguments[4];
                }



                $('tier_price_row_' + data.index + '_Custom_field_1').value    = data.Custom_field_1;
                $('tier_price_row_' + data.index + '_Custom_field_2').value    = data.Custom_field_2;
                $('tier_price_row_' + data.index + '_Custom_field_3').value    = data.Custom_field_3;


            </script>

【问题讨论】:

    标签: magento magento-1.8


    【解决方案1】:

    问题已解决:问题出在 jquery 代码中。
    请检查我编辑的代码

        if(arguments.length >=8) {
            data.website_id = arguments[0];
            data.group      = arguments[1];
            data.qty        = arguments[2];
            data.product_type = arguments[3]
            data.ourprice      = arguments[4];
            data.price      = arguments[5];
            data.links     = arguments[6];
            data.readOnly = arguments[7];
        }
        if (arguments.length == 9) {
            data.readOnly = arguments[8];
        }
    
        Element.insert($('<?php echo $_htmlId ?>_container'), {
            bottom : this.template.evaluate(data)
        });
    
        $('tier_price_row_' + data.index + '_cust_group').value = data.group;
        $('tier_price_row_' + data.index + '_website').value    = data.website_id;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多