If you are actually using a magento object (not api), this is the behavior I found. We hope that the application makes sense, regardless of how you acquire data.
// get my product $product = Mage::getModel('catalog/product')->load(x); // the group data is expecting an array of arrays that look like.. // array ('website_id'=>y, 'cust_group'=>z, 'price'=>n) $groupPricingData = array ( // for website 2, customer group 2 array ('website_id'=>2, 'cust_group'=>2, 'price'=>10), // for all websites, not logged in array ('website_id'=>0, 'cust_group'=>0, 'price'=>15) ); $product->setData('group_price',$groupPricingData); $product->save();
In this example, it will replace all previous group prices for the product, as wise.
$product->setData('group_price',array()); $product->save();
will remove group pricing.
Another behavior that I noticed related to setting the store ID on the updated product will lead to the addition of a group price. Thus, if you download a group pricing group for a particular store, you donβt have to worry about losing the group price set against another store.
// add a pricing to store 4 $product = Mage::getModel('catalog/product')->setStoreId(4)->load(1234); $product->setData('group_price',array ( array ( "website_id" => 3, "cust_group" => 4, "price" => 99 ))); $product->save(); // add a pricing to store 1 $product = Mage::getModel('catalog/product')->setStoreId(1)->load(1234); $product->setData('group_price',array ( array ( "website_id" => 1, "cust_group" => 2, "price" => 105 ))); $product->save(); // remove group pricing from store 2 $product = Mage::getModel('catalog/product')->setStoreId(2)->load(1234); $product->setData('group_price',array ()); $product->save();
This is convenient if you are dealing with group pricing lots in one store, but cannot influence other prices of store groups. I do not know if this is the simplest mechanism, but it still worked for me.