/*
 * Vendor:	CW
 * addon:	catalog_product
 * description:	
 *  New product type "Catalog" means that product is only listed on this site but can be bought on another site
 *  For this type of products the URL to real shop is required
 *  This product has special "buy" button in customer area, which may differ by appearance and text from normal products. For example it cat say "Buy from artist's site"
 *  Statistic about redirections to target site can be gathered as add_to_cart statistic (see "New statistic couner" spec)
 *  "Report as sold" feature is for this type of products only
 */
namespace CW\catalog_product;

const addon_name = 'catalog_product';
const addon_target = '';
const addon_version = '0.3';
define('PRODUCT_TYPE_CATALOG', 4);
cw_include('addons/' . addon_name . '/func.php');
if (APP_AREA == 'admin' && $target == 'products') {
    // Hook product modify to require Original URL attr for catalog product type
    cw_set_hook('cw_error_check', 'CW\\catalog_product\\cw_error_check', EVENT_POST);
    // Hook product modify to hide Original URL attr for other product types
    cw_addons_set_hooks(array('post', 'cw_attributes_get', 'CW\\catalog_product\\cw_attributes_get'));
}
if (APP_AREA == 'customer') {
    // Hook special catalog_redirect controller to redirect to original_url
    cw_set_controller('customer/catalog_redirect.php', 'addons/' . addon_name . '/customer/catalog_redirect.php', EVENT_REPLACE);
    cw_set_controller('customer/product.php', 'addons/' . addon_name . '/customer/product.php', EVENT_POST);
    cw_set_controller('customer/report_about_sold.php', 'addons/' . addon_name . '/customer/report_about_sold.php', EVENT_REPLACE);
    // hook for add_to_cart button to replace form, text and action
    cw_addons_set_template(array('pre', 'buttons/add_to_cart.tpl', 'addons/' . addon_name . '/add_to_cart.tpl', 'CW\\catalog_product\\cw_is_catalog_product'), array('pre', 'buttons/buy_now.tpl', 'addons/' . addon_name . '/buy_now.tpl', 'CW\\catalog_product\\cw_is_catalog_product'), array('replace', 'customer/products/product-amount.tpl', '', 'CW\\catalog_product\\cw_is_catalog_product'), array('pre', 'customer/products/product-fields.tpl', 'addons/' . addon_name . '/report_as_sold.tpl'));
}
<?php

cw_include('addons/paypal/include/func.paypal.php');
cw_addons_set_controllers(array('replace', 'customer/paypal.php', 'addons/paypal/customer/paypal.php'));
cw_addons_set_template(array('post', 'main/docs/notes.tpl@doc_process_other', 'addons/paypal/admin/doc_process_data.tpl'));
cw_addons_set_hooks(array('post', 'cw_payment_get_methods', 'cw_payment_paypal_get_methods'), array('post', 'cw_payment_run_processor', 'cw_payment_paypal_run_processor'));
<?php

const anti_scrapping_addon_name = 'anti_scrapping_robot';
const anti_scrapping_addon_version = '0.1';
if (constant('APP_AREA') == 'customer') {
    cw_include('addons/' . anti_scrapping_addon_name . '/include/func.anti_scrapping.php');
    cw_addons_set_controllers(array('post', 'init/robot.php', 'addons/' . anti_scrapping_addon_name . '/init/robot.php'));
    cw_addons_set_hooks(array('post', 'cw_product_search', 'cw_anti_scrapping_product_search'), array('post', 'cw_product_get', 'cw_anti_scrapping_product_get'));
}
<?php

/*
 * Vendor: CW
 * addon: Authorize.net - SIM
 */
const authorize_sim_addon_name = 'payment_authorize_sim';
const authorize_sim_addon_target = 'authorize_sim';
cw_include('addons/' . authorize_sim_addon_name . '/include/anet_php_sdk/AuthorizeNet.php');
cw_include('addons/' . authorize_sim_addon_name . '/include/func.php');
cw_addons_set_controllers(array('replace', 'customer/' . authorize_sim_addon_target . '.php', 'addons/' . authorize_sim_addon_name . '/customer/' . authorize_sim_addon_target . '.php'));
cw_addons_set_hooks(array('post', 'cw_payment_get_methods', 'cw_payment_authorize_sim_get_methods'), array('post', 'cw_payment_run_processor', 'cw_payment_authorize_sim_run_processor'));
function cw_apply_special_offer_shipping($params, $return)
{
    global $tables;
    $special_offers_apply =& cw_session_register('special_offers_apply');
    $products = $params['products'];
    if (empty($special_offers_apply['free_shipping'])) {
        return $return;
    }
    if (empty($return)) {
        return $return;
    }
    //cw_var_dump($return);
    $new_rates = array();
    // Re-calculate applicable total weight / items / subtotal	taking into account bonuses
    $total = $params['what_to_ship_params'];
    if (is_array($special_offers_apply['free_shipping']) && is_array($special_offers_apply['free_shipping']['products']) && !empty($special_offers_apply['free_shipping']['products'])) {
        $hash = crc32(serialize($total));
        foreach ($special_offers_apply['free_shipping']['products'] as $pid => $qty) {
            foreach ($products as $kk => $product) {
                if ($product['product_id'] == $pid) {
                    $tmp_qty = min($qty, $product['amount']);
                    if ($tmp_qty <= 0) {
                        continue;
                    }
                    # Calculate total_cost and total_+weight for shipping calculation
                    if ($product["free_shipping"] == "Y") {
                        continue;
                    }
                    if ($product['shipping_freight'] <= 0 || $config['Shipping']['replace_shipping_with_freight'] != 'Y') {
                        $total['apply']['weight'] -= $product["weight"] * $tmp_qty;
                        $total['apply']['items'] -= $tmp_qty;
                        $total['apply']['DST'] -= $product['display_discounted_price'] * $tmp_qty / $product['amount'];
                        $total['apply']['ST'] -= $product['display_subtotal'] * $tmp_qty / $product['amount'];
                        // Correct products array
                        $product['amount'] -= $tmp_qty;
                        $product['display_subtotal'] = $product['display_subtotal'] * $product['amount'] / ($tmp_qty + $product['amount']);
                        $product['display_discounted_price'] = $product['display_discounted_price'] * $product['amount'] / ($tmp_qty + $product['amount']);
                        $products[$kk] = $product;
                        if ($products[$kk]['amount'] <= 0) {
                            unset($products[$kk]);
                        }
                        $qty -= $tmp_qty;
                    }
                }
            }
        }
        if ($hash != crc32(serialize($total)) && $total['apply']['items'] > 0) {
            // Unset this function hook and retrieve rates again with corrected params
            cw_addons_unset_hooks(array('post', 'cw_shipping_get_rates', 'cw_apply_special_offer_shipping'));
            $_params = $params;
            $_params['what_to_ship_params'] = $total;
            $_params['weight'] = $total['apply']['weight'];
            $_params['products'] = $products;
            $new_rates = cw_func_call('cw_shipping_get_rates', $_params);
            // Restore function hook
            cw_addons_set_hooks(array('post', 'cw_shipping_get_rates', 'cw_apply_special_offer_shipping'));
        }
    }
    // Re-calc rates
    foreach ($return as $k => $rate) {
        // If bonus is applicable for certain methods only, then check this method
        if (!empty($special_offers_apply['free_shipping']['methods']) && is_array($special_offers_apply['free_shipping']['methods']) && !in_array($rate['shipping_id'], $special_offers_apply['free_shipping']['methods'])) {
            continue;
        }
        // If bonus is applicable for whole cart, then set the new rate regardless cart content
        if ($special_offers_apply['free_shipping']['apply'] == constant('PS_APPLY_CART')) {
            $return[$k]['saved_rate'] = $rate['original_rate'];
            // save initial rate to calc discount
            $return[$k]['original_rate'] = $special_offers_apply['free_shipping']['rate'];
            continue;
        }
        // If bonus is applicable for selected products then
        if (in_array($special_offers_apply['free_shipping']['apply'], array(PS_APPLY_COND, PS_APPLY_PRODS)) && !empty($special_offers_apply['free_shipping']['products'])) {
            if (isset($new_rates[$k])) {
                $return[$k] = $new_rates[$k];
            }
            if ($total['apply']['items'] <= 0) {
                $return[$k]['original_rate'] = 0;
            }
            $return[$k]['original_rate'] += $special_offers_apply['free_shipping']['rate'];
            $return[$k]['saved_rate'] = $rate['original_rate'];
            // save initial rate to calc discount
            if (defined('AOM') && constant('AOM')) {
                $return[$k]['shipping'] .= '*';
                //$return[$k]['shipping'] .= ' [offer: '.$rate['original_rate'].' => '.floatval($special_offers_apply['free_shipping']['rate']).'+'.floatval($new_rates[$k]['original_rate']).']';
            }
        }
    }
    // strange, but $rate['original_rate'] is exactly final rate value, not initial as you may think
    return $return;
}
<?php

# kornev, the product options are build on the attributes
# kornev, the product option - it's attribute, which have got the 'product_options' in the addon
# kornev, the option (as a class) is not assigned to a product - the values are assigned to the product
# kornev, the attribute -> product relation
$tables['product_options'] = 'cw_product_options';
$tables['product_options_lng'] = 'cw_product_options_lng';
$tables['product_options_values'] = 'cw_product_options_values';
$tables['product_options_values_lng'] = 'cw_product_options_values_lng';
$tables['product_variants'] = 'cw_product_variants';
$tables['product_variant_items'] = 'cw_product_variant_items';
$tables['products_options_ex'] = 'cw_products_options_ex';
$tables['product_options_js'] = 'cw_product_options_js';
$tables['products_images_var'] = 'cw_products_images_var';
cw_include('addons/product_options/include/func.product_options.php');
cw_include('addons/product_options/include/hooks.php', INCLUDE_NO_GLOBALS);
cw_addons_set_controllers(array('post', 'include/products/modify.php', 'addons/product_options/include/products/modify-options.php'), array('post', 'include/products/modify.php', 'addons/product_options/include/products/modify-variants.php'), array('replace', 'customer/popup_product_options.php', 'addons/product_options/customer/popup_product_options.php'), array('post', 'customer/product.php', 'addons/product_options/customer/product.php'));
cw_addons_set_hooks(array('post', 'cw_tabs_js_abstract', 'cw_product_options_tabs_js_abstract'), array('pre', 'cw_product_build_flat', 'cw_product_options_product_build_flat'), array('post', 'cw_product_build_flat', 'cw_product_options_product_build_flat_post'), array('pre', 'cw_product_check_avail', 'cw_product_options_product_check_avail'));
cw_addons_set_template(array('pre', 'customer/products/product-amount.tpl', 'addons/product_options/customer/products/product-amount.tpl'), array('replace', 'common/product_image.tpl', 'addons/product_options/customer/products/product_image.tpl'), array('post', 'customer/products/products-info.tpl', 'addons/product_options/customer/products/product-variant-selector.tpl'), array('pre', 'customer/products/products.tpl', 'addons/product_options/customer/products/products-prepare.tpl'));
cw_set_hook('cw_delete_product', 'cw_product_options_delete_product', EVENT_PRE);
cw_set_hook('cw_warehouse_recalculate', 'cw_on_warehouse_recalculate', EVENT_POST);
cw_set_hook('cw_product_clone', 'cw_product_options_clone', EVENT_POST);
cw_event_listen('on_prepare_products_found', 'cw_product_options_prepare_products_found');
<?php

cw_include('addons/mailchimp_subscription/include/MCAPI.class.php');
cw_include('addons/mailchimp_subscription/include/func.mailchimp.php');
cw_set_controller('include/settings.php', 'addons/mailchimp_subscription/admin/settings.php', EVENT_PRE);
cw_addons_set_hooks(array('pre', 'cw_payment_run_processor', 'cw_post_mailchimp_subscribe'));
cw_addons_set_template(array('post', 'customer/checkout/notes.tpl', 'addons/mailchimp_subscription/mailchimp_subscription.tpl'));
<?php

/*
 * Vendor: CW
 * addon: mobile skin
 */
const mobile_addon_name = 'mobile';
const mobile_addon_skin_prefix = '.mobi';
cw_include('addons/' . mobile_addon_name . '/include/func.mobile.php');
cw_include('addons/' . mobile_addon_name . '/include/Mobile_Detect.php');
if (APP_AREA == 'admin') {
    cw_addons_set_template(array('post', 'main/docs/extras.tpl', 'addons/' . mobile_addon_name . '/extras.tpl'), array('post', 'main/docs/extras_title.tpl', 'addons/' . mobile_addon_name . '/extras.tpl'));
}
if (APP_AREA == 'customer') {
    cw_addons_set_controllers(array('post', 'init/abstract.php', 'addons/' . mobile_addon_name . '/init/mobile.php'), array('pre', 'customer/referer.php', 'addons/' . mobile_addon_name . '/customer/referer.php'));
    cw_addons_set_hooks(array('post', 'cw_code_get_template_dir', 'cw_mobile_code_get_template_dir'), array('post', 'cw_doc_place_order', 'cw_mobile_doc_place_order'));
    cw_set_hook('cw_md_get_domain_data_by_alias', 'cw_mobile_get_domain_data_by_alias');
    cw_addons_set_template(array('post', 'elements/copyright.tpl', 'addons/' . mobile_addon_name . '/bottom_links.tpl'));
}
<?php

