Getting Current Customer Group Price, and Tier Price
-
04-10-2020 - |
题
I am Using Magento 1.9.1.0 CE. Now I need to display or get the current group groupprice and Tier Price. I have google it, Most of the answer Related to ver 1.7 Magento .but its not resolving the Magento 1.9.1.0 or Need to check whether Tier Price and Group Price set the particular Customer Group.
解决方案
Here $product
is the product Object.
Group Price:-
$roleId = Mage::getSingleton('customer/session')->getCustomerGroupId();
$grp_price = $product->getData('group_price');
$customer_groupprice = $grp_price[$roleId]['price'];
Here the current customer Group ID $roleId. $customer_groupprice is the customer Group Price.
Tier Price:-
$roleId = Mage::getSingleton('customer/session')->getCustomerGroupId();
$TierPrice = $product->getData('tier_price');
$customer_grouptier = array_column($TierPrice, 'price','cust_group');
$customer_tier = $customer_grouptier[$roleId];
Below the Conditions to check whether the Tier and Group Price Set or not
if(!empty($customer_groupprice))
{
echo "Customer Group Price is set";
}
else
{
echo "Customer Group Price Not Set";
}
if(!empty($customer_tier))
{
echo "Customer Tier Price is set";
}
else
{
echo "Customer Tier Price Not Set";
}