Magento 1.8:

I use the function Group Price to set a special price to a wholesaler group, but since prices are changed from time to time, and I have hundreds of products, price updates are very time consuming.

However, the wholesaler group prices are calculated as the manufacturer's prices (my price) plus a percent value (X). In short: [My Price] + X% = Wholesale price.

I just want to add the manufacturer's price once, and then be able to update all wholesale prices by changing the percent value (X). Is this possible in Magento?


class Rahul_GroupPrice_Model_Api extends Mage_Api_Model_Resource_Abstract {

    public function setGroupPrice() {
        $collection = Mage::getModel('catalog/product')->getCollection();
        foreach ($collection as $product) {
            $productObj = new Mage_Catalog_Model_Product();
            $price = $productObj->getPrice();
            $X = 5;                 // X%
            $new_group_price = $price + ($price*($X/100));
            $group_price = array(array('website_id' => 0,'cust_group' => 2,'price' => $new_group_price));
            $productObj->setData('group_price', $group_price);
        return 0;


  • Can you please describe what this codes does? – Fabian Blechschmidt Oct 20 '14 at 10:31
  • Sure Fabian! You need to create a custom module into your magento local code section and you can use it as a web service. You need to run this code once to update all the products in your magento. The percentage you want to add for the customer groups, need to be set as variable X. Hope, it'll help you. – Rahul Kumar Das Oct 20 '14 at 11:38
  • What if I need to change X%, would I have to enter all manufacturer's prices again then? – MagDev Oct 21 '14 at 11:22
  • Obviously not MagDev! You just need to change the value of X in code! $X = 5; // X% and run this code again. That will do your job. You need not to update manufacturer's price again. – Rahul Kumar Das Oct 21 '14 at 12:16
  • Rahul, would you help implement this code for me as a job? Do you have a Freelancer account? – MagDev Oct 21 '14 at 18:59

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.