cw_include('addons/discount_coupons/include/func.discount_coupons.php');
cw_addons_set_controllers(array('pre', 'customer/cart.php', 'addons/discount_coupons/customer/cart.php'), array('replace', 'admin/coupons.php', 'addons/discount_coupons/admin/coupons.php'));
cw_addons_set_hooks(array('post', 'cw_cart_calc_discounts', 'cw_discount_coupons_cart_calc_discounts'));
<?php

const addon_name = 'product_shipping_options';
$tables['product_shipping_options_values'] = 'cw_product_shipping_options_values';
$cw_allowed_tunnels[] = 'cw_product_shipping_get_options';
// Include functions
cw_include('addons/product_shipping_options/include/func.php');
cw_addons_set_template(array('post', 'main/attributes/object_modify.tpl', 'addons/product_shipping_options/main/attributes/shipping-selector.tpl'));
cw_addons_set_controllers(array('pre', 'include/products/modify.php', 'addons/product_shipping_options/include/products/modify-shipping-options.php'));
cw_addons_set_template(array('post', 'customer/cart/product-shipping-options.tpl', 'addons/product_shipping_options/customer/cart/product-shipping-options.tpl'));
cw_addons_set_hooks(array('post', 'cw_shipping_get_rates', 'cw_product_shipping_option_shipping_get_rates'));
cw_set_hook('cw_doc_prepare_doc_item_extra_data', 'cw_product_shipping_option_extra_data', EVENT_POST);
if (APP_AREA == 'customer') {
    cw_set_hook('cw_web_get_product_layout_elements', 'cw_product_shipping_option_get_product_layout_elements');
    cw_set_hook('cw_doc_get', 'cw_product_shipping_option_doc_get');
    cw_set_hook('cw_web_get_layout_by_id', 'cw_product_shipping_option_get_layout');
    cw_set_hook('cw_web_get_layout', 'cw_product_shipping_option_get_layout');
}
cw_event_listen('on_product_from_scratch', 'cw_product_shipping_option_default');
cw_event_listen('on_cart_productindexes_update', 'cw_product_shipping_option_update_cart');
    if (!file_exists($app_main_dir . '/seller')) {
        // There is no symlink /core/seller, map all files explicitly
        if (!($addon_hooks = cw_cache_get('seller', 'addon_hooks')) || defined('DEV_MODE')) {
            $addon_hooks = array();
            $files = cw_files_get_dir($app_main_dir . '/addons/seller/core', 1, false);
            foreach ($files as $file) {
                if (strpos($file, '.php') !== false) {
                    $file = str_replace($app_main_dir . '/addons/seller/core/', '', $file);
                    $addon_hooks[] = $file;
                }
            }
            cw_cache_save($addon_hooks, 'seller', 'addon_hooks');
        }
        foreach ($addon_hooks as $h) {
            cw_set_controller("seller/{$h}", 'addons/' . seller_addon_name . "/core/{$h}", EVENT_REPLACE);
        }
    } else {
        // Symlink is used, everything mapped by filesystem
    }
    cw_set_controller(APP_AREA . '/products_clients.php', 'admin/products_clients.php', EVENT_REPLACE);
    cw_set_controller(APP_AREA . '/products.php', 'addons/' . seller_addon_name . '/core/search.php', EVENT_PRE);
    cw_addons_set_hooks(array('pre', 'cw_product_search', 'cw_seller_product_search'), array('replace', 'cw_auth_check_security_targets', 'cw_seller_auth_check_security_targets'));
    cw_addons_set_template(array('replace', APP_AREA . '/main/main.tpl', 'addons/' . seller_addon_name . '/main/main.tpl'), array('replace', 'elements/auth_admin.tpl', 'addons/' . seller_addon_name . '/elements/auth.tpl'), array('replace', 'main/products/search_form.tpl', 'addons/' . seller_addon_name . '/products/search_form.tpl'), array('replace', 'menu/items.tpl', 'addons/' . seller_addon_name . '/menu/items.tpl'), array('replace', APP_AREA . '/products/product_modify.tpl', 'addons/' . seller_addon_name . '/products/product_modify.tpl'), array('replace', APP_AREA . '/products/product_add.tpl', 'addons/' . seller_addon_name . '/products/product_add.tpl'), array('replace', APP_AREA . '/products/search.tpl', 'addons/' . seller_addon_name . '/products/search.tpl'), array('replace', APP_AREA . '/products/customers.tpl', 'admin/products/customers.tpl'), array());
    // Orders
    cw_addons_set_template(array('replace', APP_AREA . '/orders/orders.tpl', 'admin/orders/orders.tpl'), array('replace', APP_AREA . '/orders/document.tpl', 'admin/orders/document.tpl'), array('replace', 'main/docs/notes.tpl', 'addons/' . seller_addon_name . '/orders/notes.tpl'));
    // Profile
    cw_addons_set_template(array('replace', 'main/users/sections/basic.tpl', 'addons/' . seller_addon_name . '/sections/basic.tpl'), array('replace', APP_AREA . '/acc_manager/acc_manager.tpl', 'addons/' . seller_addon_name . '/acc_manager/acc_manager.tpl'), array('replace', APP_AREA . '/acc_manager/modify.tpl', 'addons/' . seller_addon_name . '/acc_manager/modify.tpl'), array());
    if ($target == 'products' && $mode == 'details') {
        cw_addons_set_template(array('replace', 'main/select/availability.tpl', 'addons/' . seller_addon_name . '/main/select/availability.tpl', 'cw_seller_product_is_pending'));
    }
}
<?php

