<?php

$tables['flexible_import_profiles'] = 'cw_flexible_import_profiles';
$tables['flexible_import_files'] = 'cw_flexible_import_files';
$var_dirs['flex_import_test'] = $app_dir . '/files/flex_import_test';
define("fi_files_path", "./files/flexible_import/");
global $csvxc_field_types;
$csvxc_field_types = array('PRICE' => "decimal(12,2) NOT NULL DEFAULT '0.00'", 'PRICE_MODIFIER' => "decimal(12,2) NOT NULL DEFAULT '0.00'", 'DESCR' => "text NOT NULL DEFAULT ''", 'FULLDESCR' => "text NOT NULL DEFAULT ''", 'PRODUCTID' => "int(11) NOT NULL DEFAULT '0'", 'PRODUCTID_TO' => "int(11) NOT NULL DEFAULT '0'", 'OPTIONID' => "int(11) NOT NULL DEFAULT '0'", 'CLASSID' => "int(11) NOT NULL DEFAULT '0'", 'ADD_DATE' => "int(11) NOT NULL DEFAULT '0'", 'WEIGHT' => "decimal(12,2) NOT NULL DEFAULT '0.00'", 'LIST_PRICE' => "decimal(12,2) NOT NULL DEFAULT '0.00'", 'AVAIL' => "int(11) NOT NULL DEFAULT '0'", 'MIN_AMOUNT' => "int(11) NOT NULL DEFAULT '0'", 'LOW_AVAIL_LIMIT' => "int(11) NOT NULL DEFAULT '0'", 'default' => "varchar(255) NOT NULL DEFAULT ''");
global $tmp_load_tables;
$tmp_load_tables = array('CATEGORIES' => array('CATEGORYID' => array('type' => 'int', 'key' => true), 'CATEGORY' => array('type' => 'text', 'key' => true), 'DESCR' => array('type' => 'longtext'), 'META_DESCR' => array('type' => 'longtext'), 'AVAIL' => array('type' => 'bool'), 'ORDERBY' => array('type' => 'int'), 'META_KEYWORDS' => array('type' => 'text'), 'ICON' => array('type' => 'text', 'file_path' => true)), 'PRODUCTS' => array('PRODUCTID' => array('type' => 'int', 'key' => true), 'PRODUCTCODE' => array('type' => 'text', 'key' => true), 'PRODUCT' => array('type' => 'text', 'key' => true), 'WEIGHT' => array('type' => 'text'), 'LIST_PRICE' => array('type' => 'text'), 'DESCR' => array('type' => 'longtext'), 'FULLDESCR' => array('type' => 'longtext'), 'KEYWORDS' => array('type' => 'text'), 'AVAIL' => array('type' => 'text'), 'RATING' => array('type' => 'text'), 'FORSALE' => array('type' => 'text'), 'SHIPPING_FREIGHT' => array('type' => 'text'), 'FREE_SHIPPING' => array('type' => 'text'), 'DISCOUNT_AVAIL' => array('type' => 'text'), 'MIN_AMOUNT' => array('type' => 'text'), 'DIM_X' => array('type' => 'text'), 'DIM_Y' => array('type' => 'text'), 'DIM_Z' => array('type' => 'text'), 'LOW_AVAIL_LIMIT' => array('type' => 'text'), 'FREE_TAX' => array('type' => 'text'), 'CATEGORYID' => array('type' => 'int', 'grouped_key' => array('CATEGORY')), 'CATEGORY' => array('type' => 'text', 'grouped_key' => array('CATEGORYID')), 'MEMBERSHIP' => array('type' => 'text', 'grouped_key' => array('MEMBERSHIPID')), 'PRICE' => array('type' => 'text'), 'THUMBNAIL' => array('type' => 'text'), 'IMAGE' => array('type' => 'text'), 'TAXES' => array('type' => 'text'), 'ADD_DATE' => array('type' => 'text'), 'MANUFACTURERID' => array('type' => 'int', 'grouped_key' => array('MANUFACTURER')), 'MANUFACTURER' => array('type' => 'text', 'grouped_key' => array('MANUFACTURERID')), 'MEMBERSHIPID' => array('type' => 'int', 'grouped_key' => array('MEMBERSHIP')), 'SUPPLIERID' => array('type' => 'text'), 'COST' => array('type' => 'text')), 'PRODUCTS_EXTRA_FIELD_VALUES' => array('PRODUCTID' => array('type' => 'int', 'key' => true), 'PRODUCTCODE' => array('type' => 'text', 'key' => true), 'PRODUCT' => array('type' => 'text', 'key' => true), 'dynamic_field_set' => array('query' => "select field from {$tables['attributes']} where item_type='P' and addon in ('', 'custom_saratogawine_magazines','custom_saratogawine_backorder','clean_urls')")));
if (APP_AREA == 'admin') {
    cw_include('addons/flexible_import/include/func.flexible_import.php');
    cw_include('addons/flexible_import/include/func.import.csvxcart.php');
    cw_include('addons/flexible_import/include/csv_def_arrays.php');
    cw_set_controller('admin/import.php', 'addons/flexible_import/admin/flexible_import.php', EVENT_POST);
    cw_set_controller('admin/import.php', 'addons/flexible_import/admin/flexible_import_profile.php', EVENT_POST);
    cw_addons_set_template(array('replace', 'admin/import_export/flexible_import.tpl', 'addons/flexible_import/flexible_import.tpl'), array('replace', 'admin/import_export/flexible_import_profile.tpl', 'addons/flexible_import/add_modify_import_profile.tpl'));
    cw_addons_add_js('addons/flexible_import/flexible_import.js');
    cw_addons_add_css('addons/flexible_import/flexible_import.css');
    cw_set_hook('cw_error_check', 'cw_flexible_import_validate_import_file', EVENT_POST);
}
<?php

