Created
January 13, 2014 01:22
-
-
Save willboudle/8393197 to your computer and use it in GitHub Desktop.
Update Customer Group Price
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // USAGE http://www.site.com/dev/updategroupprice.php?price=14.95&sku=ABC152X | |
| require_once '../app/Mage.php'; | |
| umask(0); | |
| //Mage::app('admin'); | |
| Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
| $sku = $_GET['sku']; | |
| $id = $_GET['id']; | |
| $price = $_GET['price']; | |
| // get my product | |
| $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku); | |
| // 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'=>$price), | |
| ); | |
| $product->setData('group_price',$groupPricingData); | |
| $product->save(); | |
| echo $sku." wholesale price has been updated to ". $price; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment