Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento:在结帐页面上选择作为默认值的装运方式最便宜的价格_Magento - Fatal编程技术网

Magento:在结帐页面上选择作为默认值的装运方式最便宜的价格

Magento:在结帐页面上选择作为默认值的装运方式最便宜的价格,magento,Magento,我有多种运输方式,每种运输方式都有基于产品重量的不同类型的费率 如何在结帐页面上显示选择为默认的最低费率的发货方式?只需使用Javascript(jQuery) 搜索字段和价格值,查找最小值,并通过编程检查具有最低值的字段 问题解决了 更新(伪代码) 这只是一个伪代码,但你应该明白 你能用一个小例子解释一下吗? <html> ....... <div class="ship_methods"> <input name="ship1" class="ship_unit

我有多种运输方式,每种运输方式都有基于产品重量的不同类型的费率

如何在结帐页面上显示选择为默认的最低费率的发货方式?

只需使用Javascript(jQuery)

搜索字段和价格值,查找最小值,并通过编程检查具有最低值的字段

问题解决了

更新(伪代码)
这只是一个伪代码,但你应该明白

你能用一个小例子解释一下吗?
<html>
.......
<div class="ship_methods">
<input name="ship1" class="ship_unit"> 40 </input>
<input name="ship2" class="ship_unit"> 50 </input>
<input name="ship3" class="ship_unit"> 60 </input>
</div>
...
</html>
$(document).ready(function(){
  var smallest = 99999;//set anything larger ;
  var elem;
  $(".ship_unit").each(function() {
  // iterated over all the class elements.
    getVal = $(this).findYourRequiredValueOrAttr();
    if( smallest > getVal){
       smallest = getVal;
       elem= $(this);// get the input object
    }
  });
elem.prop("checked", true);
});