cw_include('addons/manufacturers/include/func.manufacturer.php');
cw_addons_set_controllers(array('replace', 'admin/manufacturers.php', 'addons/manufacturers/admin/manufacturers.php'), array('replace', 'customer/manufacturers.php', 'addons/manufacturers/customer/manufacturers.php'));
cw_addons_set_hooks(array('post', 'cw_product_search', 'cw_manufacturers_product_search'), array('post', 'cw_product_get', 'cw_manufacturers_product_get'));
cw_set_hook('cw_doc_get_extras_data', 'cw_manufacturers_doc_get_extras_data', EVENT_POST);
cw_event_listen('on_prepare_search_orders', 'cw_manufacturers_prepare_search_orders');
// CMS addon
cw_event_listen('on_cms_check_restrictions', 'cw_manufacturers_on_cms_check_restrictions_M');
cw_addons_set_template(array('post', 'main/attributes/default_types.tpl', 'addons/manufacturers/main/attributes/manufacturer-selector.tpl'), array('post', 'customer/products/search_form_adv.tpl', 'addons/manufacturers/customer/products/search_form_adv.tpl'), array('post', 'main/products/search_form.tpl', 'addons/manufacturers/main/products/search_form.tpl'), array('pre', 'customer/products/product-fields.tpl', 'addons/manufacturers/customer/products/product-fields.tpl'), array('replace', 'main/attributes/show.tpl', 'addons/manufacturers/main/attributes/show.tpl', 'cw_manufacturers_is_manufacturer_attribute'), array('post', 'main/docs/extras.tpl', 'addons/manufacturers/main/attributes/extras.tpl'), array('post', 'main/docs/extras_title.tpl', 'addons/manufacturers/main/attributes/extras.tpl'), array('pre', 'main/docs/additional_search_field.tpl', 'addons/manufacturers/main/attributes/additional_manufacturer_search_field.tpl'));
if (APP_AREA == 'customer') {
    cw_addons_set_controllers(array('post', 'customer/product.php', 'addons/manufacturers/customer/product.php'));
}
cw_addons_add_js('jquery/jquery-listnav-2.2.min.js');
<?php

$tables['domains'] = 'cw_domains';
$tables['domains_config'] = 'cw_domains_config';
cw_include('addons/multi_domains/include/func.md.php');
cw_addons_set_controllers(array('replace', 'admin/domains.php', 'addons/multi_domains/admin/domains.php'), array('post', 'init/abstract.php', 'addons/multi_domains/init/domains.php'), array('post', 'include/auth.php', 'addons/multi_domains/include/auth.php'));
if ($target != 'image') {
    cw_set_controller('init/post_init.php', 'addons/multi_domains/init/get_host_data.php', EVENT_POST);
    cw_set_controller('init/post_init.php', 'addons/multi_domains/post_init.php', EVENT_POST);
}
cw_set_hook('cw_core_get_config', 'cw_md_core_get_config', EVENT_POST);
cw_set_hook('cw_attributes_save', 'cw_md_attributes_save', EVENT_POST);
// additional function for the category attributes
cw_addons_set_hooks(array('pre', 'cw_product_search', 'cw_md_product_search'), array('pre', 'cw_category_search', 'cw_md_category_search'), array('pre', 'cw_manufacturer_search', 'cw_md_manufacturer_search'), array('pre', 'cw_pages_search', 'cw_md_pages_search'), array('pre', 'cw_speed_bar_search', 'cw_md_speed_bar_search'), array('pre', 'cw_shipping_search', 'cw_md_shipping_search'), array('pre', 'cw_payment_search', 'cw_md_payment_search'), array('pre', 'cw_product_get', 'cw_md_product_search'), array('pre', 'cw_category_get', 'cw_md_category_search'), array('pre', 'cw_manufacturer_get', 'cw_md_manufacturer_search'), array('pre', 'cw_pages_get', 'cw_md_pages_search'), array('pre', 'cw_doc_place_order', 'cw_md_doc_place_order'), array('post', 'cw_code_get_template_dir', 'cw_md_code_get_template_dir'));
if (APP_AREA == 'admin') {
    cw_event_listen('on_prepare_search_orders', 'cw_md_prepare_search_orders');
    cw_set_hook('cw_send_mail', 'cw_md_send_mail', EVENT_PRE);
    // This hook adds altskin as source of email templates
    cw_set_hook('cw_spam', 'cw_md_send_mail', EVENT_PRE);
    cw_addons_set_template(array('pre', 'main/docs/additional_search_field.tpl', 'addons/multi_domains/admin/additional_domain_selector.tpl'), array('post', 'common/navigation_counter.tpl', 'addons/multi_domains/common/current_domain_warning.tpl'));
}
if (APP_AREA == 'customer') {
    # kornev, languages per domain
    cw_addons_set_controllers(array('pre', 'init/lng.php', 'addons/multi_domains/init/lng.php'), array('pre', 'customer/referer.php', 'addons/multi_domains/customer/referer.php'));
    cw_addons_set_hooks(array('replace', 'cw_core_get_available_languages', 'cw_md_get_available_languages'));
}
cw_addons_set_template(array('post', 'main/attributes/default_types.tpl', 'addons/multi_domains/types/domain-selector.tpl'), array('post', 'common/top-filters.tpl', 'addons/multi_domains/common/top-filters.tpl'));
cw_addons_add_css('addons/multi_domains/general.css', 'A');
<?php

$cw_allowed_tunnels[] = 'cw_payment_is_authorized';
cw_include('addons/payment_system/include/func.payment.php');
cw_addons_set_template(array('post', 'customer/cart/buttons.tpl', 'addons/payment_system/customer/buttons.tpl'));
cw_addons_set_controllers(array('replace', 'admin/payments.php', 'addons/payment_system/admin/payments.php'), array('replace', 'customer/place_order.php', 'addons/payment_system/customer/place_order.php'));
cw_addons_set_hooks(array('post', 'cw_checkout_login_prepare', 'cw_payment_checkout_login_prepare'), array('post', 'cw_checkout_prepare', 'cw_payment_checkout_prepare'));
// Capture/Decline button for Authorized orders
cw_set_controller('admin/docs_O.php', 'addons/payment_system/admin/docs_O.php', EVENT_PRE);
cw_addons_set_template(array('post', 'main/docs/notes.tpl@doc_process_buttons', 'addons/payment_system/admin/doc_process_buttons.tpl'));
cw_event_listen('on_sessions_delete', 'cw_payment_data_delete');
if (APP_AREA != 'admin') {
    return;
}
if (!in_array($target, array('', 'index', 'dashboard', 'quick_data', 'dashboard_system_messages'), true)) {
    return;
}
define('SEARCH_LIMIT_FOR_AUTOCOMPLETE', 10);
define('NEWS_RSS_URL', 'http://www.cartworks-platform.com/adminfeed.xml');
$tables['dashboard'] = 'cw_dashboard';
// Define abstract dashboard builder
cw_include('addons/dashboard/include/func.dashboard.php');
cw_addons_set_controllers(array('post', 'admin/index.php', 'addons/dashboard/admin/index.php'), array('replace', 'admin/dashboard.php', 'addons/dashboard/admin/configuration.php'), array('replace', 'admin/quick_data.php', 'addons/dashboard/admin/quick_data.php'), array('replace', 'admin/dashboard_system_messages.php', 'addons/dashboard/admin/dashboard_system_messages.php'));
// Define all specific dashboard section builders
//cw_include('addons/dashboard/sections/dashboard_section_example.php');
cw_include('addons/dashboard/sections/dashboard_section_default.php');
// Register hooks
cw_addons_set_hooks(array('post', 'dashboard_build_sections', 'dashboard_section_search'), array('post', 'dashboard_build_sections', 'dashboard_section_graph'), array('post', 'dashboard_build_sections', 'dashboard_last_orders'), array('post', 'dashboard_build_sections', 'dashboard_section_system_messages'), array('post', 'dashboard_build_sections', 'dashboard_section_pending_reviews'), array('post', 'dashboard_build_sections', 'dashboard_section_awaiting'), array('post', 'dashboard_build_sections', 'dashboard_section_system_info'), array('post', 'dashboard_build_sections', 'dashboard_section_news'));
cw_addons_add_css('addons/dashboard/admin/main.css');
cw_addons_set_template(array('post', 'admin/main/main.tpl', 'addons/dashboard/admin/index.tpl'));
/*
 * jqPlot http://www.jqplot.com/
 */
