function fn_delete_company($company_id)
{
    if (empty($company_id)) {
        return false;
    }
    if (fn_allowed_for('MULTIVENDOR')) {
        // Do not delete vendor if there're any orders associated with this company
        if (db_get_field("SELECT COUNT(*) FROM ?:orders WHERE company_id = ?i", $company_id)) {
            fn_set_notification('W', __('warning'), __('unable_delete_vendor_orders_exists'), '', 'company_has_orders');
            return false;
        }
    }
    fn_set_hook('delete_company_pre', $company_id);
    $result = db_query("DELETE FROM ?:companies WHERE company_id = ?i", $company_id);
    // deleting categories
    $cat_ids = db_get_fields("SELECT category_id FROM ?:categories WHERE company_id = ?i", $company_id);
    foreach ($cat_ids as $cat_id) {
        fn_delete_category($cat_id, false);
    }
    // deleting products
    $product_ids = db_get_fields("SELECT product_id FROM ?:products WHERE company_id = ?i", $company_id);
    foreach ($product_ids as $product_id) {
        fn_delete_product($product_id);
    }
    // deleting shipping
    $shipping_ids = db_get_fields("SELECT shipping_id FROM ?:shippings WHERE company_id = ?i", $company_id);
    foreach ($shipping_ids as $shipping_id) {
        fn_delete_shipping($shipping_id);
    }
    if (fn_allowed_for('ULTIMATE')) {
        // deleting layouts
        $layouts = Layout::instance($company_id)->getList();
        foreach ($layouts as $layout_id => $layout) {
            Layout::instance($company_id)->delete($layout_id);
        }
    }
    $blocks = Block::instance($company_id)->getAllUnique();
    foreach ($blocks as $block) {
        Block::instance($company_id)->remove($block['block_id']);
    }
    $product_tabs = ProductTabs::instance($company_id)->getList();
    foreach ($product_tabs as $product_tab) {
        ProductTabs::instance($company_id)->delete($product_tab['tab_id'], true);
    }
    $_menus = Menu::getList(db_quote(" AND company_id = ?i", $company_id));
    foreach ($_menus as $menu) {
        Menu::delete($menu['menu_id']);
    }
    db_query("DELETE FROM ?:company_descriptions WHERE company_id = ?i", $company_id);
    // deleting product_options
    $option_ids = db_get_fields("SELECT option_id FROM ?:product_options WHERE company_id = ?i", $company_id);
    foreach ($option_ids as $option_id) {
        fn_delete_product_option($option_id);
    }
    // deleting company admins and users
    if (Registry::get('settings.Stores.share_users') != 'Y') {
        $users_condition = db_quote(' OR company_id = ?i', $company_id);
    } else {
        $users_condition = '';
        // Unassign users from deleted company
        db_query('UPDATE ?:users SET company_id = 0 WHERE company_id = ?i', $company_id);
    }
    $user_ids = db_get_fields("SELECT user_id FROM ?:users WHERE company_id = ?i AND user_type = ?s ?p", $company_id, 'V', $users_condition);
    foreach ($user_ids as $user_id) {
        fn_delete_user($user_id);
    }
    // deleting pages
    $page_ids = db_get_fields("SELECT page_id FROM ?:pages WHERE company_id = ?i", $company_id);
    foreach ($page_ids as $page_id) {
        fn_delete_page($page_id);
    }
    // deleting promotions
    $promotion_ids = db_get_fields("SELECT promotion_id FROM ?:promotions WHERE company_id = ?i", $company_id);
    fn_delete_promotions($promotion_ids);
    // deleting features
    $feature_ids = db_get_fields("SELECT feature_id FROM ?:product_features WHERE company_id = ?i", $company_id);
    foreach ($feature_ids as $feature_id) {
        fn_delete_feature($feature_id);
    }
    // deleting logos
    $types = fn_get_logo_types();
    foreach ($types as $type => $data) {
        fn_delete_logo($type, $company_id);
    }
    $payment_ids = db_get_fields('SELECT payment_id FROM ?:payments WHERE company_id = ?i', $company_id);
    foreach ($payment_ids as $payment_id) {
        fn_delete_payment($payment_id);
    }
    // Delete sitemap sections and links
    $params = array('company_id' => $company_id);
    $section_ids = fn_get_sitemap_sections($params);
    fn_delete_sitemap_sections(array_keys($section_ids));
    fn_set_hook('delete_company', $company_id, $result);
    return $result;
}
Esempio n. 2
0
function fn_twg_get_product_tabs($params)
{
    $allowed_page_types = array('T', 'L', 'F');
    $allowed_templates = array('blocks/product_tabs/features.tpl', 'blocks/product_tabs/description.tpl');
    $allowed_block_types = array('html_block', 'pages', 'products', 'categories', 'banners');
    $tabs = ProductTabs::instance()->getList('', $params['product_id'], $params['descr_sl']);
    foreach ($tabs as $k => $tab) {
        $isAllowedType = $tab['tab_type'] == 'B';
        $isAllowedType = ($isAllowedType or $tab['tab_type'] == 'T' and in_array($tab['template'], $allowed_templates));
        if (empty($params['all_tabs']) && $tab['status'] != 'A' || !$isAllowedType) {
            unset($tabs[$k]);
            continue;
        }
        if ($tab['tab_type'] == 'B') {
            $block = TwigmoBlock::getBlock(array('block_id' => $tab['block_id'], 'area' => 'C'));
            if (empty($block['type']) || !in_array($block['type'], $allowed_block_types)) {
                unset($tabs[$k]);
                continue;
            }
            $block_scheme = SchemesManager::getBlockScheme($block['type'], array());
            if ($block['type'] == 'html_block') {
                $tabs[$k]['html'] = $block['content']['content'];
            } elseif (!empty($block_scheme['content']) && !empty($block_scheme['content']['items'])) {
                // Products and categories: get items
                $template_variable = 'items';
                $field = $block_scheme['content']['items'];
                $items = RenderManager::getValue($template_variable, $field, $block_scheme, $block);
                // Filter pages - only texts, links and forms posible
                if ($block['type'] == 'pages') {
                    foreach ($items as $item_id => $item) {
                        if (!in_array($item['page_type'], $allowed_page_types)) {
                            unset($items[$item_id]);
                        }
                    }
                }
                if (fn_is_empty($items)) {
                    unset($tabs[$k]);
                    continue;
                }
                $block_data = array('total_items' => count($items));
                // Images
                $image_params = TwigmoSettings::get('images.cart');
                if ($block['type'] == 'products' or $block['type'] == 'categories') {
                    $object_type = $block['type'] == 'products' ? 'product' : 'category';
                    foreach ($items as $items_id => $item) {
                        $main_pair = fn_get_image_pairs($item[$object_type . '_id'], $object_type, 'M', true, true);
                        if (!empty($main_pair)) {
                            $items[$items_id]['icon'] = TwigmoImage::getApiImageData($main_pair, $object_type, 'icon', $image_params);
                        }
                    }
                }
                // Banners properties
                if ($block['type'] == 'banners') {
                    $rotation = $block['properties']['template'] == 'addons/banners/blocks/carousel.tpl' ? 'Y' : 'N';
                    $block_data['delay'] = $rotation == 'Y' ? $block['properties']['delay'] : 0;
                    $object_type = 'banner';
                }
                $block_data[$block['type']] = Api::getAsList($block['type'], $items);
                $tabs[$k] = array_merge($tab, $block_data);
            }
        } else {
            if ($tab['template'] == 'blocks/product_tabs/features.tpl') {
                $tabs[$k]['type'] = 'features';
            }
            if ($tab['template'] == 'blocks/product_tabs/description.tpl') {
                $tabs[$k]['type'] = 'description';
            }
        }
    }
    return array_values($tabs);
    // reindex
}
Esempio n. 3
0
/**
 * Updates addon status
 * @param string $addon Addon to update status for
 * @param string $status Status to change to
 * @param bool $show_notification Display notification if set to true
 * @param bool $on_install If status was changed on after ionstall process
 * @return bool|string True on success, old status ID if status was not changed
 */
