<?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_Downloadable
 * @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_Downloadable>
            <version>1.4.0.2</version>
        </Mage_Downloadable>
    </modules>
    <global>
        <fieldsets>
            <downloadable_sales_copy_order>
                <entity_id><to_downloadable>order_id</to_downloadable></entity_id>
                <increment_id><to_downloadable>order_increment_id</to_downloadable></increment_id>
                <created_at><to_downloadable>*</to_downloadable></created_at>
                <updated_at><to_downloadable>*</to_downloadable></updated_at>
                <customer_id><to_downloadable>*</to_downloadable></customer_id>
            </downloadable_sales_copy_order>
            <downloadable_sales_copy_order_item>
                <item_id><to_downloadable>order_item_id</to_downloadable></item_id>
                <name><to_downloadable>product_name</to_downloadable></name>
                <sku><to_downloadable>product_sku</to_downloadable></sku>
            </downloadable_sales_copy_order_item>
            <downloadable_sales_copy_link>
                <product_id><to_purchased>*</to_purchased></product_id>
                <link_id><to_purchased>*</to_purchased></link_id>
                <title><to_purchased>link_title</to_purchased></title>
                <is_shareable><to_purchased>*</to_purchased></is_shareable>
                <link_url><to_purchased>*</to_purchased></link_url>
                <link_file><to_purchased>*</to_purchased></link_file>
                <link_type><to_purchased>*</to_purchased></link_type>
            </downloadable_sales_copy_link>
        </fieldsets>
        <sales>
            <quote>
                <item>
                    <product_attributes>
                        <links_purchased_separately/>
                        <links_title/>
                    </product_attributes>
                </item>
            </quote>
        </sales>
        <models>
            <downloadable>
                <class>Mage_Downloadable_Model</class>
                <resourceModel>downloadable_mysql4</resourceModel>
            </downloadable>
            <downloadable_mysql4>
                <class>Mage_Downloadable_Model_Mysql4</class>
                <entities>
                    <link>
                        <table>downloadable_link</table>
                    </link>
                    <link_title>
                        <table>downloadable_link_title</table>
                    </link_title>
                    <link_price>
                        <table>downloadable_link_price</table>
                    </link_price>
                    <sample>
                        <table>downloadable_sample</table>
                    </sample>
                    <sample_title>
                        <table>downloadable_sample_title</table>
                    </sample_title>
                    <link_purchased>
                        <table>downloadable_link_purchased</table>
                    </link_purchased>
                    <link_purchased_item>
                        <table>downloadable_link_purchased_item</table>
                    </link_purchased_item>
                    <product_price_indexer_idx>
                        <table>catalog_product_index_price_downlod_idx</table>
                    </product_price_indexer_idx>
                    <product_price_indexer_tmp>
                        <table>catalog_product_index_price_downlod_tmp</table>
                    </product_price_indexer_tmp>
                </entities>
            </downloadable_mysql4>
        </models>
        <blocks>
            <downloadable>
                <class>Mage_Downloadable_Block</class>
            </downloadable>
        </blocks>
        <resources>
            <downloadable_setup>
                <setup>
                    <module>Mage_Downloadable</module>
                    <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
                </setup>
            </downloadable_setup>
        </resources>
        <catalog>
            <product>
                <type>
                    <downloadable translate="label" module="downloadable">
                        <label>Downloadable Product</label>
                        <model>downloadable/product_type</model>
                        <is_qty>1</is_qty>
                        <price_model>downloadable/product_price</price_model>
                        <index_data_retreiver>downloadable/catalogIndex_data_downloadable</index_data_retreiver>
                        <composite>0</composite>
                        <price_indexer>downloadable/indexer_price</price_indexer>
                        <can_use_qty_decimals>0</can_use_qty_decimals>
                    </downloadable>
                    <bundle>
                        <allowed_selection_types>
                            <downloadable />
                        </allowed_selection_types>
                    </bundle>
                    <configurable>
                        <allow_product_types>
                            <downloadable />
                        </allow_product_types>
                    </configurable>
                    <grouped>
                        <allow_product_types>
                            <downloadable />
                        </allow_product_types>
                    </grouped>
                </type>
            </product>
        </catalog>
        <pdf>
            <invoice>
                <downloadable>downloadable/sales_order_pdf_items_invoice</downloadable>
            </invoice>
            <creditmemo>
                <downloadable>downloadable/sales_order_pdf_items_creditmemo</downloadable>
            </creditmemo>
        </pdf>
    </global>
    <adminhtml>
        <translate>
            <modules>
                <Mage_Downloadable>
                    <files>
                        <default>Mage_Downloadable.csv</default>
                    </files>
                </Mage_Downloadable>
            </modules>
        </translate>
        <sales>
            <order>
                <create>
                    <available_product_types>
                        <downloadable/>
                    </available_product_types>
                </create>
            </order>
        </sales>
        <layout>
            <updates>
                <downloadable>
                    <file>downloadable.xml</file>
                </downloadable>
            </updates>
        </layout>
        <events>
            <catalog_product_prepare_save>
                <observers>
                    <downloadable_observer>
                        <class>downloadable/observer</class>
                        <method>prepareProductSave</method>
                    </downloadable_observer>
                </observers>
            </catalog_product_prepare_save>
            <sales_order_item_save_commit_after>
                <observers>
                    <downloadable_observer>
                        <class>downloadable/observer</class>
                        <method>saveDownloadableOrderItem</method>
                    </downloadable_observer>
                </observers>
            </sales_order_item_save_commit_after>
            <sales_order_save_commit_after>
                <observers>
                    <downloadable_observer>
                        <class>downloadable/observer</class>
                        <method>setLinkStatus</method>
                    </downloadable_observer>
                </observers>
            </sales_order_save_commit_after>
        </events>
    </adminhtml>
    <frontend>
        <routers>
            <downloadable>
                <use>standard</use>
                <args>
                    <module>Mage_Downloadable</module>
                    <frontName>downloadable</frontName>
                </args>
            </downloadable>
        </routers>
        <secure_url>
            <downloadable>/downloadable/customer/</downloadable>
        </secure_url>
        <translate>
            <modules>
                <Mage_Downloadable>
                    <files>
                        <default>Mage_Downloadable.csv</default>
                    </files>
                </Mage_Downloadable>
            </modules>
        </translate>
        <layout>
            <updates>
                <downloadable module="Mage_Downloadable">
                    <file>downloadable.xml</file>
                </downloadable>
            </updates>
        </layout>
        <events>
            <sales_order_item_save_commit_after>
                <observers>
                    <downloadable_observer>
                        <class>downloadable/observer</class>
                        <method>saveDownloadableOrderItem</method>
                    </downloadable_observer>
                </observers>
            </sales_order_item_save_commit_after>
            <sales_order_save_commit_after>
                <observers>
                    <downloadable_observer>
                        <class>downloadable/observer</class>
                        <method>setLinkStatus</method>
                    </downloadable_observer>
                </observers>
            </sales_order_save_commit_after>
            <checkout_type_onepage_save_order_after>
                <observers>
                    <checkout_type_onepage_save_order_after>
                        <class>downloadable/observer</class>
                        <method>setHasDownloadableProducts</method>
                    </checkout_type_onepage_save_order_after>
                </observers>
            </checkout_type_onepage_save_order_after>
            <checkout_type_multishipping_create_orders_single>
                <observers>
                    <checkout_type_multishipping_create_orders_single>
                        <class>downloadable/observer</class>
                        <method>setHasDownloadableProducts</method>
                    </checkout_type_multishipping_create_orders_single>
                </observers>
            </checkout_type_multishipping_create_orders_single>
            <checkout_allow_guest>
                <observers>
                    <checkout_allow_guest>
                        <class>downloadable/observer</class>
                        <method>isAllowedGuestCheckout</method>
                    </checkout_allow_guest>
                </observers>
            </checkout_allow_guest>
        </events>
    </frontend>
    <admin>
        <fieldsets>
            <catalog_product_dataflow>
                <qty>
                    <product_type>
                        <downloadable />
                    </product_type>
                </qty>
                <min_qty>
                    <product_type>
                        <downloadable />
                    </product_type>
                </min_qty>
                <is_qty_decimal>
                    <product_type>
                        <downloadable />
                    </product_type>
                </is_qty_decimal>
                <backorders>
                    <product_type>
                        <downloadable />
                    </product_type>
                </backorders>
                <min_sale_qty>
                    <product_type>
                        <downloadable />
                    </product_type>
                </min_sale_qty>
                <max_sale_qty>
                    <product_type>
                        <downloadable />
                    </product_type>
                </max_sale_qty>
                <is_in_stock>
                    <product_type>
                        <downloadable />
                    </product_type>
                </is_in_stock>
                <notify_stock_qty>
                    <product_type>
                        <downloadable />
                    </product_type>
                </notify_stock_qty>
                <manage_stock>
                    <product_type>
                        <downloadable />
                    </product_type>
                </manage_stock>
            </catalog_product_dataflow>
        </fieldsets>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Mage_Downloadable before="Mage_Adminhtml">Mage_Downloadable_Adminhtml</Mage_Downloadable>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <default>
        <catalog>
            <downloadable>
                <downloads_number>0</downloads_number>
                <order_item_status>9</order_item_status>
                <samples_title>Samples</samples_title>
                <links_title>Links</links_title>
                <links_target_new_window>1</links_target_new_window>
                <content_disposition>inline</content_disposition>
                <disable_guest_checkout>1</disable_guest_checkout>
            </downloadable>
        </catalog>
    </default>
</config>