/*
 * Vendor: CW
 * addon: ebay
 */
namespace CW\ebay;

const addon_name = 'ebay';
const addon_target = 'ebay_export';
const addon_version = '0.1';
const addon_files_location_path = 'files/ebay/';
const addon_conditions_data_file_name = 'ConditionIDs_by_Category.csv';
if (APP_AREA == 'admin' && $target == addon_target && !empty($addons[addon_name])) {
    $ebay_config = array('ebay_action' => 'Add', 'ebay_category' => 1, 'ebay_condition_id' => 1000, 'ebay_duration' => 1, 'ebay_format' => 'Auction (default)', 'ebay_immediate_pay_required' => 0, 'ebay_location' => '', 'ebay_paypal_accepted' => 0, 'ebay_paypal_email_address' => '', 'ebay_dispatch_time_max' => 1, 'ebay_returns_accepted_option' => 'ReturnsAccepted');
    cw_addons_set_controllers(array('replace', 'admin/' . addon_target . '.php', 'addons/' . addon_name . '/' . addon_target . '.php'));
    cw_include('addons/' . addon_name . '/func.php');
    cw_addons_set_template(array('replace', 'admin/main/ebay_export.tpl', 'addons/ebay/ebay_export.tpl'), array('replace', 'admin/import_export/ebay_export.tpl', 'addons/ebay/ebay_export.tpl'));
}
if (APP_AREA == 'admin') {
    cw_set_controller('admin/ajax_ebay_category_select.php', 'addons/ebay/ebay_attributes_modify.php', EVENT_REPLACE);
    cw_addons_set_template(array('post', 'main/attributes/default_types.tpl', 'addons/ebay/types/ebay_category_selector.tpl'));
    cw_addons_add_js('jquery/dynatree-1.2.4/jquery.dynatree.min.js');
    cw_addons_add_css('jquery/dynatree-1.2.4/ui.dynatree.css');
}
<?php

if (APP_AREA == 'customer') {
    cw_set_controller('customer/ajax_product_search.php', 'addons/ajax_search/customer/ajax_search.php', EVENT_REPLACE);
    cw_addons_set_template(array('post', 'js/presets_js.tpl', 'addons/ajax_search/ajax_search.tpl'));
    cw_addons_add_js('addons/ajax_search/ajax_search.js');
    cw_addons_add_css('addons/ajax_search/ajax_search.css');
}
<?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: Feedback report
 */
