Hello,
I need to be assigned by the price code according to customer group.
How can I do ?
Thank you.
Solved! Go to Solution.
hi @totti240282
Here are sample code for setting the price by group
$productId=10;
$groupId=1;
$productPrice=20;
$product = Mage::getModel('catalog/product')->setStoreId(0)->load(productId);
$new_price = array( array ('website_id'=>0, 'cust_group'=>$groupId, 'price'=>$productPrice));
$product->setData('group_price', $new_price); $product->save();
here are few example code
It's not clear from the question what you really want to achieve.
I guess that you want to define different prices for different Customer Groups. In that case, there is section called "Group prices" on every product, just go into Admin panel, open "Edit Product" page for any product you want, and go to the Prices tab.
It is exact, but I have so many products and I can not do this by hand but I would do it by programming
hi @totti240282
Here are sample code for setting the price by group
$productId=10;
$groupId=1;
$productPrice=20;
$product = Mage::getModel('catalog/product')->setStoreId(0)->load(productId);
$new_price = array( array ('website_id'=>0, 'cust_group'=>$groupId, 'price'=>$productPrice));
$product->setData('group_price', $new_price); $product->save();
here are few example code