2014-01-16 102 views
0

我已經修改了層級定價的magento擴展,並在app-> design-> adminhtml-> default-> default-> catalog-> product-> edit-> price->中添加了三個文本字段。 tier.phtml文件。 來自三個新字段的數據已成功插入表catalog_product_entity_tier_price。數據也可以在前端看到。 但問題是,在一線箱價格插入的數據和現場不匹配Magento:層級價格自定義字段

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

回答

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; 
相關問題