Setting Default Product Values in Magento

When creating new products in the Magento Admin, there are a few fields that you often fill out with the same values over and over again. Values such as the product status, tax class, stock availability, weight, etc. Wouldn't it be nice to have the system automatically assign default values to these fields every time you create a new product? Well good news! You can easily accomplish this by hooking into Magento's catalog_product_new_action event. I'm not going to cover how to create new modules in Magento, but here is the basic structure and files you'll need to accomplish this. Make sure to provide your own value anywhere Namespace is referenced below. /app/code/local/Namespace/Catalog/etc/config.xml /app/code/local/Namespace/Catalog/Model/Product/Observer.php

1) Place the following in the config.xml file listed above.

<?xml version="1.0"?>





2) Place the following in the Observer.php file. Set product default values as desired.


class Namespace_Catalog_Model_Product_Observer
	public function catalog_product_new_action($observer) {

		$product = $observer->getEvent()->getProduct();

		$stockItem = Mage::getModel('cataloginventory/stock_item');
		$stockItem->setData('is_in_stock', 1);
		$stockItem->setData('qty', 1);


3) Finally, you'll need to activate your new module by creating the file below with the following contents.


<?xml version="1.0" encoding="UTF-8"?>
Make sure to clear the Magento cache when you're done with this step as well! Check out the Magento wiki article on using Event/Observer for more information on this topic.

4 thoughts on “Setting Default Product Values in Magento”

Leave a Reply