7 Day Money Back Guarantee
View our complete refund policy
This Magento extension allows you to supply default values for new products that you create in the Magento backend. When you create a new product, this extension allows you to load default values for product attributes, like the product status, product title, tax class, weight.
Values are defined through XML files in the folder
app/design/adminhtml/default/default/etc/producttemplates/. The folder contains some example files. To make use of this module, you will need to modify these files first.
At a minimum you need to create a
default.xml file. Optionally, you can create XML files per product type, like
simple.xml. Also, an XML file can be created per attributeset, like
attributeset_42.xml. If you have specific files per attributeset and/or product type, the configuration of that will be merged into the configuration of
default.xml. If you have both an XML configuration for product types and an XML configuration for attributesets, the attributeset will be loaded first and then the product type configuration is merged into this.
An XML file
default.xml might look like this:
<?xml version="1.0"?> <product> <status>1</status> <tax_class_id>2</tax_class_id> <weight>1</weight> <cb_status>unknown_pending</cb_status> </product>
The XML file makes a listing of child-elements (like
<status>) below a
<product> element. Each child-element represents a product attribute. As soon as you know the name of an attribute, you can use it as child-element. For instance, if you have a product attribute
foobar, you can use the
<foobar> element to reference it.
If you are dealing with a product attribute with as type a select or a multiselect box, then the options for that product attribute are managed through the Attribute Management page in the Magento backend. However, each option is actually saved with a numerical ID - the input you are entering is only a value. Within the Product Templates extension, you will need to enter this numerical ID, not the value. You can find out the product ID by using a DOM analyzer in your browser.
The same counts for the Tax ID. You can set this by using a
<tax_class_id> element which contains the numerical ID of your tax class.
Some attributes will require actually care with the Product Templates extension. For instance, the product type (simple, configurable, virtual) can't be set - as of yet. The website ID is normally set for products using a call like
setWebsiteIds(array(1)). You can use one of the following to do the same using the Product Templates module:
The same applies for category IDs:
Note that within the Product Edit form in the Magento backend, category selections only become visible once the product itself is saved. When you first enter the form, the categories are not selected - while actually in the background they are selected, but will only be checked once the product has been saved to the database for the first time.
We hope to add some day an API feature, that allows you to create a new product based on a specific XML-definition. This way, you could easily create new products based on a product template, while still autogenerating unique information like SKUs.
The product type and attribute set can currently not be set automatically. It would not make sense anyway.
The location of the XML-files changed from version 0.2 to 0.3 from the subfolder
etc within the admin theme.