<?xml version="1.0"?>
<!--
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Mage
 * @package     Mage_CatalogRule
 * @copyright   Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
-->
<config>
    <modules>
        <Mage_CatalogRule>
            <version>0.7.10</version>
        </Mage_CatalogRule>
    </modules>
    <global>
        <helpers>
            <catalogrule>
                <class>Mage_CatalogRule_Helper</class>
            </catalogrule>
        </helpers>
        <models>
            <catalogrule>
                <class>Mage_CatalogRule_Model</class>
                <resourceModel>catalogrule_mysql4</resourceModel>
            </catalogrule>
            <catalogrule_mysql4>
                <class>Mage_CatalogRule_Model_Mysql4</class>
                <entities>
                    <rule><table>catalogrule</table></rule>
                    <rule_product><table>catalogrule_product</table></rule_product>
                    <rule_product_price><table>catalogrule_product_price</table></rule_product_price>
                    <affected_product><table>catalogrule_affected_product</table></affected_product>
                    <rule_group_website><table>catalogrule_group_website</table></rule_group_website>
                </entities>
            </catalogrule_mysql4>
        </models>
        <resources>
            <catalogrule_setup>
                <setup>
                    <module>Mage_CatalogRule</module>
                </setup>
            </catalogrule_setup>
        </resources>
        <events>
            <prepare_catalog_product_price_index_table>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>prepareCatalogProductPriceIndexTable</method>
                    </catalogrule>
                </observers>
            </prepare_catalog_product_price_index_table>
            <catalog_product_type_configurable_price>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>catalogProductTypeConfigurablePrice</method>
                    </catalogrule>
                </observers>
            </catalog_product_type_configurable_price>
        </events>
        <catalogrule>
            <related_cache_types>
                <block_html/>
            </related_cache_types>
        </catalogrule>
    </global>
    <frontend>
        <events>
            <catalog_product_get_final_price>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>processFrontFinalPrice</method>
                    </catalogrule>
                </observers>
            </catalog_product_get_final_price>
            <prepare_catalog_product_collection_prices>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>prepareCatalogProductCollectionPrices</method>
                    </catalogrule>
                </observers>
            </prepare_catalog_product_collection_prices>
        </events>
        <translate>
            <modules>
                <Mage_CatalogRule>
                    <files>
                        <default>Mage_CatalogRule.csv</default>
                    </files>
                </Mage_CatalogRule>
            </modules>
        </translate>
    </frontend>

    <adminhtml>
        <translate>
            <modules>
                <Mage_CatalogRule>
                    <files>
                        <default>Mage_CatalogRule.csv</default>
                    </files>
                </Mage_CatalogRule>
            </modules>
        </translate>
        <events>
            <catalog_product_get_final_price>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>processAdminFinalPrice</method>
                    </catalogrule>
                </observers>
            </catalog_product_get_final_price>
            <catalog_product_save_after>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>applyAllRulesOnProduct</method>
                    </catalogrule>
                </observers>
            </catalog_product_save_after>
            <catalog_product_import_after>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>applyAllRules</method>
                    </catalogrule>
                </observers>
            </catalog_product_import_after>
            <catalog_entity_attribute_delete_after>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>catalogAttributeDeleteAfter</method>
                    </catalogrule>
                </observers>
            </catalog_entity_attribute_delete_after>
            <catalog_entity_attribute_save_after>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>catalogAttributeSaveAfter</method>
                    </catalogrule>
                </observers>
            </catalog_entity_attribute_save_after>
        </events>
    </adminhtml>

    <crontab>
        <jobs>
            <catalogrule_apply_all>
                <schedule><cron_expr>0 1 * * *</cron_expr></schedule>
                <run><model>catalogrule/observer::dailyCatalogUpdate</model></run>
            </catalogrule_apply_all>
        </jobs>
        <events>
            <catalog_product_get_final_price>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>processAdminFinalPrice</method>
                    </catalogrule>
                </observers>
            </catalog_product_get_final_price>
        </events>
    </crontab>
</config>
