Skip to content

Instantly share code, notes, and snippets.

@Schrank
Created February 19, 2013 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Schrank/4987320 to your computer and use it in GitHub Desktop.
Save Schrank/4987320 to your computer and use it in GitHub Desktop.
Save a product from the frontend
<?php
// save the old id
$oldStoreId = Mage::app()->getStore()->getId();
// set the store to be admin
Mage::app()->getStore()->setId(Mage_Core_Model_App::ADMIN_STORE_ID);
// set the orig data
$product->setOrigData();
// save the product
$product->save();
// reset the store id
Mage::app()->getStore()->setId($oldStoreId);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment