Reputation: 3080
Is there a module or a way to add validation workflow when adding/editing/deleting a product, category or content in magento ?
The idea is to have a editor that edit contents and a validator that sees the content (preview it) and validates it.
Another question :
If I override CMS Module to add content validation (override the way to access database to put published content and draft content). Is that possible ? I don't know yet how to develop magento modules so that I'm asking the question.
Regards
Upvotes: 0
Views: 1069
Reputation: 1839
The best practise in magento to put a validation on product and category or any model add / update is to use observers.
For catalog product validation add to your module config.xml
<adminhtml>
<events>
<!-- catalog category event here -->
<catalog_product_save_before>
<observers>
<validateproduct>
<type>singleton</type>
<class>mymodule/observer</class>
<method>myobserverfunction</method>
</validateproduct>
</observers>
</catalog_product_save_before>
</events>
</adminhtml>
and then simply define a function in Yourmodule/Model/Observer with name myobserverfunction(), as follows:
class Mymodule_Model_Observer
{
public function myobserverfunction(Varien_Event_Observer $observer)
{
$product = $observer->getEvent()->getProduct();
.
.
.
}
}
Upvotes: 1
Reputation: 537
For your second question, if you're talking about the CMS, you can enable version control which allows you to save updated copies of the content without publishing it. (Might be a Pro/Enterprise feature though, not sure.)
To enable version control on a CMS page, change "Under Version Control" to yes in the Page Information tab.
Upvotes: 0