<?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@magento.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.magento.com for more information.
 *
 * @category    Mage
 * @package     Mage_CatalogRule
 * @copyright   Copyright (c) 2006-2017 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
-->
<config>
    <modules>
        <Mage_CatalogRule>
            <version>1.6.0.3</version>
        </Mage_CatalogRule>
    </modules>
    <global>
        <helpers>
            <catalogrule>
                <class>Mage_CatalogRule_Helper</class>
            </catalogrule>
        </helpers>
        <models>
            <catalogrule>
                <class>Mage_CatalogRule_Model</class>
                <resourceModel>catalogrule_resource</resourceModel>
            </catalogrule>
            <catalogrule_resource>
                <class>Mage_CatalogRule_Model_Resource</class>
                <deprecatedNode>catalogrule_mysql4</deprecatedNode>
                <entities>
                    <rule>
                        <table>catalogrule</table>
                    </rule>
                    <rule_product>
                        <table>catalogrule_product</table>
                    </rule_product>
                    <rule_product_price_tmp>
                        <table>catalogrule_product_price_tmp</table>
                    </rule_product_price_tmp>
                    <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>
                    <website>
                        <table>catalogrule_website</table>
                    </website>
                    <customer_group>
                        <table>catalogrule_customer_group</table>
                    </customer_group>
                </entities>
            </catalogrule_resource>
        </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>
            <sales_quote_collect_totals_before>
                <observers>
                    <preload_price_rules>
                        <class>catalogrule/observer</class>
                        <method>preloadPriceRules</method>
                    </preload_price_rules>
                </observers>
            </sales_quote_collect_totals_before>
            <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_before>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>loadProductRules</method>
                    </catalogrule>
                </observers>
            </catalog_product_save_before>
            <catalog_product_save_commit_after>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>applyAllRulesOnProduct</method>
                    </catalogrule>
                </observers>
            </catalog_product_save_commit_after>

            <catalog_product_import_finish_before>
                <observers>
                    <catalogrule>
                        <class>catalogrule/observer</class>
                        <method>createCatalogRulesRelations</method>
                    </catalogrule>
                </observers>
            </catalog_product_import_finish_before>

            <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>