// Excanvas is required only for IE versions below 9
preg_match("/(MSIE|Version)(?:\\/| )([0-9.]+)/", $_SERVER['HTTP_USER_AGENT'], $matches);
if (count($matches) && $matches[1] == 'MSIE' && $matches[2] < 9.0) {
    cw_addons_add_js('addons/dashboard/js/excanvas.min.js');
}
cw_addons_add_js('addons/dashboard/js/jquery.jqplot.min.js');
cw_addons_add_js('addons/dashboard/js/plugins/jqplot.dateaxisrenderer.min.js');
cw_addons_add_js('addons/dashboard/js/plugins/jqplot.highlighter.min.js');
cw_addons_add_css('addons/dashboard/js/jquery.jqplot.min.css');
<?php

$cw_allowed_tunnels[] = 'cw_shipping_search';
$cw_allowed_tunnels[] = 'cw_shipping_doc_trackable';
cw_include('addons/shipping_system/include/func.shipping.php');
cw_addons_add_css('addons/shipping_system/css/main.css');
cw_addons_set_controllers(array('replace', 'admin/shipping_carriers.php', 'addons/shipping_system/admin/shipping_carriers.php'), array('replace', 'admin/cod_types.php', 'addons/shipping_system/admin/cod_types.php'), array('replace', 'admin/shipping_zones.php', 'addons/shipping_system/admin/shipping_zones.php'), array('replace', 'admin/shipping.php', 'addons/shipping_system/admin/shipping.php'), array('replace', 'admin/shipping_rates.php', 'addons/shipping_system/admin/shipping_rates.php'), array('post', 'include/orders/order_edit.php', 'addons/shipping_system/include/orders/order_edit.php'), array('replace', 'customer/popup-shipping.php', 'addons/shipping_system/customer/popup-shipping.php'));
cw_addons_set_hooks(array('post', 'cw_checkout_login_prepare', 'cw_shipping_checkout_login_prepare'), array('pre', 'cw_cart_actions', 'cw_shipping_cart_actions'), array('post', 'cw_cart_get_warehouses_cart', 'cw_shipping_cart_get_warehouses_cart'), array('post', 'cw_cart_calc_single', 'cw_shipping_cart_calc_single'), array('pre', 'cw_cart_summarize', 'cw_shipping_cart_summarize'), array('post', 'cw_product_get', 'cw_shipping_product_get'));
cw_addons_set_template(array('pre', 'customer/cart/totals.tpl', 'addons/shipping_system/customer/cart/totals.tpl'), array('post', 'customer/checkout/shipping_methods.tpl', 'addons/shipping_system/customer/checkout/shipping_methods.tpl'), array('post', 'customer/products/product-fields.tpl', 'addons/shipping_system/customer/products/product-fields.tpl'), array('replace', 'customer/products/estimate-fields.tpl', 'addons/shipping_system/customer/products/product-fields.tpl'), array('post', 'customer/products/products-info.tpl', 'addons/shipping_system/customer/products/shipping_estimator.tpl'), array('post', 'customer/products/our_price.tpl', 'addons/shipping_system/customer/products/free-shipping.tpl'));
if (APP_AREA == 'customer') {
    cw_addons_add_js('addons/shipping_system/js/dialog.js');
    cw_set_controller('customer/shipping_estimator.php', 'addons/shipping_system/customer/shipping_estimator.php', EVENT_REPLACE);
    cw_set_controller('customer/order_tracking.php', 'addons/shipping_system/customer/order_tracking.php', EVENT_REPLACE);
    cw_addons_set_template(array('post', 'customer/products/product.tpl', 'addons/shipping_system/customer/products/estimate.tpl'), array('post', 'customer/products/subcategories.tpl', 'addons/shipping_system/customer/products/estimate.tpl'));
}
// Use namespace for your own addon as vendor\addon_name
namespace cw\product_stages;

// Constants definition
// these constants are defined in scope of addon's namespace
const addon_name = 'product_stages';
const addon_target = 'product_stages';
// Main target of addon, useful but of course addon can handle several targets
$cw_allowed_tunnels[] = 'cw\\' . addon_name . '\\cw_product_stages_get_doc_stages_history';
// New tables definition
$tables['product_stages_library'] = 'cw_product_stages_library';
$tables['product_stages_product_settings'] = 'cw_product_stages_product_settings';
$tables['docs_statuses_log'] = 'cw_docs_statuses_log';
$tables['product_stages_process_log'] = 'cw_product_stages_process_log';
// Include functions
cw_include('addons/' . addon_name . '/include/func.php');
// You can define different hooks depending on area or $target or use common init sequence.
if (APP_AREA == 'admin') {
    // Define own controller which does not exists yet using EVENT_REPLACE
    cw_set_controller(APP_AREA . '/' . addon_target . '.php', 'addons/' . addon_name . '/admin/' . addon_target . '.php', EVENT_REPLACE);
    cw_set_controller('include/products/modify.php', 'addons/' . addon_name . '/admin/include/products/modify.php', EVENT_POST);
    cw_set_controller('include/products/modify.php', 'addons/' . addon_name . '/admin/include/products/modify.php', EVENT_PRE);
    cw_set_controller(APP_AREA . '/stage_email_test.php', 'addons/' . addon_name . '/admin/stage_email_test.php', EVENT_REPLACE);
}
cw_addons_set_hooks(array('post', 'cw_tabs_js_abstract', 'cw\\' . addon_name . '\\cw_product_stages_tabs_js_abstract'));
// Cron handlers. See docs/core.cron.txt and core/cron/cron.php
cw_event_listen('on_cron_daily', 'cw\\' . addon_name . '\\on_cron_daily');
cw_event_listen('on_doc_change_status', 'cw\\' . addon_name . '\\cw_product_stages_on_doc_change_status');
// Hook templates
cw_addons_set_template(array('replace', 'admin/main/' . addon_target . '.tpl', 'addons/' . addon_name . '/admin/' . addon_target . '.tpl'));
cw_addons_set_template(array('replace', 'admin/main/stage_email_test.tpl', 'addons/' . addon_name . '/admin/stage_email_test.tpl'));
$tables['cms_images'] = 'cw_cms_images';
$tables['cms_restrictions'] = 'cw_cms_restrictions';
$tables['cms_user_counters'] = 'cw_cms_user_counters';
cw_include('addons/cms/func.hooks.php', INCLUDE_NO_GLOBALS);
cw_include('addons/cms/func.php', INCLUDE_NO_GLOBALS);
cw_event_listen('on_product_delete', 'cms\\on_product_delete');
cw_event_listen('on_category_delete', 'cms\\on_category_delete');
cw_event_listen('on_manufacturer_delete', 'cms\\on_manufacturer_delete');
cw_event_listen('on_cms_check_restrictions', 'cms\\on_cms_check_restrictions_C');
cw_event_listen('on_cms_check_restrictions', 'cms\\on_cms_check_restrictions_P');
cw_set_hook('cw_delete_product', 'cms\\cw_delete_product', EVENT_POST);
if (APP_AREA == 'admin') {
    cw_addons_set_controllers(array('replace', 'admin/cms.php', 'addons/cms/cms.php'), array('pre', 'include/products/modify.php', 'addons/cms/product_modify.php'));
    cw_addons_set_hooks(array('post', 'cw_tabs_js_abstract', 'cms\\tabs_js_abstract'));
    cw_addons_set_template(array('replace', 'admin/main/section_title.tpl', 'addons/cms/admin/section_title.tpl'));
    if ($target == 'cms' && $mode == 'search') {
        cw_addons_set_template(array('replace', 'addons/clean_urls/history_link.tpl', 'addons/cms/history_link.tpl'));
    }
}
if (APP_AREA == 'customer') {
    cw_addons_add_css('addons/cms/cms.css');
    cw_addons_add_js('addons/cms/cms.js');
    cw_addons_set_controllers(array('replace', 'customer/ab_count_click.php', 'addons/cms/ab_count_click.php'), array('replace', 'customer/pages.php', 'addons/cms/staticpages.php'), array('post', 'customer/help.php', 'addons/cms/help_pages.php'));
    //   cw_set_controller('customer/auth.php', 'addons/cms/customer/cms.php', EVENT_POST);
    cw_addons_set_hooks(array('pre', 'cw_core_get_meta', 'cw_cms_get_meta'));
    // test content section
    if (AB_TEST_CONTENTSECTION) {
        cw_addons_set_template(array('post', CS_TEST_TEMPLATE, 'addons/cms/test.tpl'));
    }
    cw_addons_set_template(array('post', 'customer/service_js.tpl', 'addons/cms/highlight.js.tpl'), array('replace', 'customer/main/pages.tpl', 'addons/cms/customer/staticpages.tpl'), array('pre', 'common/menu.tpl', 'addons/cms/customer/menu_pre.tpl'), array('post', 'common/menu.tpl', 'addons/cms/customer/menu_post.tpl'), array('post', 'customer/help/help.tpl@help_main_section', 'addons/cms/customer/help_sections.tpl'));
}
<?php

$tables['products_reviews_reminder'] = 'cw_products_reviews_reminder';
$tables['products_reviews_ratings'] = 'cw_products_reviews_ratings';
$tables['products_reviews_rating_types'] = 'cw_products_reviews_rating_types';
$cw_allowed_tunnels[] = 'cw_review_get_quick_global_info';
cw_include('addons/estore_products_review/include/func.review.php');
# kornev, TOFIX - move all of the css from general
cw_addons_add_css('addons/estore_products_review/general.css');
cw_addons_add_js('addons/estore_products_review/js/jquery.raty.min.js');
cw_addons_set_controllers(array('post', 'customer/product.php', 'addons/estore_products_review/customer/product.php'), array('replace', 'customer/top_rated.php', 'addons/estore_products_review/customer/top_rated.php'), array('replace', 'customer/estore_testimonials.php', 'addons/estore_products_review/customer/testimonials.php'), array('replace', 'admin/estore_stop_list.php', 'addons/estore_products_review/admin/estore_stop_list.php'), array('replace', APP_AREA . '/estore_reviews_management.php', 'addons/estore_products_review/' . APP_AREA . '/reviews_management.php'), array('replace', APP_AREA . '/estore_review_management.php', 'addons/estore_products_review/' . APP_AREA . '/review_management.php'), array('replace', 'admin/estore_execute_doc_action.php', 'addons/estore_products_review/admin/doc_action.php'), array('replace', 'customer/global_reviews.php', 'addons/estore_products_review/customer/global_reviews.php'));
cw_set_controller('customer/review_vote.php', 'addons/estore_products_review/customer/review_vote.php', EVENT_REPLACE);
if (APP_AREA == 'admin') {
    cw_addons_set_controllers(array('post', 'include/orders/order.php', 'addons/estore_products_review/admin/order.php'));
}
cw_set_hook('cw_delete_product', 'cw_review_delete_product', EVENT_POST);
# kornev, select rating to show it on the category page
cw_addons_set_hooks(array('post', 'cw_product_search', 'cw_review_product_search'), array('post', 'cw_product_get', 'cw_review_product_get'), array('post', 'cw_product_filter_get_slider_value', 'cw_review_product_filter_get_slider_value'), array('pre', 'cw_cron_get_targets', 'cw_review_prepare_and_send_reminder'), array('post', 'cw_attributes_delete', 'cw_review_delete_product_votes'), array('post', 'cw_attributes_get_types', 'cw_review_attributes_get_types'));
cw_addons_set_template(array('replace', 'main/attributes/show.tpl', 'addons/estore_products_review/main/attributes/show.tpl', 'cw_review_is_rating_attribute'), array('post', 'help/menu-list.tpl', 'addons/estore_products_review/menu-list.tpl'), array('replace', 'customer/help/estore_testimonials.tpl', 'addons/estore_products_review/testimonials.tpl'), array('replace', 'admin/main/estore_stop_list.tpl', 'addons/estore_products_review/admin_stop_list.tpl'), array('replace', 'admin/main/estore_reviews_management.tpl', 'addons/estore_products_review/admin_reviews_management.tpl'), array('replace', APP_AREA . '/main/estore_review_management.tpl', 'addons/estore_products_review/' . APP_AREA . '_review_management.tpl'), array('post', 'main/docs/additional_actions.tpl', 'addons/estore_products_review/additional_doc_action.tpl'), array('post', 'main/docs/additional_search_field.tpl', 'addons/estore_products_review/additional_doc_search_field.tpl'), array('replace', 'customer/main/global_reviews.tpl', 'addons/estore_products_review/global_reviews.tpl'));
cw_event_listen('on_prepare_search_orders', 'cw_review_prepare_search_orders');
cw_set_hook('cw_web_get_product_layout_elements', 'cw_review_get_product_layout_elements');
cw_set_hook('cw_doc_get', 'cw_review_doc_get');
<?php

