/** * Gets product main category products link * * @param int $product_id Product identifier * @return array Breadcrumb link data */ function fn_br_get_product_main_category_link($product_id) { $result = array(); $category_id = db_get_field('SELECT category_id FROM ?:products_categories WHERE product_id = ?i and link_type = ?s', $product_id, 'M'); if (!empty($category_id)) { $result = array('title' => __('category') . ': ' . fn_get_category_name($category_id), 'link' => "products.manage.reset_view?cid=" . $category_id); } return $result; }
function fn_exim_get_product_feature_categories($data, $lang_code) { $categories = ''; if (empty($data['Group'])) { $categories = fn_get_category_name($data['Categories'], $lang_code); if (is_array($categories)) { $categories = implode(',', $categories); } } return $categories; }
function fn_google_anaylitics_send($account, $order_info, $refuse = false) { $_uwv = '1'; $url = "http://www.google-analytics.com/__utm.gif"; $sign = $refuse == true ? '-' : ''; $cookies = fn_google_analytics_cookies(); // Transaction request // http://www.google-analytics.com/__utm.gif?utmwv=1&utmt=tran&utmn=262780020&utmtid=80&utmtto=3.96&utmttx=0&utmtsp=0.00&utmtci=Boston&utmtrg=MA&utmtco=United%20States&utmac=ASSASAS&utmcc=__utma%3D81851599.2062069588.1182951649.1183008786.1183012376.3%3B%2B__utmb%3D81851599%3B%2B__utmc%3D81851599%3B%2B__utmz%3D81851599.1182951649.1.1.utmccn%3D(direct)%7Cutmcsr%3D(direct)%7Cutmcmd%3D(none)%3B%2B $transaction = array('utmwv' => $_uwv, 'utmt' => 'tran', 'utmn' => rand(0, 2147483647), 'utmtid' => $order_info['order_id'], 'utmtto' => $sign . $order_info['total'], 'utmttx' => $order_info['tax_subtotal'], 'utmtsp' => $order_info['shipping_cost'], 'utmtci' => $order_info['b_city'], 'utmtrg' => $order_info['b_state'], 'utmtco' => $order_info['b_country_descr'], 'utmac' => $account, 'utmcc' => $cookies); list(, $result) = fn_http_request('GET', $url, $transaction); // Items request //http://www.google-analytics.com/__utm.gif?utmwv=1&utmt=item&utmn=812678190&utmtid=80&utmipc=B00078MG5M&utmipn=100%25%20Cotton%20Adult%2FYouth%20Beefy%20T-Shirt%20by%20Hanes%20(Style%23%205180)&utmipr=4.50&utmiqt=1&utmac=ASSASAS&utmcc= foreach ($order_info['items'] as $item) { $cat_id = db_get_field("SELECT category_id FROM ?:products_categories WHERE product_id = ?i AND link_type = 'M'", $item['product_id']); $i = array('utmwv' => $_uwv, 'utmt' => 'item', 'utmn' => rand(0, 2147483647), 'utmtid' => $order_info['order_id'], 'utmipc' => $item['product_code'], 'utmipn' => $item['product'], 'utmiva' => fn_get_category_name($cat_id, $order_info['lang_code']), 'utmipr' => $sign . fn_format_price($item['subtotal'] / $item['amount']), 'utmiqt' => $item['amount'], 'utmac' => $account, 'utmcc' => $cookies); list(, $result) = fn_http_request('GET', $url, $i); } }
/** * Returns info for homepage * @param object $response */ function fn_twg_set_response_homepage(&$response) { $home_page_content = TwigmoSettings::get('home_page_content'); if (empty($home_page_content)) { $home_page_content = 'random_products'; } if ($home_page_content == 'home_page_blocks' or $home_page_content == 'tw_home_page_blocks') { // Use block manager: get blocks if ($home_page_content == 'home_page_blocks') { $location = 'index.index'; } else { $location = 'twigmo.post'; } $blocks = TwigmoBlock::getBlocksForLocation($location, TwigmoSettings::get('block_types')); // Return blocks $response->setData($blocks); } else { $block = array(); // Random products or category products if ($home_page_content == 'random_products') { $product_ids = fn_twg_get_random_ids(TWG_RESPONSE_ITEMS_LIMIT, 'product_id', '?:products', db_quote("status = ?s", 'A')); $block['title'] = 'random_products'; } else { $product_ids = fn_twg_get_category_product_ids($home_page_content, false) or array(); $block['title'] = fn_get_category_name($home_page_content); } list($block['products']) = fn_twg_api_get_products(array('pid' => $product_ids), count($product_ids)); $block['total_items'] = count($block['products']); $response->setData(array($block)); } }
/** * Form top menu * * @param array $top_menu Top menu data from the database * @param int $level Current menu level * @param boolean $active Menu item active flag, returned by reference to set tree branch as active * * @return array Formed top menu */ function fn_top_menu_form($top_menu, $level = 0, &$active = NULL) { /** * Modifies top menu forming parameters * * @param array $top_menu Top menu data from the database * @param int $level Current menu level * @param boolean $active Menu item active flag */ fn_set_hook('top_menu_form_pre', $top_menu, $level, $active); $_active = false; foreach ($top_menu as $k => $v) { if (!empty($v['param_3'])) { // get extra items list($type, $id, $use_name) = fn_explode(':', $v['param_3']); if ($type == 'C') { // categories $cats = fn_get_categories_tree($id, true); $v['subitems'] = fn_array_merge(fn_top_menu_standardize($cats, 'category_id', 'category', 'subcategories', 'categories.view?category_id='), !empty($v['subitems']) ? $v['subitems'] : array(), false); if ($use_name == 'Y' && !empty($id)) { $v['descr'] = fn_get_category_name($id); $v['param'] = 'categories.view?category_id=' . $id; } //Should add this checking because the same pages can have different request parameters and the next checking //with fn_top_menu_is_current_url function could return incorrect result. //For example: categories.view?category_id=165 and categories.view?category_id=165¤cy=EUR should have the same active elements. if (fn_check_is_active_menu_item(array('category_id' => $id), 'categories')) { $top_menu[$k]['active'] = true; } } elseif ($type == 'A') { // pages $params = array('from_page_id' => $id, 'get_tree' => 'multi_level', 'status' => 'A'); list($pages) = fn_get_pages($params); $v['subitems'] = fn_array_merge(fn_top_menu_standardize($pages, 'page_id', 'page', 'subpages', 'pages.view?page_id='), !empty($v['subitems']) ? $v['subitems'] : array(), false); if ($use_name == 'Y' && !empty($id)) { $page_data = fn_get_page_data($id); $v['descr'] = $page_data['page']; $v['param'] = !empty($page_data['link']) ? $page_data['link'] : 'pages.view?page_id=' . $id; } if (fn_check_is_active_menu_item(array('page_id' => $id), 'pages')) { $top_menu[$k]['active'] = true; } } else { // for addons /** * Deprecated since 4.3.6, use top_menu_form_post instead */ fn_set_hook('top_menu_form', $v, $type, $id, $use_name); } } if (!empty($v['param']) && fn_top_menu_is_current_url($v['param'], $v['param_2'])) { $top_menu[$k]['active'] = true; // Store active value $_active = true; } if (!empty($v['subitems'])) { $top_menu[$k]['subitems'] = fn_top_menu_form($v['subitems'], $level + 1, $active); // If active status was returned fron children if ($active) { $top_menu[$k]['active'] = $active; // Strore fo return and reset activity status for athother elements on this level // Because in one level may be only one active item $_active = true; $active = false; } } $top_menu[$k]['item'] = $v['descr']; $top_menu[$k]['href'] = $v['param']; $top_menu[$k]['level'] = $level; unset($top_menu[$k]['descr'], $top_menu[$k]['param']); } $active = $_active; /** * Modifies top menu items * * @param array $top_menu Top menu data from the database * @param int $level Current menu level * @param boolean $active Menu item active flag */ fn_set_hook('top_menu_form_post', $top_menu, $level, $active); return $top_menu; }
} // [Breadcrumbs] fn_add_breadcrumb(fn_get_lang_var('plans'), "affiliate_plans.manage"); // [/Breadcrumbs] // [Page sections] Registry::set('navigation.tabs', array('general' => array('title' => fn_get_lang_var('general'), 'js' => true), 'linked_products' => array('title' => fn_get_lang_var('products'), 'js' => true), 'linked_categories' => array('title' => fn_get_lang_var('categories'), 'js' => true), 'coupons' => array('title' => fn_get_lang_var('coupons'), 'js' => true), 'multi_tier_affiliates' => array('title' => fn_get_lang_var('multi_tier_affiliates'), 'js' => true))); // [/Page sections] $linked_products = array(); foreach ($affiliate_plan['product_ids'] as $prod_id => $sale) { $linked_products[$prod_id] = fn_get_product_data($prod_id, $auth, DESCR_SL); $linked_products[$prod_id]['sale'] = $sale; } $view->assign('linked_products', $linked_products); $linked_categories = array(); foreach ($affiliate_plan['category_ids'] as $cat_id => $sale) { $linked_categories[$cat_id]['category'] = fn_get_category_name($cat_id, DESCR_SL); $linked_categories[$cat_id]['category_id'] = $cat_id; $linked_categories[$cat_id]['sale'] = $sale; } $view->assign('linked_categories', $linked_categories); $params = array('promotion_id' => empty($affiliate_plan['promotion_ids']) ? array('0' => 0) : array_keys($affiliate_plan['promotion_ids'])); list($affiliate_plan['coupons']) = fn_get_promotions($params); foreach ($affiliate_plan['coupons'] as $promotion_id => $coupon_data) { if (isset($affiliate_plan['promotion_ids'][$promotion_id])) { $affiliate_plan['coupons'][$promotion_id]['use_coupon'] = $affiliate_plan['promotion_ids'][$promotion_id]; } } $params = array('coupons' => true); list($coupons) = fn_get_promotions($params); foreach (array_keys($affiliate_plan['promotion_ids']) as $promotion_id) { unset($coupons[$promotion_id]);
/** * Form top menu * * @param array $top_menu top menu data from the database * @return array formed top menu */ function fn_top_menu_form($top_menu) { foreach ($top_menu as $k => $v) { if (!empty($v['param_3'])) { // get extra items list($type, $id, $use_name) = fn_explode(':', $v['param_3']); if ($type == 'C') { // categories $cats = fn_get_categories_tree($id, true); $v['subitems'] = fn_array_merge(fn_top_menu_standardize($cats, 'category_id', 'category', 'subcategories', 'categories.view?category_id=', $v['param_4']), !empty($v['subitems']) ? $v['subitems'] : array(), false); if ($use_name == 'Y' && !empty($id)) { $v['descr'] = fn_get_category_name($id); $v['param'] = 'categories.view?category_id=' . $id; } } elseif ($type == 'A') { // pages $params = array('from_page_id' => $id, 'get_tree' => 'multi_level', 'status' => 'A'); list($pages) = fn_get_pages($params); $v['subitems'] = fn_array_merge(fn_top_menu_standardize($pages, 'page_id', 'page', 'subpages', 'pages.view?page_id=', $v['param_4']), !empty($v['subitems']) ? $v['subitems'] : array(), false); if ($use_name == 'Y' && !empty($id)) { $v['descr'] = fn_get_page_name($id); $v['param'] = 'pages.view?page_id=' . $id; } } else { // for addons fn_set_hook('top_menu_form', $v, $type, $id, $use_name); } } if (!empty($v['subitems'])) { $top_menu[$k]['subitems'] = fn_top_menu_form($v['subitems']); } $top_menu[$k]['item'] = $v['descr']; $top_menu[$k]['href'] = $v['param']; unset($top_menu[$k]['descr'], $top_menu[$k]['param']); } return $top_menu; }
function fn_get_categories_list($category_ids, $lang_code = CART_LANGUAGE) { /** * Change params for getting categories list * * @param array $category_ids Category identifier * @param string $lang_code Two-letter language code (e.g. 'en', 'ru', etc.) */ fn_set_hook('get_categories_list_pre', $category_ids, $lang_code); static $max_categories = 10; $c_names = array(); if (!empty($category_ids)) { $c_ids = fn_explode(',', $category_ids); $tr_c_ids = array_slice($c_ids, 0, $max_categories); $c_names = fn_get_category_name($tr_c_ids, $lang_code); if (sizeof($tr_c_ids) < sizeof($c_ids)) { $c_names[] = '... (' . sizeof($c_ids) . ')'; } } else { $c_names[] = __('all_categories'); } /** * Change categories list * * @param array $c_names Categories names list * @param array $category_ids Category identifier * @param string $lang_code Two-letter language code (e.g. 'en', 'ru', etc.) */ fn_set_hook('get_categories_list_post', $c_names, $category_ids, $lang_code); return $c_names; }
function fn_price_list_build_category_name($id_path) { $result = array(); $cat_ids = explode('/', $id_path); if (!empty($cat_ids)) { $cats = fn_get_category_name($cat_ids); foreach ($cats as $cat_id => $cat_name) { $result[] = $cat_name; } } return implode(' - ', $result); }
header("Content-disposition: attachment; filename={$action}.html"); echo $file_content; exit; } $affiliate_plan = fn_get_affiliate_plan_data_by_partner_id($auth['user_id']); if (!empty($affiliate_plan['plan_id'])) { $affiliate_plan['min_payment'] = floatval($affiliate_plan['min_payment']); $linked_products = array(); foreach ($affiliate_plan['product_ids'] as $prod_id => $sale) { $linked_products[$prod_id] = fn_get_product_data($prod_id, $auth); $linked_products[$prod_id]['sale'] = $sale; } $view->assign('linked_products', $linked_products); $linked_categories = array(); foreach ($affiliate_plan['category_ids'] as $cat_id => $sale) { $linked_categories[$cat_id]['category'] = fn_get_category_name($cat_id, CART_LANGUAGE); $linked_categories[$cat_id]['category_id'] = $cat_id; $linked_categories[$cat_id]['sale'] = $sale; } $view->assign('linked_categories', $linked_categories); $params = array('promotion_id' => array_keys($affiliate_plan['promotion_ids']), 'expand' => true); list($coupons) = fn_get_promotions($params); $aff_prefix = Registry::get('addons.affiliate.coupon_prefix_delim'); foreach ($coupons as $promotion_id => $coupon_data) { if (isset($affiliate_plan['promotion_ids'][$promotion_id])) { $coupons[$promotion_id]['use_coupon'] = $affiliate_plan['promotion_ids'][$promotion_id]; foreach ($coupons[$promotion_id]['conditions']['conditions'] as $cnd) { if ($cnd['condition'] == 'coupon_code') { if (Registry::get('addons.affiliate.use_affiliate_id') == 'Y' && $aff_prefix) { $coupons[$promotion_id]['coupon_code'] = $auth['user_id'] . $aff_prefix . $cnd['value']; } else {
<?php /*************************************************************************** * * * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev * * * * This is commercial software, only users who have purchased a valid * * license and accept to the terms of the License Agreement can install * * and use this program. * * * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ if (!defined('BOOTSTRAP')) { die('Access denied'); } use Tygh\Registry; $viewed_categories = db_get_array('SELECT * FROM ?:advanced_addon_data'); if (!empty($viewed_categories)) { foreach ($viewed_categories as $key => $category_data) { $category_data['user_name'] = fn_get_user_name($category_data['user_id']); $category_data['categories'] = unserialize($category_data['categories']); $category_data['categories'] = fn_get_category_name(array_keys($category_data['categories'])); $viewed_categories[$key] = $category_data; } Registry::get('view')->assign('viewed_categories', $viewed_categories); }
/** * Form top menu * * @param array $top_menu top menu data from the database * @param int $level current menu level * @param boolean $active - menu item active flag, returned by reference to set tree branch as active * @return array formed top menu */ function fn_top_menu_form($top_menu, $level = 0, &$active = NULL) { $_active = false; foreach ($top_menu as $k => $v) { if (!empty($v['param_3'])) { // get extra items list($type, $id, $use_name) = fn_explode(':', $v['param_3']); if ($type == 'C') { // categories $cats = fn_get_categories_tree($id, true); $v['subitems'] = fn_array_merge(fn_top_menu_standardize($cats, 'category_id', 'category', 'subcategories', 'categories.view?category_id='), !empty($v['subitems']) ? $v['subitems'] : array(), false); if ($use_name == 'Y' && !empty($id)) { $v['descr'] = fn_get_category_name($id); $v['param'] = 'categories.view?category_id=' . $id; } } elseif ($type == 'A') { // pages $params = array('from_page_id' => $id, 'get_tree' => 'multi_level', 'status' => 'A'); list($pages) = fn_get_pages($params); $v['subitems'] = fn_array_merge(fn_top_menu_standardize($pages, 'page_id', 'page', 'subpages', 'pages.view?page_id='), !empty($v['subitems']) ? $v['subitems'] : array(), false); if ($use_name == 'Y' && !empty($id)) { $page_data = fn_get_page_data($id); $v['descr'] = $page_data['page']; $v['param'] = !empty($page_data['link']) ? $page_data['link'] : 'pages.view?page_id=' . $id; } } else { // for addons fn_set_hook('top_menu_form', $v, $type, $id, $use_name); } } if (!empty($v['param']) && fn_top_menu_is_current_url($v['param'], $v['param_2'])) { $top_menu[$k]['active'] = true; // Store active value $_active = true; } if (!empty($v['subitems'])) { $top_menu[$k]['subitems'] = fn_top_menu_form($v['subitems'], $level + 1, $active); // If active status was returned fron children if ($active) { $top_menu[$k]['active'] = $active; // Strore fo return and reset activity status for athother elements on this level // Because in one level may be only one active item $_active = true; $active = false; } } $top_menu[$k]['item'] = $v['descr']; $top_menu[$k]['href'] = $v['param']; $top_menu[$k]['level'] = $level; unset($top_menu[$k]['descr'], $top_menu[$k]['param']); } $active = $_active; return $top_menu; }
function fn_convert_group_data($group_data) { if (!empty($group_data)) { $group_data['name'] = empty($group_data['name']) ? '' : $group_data['name']; if (!empty($group_data['link_to']) && !empty($group_data['data'])) { if ($group_data['link_to'] == 'C') { $group_data['categories'] = fn_get_category_name($group_data['data'], CART_LANGUAGE, true); } elseif ($group_data['link_to'] == 'P') { $group_data['product_ids'] = explode(',', $group_data['data']); } elseif ($group_data['link_to'] == 'U') { $group_data['url'] = $group_data['data']; } unset($group_data['data']); } } return empty($group_data) ? false : $group_data; }
function content_55d3121dc74e80_73018261($_smarty_tpl) { if (!is_callable('smarty_function_math')) { include '/home/coriolan/public_html/lead/app/lib/other/smarty/plugins/function.math.php'; } if (!is_callable('smarty_function_set_id')) { include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.set_id.php'; } fn_preload_lang_vars(array('remove', 'remove')); if ($_smarty_tpl->tpl_vars['runtime']->value['customization_mode']['design'] == "Y" && @constant('AREA') == "C") { $_smarty_tpl->_capture_stack[0][] = array("template_content", null, null); ob_start(); if ($_smarty_tpl->tpl_vars['category_id']->value == "0") { ?> <?php $_smarty_tpl->tpl_vars["category"] = new Smarty_variable($_smarty_tpl->tpl_vars['default_name']->value, null, 0); } else { ?> <?php $_smarty_tpl->tpl_vars["category"] = new Smarty_variable(($tmp = @fn_get_category_name($_smarty_tpl->tpl_vars['category_id']->value)) === null || $tmp === '' ? (string) $_smarty_tpl->tpl_vars['ldelim']->value . "category" . (string) $_smarty_tpl->tpl_vars['rdelim']->value : $tmp, null, 0); } ?> <<?php if ($_smarty_tpl->tpl_vars['single_line']->value) { ?> span<?php } else { ?> p<?php } ?> <?php if (!$_smarty_tpl->tpl_vars['clone']->value) { ?> id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['holder']->value, ENT_QUOTES, 'UTF-8'); ?> _<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> " <?php } ?> class="cm-js-item ty-p-none<?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> cm-clone hidden<?php } ?> "> <?php if (!$_smarty_tpl->tpl_vars['first_item']->value && $_smarty_tpl->tpl_vars['single_line']->value) { ?> <span class="cm-comma<?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> hidden<?php } ?> ">, </span><?php } if ($_smarty_tpl->tpl_vars['multiple']->value) { ?> <?php if (!$_smarty_tpl->tpl_vars['hide_link']->value) { ?> <?php if ($_smarty_tpl->tpl_vars['position_field']->value) { ?> <input type="text" name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['input_name']->value, ENT_QUOTES, 'UTF-8'); ?> [<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> ]" value="<?php echo smarty_function_math(array('equation' => "a*b", 'a' => $_smarty_tpl->tpl_vars['position']->value, 'b' => 10), $_smarty_tpl); ?> " size="3" class="ty-input-text-short<?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> disabled<?php } ?> "<?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> disabled="disabled"<?php } ?> /> <?php } ?> <a href="<?php echo htmlspecialchars(fn_url("categories.update?category_id=" . (string) $_smarty_tpl->tpl_vars['category_id']->value), ENT_QUOTES, 'UTF-8'); ?> "><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value, ENT_QUOTES, 'UTF-8'); ?> </a> <?php } else { ?> <strong><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value, ENT_QUOTES, 'UTF-8'); ?> </strong> <?php } ?> <?php if (!$_smarty_tpl->tpl_vars['hide_delete_button']->value && !$_smarty_tpl->tpl_vars['view_only']->value) { ?> <a onclick="Tygh.$.cePicker('delete_js_item', '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['holder']->value, ENT_QUOTES, 'UTF-8'); ?> ', '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> ', 'c'); return false;" class="ty-delete-big" title="<?php echo $_smarty_tpl->__("remove"); ?> "><i class="ty-delete-big__icon ty-icon-cancel-circle"></i></a> <?php } } else { ?> <input class="ty-input-text cm-picker-value-description" type="text" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value, ENT_QUOTES, 'UTF-8'); ?> " <?php if ($_smarty_tpl->tpl_vars['display_input_id']->value) { ?> id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['display_input_id']->value, ENT_QUOTES, 'UTF-8'); ?> "<?php } ?> size="10" name="category_name" readonly="readonly" <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['extra']->value, ENT_QUOTES, 'UTF-8'); ?> /> <?php } ?> </<?php if ($_smarty_tpl->tpl_vars['single_line']->value) { ?> span<?php } else { ?> p<?php } ?> > <?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { if (isset($_capture_assign)) { $_smarty_tpl->assign($_capture_assign, ob_get_contents()); } if (isset($_capture_append)) { $_smarty_tpl->append($_capture_append, ob_get_contents()); } Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean(); } else { $_smarty_tpl->capture_error(); } if (trim(Smarty::$_smarty_vars['capture']['template_content'])) { if ($_smarty_tpl->tpl_vars['auth']->value['area'] == "A") { ?> <span class="cm-template-box template-box" data-ca-te-template="pickers/categories/js.tpl" id="<?php echo smarty_function_set_id(array('name' => "pickers/categories/js.tpl"), $_smarty_tpl); ?> "><div class="cm-template-icon icon-edit ty-icon-edit hidden"></div><?php echo Smarty::$_smarty_vars['capture']['template_content']; ?> <!--[/tpl_id]--></span><?php } else { echo Smarty::$_smarty_vars['capture']['template_content']; } } } else { if ($_smarty_tpl->tpl_vars['category_id']->value == "0") { ?> <?php $_smarty_tpl->tpl_vars["category"] = new Smarty_variable($_smarty_tpl->tpl_vars['default_name']->value, null, 0); } else { ?> <?php $_smarty_tpl->tpl_vars["category"] = new Smarty_variable(($tmp = @fn_get_category_name($_smarty_tpl->tpl_vars['category_id']->value)) === null || $tmp === '' ? (string) $_smarty_tpl->tpl_vars['ldelim']->value . "category" . (string) $_smarty_tpl->tpl_vars['rdelim']->value : $tmp, null, 0); } ?> <<?php if ($_smarty_tpl->tpl_vars['single_line']->value) { ?> span<?php } else { ?> p<?php } ?> <?php if (!$_smarty_tpl->tpl_vars['clone']->value) { ?> id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['holder']->value, ENT_QUOTES, 'UTF-8'); ?> _<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> " <?php } ?> class="cm-js-item ty-p-none<?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> cm-clone hidden<?php } ?> "> <?php if (!$_smarty_tpl->tpl_vars['first_item']->value && $_smarty_tpl->tpl_vars['single_line']->value) { ?> <span class="cm-comma<?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> hidden<?php } ?> ">, </span><?php } if ($_smarty_tpl->tpl_vars['multiple']->value) { ?> <?php if (!$_smarty_tpl->tpl_vars['hide_link']->value) { ?> <?php if ($_smarty_tpl->tpl_vars['position_field']->value) { ?> <input type="text" name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['input_name']->value, ENT_QUOTES, 'UTF-8'); ?> [<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> ]" value="<?php echo smarty_function_math(array('equation' => "a*b", 'a' => $_smarty_tpl->tpl_vars['position']->value, 'b' => 10), $_smarty_tpl); ?> " size="3" class="ty-input-text-short<?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> disabled<?php } ?> "<?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> disabled="disabled"<?php } ?> /> <?php } ?> <a href="<?php echo htmlspecialchars(fn_url("categories.update?category_id=" . (string) $_smarty_tpl->tpl_vars['category_id']->value), ENT_QUOTES, 'UTF-8'); ?> "><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value, ENT_QUOTES, 'UTF-8'); ?> </a> <?php } else { ?> <strong><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value, ENT_QUOTES, 'UTF-8'); ?> </strong> <?php } ?> <?php if (!$_smarty_tpl->tpl_vars['hide_delete_button']->value && !$_smarty_tpl->tpl_vars['view_only']->value) { ?> <a onclick="Tygh.$.cePicker('delete_js_item', '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['holder']->value, ENT_QUOTES, 'UTF-8'); ?> ', '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> ', 'c'); return false;" class="ty-delete-big" title="<?php echo $_smarty_tpl->__("remove"); ?> "><i class="ty-delete-big__icon ty-icon-cancel-circle"></i></a> <?php } } else { ?> <input class="ty-input-text cm-picker-value-description" type="text" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value, ENT_QUOTES, 'UTF-8'); ?> " <?php if ($_smarty_tpl->tpl_vars['display_input_id']->value) { ?> id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['display_input_id']->value, ENT_QUOTES, 'UTF-8'); ?> "<?php } ?> size="10" name="category_name" readonly="readonly" <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['extra']->value, ENT_QUOTES, 'UTF-8'); ?> /> <?php } ?> </<?php if ($_smarty_tpl->tpl_vars['single_line']->value) { ?> span<?php } else { ?> p<?php } ?> > <?php } }
function fn_ult_check_store_permission($params, &$redirect_controller) { $result = true; $controller = Registry::get('runtime.controller'); $redirect_controller = $controller; // FIXME: move in schema switch ($controller) { case 'products': if (!empty($params['product_id'])) { $key = 'product_id'; $key_id = $params[$key]; $table = 'products'; $object_name = fn_get_product_name($key_id, DESCR_SL); $object_type = __('product'); $check_store_permission = array('func' => 'fn_ult_check_store_permission_product', 'args' => array('$table', '$key', '$key_id')); } break; case 'categories': if (!empty($params['category_id'])) { $key = 'category_id'; $key_id = $params[$key]; $table = 'categories'; $object_name = fn_get_category_name($key_id, DESCR_SL); $object_type = __('category'); } break; case 'orders': if (!empty($params['order_id'])) { $key = 'order_id'; $key_id = $params[$key]; $table = 'orders'; $object_name = '#' . $key_id; $object_type = __('order'); } break; case 'shippings': if (!empty($params['shipping_id'])) { $key = 'shipping_id'; $key_id = $params[$key]; $table = 'shippings'; $object_name = fn_get_shipping_name($key_id, DESCR_SL); $object_type = __('shipping'); } break; case 'promotions': if (!empty($params['promotion_id'])) { $key = 'promotion_id'; $key_id = $params[$key]; $table = 'promotions'; $object_name = fn_get_promotion_name($key_id, DESCR_SL); $object_type = __('promotion'); } break; case 'pages': if (!empty($params['page_id'])) { $key = 'page_id'; $key_id = $params[$key]; $table = 'pages'; $object_name = fn_get_page_name($key_id, DESCR_SL); $object_type = __('content'); } break; case 'profiles': if (!empty($params['user_id'])) { $key = 'user_id'; $key_id = $params[$key]; $table = 'users'; $object_name = fn_get_user_name($key_id, DESCR_SL); $object_type = __('user'); $check_store_permission = array('func' => 'fn_ult_check_store_permission_profiles', 'args' => array('$params', '$table', '$key', '$key_id')); } break; case 'settings': if (!empty($params['section_id'])) { $object_name = $params['section_id']; $object_type = __('section'); $table = 'settings'; $check_store_permission = array('func' => 'fn_ult_check_store_permission_settings', 'args' => array('$object_name')); } break; case 'shipments': if (!empty($params['shipment_id'])) { $key = 'shipment_id'; $key_id = $params[$key]; $table = 'shipments'; $object_name = '#' . $key_id; $object_type = __('shipment'); $check_store_permission = array('func' => 'fn_ult_check_store_permission_shipments', 'args' => array('$key_id')); } break; case 'static_data': if (!empty($params['menu_id'])) { $key = 'menu_id'; $key_id = $params[$key]; $table = 'menus'; $object_name = fn_get_menu_name($key_id); $object_type = __('menu'); $redirect_controller = 'menus'; } break; case 'companies': if (!empty($params['company_id'])) { $key = 'company_id'; $key_id = $params[$key]; $table = 'companies'; $object_name = fn_get_company_name($key_id); $object_type = __('company'); } break; } fn_set_hook('ult_check_store_permission', $params, $object_type, $object_name, $table, $key, $key_id); if (!empty($object_name)) { if (!empty($check_store_permission)) { $args = array(); foreach ($check_store_permission['args'] as $arg) { if ($arg[0] == '$') { $arg = ltrim($arg, "\$"); $args[] = ${$arg}; } } $result = call_user_func_array($check_store_permission['func'], $args); } else { $result = fn_check_company_id($table, $key, $key_id) || fn_check_shared_company_id($table, $key_id); } } fn_set_hook('ult_check_store_permission_post', $params, $object_type, $object_name, $result); if ($result == false) { fn_set_notification('W', __('warning'), __('store_object_denied', array('[object_type]' => $object_type, '[object_name]' => fn_truncate_chars($object_name, 20))), '', 'store_object_denied'); } return $result; }
if ($config) { $interest = $vendor_items[0]['interest']; $view->assign("interest", $interest); foreach ($config['vendors'] as $vendorName => $vendorConfig) { $vendor_fields[$vendorName] = array('label' => $vendorConfig['name'], 'item' => $vendor_items[0][$vendorConfig['master-file-item-column-name']], 'price' => $vendor_prices[0][$vendorConfig['master-file-price-column-name']], 'qty' => $vendor_prices[0][$vendorConfig['master-file-qty-column-name']], 'name' => $vendorConfig['master-file-item-column-name']); } } } $view->assign("vendors", $vendor_fields); } if (empty($product_data)) { return array(CONTROLLER_STATUS_NO_PAGE); } fn_add_breadcrumb(fn_get_lang_var('products'), "products.manage.reset_view"); fn_add_breadcrumb(fn_get_lang_var('search_results'), "products.manage.last_view"); fn_add_breadcrumb(fn_get_lang_var('category') . ': ' . fn_get_category_name($product_data['main_category']), "products.manage.reset_view?cid={$product_data['main_category']}"); $taxes = fn_get_taxes(); $view->assign('product_data', $product_data); $view->assign('taxes', $taxes); $view->assign('companies', fn_get_short_companies()); $product_options = fn_get_product_options($_REQUEST['product_id'], DESCR_SL); if (!empty($product_options)) { $has_inventory = false; foreach ($product_options as $p) { if ($p['inventory'] == 'Y') { $has_inventory = true; break; } } $view->assign('has_inventory', $has_inventory); }
function fn_stat_product_search_data($search_params, $text_conditions = array()) { $text_conditions['find_results_with'] = (empty($search_params['q']) ? '- ' . fn_get_lang_var('empty') . ' -' : $search_params['q']) . ' [' . ($search_params['match'] == 'exact' ? fn_get_lang_var('exact_phrase') : ($search_params['match'] == 'all' ? fn_get_lang_var('all_words') : fn_get_lang_var('any_words'))) . ']'; $_data = array(); if (!empty($search_params['pname'])) { $_data[] = fn_get_lang_var('product_name'); } if (!empty($search_params['pshort'])) { $_data[] = fn_get_lang_var('short_description'); } if (!empty($search_params['pfull'])) { $_data[] = fn_get_lang_var('full_description'); } if (!empty($search_params['pkeywords'])) { $_data[] = fn_get_lang_var('keywords'); } if (!empty($_data)) { $text_conditions['search_in'] = implode(', ', $_data); } if (!empty($search_params['feature'])) { list($product_features) = fn_get_product_features(); $_data = array(); foreach ($search_params['feature'] as $feature_id) { $_data[] = $product_features[$feature_id]['description']; } if (!empty($_data)) { $text_conditions['search_by_product_features'] = implode(', ', $_data); } } if (!empty($search_params['cid'])) { $text_conditions['search_in_category'] = fn_get_category_name($search_params['cid'], CART_LANGUAGE) . (empty($search_params['subcats']) ? '' : ' [' . fn_get_lang_var('search_in_subcategories') . ']'); } if (!empty($search_params['pcode'])) { $text_conditions['search_by_sku'] = $search_params['pcode']; } if (!empty($search_params['price_from']) || !empty($search_params['price_to'])) { $text_conditions['search_by_price'] = fn_format_price($search_params['price_from']) . ' - ' . fn_format_price($search_params['price_to']); } if (!empty($search_params['weight_from']) || !empty($search_params['weight_to'])) { $text_conditions['search_by_weight'] = (empty($search_params['weight_from']) ? '0' : $search_params['weight_from']) . ' - ' . (empty($search_params['weight_to']) ? '0' : $search_params['weight_to']) . " ({Registry::get('settings.General.weight_symbol')})"; } fn_set_hook('stat_product_search_data', $search_params, $text_conditions); return $text_conditions; }
$params['extend'] = array('description'); if (!empty($_REQUEST['category_id'])) { fn_add_breadcrumb($company_data['company'], 'companies.products?company_id=' . $company_id); $category_id = $_REQUEST['category_id']; // Get full data for current category $category_data = fn_get_category_data($category_id); if (!empty($category_data)) { $params['cid'] = $category_id; if (Registry::get('settings.General.show_products_from_subcategories') == 'Y') { $params['subcats'] = 'Y'; } // [Breadcrumbs] $parent_ids = explode('/', $category_data['id_path']); array_pop($parent_ids); if (!empty($parent_ids)) { $cats = fn_get_category_name($parent_ids); foreach ($parent_ids as $c_id) { fn_add_breadcrumb($cats[$c_id], "companies.products?category_id={$c_id}&company_id={$company_id}"); } } fn_add_breadcrumb($category_data['category']); } // Get subcategories list for current category Tygh::$app['view']->assign('subcategories', fn_get_subcategories($category_id)); Tygh::$app['view']->assign('category_data', $category_data); Tygh::$app['view']->assign('reset_url', fn_url('companies.products?category_id=' . $category_id . '&company_id=' . $company_id)); } else { if (!empty($_REQUEST['q'])) { fn_add_breadcrumb($company_data['company'], 'companies.products?company_id=' . $company_id); fn_add_breadcrumb(__('search')); } else {
function fn_get_categories_list($category_ids, $lang_code = CART_LANGUAGE) { static $max_categories = 10; $c_names = array(); if (!empty($category_ids)) { $c_ids = fn_explode(',', $category_ids); $tr_c_ids = array_slice($c_ids, 0, $max_categories); $c_names = fn_get_category_name($tr_c_ids, $lang_code); if (sizeof($tr_c_ids) < sizeof($c_ids)) { $c_names[] = '...'; } } else { $c_names[] = fn_get_lang_var('all_categories'); } return $c_names; }