const feedback_addon_name = 'feedback_report';
const feedback_our_email_to_send = '*****@*****.**';
const feedback_files_folder_name = 'feedback';
const feedback_image_type = 'jpeg';
// png/jpeg (also need change type in feedback.min.js and html2canvas.min.js)
cw_include('addons/' . feedback_addon_name . '/include/func.feedback.php');
cw_event_listen('on_build_var_dirs', 'cw_fbr_build_var_dirs');
cw_event_listen('on_log_add', 'cw_fbr_log_add');
cw_set_controller(APP_AREA . '/save_feedback_data.php', 'addons/' . feedback_addon_name . '/common/save_feedback_data.php', EVENT_REPLACE);
cw_set_controller('init/numbers.php', 'addons/' . feedback_addon_name . '/common/error_handler.php', EVENT_POST);
cw_set_controller('customer/feedback.php', 'addons/' . feedback_addon_name . '/common/feedback.php', EVENT_REPLACE);
cw_event_listen('on_cron_hourly', 'cw_fbr_prepare_and_send_feedbacks');
cw_addons_set_template(array('post', APP_AREA . '/elements/bottom_links.tpl', 'addons/' . feedback_addon_name . '/bottom_links.tpl'), array('post', 'customer/main/feedback_image.tpl', 'addons/' . feedback_addon_name . '/feedback_image.tpl'));
cw_addons_add_css('addons/' . feedback_addon_name . '/css/feedback.css');
cw_addons_add_js('addons/' . feedback_addon_name . '/js/feedback.min.js');
cw_addons_add_js('addons/' . feedback_addon_name . '/js/html2canvas.min.js');
<?php

/*
 * Vendor: CW
 * addon: bookmarks
 */
namespace CW\bookmarks;

const addon_name = 'bookmarks';
const addon_target = 'bookmarks';
$tables['bookmarks'] = 'cw_bookmarks';
if (APP_AREA != 'admin') {
    return true;
}
cw_include('addons/' . addon_name . '/func.php');
if ($target == addon_target) {
    cw_set_controller(APP_AREA . '/' . addon_target . '.php', 'addons/' . addon_name . '/' . addon_target . '.php', EVENT_REPLACE);
}
cw_addons_set_template(array('post', 'elements/bottom.tpl', 'addons/' . addon_name . '/bookmarks.tpl'), array('post', 'elements/bottom_admin.tpl', 'addons/' . addon_name . '/bookmarks.tpl'));
cw_event_listen('on_login', 'CW\\bookmarks\\on_login');
cw_event_listen('on_customer_delete', 'CW\\bookmarks\\on_customer_delete');
cw_event_listen('on_sessions_delete', 'CW\\bookmarks\\on_sessions_delete');
cw_addons_add_css('addons/' . addon_name . '/bookmarks.css');
cw_addons_add_js('addons/' . addon_name . '/bookmarks.js');
cw_set_controller('addons/mobile/init/mobile.php', 'addons/' . addon_name . '/addons/mobile.php', EVENT_POST);
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');
$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'));
}
// Include functions
cw_include('addons/' . addon_name . '/include/func.php');
// Sometimes some part of initialization must be after all addons init - in post_init.php
cw_set_controller('init/post_init.php', 'addons/' . addon_name . '/post_init.php', EVENT_POST);
// 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
    /* Place comment here with description of functionality provided by this additional controller */
    cw_set_controller(APP_AREA . '/' . addon_target . '.php', 'addons/' . addon_name . '/admin/' . addon_target . '.php', EVENT_REPLACE);
}
if (APP_AREA == 'customer') {
    // Add own controller to existing one using EVENT_POST or EVENT_PRE
    /* Place comment here with description of functionality provided by this additional controller */
    cw_set_controller(APP_AREA . '/index.php', 'addons/' . addon_name . '/customer/index.php', EVENT_POST);
}
// Event handlers
/* Place comment here with description of functionality provided by this event handler */
cw_event_listen('on_login', 'cw\\' . addon_name . '\\on_login');
// specify full function name for event handlers including namespace
// Cron handlers. See docs/core.cron.txt and core/cron/cron.php
cw_event_listen('on_cron_daily', 'cw\\' . addon_name . '\\on_cron_daily');
// Function hooks. Note you can use same function name under scope of addon's namespace
/* Place comment here with description of functionality provided by this hook or how it alters default function */
cw_set_hook('cw_products_in_cart', 'cw\\' . addon_name . '\\cw_products_in_cart', EVENT_POST);
// Hook templates
cw_addons_set_template(array('replace', 'admin/main/' . addon_target . '.tpl', 'addons/' . addon_name . '/admin/' . addon_target . '.tpl'), array('post', 'elements/bottom.tpl', 'addons/' . addon_name . '/customer/my_bottom.tpl'), array('pre', 'elements/bottom_admin.tpl@label', 'addons/' . addon_name . '/admin/my_bottom_admin.tpl'));
// Add addon CSS style
cw_addons_add_css('addons/' . addon_name . '/my_addon.css');
// Add addon JS
cw_addons_add_js('addons/' . addon_name . '/my_addon.js');
<?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'));
}
}
$smarty->assign('from_quote', !empty($cart['info']['quote_doc_id']) ? 1 : 0);
cw_save_customer_cart($customer_id, $cart);
if ($addons['recommended_products']) {
    $config['recommended_products']['number_of_recommends'] = 4;
    cw_include('addons/recommended_products/recommends.php');
}
if ($action == 'print') {
    $smarty->assign('home_style', 'popup');
}
$smarty->assign('current_section_dir', 'cart');
if (!in_array($mode, array('auth', 'checkout', 'order_message'))) {
    $mode = 'cart';
    $location[] = array(cw_get_langvar_by_name('lbl_cart'), '');
}
$smarty->assign('main', $mode);
if ($mode == 'checkout') {
    if ($action == 'simple_action') {
        cw_call('cw_checkout_show_cart', array('action' => $action));
    } elseif ($action == 'show_cart') {
        cw_call('cw_checkout_show_cart', array('action' => $action));
    } elseif ($action == 'update' && $is_ajax) {
        cw_func_call('cw_checkout_login');
    }
    //elseif ($is_ajax) return;
    $location[] = array(cw_get_langvar_by_name('lbl_checkout'), '');
    cw_addons_add_js('js/one_step_checkout.js');
    $smarty->assign('current_section_dir', 'checkout');
    $smarty->assign('main', 'index');
}
//cw_var_dump($cart);
<?php

