Magento 使用其他customergroup的TierPrice

Magento 使用其他customergroup的TierPrice,magento,Magento,我试图让我的定价扩展工作,但我在Tierplices绊倒了。 如果有访问者访问我的站点,我会在cookie中添加一个参数 例如: 现在,访问者使用sidx参数进入我的站点。现在,观察者:catalog\u product\u get\u final\u price将最终价格设置为Customergroup 5中该产品的第一层价格 访问者的Customergroup仍未登录。现在我需要Customergroup ID 5的其他层许可证,无需注册 我在谷歌上搜索了很多,想找到一个解决方案,但我没有抓

我试图让我的定价扩展工作,但我在Tierplices绊倒了。 如果有访问者访问我的站点,我会在cookie中添加一个参数

例如:

现在,访问者使用sidx参数进入我的站点。现在,观察者:catalog\u product\u get\u final\u price将最终价格设置为Customergroup 5中该产品的第一层价格

访问者的Customergroup仍未登录。现在我需要Customergroup ID 5的其他层许可证,无需注册

我在谷歌上搜索了很多,想找到一个解决方案,但我没有抓住要点

致意
boti

如果您想获得任何产品的分层价格:

$product = Mage::getModel('catalog/product')->load(PRODUCT_ID_HERE);
$tierPrices = $product->getData('tier_price');

if (!is_array($tierPrices)) {
    $tierPrices = array();
}

$result = array();

foreach ($tierPrices as $tierPrice) {
   $row = array();
   $row['customer_group_id'] = (empty($tierPrice['all_groups']) ? $tierPrice['cust_group'] : 'all' );
   $row['website']           = ($tierPrice['website_id'] ? Mage::app()->getWebsite($tierPrice['website_id'])->getCode() : 'all');
   $row['qty']               = $tierPrice['price_qty'];
   $row['price']             = $tierPrice['price'];

   $result[] = $row;
}

// $result now has an array of all tier prices...
// looking for cust_group = 5 would be trivial:

foreach ($tierPrices as $tierPrice) {
    if($tierPrice['cust_group'] == 5) {
        return $tierPrice; // this is what you want..
    }
}

如果您想获得任何产品的分层价格:

$product = Mage::getModel('catalog/product')->load(PRODUCT_ID_HERE);
$tierPrices = $product->getData('tier_price');

if (!is_array($tierPrices)) {
    $tierPrices = array();
}

$result = array();

foreach ($tierPrices as $tierPrice) {
   $row = array();
   $row['customer_group_id'] = (empty($tierPrice['all_groups']) ? $tierPrice['cust_group'] : 'all' );
   $row['website']           = ($tierPrice['website_id'] ? Mage::app()->getWebsite($tierPrice['website_id'])->getCode() : 'all');
   $row['qty']               = $tierPrice['price_qty'];
   $row['price']             = $tierPrice['price'];

   $result[] = $row;
}

// $result now has an array of all tier prices...
// looking for cust_group = 5 would be trivial:

foreach ($tierPrices as $tierPrice) {
    if($tierPrice['cust_group'] == 5) {
        return $tierPrice; // this is what you want..
    }
}