Ejemplo n.º 1
0
<?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_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);
Ejemplo n.º 3
0
<?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');
}
Ejemplo n.º 4
0
<?php

/*
 * Vendor: CW
 * addon: Facebook auth/login
 */
const fbauth_addon_name = 'fbauth';
const fbauth_addon_target = 'fb_auth';
const fbauth_addon_version = '0.1';
if (!empty($addons[fbauth_addon_name]) && APP_AREA == 'customer') {
    cw_include('addons/' . fbauth_addon_name . '/include/func.fbauth.php');
    cw_event_listen('on_logout', 'cw_fbauth_user_logout');
    cw_addons_set_controllers(array('replace', 'customer/fb_auth.php', 'addons/' . fbauth_addon_name . '/customer/fb_auth.php'), array('replace', 'customer/fb_auth_get_email.php', 'addons/' . fbauth_addon_name . '/customer/fb_auth_get_email.php'));
    cw_addons_set_template(array('post', 'buttons/social_media_panel.tpl', 'addons/' . fbauth_addon_name . '/customer/auth-button.tpl'), array('pre', 'customer/head.tpl', 'addons/' . fbauth_addon_name . '/customer/init.tpl'), array('replace', 'customer/main/fb_auth_get_email.tpl', 'addons/' . fbauth_addon_name . '/customer/email_request.tpl'));
}
<?php

cw_event_listen('on_build_cart_product_hash', 'cw_cart_on_build_cart_product_hash');
# Get the customer's zone
function cw_cart_get_zone_ship($params)
{
    global $tables;
    extract($params);
    $zones = cw_call('cw_cart_get_zones', array('address' => $address, 'is_shipping' => 1));
    $zone = 0;
    # default zone
    if (is_array($zones)) {
        $tmp = cw_query_column("SELECT zone_id FROM {$tables['shipping_rates']} WHERE zone_id IN ('" . implode("','", array_keys($zones)) . "') and type='{$type}' group by zone_id");
        if (is_array($tmp) && !empty($tmp)) {
            $unused = $zones;
            # remove not available zones
            foreach ($tmp as $v) {
                if (isset($unused[intval($v)])) {
                    unset($unused[intval($v)]);
                }
            }
            if (!empty($unused)) {
                foreach ($unused as $k => $v) {
                    unset($zones[$k]);
                }
            }
            reset($zones);
            $zone = key($zones);
        }
    }
    return $zone;
Ejemplo n.º 6
0
// 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'));
Ejemplo n.º 7
0
<?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');
Ejemplo n.º 8
0
// for test purposes. create content section with 'test' servicecode. set false on production site
define('CS_TEST_TEMPLATE', 'customer/menu/menu_sections.tpl');
// where to place the test content section
$tables['cms'] = 'cw_cms';
$tables['cms_alt_languages'] = 'cw_cms_alt_languages';
$tables['cms_categories'] = 'cw_cms_categories';
$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'));
Ejemplo n.º 9
0
<?php

/*
 * Vendor: cw
 * addon: mslive_login
 */
/*
 * init.php
 * this file only defines constants, variables, functinos, hooks and event hanlers
 * no real routine must be here on init stage
 */
// Use namespace for your own addon as vendor\addon_name
//namespace cw\mslive_login;
// Constants definition
// these constants are defined in scope of addon's namespace
//const addon_name    = 'mslive_login';
// Include functions
cw_include('addons/mslive_login/include/func.php');
if (APP_AREA == 'customer') {
    cw_set_controller('include/check_useraccount.php', 'addons/mslive_login/post_init.php', EVENT_POST);
    cw_set_controller(APP_AREA . '/mslive_login.php', 'addons/mslive_login/customer/mslive_login.php', EVENT_REPLACE);
    cw_event_listen('on_logout', 'cw_mslive_on_logout');
    cw_addons_set_template(array('post', 'buttons/social_media_panel.tpl', 'addons/mslive_login/customer/auth-button.tpl'));
}
Ejemplo n.º 10
0
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'));
    cw_set_controller('include/products/modify.php', 'addons/promotion_suite/admin/product_modify.php', EVENT_PRE);
    cw_addons_set_hooks(array('post', 'cw_tabs_js_abstract', 'cw_ps_tabs_js_abstract'));
    cw_addons_set_template(array('replace', 'admin/main/promosuite.tpl', 'addons/promotion_suite/admin/main.tpl'), array('replace', 'admin/main/discount_bundles.tpl', 'addons/promotion_suite/admin/discount_bundles.tpl'));
    if ($target == 'cms') {
        cw_addons_set_template(array('pre', 'main/attributes/object_modify.tpl', 'addons/promotion_suite/addons/cms/cms_details.tpl'));
        cw_event_listen('on_cms_update', 'cw_ps_on_cms_update');
        cw_set_controller('addons/cms/cs_banner.php', 'addons/promotion_suite/addons/cms/cs_banner.php', EVENT_POST);
        cw_set_controller('addons/cms/cs_banners.php', 'addons/promotion_suite/addons/cms/cs_banner.php', EVENT_POST);
    }
    cw_addons_add_css('addons/promotion_suite/admin/promosuite.css');
}
if (APP_AREA == 'customer') {
    cw_addons_add_css('addons/promotion_suite/customer/promosuite.css');
    cw_addons_set_hooks(array('post', 'cw_tabs_js_abstract', 'cw_ps_tabs_js_abstract'));
}
/* PS tables */
$_addon_tables = array('ps_offers', 'ps_conditions', 'ps_bonuses', 'ps_offer_images', 'ps_bonus_details', 'ps_cond_details');
foreach ($_addon_tables as $_table) {
    $tables[$_table] = 'cw_' . $_table;
}
Ejemplo n.º 11
0
<?php

/*
 * Vendor: cw
 * addon: linkedin_login
 */
/*
 * init.php
 * this file only defines constants, variables, functinos, hooks and event hanlers
 * no real routine must be here on init stage
 */
// Use namespace for your own addon as vendor\addon_name
//namespace cw\linkedin_login;
// Constants definition
// these constants are defined in scope of addon's namespace
//const addon_name    = 'linkedin_login';
// Include functions
cw_include('addons/linkedin_login/include/func.php');
if (APP_AREA == 'customer') {
    cw_set_controller('include/check_useraccount.php', 'addons/linkedin_login/post_init.php', EVENT_POST);
    cw_set_controller(APP_AREA . '/login_with_linkedin.php', 'addons/linkedin_login/customer/login_with_linkedin.php', EVENT_REPLACE);
    cw_event_listen('on_logout', 'cw_linkedin_on_logout');
    cw_addons_set_template(array('post', 'buttons/social_media_panel.tpl', 'addons/linkedin_login/customer/auth-button.tpl'));
}
Ejemplo n.º 12
0
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');
Ejemplo n.º 13
0
<?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;
Ejemplo n.º 14
0
<?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');
Ejemplo n.º 15
0
<?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);
Ejemplo n.º 16
0
<?php

cw_include('addons/image_verification/include/cw.image_verification.php');
cw_addons_set_controllers(array('post', 'init/abstract.php', 'addons/image_verification/init/image_verification.php'), array('post', 'customer/acc_manager.php', 'addons/image_verification/antibot_err_display.php'));
cw_event_listen('on_register_validate', 'cw_image_verification_on_register_validate');
Ejemplo n.º 17
0
<?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

// Register listener depending on settings
if (!empty($config['google_base']['gb_cron_period'])) {
    cw_event_listen('on_cron_' . $config['google_base']['gb_cron_period'], 'cw_google_base_cron');
}
Ejemplo n.º 19
0
<?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');
Ejemplo n.º 20
0
$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');
Ejemplo n.º 21
0
<?php

# kornev
# $params['time'] (01:30)
# $params['hour']
# $params['minute']
# $params['manual_run'] - special target to run
cw_event_listen('on_cron_daily', 'cw_cron_invoice_check_params');
cw_event_listen('on_cron_hourly', 'cw_cron_sessions_delete');
cw_event_listen('on_cron_monthly', 'cw_cron_doc_delete_temp');
cw_event_listen('on_cron_biweekly', 'cw_cron_optimize_table');
// TODO: Rework the single left old-fashioned cron task from included file to new event handler function
function cw_cron_get_targets($params, $return)
{
    extract($params);
    if (!is_array($return)) {
        $return = array();
    }
    $return[] = 'mail_spool';
    return $return;
}
/**
 * Optimize table, try to analyze for InnoDB
 * 
 * @return array of strings with mysql replies
 */
function cw_cron_optimize_table($time, $prev_time)
{
    $return = array();
    $tbls = cw_query_column("SHOW TABLES");
    foreach ($tbls as $t) {
Ejemplo n.º 22
0
<?php

/*
 * Vendor: cw
 * addon: googleplus_login
 */
/*
 * init.php
 * this file only defines constants, variables, functinos, hooks and event hanlers
 * no real routine must be here on init stage
 */
// Use namespace for your own addon as vendor\addon_name
//namespace cw\googleplus_login;
// Constants definition
// these constants are defined in scope of addon's namespace
//const addon_name    = 'googleplus_login';
// Include functions
cw_include('addons/googleplus_login/include/func.php');
/*
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);
}
*/
if (APP_AREA == 'customer') {
    // Sometimes some part of initialization must be after all addons init - in post_init.php
    cw_set_controller('include/check_useraccount.php', 'addons/googleplus_login/post_init.php', EVENT_POST);
    cw_event_listen('on_logout', 'cw_googleplus_on_logout');
    cw_addons_set_template(array('post', 'buttons/social_media_panel.tpl', 'addons/googleplus_login/customer/auth-button.tpl'));
}
Ejemplo n.º 23
0
<?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');
Ejemplo n.º 24
0
function cw_set_hook($hook, $callback, $type = EVENT_POST)
{
    cw_event_listen($hook, $callback, $type);
}
{
    return getField($id, 'avail') > 0;
}
/* =================================
 * Product\Category
 *
 * =================================
 */
namespace Product\Category;

/* ---------------------------------
 * Events handlers
 * ---------------------------------
 */
cw_event_listen('on_product_delete', '\\Product\\Category\\on_product_delete');
cw_event_listen('on_category_delete', '\\Product\\Category\\on_category_delete');
function on_product_delete($product_id)
{
    cw_call('Product\\Category\\delete', array($product_id, null));
}
function on_category_delete($category_id)
{
    cw_call('Product\\Category\\delete', array(null, $category_id));
}
/* ---------------------------------
 * Interface
 * ---------------------------------
 */
function add($product_id, $category_id, $main = true)
{
    // TODO: Implement
Ejemplo n.º 26
0
<?php

/*
 * Vendor: cw
 * addon: instagram_login
 */
/*
 * init.php
 * this file only defines constants, variables, functinos, hooks and event hanlers
 * no real routine must be here on init stage
 */
// Use namespace for your own addon as vendor\addon_name
//namespace cw\instagram_login;
// Constants definition
// these constants are defined in scope of addon's namespace
//const addon_name    = 'instagram_login';
// Include functions
cw_include('addons/instagram_login/include/func.php');
if (APP_AREA == 'customer') {
    cw_set_controller('include/check_useraccount.php', 'addons/instagram_login/post_init.php', EVENT_POST);
    cw_event_listen('on_logout', 'cw_instagram_on_logout');
    cw_addons_set_template(array('post', 'buttons/social_media_panel.tpl', 'addons/instagram_login/customer/auth-button.tpl'));
}
<?php

// Register listener depending on settings
if (!empty($config['sitemap_xml']['sm_cron_period'])) {
    cw_event_listen('on_cron_' . $config['sitemap_xml']['sm_cron_period'], 'cw_sitemap_cron');
}
Ejemplo n.º 28
0
<?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');
Ejemplo n.º 29
0
<?php

/*
 * Vendor: cw
 * addon: twitter_login
 */
/*
 * init.php
 * this file only defines constants, variables, functinos, hooks and event hanlers
 * no real routine must be here on init stage
 */
// Use namespace for your own addon as vendor\addon_name
//namespace cw\twitter_login;
// Constants definition
// these constants are defined in scope of addon's namespace
//const addon_name    = 'twitter_login';
// Include functions
cw_include('addons/twitter_login/include/func.php');
if (APP_AREA == 'customer') {
    cw_set_controller('include/check_useraccount.php', 'addons/twitter_login/post_init.php', EVENT_POST);
    cw_set_controller(APP_AREA . '/twitter_login_verified.php', 'addons/twitter_login/customer/twitter_login_verified.php', EVENT_REPLACE);
    cw_event_listen('on_logout', 'cw_twitter_on_logout');
    cw_addons_set_template(array('post', 'buttons/social_media_panel.tpl', 'addons/twitter_login/customer/auth-button.tpl'));
}
Ejemplo n.º 30
0
<?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');