Magento2GetProductFinalPriceByCustomerGroupId

编程

<?php
    $productId = 646;//AM-OL-SEEKER-2PRO-OR-CA-OS-30的产品
    $objectManager =  MagentoFrameworkAppObjectManager::getInstance();
    $productRepository = $objectManager->get("MagentoCatalogApiProductRepositoryInterface");
    $product = $productRepository->getById($productId);
    
    $arrGroup = [
        "0" => "Not Login In",
        "4" => "Retail Member",
        "5" => "Diamond Member",
        "7" => "Platinum Member",
        "8" => "Gold member",
        "10" => "CAD$500 Gold member"
    ];
    echo "AM-OL-SEEKER-2PRO-OR-CA-OS-30 产品各用户组价格:</br>";
    foreach ($arrGroup as $groupId => $groupName) {
        $product->setCustomerGroupId($groupId);
        echo $groupName.": ".$product->getFinalPrice()."</br>";
    }

 

输出结果打印:

AM-OL-SEEKER-2PRO-OR-CA-OS-30 产品各用户组价格:
Not Login In: 202.95
Retail Member: 202.95
Diamond Member: 202.95
Platinum Member: 131.9200
Gold member: 142.0700
CAD$500 Gold member: 202.95

以上是 Magento2GetProductFinalPriceByCustomerGroupId 的全部内容, 来源链接: utcz.com/z/513786.html

回到顶部