/*
 * Vendor: CW
 * addon: SagePay Go - Form protocol
 */
const sagepaygo_form_addon_name = 'payment_sagepay_form';
const sagepaygo_form_addon_target = 'sagepaygo_form';
const sagepaygo_form_addon_version = '0.1';
const sagepaygo_form_addon_partner_id = '';
//If you are a Sage Pay Partner and wish to flag the transactions with your unique partner id set it here.
if (!empty($addons[sagepaygo_form_addon_name])) {
    cw_include('addons/' . sagepaygo_form_addon_name . '/include/func.php');
    cw_addons_set_controllers(array('replace', 'customer/' . sagepaygo_form_addon_target . '.php', 'addons/' . sagepaygo_form_addon_name . '/customer/' . sagepaygo_form_addon_target . '.php'));
    cw_addons_set_hooks(array('post', 'cw_payment_get_methods', 'cw_payment_sagepaygo_form_get_methods'), array('post', 'cw_payment_run_processor', 'cw_payment_sagepaygo_form_run_processor'));
}
<?php

cw_include('addons/shipping_fedex/include/func.fedex.php');
/*
cw_addons_set_template(
    array('pre', 'admin/configuration/addon_settings.tpl', 'addons/shipping_fedex/admin/configuration/addon_settings.tpl')
);
*/
cw_addons_set_hooks(array('post', 'cw_shipping_get_rates', 'cw_fedex_shipping_get_rates'));
<?php

cw_include('addons/ppd/include/func.hooks.php');
cw_addons_set_controllers(array('replace', 'admin/filetypes.php', 'addons/ppd/admin/filetypes.php'), array('replace', 'customer/getfile.php', 'addons/ppd/customer/getfile.php'), array('pre', 'include/products/modify.php', 'addons/ppd/admin/main.php'), array('pre', 'customer/product.php', 'addons/ppd/customer/main.php'));
cw_addons_set_template(array('replace', 'admin/main/filetypes.tpl', 'addons/ppd/admin/filetypes.tpl'));
cw_addons_set_hooks(array('post', 'cw_doc_change_status_C', 'cw_ppd_doc_change_status_C'), array('post', 'cw_doc_change_status_P', 'cw_ppd_doc_change_status_C'), array('post', 'cw_doc_change_status_D', 'cw_ppd_doc_change_status_D'), array('post', 'cw_doc_delete', 'cw_ppd_doc_delete'), array('pre', 'cw_user_delete', 'cw_ppd_user_delete'), array('post', 'cw_tabs_js_abstract', 'cw_ppd_tabs_js_abstract'));
cw_set_hook('cw_delete_product', 'cw_ppd_delete_product', EVENT_POST);
cw_set_hook('cw_product_clone', 'cw_ppd_product_clone', EVENT_POST);
if (APP_AREA == 'admin') {
    cw_addons_add_css('addons/ppd/admin/main.css');
}
if (APP_AREA == 'customer') {
    cw_addons_add_css('addons/ppd/customer/main.css');
}
$_addon_tables = array('ppd_files', 'ppd_types', 'ppd_downloads', 'ppd_stats');
foreach ($_addon_tables as $_table) {
    $tables[$_table] = 'cw_' . $_table;
}
<?php

cw_addons_set_hooks(array('post', 'cw_shipping_get_rates', 'cw_apply_special_offer_shipping'));
cw_event_listen('on_collect_shipping_rates_hash', 'cw_ps_on_collect_shipping_rates_hash', EVENT_POST);
<?php

cw_include('addons/payment_offline/include/func.payment_offline.php');
cw_addons_set_hooks(array('post', 'cw_payment_run_processor', 'cw_payment_offline_run_processor'));
<?php

$tables['linked_products'] = 'cw_linked_products';
require $app_main_dir . '/addons/accessories/func.php';
require $app_main_dir . '/addons/accessories/func.hooks.php';
if (APP_AREA == 'admin') {
    cw_addons_set_controllers(array('pre', 'include/products/modify.php', 'addons/accessories/product_modify_accessories.php'));
    cw_addons_set_hooks(array('post', 'cw_tabs_js_abstract', 'cw_ac_tabs_js_abstract'));
    cw_set_hook('cw_product_clone', 'cw_ac_product_clone', EVENT_POST);
    cw_set_hook('cw_delete_product', 'cw_ac_delete_product', EVENT_POST);
}
if (APP_AREA == 'customer') {
    //cw_addons_add_js('addons/accessories/func.js');
    cw_addons_set_controllers(array('post', 'customer/product.php', 'addons/accessories/product_accessories.php'));
    cw_set_controller('customer/product.php', 'addons/accessories/rv_product.php', EVENT_POST);
    cw_set_controller('customer/cart.php', 'addons/accessories/rv_products_list.php', EVENT_POST);
    cw_set_controller('customer/cart.php', 'addons/accessories/cab_products_list.php', EVENT_POST);
    cw_addons_set_template(array('post', 'customer/cart/cart.tpl', 'addons/accessories/cart_recently_viewed_products.tpl'), array('post', 'customer/cart/cart.tpl', 'addons/accessories/cab_products_list.tpl'));
    cw_addons_set_hooks(array('post', 'cw_tabs_js_abstract', 'cw_ac_tabs_js_abstract'));
    // Integration with ajax_add2cart addon {
    if (defined('IS_AJAX') && constant('IS_AJAX')) {
        cw_event_listen('on_add_cart', 'cw_ac_on_add_to_cart');
        cw_addons_set_template(array('post', 'addons/ajax_add2cart/add2cart_popup.tpl', 'addons/accessories/add2cart_popup.tpl'));
    }
    // } Integration with ajax_add2cart addon
    cw_addons_add_css('addons/accessories/accessories.css');
}
<?php

