How to get final price for not current customer?
-
11-04-2021 - |
Question
There is a special customer group named A which has it's own special catalog rules and group prices. I am going to display final price of another customer group named B for A users. How can I get final price of another customer group which is not for the current user?
Solution
$now = Mage::getSingleton('core/date')->timestamp(time());
$websiteId = Mage::app()->getStore()->getWebsiteId();
$customerGroup = 4;
$new = Mage::getResourceModel('catalogrule/rule')->getRulePrice( $now, $websiteId, $customerGroup, $_productId);
var_dump($new);
Or :
$product = Mage::getModel('catalog/product')->load($id);
$group = Mage::getModel('customer/group')->load($code, 'customer_group_code');
//get group price
$product->setCustomerGroupId($group->getId());
$price = $product->getGroupPrice();
//get main price
$product->setCustomerGroupId(null);
$price = $product->getPrice();
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange