$cw_allowed_tunnels[] = 'cw\\addon_skeleton\\get_available_entries_list'; // 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_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; }
function cw_md_attributes_save($item_id, $item_type, $attributes, $language = null, $extra = array()) { # kornev, for the categories we need to distribute the params sometimes if ($item_type == 'C') { $cats[] = $item_id; # kornev, only domains should be updated $new_attributes = array('domains' => $attributes['domains']); // Disable this hook to avoid loop cw_unset_hook('cw_attributes_save', 'cw_md_attributes_save', EVENT_POST); if ($attributes['subcats_distribution']) { $subcats = cw_category_get_subcategory_ids($item_id); foreach ($subcats as $cat) { if ($cat != $item_id) { cw_call('cw_attributes_save', array('item_id' => $cat, 'item_type' => 'C', 'attributes' => $new_attributes, 'language' => $language)); $cats[] = $cat; } } } if ($attributes['subproducts_distribution']) { global $user_account, $current_area; list($products, $tmp) = cw_func_call('cw_product_search', array('data' => array('categories' => $cats, 'categories_orig' => $cats, 'user_account' => $user_account, 'current_area' => $current_area, 'info_type' => 0, 'flat_search' => 1, 'all' => 1))); if (is_array($products)) { foreach ($products as $product) { cw_call('cw_attributes_save', array('item_id' => $product['product_id'], 'item_type' => 'P', 'attributes' => $new_attributes, 'language' => $language)); } } } // Return hook back cw_set_hook('cw_attributes_save', 'cw_md_attributes_save', EVENT_POST); } return null; }
cw_set_hook('cw_aom_recalculate_totals', 'cw_ps_aom_recalculate_totals', EVENT_PRE); cw_set_hook('cw_aom_recalculate_totals', 'cw_ps_aom_recalculate_totals_extra', EVENT_POST); cw_addons_set_template(array('replace', 'customer/main/promosuite.tpl', 'addons/promotion_suite/customer/main.tpl'), array('post', 'customer/menu/special_product_links_inner.tpl', 'addons/promotion_suite/customer/menu/special_product_links.tpl'), array('pre', 'customer/products/subcategories.tpl', 'addons/promotion_suite/customer/products/subcategories.tpl')); cw_addons_set_template(array('replace', 'customer/cart/item_price.tpl', 'addons/promotion_suite/customer/cart/item_price.tpl', 'cw_is_product_free'), array('post', 'customer/cart/cart.tpl', 'addons/promotion_suite/customer/cart/cart_init.tpl')); cw_addons_set_template(array('post', 'main/docs/layout/bottom.tpl', 'addons/promotion_suite/main/coupon.tpl')); /* SERG cw_addons_set_hooks( array('pre', 'cw_cart_actions', 'cw_ps_cart_actions'), // // ATTENTION array('post', 'cw_cart_calc_single', 'cw_ps_cart_calc_single', 300)// this hook critically must be called after all standard hooks (e.g. shipping) //array('post', 'cw_cart_calc_discounts', 'cw_ps_cart_calc_discounts'), //array('post', 'cw_cart_calc', 'cw_ps_cart_calc') ); */ /* Hooks for free product bonus */ cw_set_hook('cw_products_in_cart', 'cw_ps_products_in_cart_pre', EVENT_PRE); //cw_set_hook('cw_products_in_cart', 'cw_ps_products_in_cart_post', EVENT_POST); cw_event_listen('on_product_from_scratch', 'cw_apply_special_offer_free'); /* Hooks for discount bonus */ // Function adds offer discounts applied to whole cart cw_event_listen('on_collect_discounts', 'cw_ps_on_collect_discounts'); // Function adds offer discounts applied to a product in cart cw_event_listen('on_product_from_scratch', 'cw_apply_special_offer_discount'); /* Hooks for coupon bonus */ cw_event_listen('on_place_order_extra', 'cw_ps_on_place_order_extra'); // CMS cw_event_listen('on_cms_check_restrictions', 'cw_ps_on_cms_check_restrictions_PS'); // cw_delete_from_cart // $product_id = cw_delete_from_cart($cart, $productindex); if (APP_AREA == 'admin') { cw_addons_set_controllers(array('replace', 'admin/promosuite.php', 'addons/promotion_suite/admin/promosuite.php'), array('replace', 'admin/discount_bundles.php', 'addons/promotion_suite/admin/discount_bundles.php'), array('post', 'include/auth.php', 'addons/promotion_suite/include/auth.php'));
<?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 $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 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');
<?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/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 cw_load('edit_on_place'); cw_set_hook('cw_can_edit_on_place', 'cw_can_edit_on_place_productcode', EVENT_POST); $cw_tokens =& cw_session_register('cw_tokens', array()); $token_data = $cw_tokens[$request_prepared['token']]; $error = null; if (empty($cw_tokens[$token])) { $error = error('Token is wrong'); } elseif (CURRENT_TIME - $cw_tokens[$token]['time'] > 60 * 30) { $error = error('Token expired. Please refresh the page.'); } elseif (empty($tables[$token_data['table']])) { $error = error("Token error. Table \"{$token_data['table']}\" is not defined"); } else { $errors = cw_call('cw_can_edit_on_place', array($token_data), array()); } if (!empty($token_data['pk'])) { $pk_fields = cw_query("SHOW KEYS FROM {$tables[$token_data['table']]} WHERE Key_name = 'PRIMARY'"); if (count($pk_fields) > 1) { $error = error('Token error. Primary key is specified, but table has multicolumn primary key. Use "where" instead'); } if (count($pk_fields) == 0) { $error = error('Token error. Primary key is specified, but table has no primary key. Use "where" instead'); } } if (is_error()) { cw_add_top_message(get_error_message(), 'E'); return $error; } $where = array(); if (!empty($token_data['pk'])) {
<?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 const vertical_response_addon_name = 'vertical_response'; const vertical_response_addon_version = '1.0'; const vertical_response_wsdl = "https://api.verticalresponse.com/wsdl/1.0/VRAPI.wsdl"; //location of the wsdl const vertical_response_ses_time = 10; // duration of session in minutes $tables['newsletter_products'] = 'cw_newsletter_products'; $tables['recurring_list_update'] = 'cw_recurring_list_update'; cw_include('addons/' . vertical_response_addon_name . '/include/func.vertical_response.php'); if (class_exists("SoapClient")) { cw_set_hook('cw\\news\\get_newslists_by_customer', 'cw_vertical_response_get_newslists_by_customer', EVENT_POST); cw_set_hook('cw\\news\\get_available_newslists', 'cw_vertical_response_get_newslists', EVENT_POST); cw_addons_set_controllers(array('post', 'admin/recurring_vr_list_update.php', 'addons/' . vertical_response_addon_name . '/admin/recurring_list_update.php')); cw_addons_set_template(array('post', 'admin/main/recurring_vr_list_update.tpl', 'addons/' . vertical_response_addon_name . '/admin/recurring_list_update.tpl')); cw_event_listen('on_profile_modify', 'cw_vertical_response_on_profile_modify'); cw_event_listen('on_cron_daily', 'cw_vertical_response_daily_list_update'); cw_event_listen('on_cron_hourly', 'cw_vertical_response_emails_update'); if (APP_AREA == 'admin') { cw_addons_set_controllers(array('replace', 'admin/news.php', 'addons/' . vertical_response_addon_name . '/admin/news.php')); cw_addons_set_template(array('replace', 'admin/news/news.tpl', 'addons/' . vertical_response_addon_name . '/admin/news.tpl'), array('replace', 'admin/news/management.tpl', 'addons/' . vertical_response_addon_name . '/admin/management.tpl'), array('replace', 'admin/news/details.tpl', 'addons/' . vertical_response_addon_name . '/admin/details.tpl'), array('replace', 'admin/news/subscribers.tpl', 'addons/' . vertical_response_addon_name . '/admin/subscribers.tpl'), array('replace', 'admin/news/message.tpl', 'addons/' . vertical_response_addon_name . '/admin/message.tpl')); } }
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 cw_set_controller(APP_AREA.'/index.php','addons/'.addon_name.'/customer/index.php', EVENT_POST); } */ cw_set_controller('include/products/modify.php', 'addons/' . addon_name . '/admin/product.php', EVENT_PRE); cw_set_controller('customer/product.php', 'addons/' . addon_name . '/customer/product.php', EVENT_PRE); /* // Event handlers cw_event_listen('on_login','cw\\'.addon_name.'\\on_login'); // specify full function name for event handlers including namespace */ // Function hooks cw_set_hook('cw_delete_product', 'cw\\' . addon_name . '\\cw_delete_product', EVENT_POST); cw_set_hook('cw_product_clone', 'cw\\' . addon_name . '\\cw_product_clone', EVENT_POST); cw_addons_set_hooks(array('post', 'cw_tabs_js_abstract', 'cw\\' . addon_name . '\\cw_tabs_js_abstract')); /* // 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', '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 define('CHECK_UNIQ_ID', true); // Check or not the uniqueness of gift certificate ID $tables['wishlist'] = 'cw_wishlist'; $tables['giftreg_events'] = 'cw_giftreg_events'; $tables['giftreg_maillist'] = 'cw_giftreg_maillist'; $tables['giftreg_guestbooks'] = 'cw_giftreg_guestbooks'; cw_include('addons/estore_gift/include/func.gift.php'); cw_addons_set_controllers(array('replace', 'admin/giftcerts.php', 'addons/estore_gift/admin/giftcerts.php'), array('replace', 'customer/gifts.php', 'addons/estore_gift/customer/gifts.php'), array('pre', 'customer/cart.php', 'addons/estore_gift/customer/cart.php')); cw_addons_set_template(array('post', 'customer/cart/content.tpl', 'addons/estore_gift/content.tpl')); cw_addons_set_hooks(array('post', 'cw_payment_get_methods', 'cw_gift_payment_get_methods'), array('post', 'cw_payment_run_processor', 'cw_gift_payment_run_processor')); cw_set_hook('cw_delete_product', 'cw_gift_delete_product', EVENT_POST); cw_set_hook('cw_doc_update_item', 'cw_gift_doc_update_item', EVENT_PRE); cw_set_hook('cw_doc_update', 'cw_gift_doc_update', EVENT_POST); if (APP_AREA == 'customer') { cw_event_listen('on_cart_menu_build', 'cw_gift_get_menu_list'); cw_event_listen('on_login', 'cw_gift_on_login'); } if (APP_AREA == 'admin') { cw_set_controller('admin/giftcert_user_data.php', 'addons/estore_gift/admin/giftcert_user_data.php', EVENT_REPLACE); }
<?php const seller_addon_name = 'seller'; const seller_area_letter = 'V'; $cw_allowed_tunnels[] = 'cw_seller_get_info'; cw_include('addons/' . seller_addon_name . '/include/func.seller.php'); cw_set_hook('cw_product_update_status', 'cw_seller_product_update_status', EVENT_PRE); // Replace warehouse_id to seller customer id cw_addons_set_hooks(array('post', 'cw_cart_summarize', 'cw_seller_cart_summarize')); if (APP_AREA == 'customer') { cw_addons_set_controllers(array('pre', APP_AREA . '/search.php', 'addons/' . seller_addon_name . '/core/search.php')); cw_event_listen('on_build_order_hash', 'cw_seller_on_build_order_hash'); cw_addons_set_hooks(array('post', 'cw_doc_place_order', 'cw_seller_doc_place_order'), array('post', 'cw_product_get', 'cw_seller_product_get')); cw_addons_set_template(array('pre', 'customer/products/additional_data.tpl', 'addons/' . seller_addon_name . '/products/seller_owner.tpl'), array('pre', 'customer/products/search.tpl', 'addons/' . seller_addon_name . '/products/seller_section.tpl')); } if (APP_AREA == 'admin') { cw_set_controller(APP_AREA . '/user_V.php', 'addons/' . seller_addon_name . '/core/user_V.php', EVENT_REPLACE); cw_addons_set_hooks(array('post', 'cw_product_get', 'cw_seller_product_get')); cw_addons_set_template(array('pre', 'main/products/product/details.tpl', 'addons/' . seller_addon_name . '/products/seller.tpl')); } if (APP_AREA == 'seller') { /* Map controllers from seller area to their real location under addons/seller/core */ 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;
/* * 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')); }
function cw_addons_set_hooks() { global $ars_hooks, $_current_hook_order; $params = func_get_args(); if (is_array($params)) { foreach ($params as $v) { $index = $_current_hook_order; while (isset($ars_hooks['func'][$v[1]][$v[0]][$index])) { $index++; } $ars_hooks['func'][$v[1]][$v[0]][$index] = $v[2]; // Duplicate hook for new notation so it can be also called thru cw_call() $type = $v[0] == 'replace' ? EVENT_REPLACE : ($v[0] == 'pre' ? EVENT_PRE : EVENT_POST); cw_set_hook($v[1], $v[2], $type); } } }
<?php cw_include('addons/paypal_pro_payflow/include/func.paypal_pro_payflow.php'); cw_addons_set_hooks(array('post', 'cw_payment_get_methods', 'cw_payment_paypalpro_payflow_get_methods'), array('post', 'cw_payment_run_processor', 'cw_payment_paypalpro_payflow_run_processor')); cw_addons_set_template(array('post', 'main/docs/notes.tpl@doc_process_other', 'addons/paypal_pro_payflow/admin/doc_process_data.tpl')); cw_set_hook('cw_payment_do_capture', 'cw_paypal_pro_payflow_do_capture', EVENT_POST); cw_set_hook('cw_payment_do_void', 'cw_paypal_pro_payflow_do_void', EVENT_POST);
cw_include('include/check_useraccount.php'); cw_include('init/lng.php'); cw_include('include/settings.php'); if ($target != 'ajax') { cw_include('include/area_sections.php'); $smarty->assign('current_target', $target); cw_load('tabs'); $current_sections = cw_tabs_get_section('A'); /* print_r($current_sections); foreach($current_sections as $index => $v) cw_array2insert('navigation_menu', array( 'title' => $v['title'], 'link' => $v['link'], 'area' => 'G', 'orderby' => $index * 10, 'access_level' => $v['access_level'], 'addon' => $v['addon'], )); die; $smarty->assign('current_sections', $current_sections); */ } $location = array(); $location[] = array(cw_get_langvar_by_name('lbl_area_admin', null, false, true), 'index.php'); cw_set_hook('cw_auth_security', 'cw_auth_updates', EVENT_PRE); cw_call('cw_auth_security'); cw_event_listen('on_login', 'cw_on_login_license'); cw_event_listen('on_login', 'cw_on_login_crontab'); //logging code cw_include('include/logging_data.php');
<?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: 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 namespace CW\Ajax_Add2Cart; // Remove bookmark for mobile skin if ($mobile_select_type == 1) { function disable_popup() { global $ajax_blocks; cw_ajax_remove_block('add2cart_popup'); cw_ajax_remove_block('add2cart_popup_script'); } cw_set_hook('CW\\Ajax_Add2Cart\\on_add_cart', 'CW\\Ajax_Add2Cart\\disable_popup', EVENT_POST); }
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);