2

I'm having trouble displaying the group price to all users, i'm running 1.9

it obviously works if you're logged in and a user, but i need to display it to non members to entice them to become a member.

  • Do you mean to say if your product has a group price you want to display it to all users even if they are guest users? – Mukesh Sep 2 '15 at 16:51
3

You can load the group prices using the backend model of the group_price attribute. The following code loads and outputs all group prices:

$groupPrices = $ProductObject->getData('group_price');
if (is_null($groupPrices)) {
    $attribute = $ProductObject->getResource()->getAttribute('group_price');
    if ($attribute){
        $attribute->getBackend()->afterLoad($ProductObject);
        $groupPrices = $ProductObject->getData('group_price');
    }
}

if (!is_null($groupPrices) || is_array($groupPrices)) {
    foreach ($groupPrices as $groupPrice) {

        $formattedPrice = Mage::helper('core')->currency($groupPrice['website_price'], true, false);

        echo "Customer group: ", $groupPrice['cust_group'];
        echo "Group price: ", $formattedPrice;
    }

}
  • where to add this code inside template/catalog/product/view.phtml ? – mudit mehrotra Sep 7 '16 at 7:01
  • you use this code at any where you have product object – Amit Bera Sep 7 '16 at 7:02
  • I am new to magento and I need to show all group prices on the product page. can you tell me the specific file in which I can put this and group prices will show on the product page – mudit mehrotra Sep 7 '16 at 7:06
-1
  1. You need create different customer groups. In Backend -> Customer -> Customer Groups

  2. Go to the product page, and select product you want to show different price for customers. In Catalog -> Manage products, choose one product and select left side tab 'prices'. In right side you will see there has a group price field, then you can click 'add group price' for different customer group for different price.

*friendly remind: show some information about there is different price if become a member on the home page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.