// @TODO: remove second condition after ajax product_filter rework
if (APP_AREA == 'customer' && (!defined('IS_AJAX') && $target != 'image' || isset($ajax_filter) && $ajax_filter && defined('IS_AJAX') && $target != 'image')) {
    cw_include('addons/top_menu/func.php');
    cw_set_controller('customer/auth.php', 'addons/top_menu/cust.php', EVENT_POST);
    cw_addons_set_template(array('replace', 'customer/top_categories.tpl', 'addons/top_menu/menu.tpl'));
    cw_addons_add_js('jquery/jquery.ui.potato.menu.js');
    cw_addons_add_css('jquery/jquery.ui.potato.menu.css');
    cw_addons_add_css('menu.css');
    cw_addons_add_css('addons/top_menu/menu.css');
}
if (APP_AREA == 'admin' && $target == 'top_menu') {
    cw_include('addons/top_menu/func.php');
    cw_set_controller('admin/top_menu.php', 'addons/top_menu/admin/top_menu.php', EVENT_REPLACE);
    cw_addons_set_template(array('replace', 'admin/products/top_menu.tpl', 'addons/top_menu/admin_main.tpl'));
}
$tables['top_menu_user_categories'] = 'cw_top_menu_user_categories';
// TODO: register on_category_delete handler, otherwise cw_top_menu_user_categories will have orphaned links
<?php

namespace CW\Ajax_Add2Cart;

const addon_name = 'ajax_add2cart';
const addon_version = '0.2';
if (APP_AREA == 'customer' && !empty($addons[addon_name])) {
    cw_include('addons/ajax_add2cart/func.php');
    if ($target == 'cart') {
        cw_addons_set_controllers(array('post', 'customer/cart.php', 'addons/ajax_add2cart/minicart.php'));
        cw_event_listen('on_add_cart', 'CW\\Ajax_Add2Cart\\on_add_cart');
    }
    // Skin requirements:
    // add_to_cart.tpl is used for button
    // cw_form_submit is used for form submittion, no GET links supported
    if ($target != 'gifts') {
        cw_addons_set_template(array('replace', 'customer/menu/minicart.tpl', 'addons/ajax_add2cart/minicart.tpl'), array('pre', 'buttons/add_to_cart.tpl', 'addons/' . addon_name . '/add_to_cart.tpl', 'CW\\Ajax_Add2Cart\\cw_smarty_replace_href'), array('pre', 'buttons/buy_now.tpl', 'addons/' . addon_name . '/buy_now.tpl', 'CW\\Ajax_Add2Cart\\cw_smarty_replace_href'));
    }
    cw_addons_set_template(array('pre', 'customer/menu/microcart.tpl', 'addons/ajax_add2cart/microcart.tpl'));
    cw_addons_add_css('addons/ajax_add2cart/minicart.css');
    cw_addons_add_js('addons/ajax_add2cart/minicart.js');
    cw_set_controller('addons/mobile/init/mobile.php', 'addons/' . addon_name . '/addons/mobile.php', EVENT_POST);
}
<?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');