小编inf*_*ODE的帖子

Magento:获得捆绑产品的最高和最低价格

我尝试了几个我可以在谷歌找到的想法,但几天没有人为我工作.最后,我发现了一种在自定义扩展中显示magento中捆绑产品的"最小可能价格"和"最大可能价格"的方法:

    $_product_id            = YOUR_BUNDLE_PRODUCT_ID;

    // highest possible price for this bundle product
    $return_type            = 'max'; // because I used this in a helper method

    // lowest possible price for this bundle product
    // $return_type         = 'min';

    $model_catalog_product  = Mage::getModel('catalog/product'); // getting product model
    $_product               = $model_catalog_product->load( $_product_id );

    $TypeInstance           = $_product->getTypeInstance(true);
    $Selections             = $TypeInstance->getSelectionsCollection($OptionIds, $_product );
    $Options                = $TypeInstance->getOptionsByIds($OptionIds, $_product);
    $bundleOptions          = $Options->appendSelections($Selections, true);

    $minmax_pricevalue      = 0; // to sum them up from 0

    foreach ($bundleOptions as $bundleOption) {
        if …
Run Code Online (Sandbox Code Playgroud)

bundle product max min magento

1
推荐指数
2
解决办法
5768
查看次数

标签 统计

bundle ×1

magento ×1

max ×1

min ×1

product ×1