$tables['order_messages_threads'] = 'cw_order_messages_threads';
$tables['order_messages_messages'] = 'cw_order_messages_messages';
$tables['mail_rpool'] = 'cw_mail_rpool';
const order_messages_addon_name = 'order_messages';
cw_include('addons/' . order_messages_addon_name . '/func.php');
if (APP_AREA == 'admin') {
    cw_addons_set_hooks(array('post', 'cw_tabs_js_abstract', 'cw_order_messages_tabs_js_abstract'), array('post', 'cw_send_mail', 'cw_order_messages_send_mail'));
    cw_addons_set_controllers(array('post', 'include/orders/order.php', 'addons/' . order_messages_addon_name . '/threads_list.php'), array('replace', 'admin/thread_messages.php', 'addons/' . order_messages_addon_name . '/thread_messages.php'), array('replace', 'admin/take_messages.php', 'addons/' . order_messages_addon_name . '/take_messages.php'));
    cw_addons_set_template(array('replace', 'admin/main/thread_messages.tpl', 'addons/' . order_messages_addon_name . '/thread_messages.tpl'));
    cw_addons_set_template(array('post', 'mail/mail_header.tpl', 'addons/' . order_messages_addon_name . '/doc_layout_pre.tpl'));
    cw_addons_set_template(array('pre', 'main/docs/doc_layout.tpl', 'addons/' . order_messages_addon_name . '/doc_layout_post.tpl'));
    cw_addons_set_template(array('post', 'main/docs/additional_search_field.tpl', 'addons/' . order_messages_addon_name . '/additional_doc_search_field.tpl'));
    cw_event_listen('on_prepare_search_orders', 'cw_order_messages_prepare_search_orders');
    if ($target == "thread_messages") {
        cw_addons_set_template(array('replace', 'common/head.tpl', 'addons/' . order_messages_addon_name . '/admin_head_order_messages.tpl'));
    }
} elseif (APP_AREA == 'customer') {
    cw_addons_set_hooks(array('post', 'cw_send_mail', 'cw_order_messages_send_mail'));
}
cw_event_listen('on_cron_regular', 'cw_order_messages_get_emails');
<?php

cw_include('addons/paypal_express/include/func.paypal_express.php');
cw_addons_set_template(array('post', 'customer/cart/buttons.tpl', 'addons/paypal_express/customer/buttons.tpl'));
cw_addons_set_controllers(array('replace', 'customer/paypal_express.php', 'addons/paypal_express/customer/paypal_express.php'));
cw_addons_set_hooks(array('post', 'cw_payment_search', 'cw_paypal_express_payment_search'), array('pre', 'cw_payment_get_label', 'cw_paypal_express_payment_get_label'));
const clean_urls_attributes_values_item_type = 'AV';
$tables['clean_urls_custom_facet_urls'] = 'cw_clean_urls_custom_facet_urls';
$tables['clean_urls_custom_facet_urls_options'] = 'cw_clean_urls_custom_facet_urls_options';
$tables['facet_categories_images'] = 'cw_facet_categories_images';
$tables['clean_urls_history'] = 'cw_clean_urls_history';
$tables['manufacturers_categories'] = 'cw_manufacturers_categories';
$cw_allowed_tunnels[] = 'cw_clean_url_alt_tags';
cw_include('addons/clean_urls/include/func.clean_urls.php');
cw_addons_set_controllers(array('pre', 'init/abstract.php', 'addons/clean_urls/init/abstract.php'));
cw_event_listen('on_product_delete', 'cw_clean_url_on_product_delete');
// CMS addon
cw_event_listen('on_cms_check_restrictions', 'cw_clean_url_on_cms_check_restrictions_URL');
// Event handler to update clean url for attribute values
cw_event_listen('on_after_attribute_options_modify_att_options', 'cw_clean_url_on_attribute_options');
cw_set_hook('cw_manufacturer_delete', 'cw_clean_url_manufacturer_delete', EVENT_POST);
cw_set_hook('cw_category_delete', 'cw_clean_url_category_delete', EVENT_POST);
cw_set_hook('cw_attributes_delete', 'cw_clean_url_attributes_delete', EVENT_PRE);
cw_set_hook('cw_attributes_delete_values', 'cw_clean_url_attributes_delete_values', EVENT_PRE);
cw_set_hook('cw_core_get_html_page_url', 'cw_clean_url_get_html_page_url', EVENT_PRE);
cw_set_hook('cw_core_get_meta', 'cw_clean_url_get_meta', EVENT_PRE);
cw_set_hook('cw_attributes_save', 'cw_clean_url_attributes_save', EVENT_PRE);
cw_addons_set_hooks(array('post', 'cw_attributes_create_attribute', 'cw_clean_url_attributes_create_attribute'), array('post', 'cw_attributes_save_attribute', 'cw_clean_url_attributes_save_attribute'), array('post', 'cw_attributes_get_attribute', 'cw_clean_url_attributes_get_attribute'), array('replace', 'cw_product_navigation_filter_url', 'cw_clean_url_product_navigation_filter_url'));
cw_addons_set_template(array('replace', 'common/image_alt.tpl', 'addons/clean_urls/image_alt.tpl'));
if (APP_AREA == 'admin') {
    cw_addons_set_controllers(array('replace', 'admin/clean_url_show_history.php', 'addons/clean_urls/admin/show_history.php'), array('replace', 'admin/clean_url_delete_url.php', 'addons/clean_urls/admin/delete_history_url.php'), array('replace', 'admin/clean_urls_list.php', 'addons/clean_urls/admin/clean_urls_list.php'), array('replace', 'admin/custom_facet_urls.php', 'addons/clean_urls/admin/custom_facet_urls.php'));
    cw_addons_set_template(array('post', 'main/attributes/default_types.tpl', 'addons/clean_urls/history_link.tpl'), array('replace', 'admin/main/clean_url_history_list.tpl', 'addons/clean_urls/history_list.tpl'), array('replace', 'admin/seo/clean_urls_list.tpl', 'addons/clean_urls/clean_urls_list.tpl'), array('replace', 'admin/attributes/attribute_field.tpl', 'addons/clean_urls/attribute_field.tpl'), array('replace', 'admin/attributes/attribute_value_field.tpl', 'addons/clean_urls/attribute_value_field.tpl'), array('replace', 'admin/attributes/attribute_value_th_title.tpl', 'addons/clean_urls/attribute_value_th_title.tpl'), array('replace', 'admin/attributes/attribute_value_td_field.tpl', 'addons/clean_urls/attribute_value_td_field.tpl'), array('replace', 'admin/attributes/attribute_preset_item.tpl', 'addons/clean_urls/attribute_preset_item.tpl'), array('replace', 'admin/seo/custom_facet_urls.tpl', 'addons/clean_urls/custom_facet_urls.tpl'), array('replace', 'admin/seo/custom_facet_url.tpl', 'addons/clean_urls/custom_facet_url.tpl'));
    // Integration with manufacturers
    cw_set_controller('addons/manufacturers/admin/manufacturers.php', 'addons/clean_urls/manufacturers.php', EVENT_PRE);
    //	cw_addons_set_template(array('post','addons/manufacturers/manufacturer.tpl','addons/clean_urls/manufacturer.tpl'));
}
cw_set_controller('addons/manufacturers/customer/manufacturers.php', 'addons/clean_urls/manufacturers.php', EVENT_POST);