function fn_update_addon_status($addon, $status, $show_notification = true, $on_install = false)
{
    $old_status = db_get_field("SELECT status FROM ?:addons WHERE addon = ?s", $addon);
    $new_status = $status;
    $scheme = SchemesManager::getScheme($addon);
    // Unmanaged addons can be enabled/disabled via console only
    if ($scheme->getUnmanaged() && !defined('CONSOLE')) {
        return false;
    }
    if ($old_status != $new_status) {
        // Check if addon can be enabled
        $conflicts = db_get_fields("SELECT addon FROM ?:addons WHERE status = 'A' AND FIND_IN_SET(?s, conflicts)", $addon);
        if ($new_status == 'A' && !empty($conflicts)) {
            $scheme = SchemesManager::getScheme($addon);
            fn_set_notification('W', __('warning'), __('text_addon_cannot_enable', array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName())));
            return $old_status;
        }
        fn_get_schema('settings', 'actions.functions', 'php', true);
        $func = 'fn_settings_actions_addons_' . $addon;
        if (function_exists($func)) {
            $func($new_status, $old_status, $on_install);
        }
        // If status change is allowed, update it
        if ($old_status != $new_status) {
            if ($new_status != 'D') {
                // Check that addon have conflicts
                $scheme = SchemesManager::getScheme($addon);
                $conflicts = db_get_field("SELECT conflicts FROM ?:addons WHERE addon = ?s", $addon);
                if (!empty($conflicts)) {
                    $conflicts = explode(',', $conflicts);
                    $lang_var = 'text_addon_confclicts_on_install';
                    if (!$on_install) {
                        foreach ($conflicts as $conflict) {
                            fn_disable_addon($conflict, $scheme->getName(), $show_notification);
                        }
                        $lang_var = 'text_addon_confclicts';
                    }
                    fn_set_notification('W', __('warning'), __($lang_var, array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName())));
                    // On install we cannot enable addon with conflicts automaticly
                    if ($on_install) {
                        return $old_status;
                    }
                }
            }
            db_query("UPDATE ?:addons SET status = ?s WHERE addon = ?s", $status, $addon);
            $func = 'fn_settings_actions_addons_post_' . $addon;
            if (function_exists($func)) {
                $func($status);
            }
            if ($show_notification == true) {
                fn_set_notification('N', __('notice'), __('status_changed'));
            }
            // Enable/disable tabs for addon
            ProductTabs::instance()->updateAddonTabStatus($addon, $new_status);
            Registry::set('addons.' . $addon . '.status', $status);
        } else {
            return $old_status;
        }
    }
    // Clean cache
    fn_clear_cache();
    if ($status == 'A') {
        foreach (fn_get_installed_themes() as $theme_name) {
            $theme = Themes::factory($theme_name);
            $theme_manifest = $theme->getManifest();
            // Precompile addon LESS files if the theme has been converted to CSS
            if (!empty($theme_manifest['converted_to_css']) && !$theme->convertAddonToCss($addon)) {
                fn_update_addon_status($addon, 'D', $show_notification, $on_install);
                return $old_status;
            }
        }
    }
    return true;
}
Esempio n. 4
0
        $tab = current($tab);
        if (!empty($_REQUEST['dynamic_object']['object_id']) && $_REQUEST['dynamic_object']['object_id'] > 0) {
            // If it's status update for dynamic object
            $object_ids = explode(',', $tab['product_ids']);
            $key = array_search($_REQUEST['dynamic_object']['object_id'], $object_ids);
            if ($_REQUEST['status'] == $tab['status'] && isset($object_ids[$key])) {
                unset($object_ids[$key]);
            } elseif ($_REQUEST['status'] != $tab['status']) {
                $object_ids[] = $_REQUEST['dynamic_object']['object_id'];
            }
            foreach ($object_ids as $k => $v) {
                if (empty($v)) {
                    unset($object_ids[$k]);
                }
            }
            ProductTabs::instance()->update(array('tab_id' => $_REQUEST['id'], 'product_ids' => implode(',', $object_ids)));
            $result = true;
        } else {
            // If it's simple status update just do it
            ProductTabs::instance()->update(array('tab_id' => $_REQUEST['id'], 'status' => $_REQUEST['status'], 'product_ids' => ''));
            $result = true;
        }
        if ($result) {
            fn_set_notification('N', __('notice'), __('status_changed'));
        } else {
            fn_set_notification('E', __('error'), __('error_status_not_changed'));
            Registry::get('ajax')->assign('return_status', $tab['status']);
        }
    }
    exit;
}
Esempio n. 5
0
 //  echo "shipping estimation for the products is ".date('Y m d',$ls_individual_estimation);
 Registry::get('view')->assign('ls_shipping_estimation_date', $ls_individual_estimation);
 Registry::get('view')->assign('ls_inventory_amount', $product['inventory_amount']);
 Registry::get('view')->assign('ls_amount', $product['amount']);
 Registry::get('view')->assign('product', $product);
 // If page title for this product is exist than assign it to template
 if (!empty($product['page_title'])) {
     Registry::get('view')->assign('page_title', $product['page_title']);
 }
 $params = array('product_id' => $_REQUEST['product_id'], 'preview_check' => true);
 list($files) = fn_get_product_files($params);
 if (!empty($files)) {
     Registry::get('view')->assign('files', $files);
 }
 /* [Product tabs] */
 $tabs = ProductTabs::instance()->getList('', $product['product_id'], DESCR_SL);
 foreach ($tabs as $tab_id => $tab) {
     if ($tab['status'] == 'D') {
         continue;
     }
     if (!empty($tab['template'])) {
         $tabs[$tab_id]['html_id'] = fn_basename($tab['template'], ".tpl");
     } else {
         $tabs[$tab_id]['html_id'] = 'product_tab_' . $tab_id;
     }
     if ($tab['show_in_popup'] != "Y") {
         Registry::set('navigation.tabs.' . $tabs[$tab_id]['html_id'], array('title' => $tab['name'], 'js' => true));
     }
 }
 Registry::get('view')->assign('tabs', $tabs);
 /* [/Product tabs] */
Esempio n. 6
0
 public static function installAddonsTabs()
 {
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $addons = db_get_array("SELECT addon, status FROM ?:addons");
     if (fn_allowed_for('ULTIMATE')) {
         $companies = fn_get_all_companies_ids(true);
         foreach ($addons as $addon) {
             ProductTabs::instance()->deleteAddonTabs($addon['addon']);
             foreach ($companies as $company) {
                 ProductTabs::instance($company)->createAddonTabs($addon['addon']);
             }
             ProductTabs::instance()->updateAddonTabStatus($addon['addon'], $addon['status']);
         }
     } else {
         foreach ($addons as $addon) {
             ProductTabs::instance()->deleteAddonTabs($addon['addon']);
             ProductTabs::instance()->createAddonTabs($addon['addon']);
             ProductTabs::instance()->updateAddonTabStatus($addon['addon'], $addon['status']);
         }
     }
     return true;
 }
Esempio n. 7
0
function fn_clone_product($product_id)
{
    /**
     * Adds additional actions before product cloning
     *
     * @param int $product_id Original product identifier
     */
    fn_set_hook('clone_product_pre', $product_id);
    // Clone main data
    $data = db_get_row("SELECT * FROM ?:products WHERE product_id = ?i", $product_id);
    unset($data['product_id']);
    $data['status'] = 'D';
    $data['timestamp'] = $data['updated_timestamp'] = time();
    $pid = db_query("INSERT INTO ?:products ?e", $data);
    // Clone descriptions
    $data = db_get_array("SELECT * FROM ?:product_descriptions WHERE product_id = ?i", $product_id);
    foreach ($data as $v) {
        $v['product_id'] = $pid;
        if ($v['lang_code'] == CART_LANGUAGE) {
            $orig_name = $v['product'];
            $new_name = $v['product'] . ' [CLONE]';
        }
        $v['product'] .= ' [CLONE]';
        db_query("INSERT INTO ?:product_descriptions ?e", $v);
    }
    // Clone prices
    $data = db_get_array("SELECT * FROM ?:product_prices WHERE product_id = ?i", $product_id);
    foreach ($data as $v) {
        $v['product_id'] = $pid;
        unset($v['price_id']);
        db_query("INSERT INTO ?:product_prices ?e", $v);
    }
    // Clone categories links
    $data = db_get_array("SELECT * FROM ?:products_categories WHERE product_id = ?i", $product_id);
    $_cids = array();
    foreach ($data as $v) {
        $v['product_id'] = $pid;
        db_query("INSERT INTO ?:products_categories ?e", $v);
        $_cids[] = $v['category_id'];
    }
    fn_update_product_count($_cids);
    // Clone product options
    fn_clone_product_options($product_id, $pid);
    // Clone global linked options
    $gl_options = db_get_fields("SELECT option_id FROM ?:product_global_option_links WHERE product_id = ?i", $product_id);
    if (!empty($gl_options)) {
        foreach ($gl_options as $v) {
            db_query("INSERT INTO ?:product_global_option_links (option_id, product_id) VALUES (?i, ?i)", $v, $pid);
        }
    }
    // Clone product features
    $data = db_get_array("SELECT * FROM ?:product_features_values WHERE product_id = ?i", $product_id);
    foreach ($data as $v) {
        $v['product_id'] = $pid;
        db_query("INSERT INTO ?:product_features_values ?e", $v);
    }
    // Clone blocks
    Block::instance()->cloneDynamicObjectData('products', $product_id, $pid);
    // Clone tabs info
    ProductTabs::instance()->cloneStatuses($pid, $product_id);
    // Clone addons
    fn_set_hook('clone_product', $product_id, $pid);
    // Clone images
    fn_clone_image_pairs($pid, $product_id, 'product');
    // Clone product files
    fn_clone_product_files($product_id, $pid);
    /**
     * Adds additional actions after product cloning
     *
     * @param int    $product_id Original product identifier
     * @param int    $pid        Cloned product identifier
     * @param string $orig_name  Original product name
     * @param string $new_name   Cloned product name
     */
    fn_set_hook('clone_product_post', $product_id, $pid, $orig_name, $new_name);
    return array('product_id' => $pid, 'orig_name' => $orig_name, 'product' => $new_name);
}
Esempio n. 8
0
    $tab_id = isset($_REQUEST['tab_data']['tab_id']) ? $_REQUEST['tab_data']['tab_id'] : 0;
    $tab_type = isset($_REQUEST['tab_data']['tab_type']) ? $_REQUEST['tab_data']['tab_type'] : 'T';
    if (!empty($_REQUEST['dynamic_object'])) {
        Registry::get('view')->assign('dynamic_object', $_REQUEST['dynamic_object']);
    }
    $dynamic_object_scheme = SchemesManager::getDynamicObjectByType('products');
    $selected_location = Location::instance()->get('products.view', array(), DESCR_SL);
    Registry::get('view')->assign('location', $selected_location);
    Registry::get('view')->assign('dynamic_object_scheme', $dynamic_object_scheme);
    if (!empty($_REQUEST['tab_data'])) {
        $tab_data = $_REQUEST['tab_data'];
    } else {
        $tab_data = array();
    }
    // If edit block
    if ($tab_id > 0 && empty($_REQUEST['tab_data']['content'])) {
        $tab_data = current(ProductTabs::instance()->getList(db_quote(' AND ?:product_tabs.tab_id=?i', $tab_id), 0, DESCR_SL));
    }
    if (isset($tab_data['block_id']) && $tab_data['block_id'] > 0) {
        if (!empty($_REQUEST['dynamic_object'])) {
            $dynamic_object = $_REQUEST['dynamic_object'];
        } else {
            $dynamic_object = array();
        }
        Registry::get('view')->assign('block_data', Block::instance()->getById($tab_data['block_id'], 0, $dynamic_object, DESCR_SL));
    }
    if (empty($tab_data['type'])) {
        $tab_data['type'] = $tab_type;
    }
    Registry::get('view')->assign('tab_data', $tab_data);
}
Esempio n. 9
0
/**
 * Updates addon status
 *
 * @param string $addon             Addon to update status for
 * @param string $status            Status to change to
 * @param bool   $show_notification Display notification if set to true
 * @param bool   $on_install        If status was changed right after install process
 * @param bool   $allow_unmanaged   Whether to allow change status for unmanaged addons in non-console environment
 *
 * @return bool|string True on success, old status ID if status was not changed
 */
function fn_update_addon_status($addon, $status, $show_notification = true, $on_install = false, $allow_unmanaged = false)
{
    $old_status = db_get_field("SELECT status FROM ?:addons WHERE addon = ?s", $addon);
    $new_status = $status;
    $scheme = SchemesManager::getScheme($addon);
    // Unmanaged addons can be enabled/disabled via console only
    if ($scheme->getUnmanaged() && !($allow_unmanaged || defined('CONSOLE'))) {
        return false;
    }
    /**
     * Hook is executed before changing add-on status (i.e. before add-on enabling or disabling).
     *
     * @param string                  $addon             Add-on name
     * @param string                  $status            New addon status - "A" for enabled, "D" for disabled
     * @param bool                    $show_notification Display notification if set to true
     * @param bool                    $on_install        If status was changed right after install process
     * @param bool                    $allow_unmanaged   Whether to allow change status for unmanaged addons in non-console environment
     * @param string                  $old_status        Previous addon status - "A" for enabled, "D" for disabled
     * @param \Tygh\Addons\AXmlScheme $scheme            Add-on scheme
     */
    fn_set_hook('update_addon_status_pre', $addon, $status, $show_notification, $on_install, $allow_unmanaged, $old_status, $scheme);
    if ($old_status != $new_status) {
        // Check if addon can be enabled
        $conflicts = db_get_fields("SELECT addon FROM ?:addons WHERE status = 'A' AND FIND_IN_SET(?s, conflicts)", $addon);
        if ($new_status == 'A' && !empty($conflicts)) {
            $scheme = SchemesManager::getScheme($addon);
            fn_set_notification('W', __('warning'), __('text_addon_cannot_enable', array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName())));
            return $old_status;
        }
        fn_get_schema('settings', 'actions.functions', 'php', true);
        $func = 'fn_settings_actions_addons_' . $addon;
        if (function_exists($func)) {
            $func($new_status, $old_status, $on_install);
        }
        // If status change is allowed, update it
        if ($old_status != $new_status) {
            if ($new_status != 'D') {
                // Check that addon have conflicts
                $scheme = SchemesManager::getScheme($addon);
                $conflicts = db_get_field("SELECT conflicts FROM ?:addons WHERE addon = ?s", $addon);
                if (!empty($conflicts)) {
                    $conflicts = explode(',', $conflicts);
                    $conflicted_addons = db_get_fields("SELECT addon FROM ?:addons WHERE addon IN (?a) AND status = 'A'", $conflicts);
                    if (!empty($conflicted_addons)) {
                        $lang_var = 'text_addon_confclicts_on_install';
                        if (!$on_install) {
                            foreach ($conflicts as $conflict) {
                                fn_disable_addon($conflict, $scheme->getName(), $show_notification);
                            }
                            $lang_var = 'text_addon_confclicts';
                        }
                        fn_set_notification('W', __('warning'), __($lang_var, array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName())));
                        // On install we cannot enable addon with conflicts automaticly
                        if ($on_install) {
                            return $old_status;
                        }
                    }
                }
            }
            db_query("UPDATE ?:addons SET status = ?s WHERE addon = ?s", $status, $addon);
            $func = 'fn_settings_actions_addons_post_' . $addon;
            if (function_exists($func)) {
                $func($status);
            }
            if ($show_notification == true) {
                fn_set_notification('N', __('notice'), __('status_changed'));
            }
            // Enable/disable tabs for addon
            ProductTabs::instance()->updateAddonTabStatus($addon, $new_status);
            Registry::set('addons.' . $addon . '.status', $status);
        } else {
            return $old_status;
        }
    }
    // Clean cache
    fn_clear_cache();
    if ($status == 'A') {
        foreach (fn_get_installed_themes() as $theme_name) {
            $theme = Themes::factory($theme_name);
            $theme_manifest = $theme->getManifest();
            // Precompile addon LESS files if the theme has been converted to CSS
            if (!empty($theme_manifest['converted_to_css']) && !$theme->convertAddonToCss($addon)) {
                fn_update_addon_status($addon, 'D', $show_notification, $on_install);
                return $old_status;
            }
        }
    }
    /**
     * Hook is executed after changing add-on status (i.e. after add-on enabling or disabling).
     *
     * @param string                  $addon             Add-on name
     * @param string                  $status            New addon status - "A" for enabled, "D" for disabled
     * @param bool                    $show_notification Display notification if set to true
     * @param bool                    $on_install        If status was changed right after install process
     * @param bool                    $allow_unmanaged   Whether to allow change status for unmanaged addons in non-console environment
     * @param string                  $old_status        Previous addon status - "A" for enabled, "D" for disabled
     * @param \Tygh\Addons\AXmlScheme $scheme            Add-on scheme
     */
    fn_set_hook('update_addon_status_post', $addon, $status, $show_notification, $on_install, $allow_unmanaged, $old_status, $scheme);
    return true;
}
Esempio n. 10
0
function fn_ult_update_company(&$company_data, &$company_id, &$lang_code, &$action)
{
    if ($action == 'add') {
        // Create required data
        $clone_from = !empty($company_data['clone_from']) && $company_data['clone_from'] != 'all' ? $company_data['clone_from'] : null;
        ProductTabs::instance($company_id)->createDefaultTabs();
        if (!is_null($clone_from) && !empty($company_data['clone'])) {
            Registry::set('clone_data', $company_data['clone']);
            foreach ($company_data['clone'] as $object => $enabled) {
                if ($enabled == 'Y') {
                    fn_clone_object($object, $company_data['clone_from'], $company_id);
                }
            }
        }
        // Share currencies for new company
        foreach (Registry::get('currencies') as $currency_code => $data) {
            fn_ult_update_share_object($data['currency_id'], 'currencies', $company_id);
        }
        // Share languages for new company
        foreach (fn_get_translation_languages() as $lang_code => $data) {
            fn_ult_update_share_object($data['lang_id'], 'languages', $company_id);
        }
    }
}