} } } $prev_cart_products = empty($cart['products']) ? array() : $cart['products']; fn_add_product_to_cart($_REQUEST['product_data'], $cart, $auth); fn_save_cart_content($cart, $auth['user_id']); $previous_state = md5(serialize($cart['products'])); $cart['change_cart_products'] = true; fn_calculate_cart_content($cart, $auth, 'S', true, 'F', true); if (md5(serialize($cart['products'])) != $previous_state && empty($cart['skip_notification'])) { $product_cnt = 0; $added_products = array(); foreach ($cart['products'] as $key => $data) { if (empty($prev_cart_products[$key]) || !empty($prev_cart_products[$key]) && $prev_cart_products[$key]['amount'] != $data['amount']) { $added_products[$key] = $data; $added_products[$key]['product_option_data'] = fn_get_selected_product_options_info($data['product_options']); if (!empty($prev_cart_products[$key])) { $added_products[$key]['amount'] = $data['amount'] - $prev_cart_products[$key]['amount']; } $product_cnt += $added_products[$key]['amount']; } } if (!empty($added_products)) { Tygh::$app['view']->assign('added_products', $added_products); if (Registry::get('config.tweaks.disable_dhtml') && Registry::get('config.tweaks.redirect_to_cart')) { Tygh::$app['view']->assign('continue_url', !empty($_REQUEST['redirect_url']) && empty($_REQUEST['appearance']['details_page']) ? $_REQUEST['redirect_url'] : $_SESSION['continue_url']); } $msg = Tygh::$app['view']->fetch('views/checkout/components/product_notification.tpl'); fn_set_notification('I', __($product_cnt > 1 ? 'products_added_to_cart' : 'product_added_to_cart'), $msg, 'I'); $cart['recalculate'] = true; } else {
function content_55d42e47dff943_86175395($_smarty_tpl) { if (!is_callable('smarty_function_script')) { include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.script.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('no_items', 'name', 'quantity', 'options', 'any_option_combinations', 'deleted_product', 'add_products', 'add_products', 'no_items', 'name', 'quantity', 'options', 'any_option_combinations', 'deleted_product', 'add_products', 'add_products')); 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(); $_smarty_tpl->tpl_vars["view_mode"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['view_mode']->value) === null || $tmp === '' ? "mixed" : $tmp, null, 0); if (!$_smarty_tpl->tpl_vars['display']->value) { ?> <?php $_smarty_tpl->tpl_vars["display"] = new Smarty_variable("options", null, 0); } ?> <?php echo smarty_function_script(array('src' => "js/tygh/picker.js"), $_smarty_tpl); ?> <?php if ($_smarty_tpl->tpl_vars['view_mode']->value != "button") { if ($_smarty_tpl->tpl_vars['type']->value == "table") { ?> <p id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> _no_item" class="ty-no-items<?php if ($_smarty_tpl->tpl_vars['item_ids']->value) { ?> hidden<?php } ?> "><?php echo ($tmp = @$_smarty_tpl->tpl_vars['no_item_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("no_items") : $tmp; ?> </p> <table id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="ty-table<?php if (!$_smarty_tpl->tpl_vars['item_ids']->value) { ?> hidden<?php } ?> cm-picker-options"> <thead> <tr> <th><?php echo $_smarty_tpl->__("name"); ?> </th> <th><?php echo $_smarty_tpl->__("quantity"); ?> </th> </tr> </thead> <?php echo $_smarty_tpl->getSubTemplate("pickers/products/js.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('clone' => true, 'options' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "options" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'root_id' => $_smarty_tpl->tpl_vars['data_id']->value, 'product' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "product" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'delete_id' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "delete_id" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'amount' => 1, 'amount_input' => "text", 'input_name' => (string) $_smarty_tpl->tpl_vars['input_name']->value . "[" . (string) $_smarty_tpl->tpl_vars['ldelim']->value . "product_id" . (string) $_smarty_tpl->tpl_vars['rdelim']->value . "]"), 0); ?> <?php if ($_smarty_tpl->tpl_vars['item_ids']->value) { ?> <?php $_smarty_tpl->tpl_vars["product"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["product"]->_loop = false; $_smarty_tpl->tpl_vars["product_id"] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['item_ids']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["product"]->key => $_smarty_tpl->tpl_vars["product"]->value) { $_smarty_tpl->tpl_vars["product"]->_loop = true; $_smarty_tpl->tpl_vars["product_id"]->value = $_smarty_tpl->tpl_vars["product"]->key; ?> <?php $_smarty_tpl->_capture_stack[0][] = array("product_options", null, null); ob_start(); ?> <?php $_smarty_tpl->tpl_vars["prod_opts"] = new Smarty_variable(fn_get_product_options($_smarty_tpl->tpl_vars['product']->value['product_id']), null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['prod_opts']->value && !$_smarty_tpl->tpl_vars['product']->value['product_options']) { ?> <strong><?php echo $_smarty_tpl->__("options"); ?> : </strong> <?php echo $_smarty_tpl->__("any_option_combinations"); ?> <?php } else { ?> <?php if ($_smarty_tpl->tpl_vars['product']->value['product_options_value']) { ?> <?php echo $_smarty_tpl->getSubTemplate("common/options_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_options' => $_smarty_tpl->tpl_vars['product']->value['product_options_value']), 0); ?> <?php } else { ?> <?php echo $_smarty_tpl->getSubTemplate("common/options_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_options' => fn_get_selected_product_options_info($_smarty_tpl->tpl_vars['product']->value['product_options'])), 0); ?> <?php } ?> <?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(); } ?> <?php if ($_smarty_tpl->tpl_vars['product']->value['product']) { ?> <?php $_smarty_tpl->tpl_vars["product_name"] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value['product'], null, 0); ?> <?php } else { ?> <?php $_smarty_tpl->tpl_vars["product_name"] = new Smarty_variable(($tmp = @htmlspecialchars(fn_get_product_name($_smarty_tpl->tpl_vars['product']->value['product_id']), ENT_QUOTES, 'UTF-8', true)) === null || $tmp === '' ? $_smarty_tpl->__("deleted_product") : $tmp, null, 0); ?> <?php } ?> <?php echo $_smarty_tpl->getSubTemplate("pickers/products/js.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('options' => Smarty::$_smarty_vars['capture']['product_options'], 'root_id' => $_smarty_tpl->tpl_vars['data_id']->value, 'product' => $_smarty_tpl->tpl_vars['product_name']->value, 'delete_id' => $_smarty_tpl->tpl_vars['product_id']->value, 'product_id' => $_smarty_tpl->tpl_vars['product']->value['product_id'], 'amount' => $_smarty_tpl->tpl_vars['product']->value['amount'], 'amount_input' => "text", 'input_name' => (string) $_smarty_tpl->tpl_vars['input_name']->value . "[" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id'] . "]", 'options_array' => $_smarty_tpl->tpl_vars['product']->value['product_options']), 0); ?> <?php } ?> <?php } ?> </table> <?php } } ?> <?php if ($_smarty_tpl->tpl_vars['view_mode']->value != "list") { ?> <?php if ($_smarty_tpl->tpl_vars['extra_var']->value) { ?> <?php $_smarty_tpl->tpl_vars["extra_var"] = new Smarty_variable(rawurlencode($_smarty_tpl->tpl_vars['extra_var']->value), null, 0); ?> <?php } ?> <?php if (!$_smarty_tpl->tpl_vars['no_container']->value) { ?> <div class="buttons-container picker"><?php } if ($_smarty_tpl->tpl_vars['picker_view']->value) { ?> [<?php } ?> <div class="ty-mt-m"> <?php echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_id' => "opener_picker_" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'but_href' => "products.picker?display=" . (string) $_smarty_tpl->tpl_vars['display']->value . "&picker_for=" . (string) $_smarty_tpl->tpl_vars['picker_for']->value . "&extra=" . (string) $_smarty_tpl->tpl_vars['extra_var']->value . "&checkbox_name=" . (string) $_smarty_tpl->tpl_vars['checkbox_name']->value . "&aoc=" . (string) $_smarty_tpl->tpl_vars['aoc']->value . "&data_id=" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'but_text' => ($tmp = @$_smarty_tpl->tpl_vars['but_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("add_products") : $tmp, 'but_role' => ($tmp = @$_smarty_tpl->tpl_vars['but_role']->value) === null || $tmp === '' ? "add" : $tmp, 'but_target_id' => "content_" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'but_meta' => "ty-btn__secondary cm-dialog-opener", 'but_rel' => "nofollow", 'but_icon' => "product-picker-icon ty-icon-plus"), 0); ?> <?php if ($_smarty_tpl->tpl_vars['picker_view']->value) { ?> ]<?php } if (!$_smarty_tpl->tpl_vars['no_container']->value) { ?> </div><?php } ?> </div> <div class="hidden" id="content_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> " title="<?php echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['but_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("add_products") : $tmp, ENT_QUOTES, 'UTF-8'); ?> "> </div> <?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/products/picker.tpl" id="<?php echo smarty_function_set_id(array('name' => "pickers/products/picker.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 { $_smarty_tpl->tpl_vars["view_mode"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['view_mode']->value) === null || $tmp === '' ? "mixed" : $tmp, null, 0); if (!$_smarty_tpl->tpl_vars['display']->value) { ?> <?php $_smarty_tpl->tpl_vars["display"] = new Smarty_variable("options", null, 0); } ?> <?php echo smarty_function_script(array('src' => "js/tygh/picker.js"), $_smarty_tpl); ?> <?php if ($_smarty_tpl->tpl_vars['view_mode']->value != "button") { if ($_smarty_tpl->tpl_vars['type']->value == "table") { ?> <p id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> _no_item" class="ty-no-items<?php if ($_smarty_tpl->tpl_vars['item_ids']->value) { ?> hidden<?php } ?> "><?php echo ($tmp = @$_smarty_tpl->tpl_vars['no_item_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("no_items") : $tmp; ?> </p> <table id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="ty-table<?php if (!$_smarty_tpl->tpl_vars['item_ids']->value) { ?> hidden<?php } ?> cm-picker-options"> <thead> <tr> <th><?php echo $_smarty_tpl->__("name"); ?> </th> <th><?php echo $_smarty_tpl->__("quantity"); ?> </th> </tr> </thead> <?php echo $_smarty_tpl->getSubTemplate("pickers/products/js.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('clone' => true, 'options' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "options" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'root_id' => $_smarty_tpl->tpl_vars['data_id']->value, 'product' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "product" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'delete_id' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "delete_id" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'amount' => 1, 'amount_input' => "text", 'input_name' => (string) $_smarty_tpl->tpl_vars['input_name']->value . "[" . (string) $_smarty_tpl->tpl_vars['ldelim']->value . "product_id" . (string) $_smarty_tpl->tpl_vars['rdelim']->value . "]"), 0); ?> <?php if ($_smarty_tpl->tpl_vars['item_ids']->value) { ?> <?php $_smarty_tpl->tpl_vars["product"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["product"]->_loop = false; $_smarty_tpl->tpl_vars["product_id"] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['item_ids']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["product"]->key => $_smarty_tpl->tpl_vars["product"]->value) { $_smarty_tpl->tpl_vars["product"]->_loop = true; $_smarty_tpl->tpl_vars["product_id"]->value = $_smarty_tpl->tpl_vars["product"]->key; ?> <?php $_smarty_tpl->_capture_stack[0][] = array("product_options", null, null); ob_start(); ?> <?php $_smarty_tpl->tpl_vars["prod_opts"] = new Smarty_variable(fn_get_product_options($_smarty_tpl->tpl_vars['product']->value['product_id']), null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['prod_opts']->value && !$_smarty_tpl->tpl_vars['product']->value['product_options']) { ?> <strong><?php echo $_smarty_tpl->__("options"); ?> : </strong> <?php echo $_smarty_tpl->__("any_option_combinations"); ?> <?php } else { ?> <?php if ($_smarty_tpl->tpl_vars['product']->value['product_options_value']) { ?> <?php echo $_smarty_tpl->getSubTemplate("common/options_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_options' => $_smarty_tpl->tpl_vars['product']->value['product_options_value']), 0); ?> <?php } else { ?> <?php echo $_smarty_tpl->getSubTemplate("common/options_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_options' => fn_get_selected_product_options_info($_smarty_tpl->tpl_vars['product']->value['product_options'])), 0); ?> <?php } ?> <?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(); } ?> <?php if ($_smarty_tpl->tpl_vars['product']->value['product']) { ?> <?php $_smarty_tpl->tpl_vars["product_name"] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value['product'], null, 0); ?> <?php } else { ?> <?php $_smarty_tpl->tpl_vars["product_name"] = new Smarty_variable(($tmp = @htmlspecialchars(fn_get_product_name($_smarty_tpl->tpl_vars['product']->value['product_id']), ENT_QUOTES, 'UTF-8', true)) === null || $tmp === '' ? $_smarty_tpl->__("deleted_product") : $tmp, null, 0); ?> <?php } ?> <?php echo $_smarty_tpl->getSubTemplate("pickers/products/js.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('options' => Smarty::$_smarty_vars['capture']['product_options'], 'root_id' => $_smarty_tpl->tpl_vars['data_id']->value, 'product' => $_smarty_tpl->tpl_vars['product_name']->value, 'delete_id' => $_smarty_tpl->tpl_vars['product_id']->value, 'product_id' => $_smarty_tpl->tpl_vars['product']->value['product_id'], 'amount' => $_smarty_tpl->tpl_vars['product']->value['amount'], 'amount_input' => "text", 'input_name' => (string) $_smarty_tpl->tpl_vars['input_name']->value . "[" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id'] . "]", 'options_array' => $_smarty_tpl->tpl_vars['product']->value['product_options']), 0); ?> <?php } ?> <?php } ?> </table> <?php } } ?> <?php if ($_smarty_tpl->tpl_vars['view_mode']->value != "list") { ?> <?php if ($_smarty_tpl->tpl_vars['extra_var']->value) { ?> <?php $_smarty_tpl->tpl_vars["extra_var"] = new Smarty_variable(rawurlencode($_smarty_tpl->tpl_vars['extra_var']->value), null, 0); ?> <?php } ?> <?php if (!$_smarty_tpl->tpl_vars['no_container']->value) { ?> <div class="buttons-container picker"><?php } if ($_smarty_tpl->tpl_vars['picker_view']->value) { ?> [<?php } ?> <div class="ty-mt-m"> <?php echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_id' => "opener_picker_" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'but_href' => "products.picker?display=" . (string) $_smarty_tpl->tpl_vars['display']->value . "&picker_for=" . (string) $_smarty_tpl->tpl_vars['picker_for']->value . "&extra=" . (string) $_smarty_tpl->tpl_vars['extra_var']->value . "&checkbox_name=" . (string) $_smarty_tpl->tpl_vars['checkbox_name']->value . "&aoc=" . (string) $_smarty_tpl->tpl_vars['aoc']->value . "&data_id=" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'but_text' => ($tmp = @$_smarty_tpl->tpl_vars['but_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("add_products") : $tmp, 'but_role' => ($tmp = @$_smarty_tpl->tpl_vars['but_role']->value) === null || $tmp === '' ? "add" : $tmp, 'but_target_id' => "content_" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'but_meta' => "ty-btn__secondary cm-dialog-opener", 'but_rel' => "nofollow", 'but_icon' => "product-picker-icon ty-icon-plus"), 0); ?> <?php if ($_smarty_tpl->tpl_vars['picker_view']->value) { ?> ]<?php } if (!$_smarty_tpl->tpl_vars['no_container']->value) { ?> </div><?php } ?> </div> <div class="hidden" id="content_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> " title="<?php echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['but_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("add_products") : $tmp, ENT_QUOTES, 'UTF-8'); ?> "> </div> <?php } } }
function fn_buy_together_calculate($items, $auth = array()) { $total_price = 0; $product = fn_get_product_data($items['product_id'], $auth, CART_LANGUAGE, '', true, true, true, true); fn_gather_additional_product_data($product, true, true); $total_price += $product['price'] * $product['min_qty']; foreach ($items['item_data']['products'] as $hash => $product) { if (!is_integer($hash)) { continue; } $_product = fn_get_product_data($product['product_id'], $auth, CART_LANGUAGE, '', true, true, true, true); fn_gather_additional_product_data($_product, true, true); $price = $_product['price'] * $product['amount']; if (!empty($product['product_options'])) { $options = fn_get_selected_product_options_info($product['product_options'], DESCR_SL); if (!empty($options)) { foreach ($options as $option) { if ($option['modifier_type'] == 'A') { $price += $option['modifier'] * $product['amount']; } else { $price += ($_product['price'] + $_product['price'] * $option['modifier'] / 100) * $product['amount']; } } } } $total_price += $price; } $discounted_price = $total_price; switch ($items['discount_type']) { case 'to_fixed': $discounted_price = $items['discount_value']; $discount = $total_price - $items['discount_value']; break; case 'by_fixed': $discounted_price -= $items['discount_value']; $discount = $items['discount_value']; break; case 'to_percentage': $discounted_price = $discounted_price / 100 * $items['discount_value']; $discount = $total_price - $total_price / 100 * $items['discount_value']; break; case 'by_percentage': $discounted_price = $discounted_price - $discounted_price / 100 * $items['discount_value']; $discount = $total_price / 100 * $items['discount_value']; break; } if ($discounted_price < 0) { $discounted_price = 0; } if ($discount < 0 || $discount > $total_price) { $discount = $total_price; } return array(fn_format_price($total_price), fn_format_price($discount), fn_format_price($discounted_price)); }
function fn_fill_certificate_products(&$certificate_products, $stored_products = array(), $lang_code = CART_LANGUAGE) { if (!empty($certificate_products)) { foreach ($certificate_products as $cp_id => $cp) { if (!empty($stored_products)) { $ok = false; foreach ($stored_products as $sp_id => $sp) { if ($cp['product_id'] == $sp['product_id']) { if (!empty($cp['product_options']) && !empty($sp['extra']['product_options']) && array_diff($cp['product_options'], $sp['extra']['product_options']) == array() || empty($cp['product_options']) && empty($sp['extra']['product_options'])) { if (!empty($sp['extra']['product_options_value'])) { $certificate_products[$cp_id]['product_options_value'] = $sp['extra']['product_options_value']; } if (!empty($sp['extra']['product'])) { $certificate_products[$cp_id]['product'] = $sp['extra']['product']; } break; } } } } if (empty($certificate_products[$cp_id]['product_options_value']) && !empty($cp['product_options'])) { $certificate_products[$cp_id]['product_options_value'] = fn_get_selected_product_options_info($cp['product_options']); } if (empty($certificate_products[$cp_id]['product'])) { $certificate_products[$cp_id]['product'] = fn_get_product_name($cp['product_id'], $lang_code); } } } }
function fn_twg_api_get_cart_products($cart_items, $lang_code = CART_LANGUAGE) { if (empty($cart_items)) { return array(); } $api_products = array(); $image_params = TwigmoSettings::get('images.cart'); foreach ($cart_items as $k => $item) { $product = array('product' => db_get_field("SELECT product\n FROM ?:product_descriptions\n WHERE product_id = ?i AND lang_code = ?s", $item['product_id'], $lang_code), 'product_id' => $item['product_id'], 'cart_id' => $k, 'price' => $item['display_price'], 'exclude_from_calculate' => !empty($item['extra']['exclude_from_calculate']) ? $item['extra']['exclude_from_calculate'] : null, 'amount' => $item['amount'], 'company_id' => $item['company_id'], 'company_name' => fn_get_company_name($item['company_id']), 'extra' => !empty($item['extra']) ? $item['extra'] : array()); $qty_data = db_get_row('SELECT min_qty, max_qty, qty_step FROM ?:products WHERE product_id = ?i', $item['product_id']); $product = array_merge($product, $qty_data); $main_pair = !empty($item['main_pair']) ? $item['main_pair'] : fn_get_image_pairs($item['product_id'], 'product', 'M', true, true, $lang_code); if (!empty($main_pair)) { $product['icon'] = Api::getAsApiObject('images', TwigmoImage::getApiImageData($main_pair, 'product', 'icon', $image_params)); } if (!empty($item['product_options'])) { $advanced_options = fn_get_selected_product_options_info($item['product_options']); $api_options = Api::getAsList('cart_product_options', $advanced_options); if (!empty($api_options['option'])) { $product['product_options'] = $api_options['option']; } } $api_products[] = $product; } return $api_products; }
function content_55d31250106d44_89089488($_smarty_tpl) { if (!is_callable('smarty_modifier_truncate')) { include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/modifier.truncate.php'; } if (!is_callable('smarty_block_hook')) { include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/block.hook.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('edit', 'gift_certificate', 'remove', 'gift_certificate', 'gift_cert_to', 'gift_cert_from', 'amount', 'send_via', 'email', 'postal_mail', 'free_products', 'remove', 'price', 'qty', 'discount', 'tax', 'subtotal', 'price_summary', 'free', 'free', 'free', 'edit', 'gift_certificate', 'remove', 'gift_certificate', 'gift_cert_to', 'gift_cert_from', 'amount', 'send_via', 'email', 'postal_mail', 'free_products', 'remove', 'price', 'qty', 'discount', 'tax', 'subtotal', 'price_summary', 'free', 'free', 'free')); 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['cart']->value['gift_certificates']) { ?> <?php $_smarty_tpl->tpl_vars["c_url"] = new Smarty_variable(rawurlencode($_smarty_tpl->tpl_vars['config']->value['current_url']), null, 0); ?> <?php $_smarty_tpl->tpl_vars["gift"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["gift"]->_loop = false; $_smarty_tpl->tpl_vars["gift_key"] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['cart']->value['gift_certificates']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["gift"]->key => $_smarty_tpl->tpl_vars["gift"]->value) { $_smarty_tpl->tpl_vars["gift"]->_loop = true; $_smarty_tpl->tpl_vars["gift_key"]->value = $_smarty_tpl->tpl_vars["gift"]->key; $_smarty_tpl->tpl_vars["obj_id"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['gift']->value['object_id']) === null || $tmp === '' ? $_smarty_tpl->tpl_vars['gift_key']->value : $tmp, null, 0); if (!Smarty::$_smarty_vars['capture']['prods']) { ?> <?php $_smarty_tpl->_capture_stack[0][] = array("prods", null, null); ob_start(); ?> Y<?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(); } } ?> <tr> <td class="ty-cart-content__product-elem ty-cart-content__image-block"> <?php if ($_smarty_tpl->tpl_vars['runtime']->value['mode'] == "cart" || $_smarty_tpl->tpl_vars['show_images']->value) { ?> <div class="ty-cart-content__image cm-reload-<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> " id="product_image_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { ?> <a href="<?php echo htmlspecialchars(fn_url("gift_certificates.update?gift_cert_id=" . (string) $_smarty_tpl->tpl_vars['gift_key']->value), ENT_QUOTES, 'UTF-8'); ?> "> <?php echo $_smarty_tpl->getSubTemplate("addons/gift_certificates/views/gift_certificates/components/gift_certificates_cart_icon.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('width' => $_smarty_tpl->tpl_vars['settings']->value['Thumbnails']['product_cart_thumbnail_width'], 'height' => $_smarty_tpl->tpl_vars['settings']->value['Thumbnails']['product_cart_thumbnail_height']), 0); ?> </a> <div class="ty-mtb-xs ty-center"><?php echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_text' => __("edit"), 'but_href' => "gift_certificates.update?gift_cert_id=" . (string) $_smarty_tpl->tpl_vars['gift_key']->value, 'but_role' => "text"), 0); ?> </div> <?php } else { ?> <?php echo $_smarty_tpl->getSubTemplate("addons/gift_certificates/views/gift_certificates/components/gift_certificates_cart_icon.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('width' => $_smarty_tpl->tpl_vars['settings']->value['Thumbnails']['product_cart_thumbnail_width'], 'height' => $_smarty_tpl->tpl_vars['settings']->value['Thumbnails']['product_cart_thumbnail_height']), 0); ?> <?php } ?> <!--product_image_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> --></div> <?php } ?> </td> <td class="ty-cart-content__product-elem ty-cart-content__description" style="width: 50%;"> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { ?> <a href="<?php echo htmlspecialchars(fn_url("gift_certificates.update?gift_cert_id=" . (string) $_smarty_tpl->tpl_vars['gift_key']->value), ENT_QUOTES, 'UTF-8'); ?> " class="ty-cart-content__product-title"> <?php echo $_smarty_tpl->__("gift_certificate"); ?> </a> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { ?> <a class="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['ajax_class']->value, ENT_QUOTES, 'UTF-8'); ?> ty-delete-big" href="<?php echo htmlspecialchars(fn_url("gift_certificates.delete?gift_cert_id=" . (string) $_smarty_tpl->tpl_vars['gift_key']->value . "&redirect_url=" . (string) $_smarty_tpl->tpl_vars['c_url']->value), ENT_QUOTES, 'UTF-8'); ?> " data-ca-target-id="cart_items,checkout_totals,cart_status*,checkout_steps,checkout_cart" title="<?php echo $_smarty_tpl->__("remove"); ?> "> <i class="ty-delete-big__icon ty-icon-cancel-circle"></i> </a> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['use_ajax']->value == true && $_smarty_tpl->tpl_vars['cart']->value['amount'] != 1) { ?> <?php $_smarty_tpl->tpl_vars["ajax_class"] = new Smarty_variable("cm-ajax", null, 0); ?> <?php } ?> <?php } else { ?> <strong><?php echo $_smarty_tpl->__("gift_certificate"); ?> </strong> <?php } ?> <div class="ty-control-group"> <label class="ty-control-group__label"><?php echo $_smarty_tpl->__("gift_cert_to"); ?> :</label><span class="ty-control-group__item"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['gift']->value['recipient'], ENT_QUOTES, 'UTF-8'); ?> </span> </div> <div class="ty-control-group"> <label class="ty-control-group__label"><?php echo $_smarty_tpl->__("gift_cert_from"); ?> :</label><span class="ty-control-group__item"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['gift']->value['sender'], ENT_QUOTES, 'UTF-8'); ?> </span> </div> <div class="ty-control-group"> <label class="ty-control-group__label"><?php echo $_smarty_tpl->__("amount"); ?> :</label><span class="ty-control-group__item"><?php echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['gift']->value['amount']), 0); ?> </span> </div> <div class="ty-control-group"> <label class="ty-control-group__label"><?php echo $_smarty_tpl->__("send_via"); ?> :</label><span class="ty-control-group__item"><?php if ($_smarty_tpl->tpl_vars['gift']->value['send_via'] == "E") { echo $_smarty_tpl->__("email"); } else { echo $_smarty_tpl->__("postal_mail"); } ?> </span> </div> <?php if ($_smarty_tpl->tpl_vars['gift']->value['products'] && $_smarty_tpl->tpl_vars['addons']->value['gift_certificates']['free_products_allow'] == "Y" && !$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { ?> <a id="sw_gift_products_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['gift_key']->value, ENT_QUOTES, 'UTF-8'); ?> " class="cm-combination ty-cart-content__detailed-link"><?php echo $_smarty_tpl->__("free_products"); ?> </a> <div id="gift_products_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['gift_key']->value, ENT_QUOTES, 'UTF-8'); ?> " class="hidden"> <div class="ty-cart-content-products"> <div class="ty-caret-info"><span class="ty-caret-outer"></span> <span class="ty-caret-inner"></span></div> <?php $_smarty_tpl->tpl_vars["product"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["product"]->_loop = false; $_smarty_tpl->tpl_vars["key"] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['cart_products']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["product"]->key => $_smarty_tpl->tpl_vars["product"]->value) { $_smarty_tpl->tpl_vars["product"]->_loop = true; $_smarty_tpl->tpl_vars["key"]->value = $_smarty_tpl->tpl_vars["product"]->key; ?> <?php if ($_smarty_tpl->tpl_vars['cart']->value['products'][$_smarty_tpl->tpl_vars['key']->value]['extra']['parent']['certificate'] == $_smarty_tpl->tpl_vars['gift_key']->value) { ?> <div class="ty-cart-content-products__item"> <div> <a href="<?php echo htmlspecialchars(fn_url("products.view?product_id=" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id']), ENT_QUOTES, 'UTF-8'); ?> " title="<?php echo $_smarty_tpl->tpl_vars['product']->value['product']; ?> "><?php echo smarty_modifier_truncate(preg_replace('!<[^>]*?>!', ' ', $_smarty_tpl->tpl_vars['product']->value['product']), 70, "...", true); ?> </a> <?php if ($_smarty_tpl->tpl_vars['use_ajax']->value == true) { ?> <?php $_smarty_tpl->tpl_vars["ajax_class"] = new Smarty_variable("cm-ajax", null, 0); ?> <?php } ?> <a class="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['ajax_class']->value, ENT_QUOTES, 'UTF-8'); ?> ty-delete-big" href="<?php echo htmlspecialchars(fn_url("checkout.delete?cart_id=" . (string) $_smarty_tpl->tpl_vars['key']->value . "&redirect_url=" . (string) $_smarty_tpl->tpl_vars['c_url']->value), ENT_QUOTES, 'UTF-8'); ?> " data-ca-target-id="cart_items,checkout_totals,cart_status*,checkout_steps" title="<?php echo $_smarty_tpl->__("remove"); ?> "><i class="ty-delete-big__icon ty-icon-cancel-circle"></i></a> <?php echo $_smarty_tpl->getSubTemplate("common/options_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_options' => fn_get_selected_product_options_info($_smarty_tpl->tpl_vars['cart']->value['products'][$_smarty_tpl->tpl_vars['key']->value]['product_options']), 'fields_prefix' => "cart_products[" . (string) $_smarty_tpl->tpl_vars['key']->value . "][product_options]"), 0); ?> <?php $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "checkout:product_info")); $_block_repeat = true; echo smarty_block_hook(array('name' => "checkout:product_info"), null, $_smarty_tpl, $_block_repeat); while ($_block_repeat) { ob_start(); $_block_content = ob_get_clean(); $_block_repeat = false; echo smarty_block_hook(array('name' => "checkout:product_info"), $_block_content, $_smarty_tpl, $_block_repeat); } array_pop($_smarty_tpl->smarty->_tag_stack); ?> <input type="hidden" name="cart_products[<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['key']->value, ENT_QUOTES, 'UTF-8'); ?> ][extra][parent][certificate]" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['gift_key']->value, ENT_QUOTES, 'UTF-8'); ?> " /> </div> <div class="ty-control-group"> <strong class="ty-control-group__label"><?php echo $_smarty_tpl->__("price"); ?> </strong> <span class="ty-control-group__item"> <?php echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['product']->value['original_price']), 0); ?> </span> </div> <div class="ty-control-group"> <strong class="ty-control-group__label"><?php echo $_smarty_tpl->__("qty"); ?> </strong> <input type="text" size="3" name="cart_products[<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['key']->value, ENT_QUOTES, 'UTF-8'); ?> ][amount]" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['amount'], ENT_QUOTES, 'UTF-8'); ?> " class="ty-input-text-short" <?php if ($_smarty_tpl->tpl_vars['product']->value['is_edp'] == "Y") { ?> readonly="readonly"<?php } ?> /> <input type="hidden" name="cart_products[<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['key']->value, ENT_QUOTES, 'UTF-8'); ?> ][product_id]" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product_id'], ENT_QUOTES, 'UTF-8'); ?> " /> </div> <?php if ($_smarty_tpl->tpl_vars['cart']->value['use_discount']) { ?> <div class="ty-control-group"> <strong class="ty-control-group__label"><?php echo $_smarty_tpl->__("discount"); ?> </strong> <span class="ty-control-group__item"> <?php if (floatval($_smarty_tpl->tpl_vars['product']->value['discount'])) { echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['product']->value['discount']), 0); } else { ?> -<?php } ?> </span> </div> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['cart']->value['taxes'] && $_smarty_tpl->tpl_vars['settings']->value['General']['tax_calculation'] != "subtotal") { ?> <div class="ty-control-group"> <strong class="ty-control-group__label"><?php echo $_smarty_tpl->__("tax"); ?> </strong> <span class="ty-control-group__item"> <?php echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['product']->value['tax_summary']['total']), 0); ?> </span> </div> <?php } ?> <div class="ty-control-group"> <strong class="ty-control-group__label"><?php echo $_smarty_tpl->__("subtotal"); ?> </strong> <span class="ty-control-group__item"> <?php echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['product']->value['display_subtotal']), 0); ?> </span> </div> </div> <?php } ?> <?php } ?> </div> <div class="ty-control-group ty-float-right"> <strong><?php echo $_smarty_tpl->__("price_summary"); ?> : </strong> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['gift']->value['display_subtotal'], 'class' => "ty-price"), 0); } else { ?> <span class="ty-price"><?php echo $_smarty_tpl->__("free"); ?> </span><?php } ?> </div> <div class="clearfix"></div> </div> <?php } ?> </td> <td class="ty-cart-content__product-elem ty-cart-content__price cm-reload-<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> " id="price_display_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['gift']->value['display_subtotal'], 'class' => "ty-sub-price"), 0); } else { ?> <span class="ty-price"><?php echo $_smarty_tpl->__("free"); ?> </span><?php } ?> <!--price_display_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> --></td> <td class="ty-cart-content__product-elem ty-cart-content__qty"> </td> <td class="ty-cart-content__product-elem ty-cart-content__price cm-reload-<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> " id="price_subtotal_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['gift']->value['display_subtotal'], 'class' => "price"), 0); } else { ?> <span class="ty-price"><?php echo $_smarty_tpl->__("free"); ?> </span><?php } ?> <!--price_subtotal_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> --></td> </tr> <?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="addons/gift_certificates/hooks/checkout/extra_list.post.tpl" id="<?php echo smarty_function_set_id(array('name' => "addons/gift_certificates/hooks/checkout/extra_list.post.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['cart']->value['gift_certificates']) { ?> <?php $_smarty_tpl->tpl_vars["c_url"] = new Smarty_variable(rawurlencode($_smarty_tpl->tpl_vars['config']->value['current_url']), null, 0); ?> <?php $_smarty_tpl->tpl_vars["gift"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["gift"]->_loop = false; $_smarty_tpl->tpl_vars["gift_key"] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['cart']->value['gift_certificates']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["gift"]->key => $_smarty_tpl->tpl_vars["gift"]->value) { $_smarty_tpl->tpl_vars["gift"]->_loop = true; $_smarty_tpl->tpl_vars["gift_key"]->value = $_smarty_tpl->tpl_vars["gift"]->key; $_smarty_tpl->tpl_vars["obj_id"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['gift']->value['object_id']) === null || $tmp === '' ? $_smarty_tpl->tpl_vars['gift_key']->value : $tmp, null, 0); if (!Smarty::$_smarty_vars['capture']['prods']) { ?> <?php $_smarty_tpl->_capture_stack[0][] = array("prods", null, null); ob_start(); ?> Y<?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(); } } ?> <tr> <td class="ty-cart-content__product-elem ty-cart-content__image-block"> <?php if ($_smarty_tpl->tpl_vars['runtime']->value['mode'] == "cart" || $_smarty_tpl->tpl_vars['show_images']->value) { ?> <div class="ty-cart-content__image cm-reload-<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> " id="product_image_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { ?> <a href="<?php echo htmlspecialchars(fn_url("gift_certificates.update?gift_cert_id=" . (string) $_smarty_tpl->tpl_vars['gift_key']->value), ENT_QUOTES, 'UTF-8'); ?> "> <?php echo $_smarty_tpl->getSubTemplate("addons/gift_certificates/views/gift_certificates/components/gift_certificates_cart_icon.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('width' => $_smarty_tpl->tpl_vars['settings']->value['Thumbnails']['product_cart_thumbnail_width'], 'height' => $_smarty_tpl->tpl_vars['settings']->value['Thumbnails']['product_cart_thumbnail_height']), 0); ?> </a> <div class="ty-mtb-xs ty-center"><?php echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_text' => __("edit"), 'but_href' => "gift_certificates.update?gift_cert_id=" . (string) $_smarty_tpl->tpl_vars['gift_key']->value, 'but_role' => "text"), 0); ?> </div> <?php } else { ?> <?php echo $_smarty_tpl->getSubTemplate("addons/gift_certificates/views/gift_certificates/components/gift_certificates_cart_icon.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('width' => $_smarty_tpl->tpl_vars['settings']->value['Thumbnails']['product_cart_thumbnail_width'], 'height' => $_smarty_tpl->tpl_vars['settings']->value['Thumbnails']['product_cart_thumbnail_height']), 0); ?> <?php } ?> <!--product_image_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> --></div> <?php } ?> </td> <td class="ty-cart-content__product-elem ty-cart-content__description" style="width: 50%;"> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { ?> <a href="<?php echo htmlspecialchars(fn_url("gift_certificates.update?gift_cert_id=" . (string) $_smarty_tpl->tpl_vars['gift_key']->value), ENT_QUOTES, 'UTF-8'); ?> " class="ty-cart-content__product-title"> <?php echo $_smarty_tpl->__("gift_certificate"); ?> </a> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { ?> <a class="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['ajax_class']->value, ENT_QUOTES, 'UTF-8'); ?> ty-delete-big" href="<?php echo htmlspecialchars(fn_url("gift_certificates.delete?gift_cert_id=" . (string) $_smarty_tpl->tpl_vars['gift_key']->value . "&redirect_url=" . (string) $_smarty_tpl->tpl_vars['c_url']->value), ENT_QUOTES, 'UTF-8'); ?> " data-ca-target-id="cart_items,checkout_totals,cart_status*,checkout_steps,checkout_cart" title="<?php echo $_smarty_tpl->__("remove"); ?> "> <i class="ty-delete-big__icon ty-icon-cancel-circle"></i> </a> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['use_ajax']->value == true && $_smarty_tpl->tpl_vars['cart']->value['amount'] != 1) { ?> <?php $_smarty_tpl->tpl_vars["ajax_class"] = new Smarty_variable("cm-ajax", null, 0); ?> <?php } ?> <?php } else { ?> <strong><?php echo $_smarty_tpl->__("gift_certificate"); ?> </strong> <?php } ?> <div class="ty-control-group"> <label class="ty-control-group__label"><?php echo $_smarty_tpl->__("gift_cert_to"); ?> :</label><span class="ty-control-group__item"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['gift']->value['recipient'], ENT_QUOTES, 'UTF-8'); ?> </span> </div> <div class="ty-control-group"> <label class="ty-control-group__label"><?php echo $_smarty_tpl->__("gift_cert_from"); ?> :</label><span class="ty-control-group__item"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['gift']->value['sender'], ENT_QUOTES, 'UTF-8'); ?> </span> </div> <div class="ty-control-group"> <label class="ty-control-group__label"><?php echo $_smarty_tpl->__("amount"); ?> :</label><span class="ty-control-group__item"><?php echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['gift']->value['amount']), 0); ?> </span> </div> <div class="ty-control-group"> <label class="ty-control-group__label"><?php echo $_smarty_tpl->__("send_via"); ?> :</label><span class="ty-control-group__item"><?php if ($_smarty_tpl->tpl_vars['gift']->value['send_via'] == "E") { echo $_smarty_tpl->__("email"); } else { echo $_smarty_tpl->__("postal_mail"); } ?> </span> </div> <?php if ($_smarty_tpl->tpl_vars['gift']->value['products'] && $_smarty_tpl->tpl_vars['addons']->value['gift_certificates']['free_products_allow'] == "Y" && !$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { ?> <a id="sw_gift_products_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['gift_key']->value, ENT_QUOTES, 'UTF-8'); ?> " class="cm-combination ty-cart-content__detailed-link"><?php echo $_smarty_tpl->__("free_products"); ?> </a> <div id="gift_products_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['gift_key']->value, ENT_QUOTES, 'UTF-8'); ?> " class="hidden"> <div class="ty-cart-content-products"> <div class="ty-caret-info"><span class="ty-caret-outer"></span> <span class="ty-caret-inner"></span></div> <?php $_smarty_tpl->tpl_vars["product"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["product"]->_loop = false; $_smarty_tpl->tpl_vars["key"] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['cart_products']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["product"]->key => $_smarty_tpl->tpl_vars["product"]->value) { $_smarty_tpl->tpl_vars["product"]->_loop = true; $_smarty_tpl->tpl_vars["key"]->value = $_smarty_tpl->tpl_vars["product"]->key; ?> <?php if ($_smarty_tpl->tpl_vars['cart']->value['products'][$_smarty_tpl->tpl_vars['key']->value]['extra']['parent']['certificate'] == $_smarty_tpl->tpl_vars['gift_key']->value) { ?> <div class="ty-cart-content-products__item"> <div> <a href="<?php echo htmlspecialchars(fn_url("products.view?product_id=" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id']), ENT_QUOTES, 'UTF-8'); ?> " title="<?php echo $_smarty_tpl->tpl_vars['product']->value['product']; ?> "><?php echo smarty_modifier_truncate(preg_replace('!<[^>]*?>!', ' ', $_smarty_tpl->tpl_vars['product']->value['product']), 70, "...", true); ?> </a> <?php if ($_smarty_tpl->tpl_vars['use_ajax']->value == true) { ?> <?php $_smarty_tpl->tpl_vars["ajax_class"] = new Smarty_variable("cm-ajax", null, 0); ?> <?php } ?> <a class="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['ajax_class']->value, ENT_QUOTES, 'UTF-8'); ?> ty-delete-big" href="<?php echo htmlspecialchars(fn_url("checkout.delete?cart_id=" . (string) $_smarty_tpl->tpl_vars['key']->value . "&redirect_url=" . (string) $_smarty_tpl->tpl_vars['c_url']->value), ENT_QUOTES, 'UTF-8'); ?> " data-ca-target-id="cart_items,checkout_totals,cart_status*,checkout_steps" title="<?php echo $_smarty_tpl->__("remove"); ?> "><i class="ty-delete-big__icon ty-icon-cancel-circle"></i></a> <?php echo $_smarty_tpl->getSubTemplate("common/options_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_options' => fn_get_selected_product_options_info($_smarty_tpl->tpl_vars['cart']->value['products'][$_smarty_tpl->tpl_vars['key']->value]['product_options']), 'fields_prefix' => "cart_products[" . (string) $_smarty_tpl->tpl_vars['key']->value . "][product_options]"), 0); ?> <?php $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "checkout:product_info")); $_block_repeat = true; echo smarty_block_hook(array('name' => "checkout:product_info"), null, $_smarty_tpl, $_block_repeat); while ($_block_repeat) { ob_start(); $_block_content = ob_get_clean(); $_block_repeat = false; echo smarty_block_hook(array('name' => "checkout:product_info"), $_block_content, $_smarty_tpl, $_block_repeat); } array_pop($_smarty_tpl->smarty->_tag_stack); ?> <input type="hidden" name="cart_products[<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['key']->value, ENT_QUOTES, 'UTF-8'); ?> ][extra][parent][certificate]" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['gift_key']->value, ENT_QUOTES, 'UTF-8'); ?> " /> </div> <div class="ty-control-group"> <strong class="ty-control-group__label"><?php echo $_smarty_tpl->__("price"); ?> </strong> <span class="ty-control-group__item"> <?php echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['product']->value['original_price']), 0); ?> </span> </div> <div class="ty-control-group"> <strong class="ty-control-group__label"><?php echo $_smarty_tpl->__("qty"); ?> </strong> <input type="text" size="3" name="cart_products[<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['key']->value, ENT_QUOTES, 'UTF-8'); ?> ][amount]" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['amount'], ENT_QUOTES, 'UTF-8'); ?> " class="ty-input-text-short" <?php if ($_smarty_tpl->tpl_vars['product']->value['is_edp'] == "Y") { ?> readonly="readonly"<?php } ?> /> <input type="hidden" name="cart_products[<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['key']->value, ENT_QUOTES, 'UTF-8'); ?> ][product_id]" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product_id'], ENT_QUOTES, 'UTF-8'); ?> " /> </div> <?php if ($_smarty_tpl->tpl_vars['cart']->value['use_discount']) { ?> <div class="ty-control-group"> <strong class="ty-control-group__label"><?php echo $_smarty_tpl->__("discount"); ?> </strong> <span class="ty-control-group__item"> <?php if (floatval($_smarty_tpl->tpl_vars['product']->value['discount'])) { echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['product']->value['discount']), 0); } else { ?> -<?php } ?> </span> </div> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['cart']->value['taxes'] && $_smarty_tpl->tpl_vars['settings']->value['General']['tax_calculation'] != "subtotal") { ?> <div class="ty-control-group"> <strong class="ty-control-group__label"><?php echo $_smarty_tpl->__("tax"); ?> </strong> <span class="ty-control-group__item"> <?php echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['product']->value['tax_summary']['total']), 0); ?> </span> </div> <?php } ?> <div class="ty-control-group"> <strong class="ty-control-group__label"><?php echo $_smarty_tpl->__("subtotal"); ?> </strong> <span class="ty-control-group__item"> <?php echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['product']->value['display_subtotal']), 0); ?> </span> </div> </div> <?php } ?> <?php } ?> </div> <div class="ty-control-group ty-float-right"> <strong><?php echo $_smarty_tpl->__("price_summary"); ?> : </strong> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['gift']->value['display_subtotal'], 'class' => "ty-price"), 0); } else { ?> <span class="ty-price"><?php echo $_smarty_tpl->__("free"); ?> </span><?php } ?> </div> <div class="clearfix"></div> </div> <?php } ?> </td> <td class="ty-cart-content__product-elem ty-cart-content__price cm-reload-<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> " id="price_display_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['gift']->value['display_subtotal'], 'class' => "ty-sub-price"), 0); } else { ?> <span class="ty-price"><?php echo $_smarty_tpl->__("free"); ?> </span><?php } ?> <!--price_display_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> --></td> <td class="ty-cart-content__product-elem ty-cart-content__qty"> </td> <td class="ty-cart-content__product-elem ty-cart-content__price cm-reload-<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> " id="price_subtotal_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <?php if (!$_smarty_tpl->tpl_vars['gift']->value['extra']['exclude_from_calculate']) { echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['gift']->value['display_subtotal'], 'class' => "price"), 0); } else { ?> <span class="ty-price"><?php echo $_smarty_tpl->__("free"); ?> </span><?php } ?> <!--price_subtotal_update_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['obj_id']->value, ENT_QUOTES, 'UTF-8'); ?> --></td> </tr> <?php } ?> <?php } } }
} fn_order_placement_routines('route', $order_id, false); exit; } elseif (!empty($_payment_id) && !fn_cart_is_empty($cart)) { $base_domain = 'https://' . ($processor_data['processor_params']['test'] != 'Y' ? 'payments.amazon.com' : 'payments-sandbox.amazon.com'); $merchant_id = $processor_data['processor_params']['merchant_id']; $_currency = $processor_data['processor_params']['currency']; $amazon_products = $cart['products']; fn_set_hook('amazon_products', $amazon_products, $cart); // Get cart items $amazon_order = array(); foreach ($amazon_products as $key => $product) { // Get product options $item_options = ' '; if (!empty($product['product_options'])) { $_options = fn_get_selected_product_options_info($cart['products'][$key]['product_options']); foreach ($_options as $opt) { $item_options .= $opt['option_name'] . ': ' . $opt['variant_name'] . '; '; } $item_options = ' [' . trim($item_options, '; ') . ']'; } $amazon_order['Cart']['Items']['Item'][] = array('SKU' => empty($product['product_code']) ? 'pid_' . $product['product_id'] : substr(strip_tags($product['product_code']), 0, 250), 'MerchantId' => $processor_data['processor_params']['merchant_id'], 'Title' => substr(strip_tags($product['product']), 0, 250) . $item_options, 'Price' => array('Amount' => fn_format_price($product['price']), 'CurrencyCode' => $_currency), 'Quantity' => $product['amount'], 'ItemCustomData' => array('CartID' => $key)); } $amazon_order['Cart']['CartCustomData'] = array('ClientRequestId' => base64_encode(Tygh::$app['session']->getID() . ';' . $_payment_id)); // Activate the Amazon callbacks functionality $amazon_order['ReturnUrl'] = Registry::get('config.http_location') . '/' . Registry::get('config.customer_index') . '?dispatch=payment_notification.placement&payment=amazon_checkout'; $amazon_order['CancelUrl'] = fn_url('checkout.cart'); $amazon_order['OrderCalculationCallbacks'] = array('CalculateTaxRates' => 'true', 'CalculatePromotions' => 'true', 'CalculateShippingRates' => 'true', 'OrderCallbackEndpoint' => Registry::get('config.origin_http_location') . '/app/payments/amazon_checkout.php', 'ProcessOrderOnCallbackFailure' => $processor_data['processor_params']['process_on_failure'] == 'Y' ? 'true' : 'false'); $amazon_order['DisablePromotionCode'] = 'true'; $amazon_cart = '<?xml version="1.0" encoding="UTF-8"?>' . '<Order xmlns="http://payments.amazon.com/checkout/2009-05-15/">' . fn_array_to_xml($amazon_order) . '</Order>'; // Calculate cart signature
function fn_get_order_info($order_id, $native_language = false, $format_info = true, $get_edp_files = false, $skip_static_values = false) { if (!empty($order_id)) { $condition = fn_get_company_condition('?:orders.company_id'); $order = db_get_row("SELECT * FROM ?:orders WHERE ?:orders.order_id = ?i {$condition}", $order_id); if (!empty($order)) { $lang_code = $native_language == true ? $order['lang_code'] : CART_LANGUAGE; if (isset($order['ip_address'])) { $order['ip_address'] = fn_ip_from_db($order['ip_address']); } $order['payment_method'] = fn_get_payment_method_data($order['payment_id'], $lang_code); // Get additional profile fields $additional_fields = db_get_hash_single_array("SELECT field_id, value FROM ?:profile_fields_data " . "WHERE object_id = ?i AND object_type = 'O'", array('field_id', 'value'), $order_id); $order['fields'] = $additional_fields; $order['products'] = db_get_hash_array("SELECT ?:order_details.*, ?:product_descriptions.product, ?:products.status as product_status FROM ?:order_details " . "LEFT JOIN ?:product_descriptions ON ?:order_details.product_id = ?:product_descriptions.product_id AND ?:product_descriptions.lang_code = ?s " . "LEFT JOIN ?:products ON ?:order_details.product_id = ?:products.product_id " . "WHERE ?:order_details.order_id = ?i ORDER BY ?:product_descriptions.product", 'item_id', $lang_code, $order_id); $order['promotions'] = unserialize($order['promotions']); if (!empty($order['promotions'])) { // collect additional data $params = array('promotion_id' => array_keys($order['promotions'])); list($promotions) = fn_get_promotions($params); foreach ($promotions as $pr_id => $p) { $order['promotions'][$pr_id]['name'] = $p['name']; $order['promotions'][$pr_id]['short_description'] = $p['short_description']; } } // Get additional data $additional_data = db_get_hash_single_array("SELECT type, data FROM ?:order_data WHERE order_id = ?i", array('type', 'data'), $order_id); $order['taxes'] = array(); $order['tax_subtotal'] = 0; $order['display_shipping_cost'] = $order['shipping_cost']; // Replace country, state and title values with their descriptions $order_company_id = isset($order['company_id']) ? $order['company_id'] : ''; // company_id will be rewritten by user field, so need to save it. fn_add_user_data_descriptions($order, $lang_code); $order['company_id'] = $order_company_id; $order['need_shipping'] = false; $deps = array(); // Get shipping information if (!empty($additional_data['L'])) { $order['shipping'] = unserialize($additional_data['L']); foreach ($order['shipping'] as $key => $v) { $shipping_id = isset($v['shipping_id']) ? $v['shipping_id'] : 0; $shipping_name = fn_get_shipping_name($shipping_id, $lang_code); if ($shipping_name) { $order['shipping'][$key]['shipping'] = $shipping_name; } } } if (!fn_allowed_for('ULTIMATE:FREE')) { // Get shipments common information $order['shipment_ids'] = db_get_fields("SELECT sh.shipment_id FROM ?:shipments AS sh LEFT JOIN ?:shipment_items AS s_items ON (sh.shipment_id = s_items.shipment_id) " . "WHERE s_items.order_id = ?i GROUP BY s_items.shipment_id", $order_id); $_products = db_get_array("SELECT item_id, SUM(amount) AS amount FROM ?:shipment_items WHERE order_id = ?i GROUP BY item_id", $order_id); $shipped_products = array(); if (!empty($_products)) { foreach ($_products as $_product) { $shipped_products[$_product['item_id']] = $_product['amount']; } } unset($_products); } foreach ($order['products'] as $k => $v) { //Check for product existance if (empty($v['product'])) { $order['products'][$k]['deleted_product'] = true; } else { $order['products'][$k]['deleted_product'] = false; } $order['products'][$k]['discount'] = 0; $v['extra'] = @unserialize($v['extra']); if ($order['products'][$k]['deleted_product'] == true && !empty($v['extra']['product'])) { $order['products'][$k]['product'] = $v['extra']['product']; } else { $order['products'][$k]['product'] = fn_get_product_name($v['product_id'], $lang_code); } $order['products'][$k]['company_id'] = empty($v['extra']['company_id']) ? 0 : $v['extra']['company_id']; if (!empty($v['extra']['discount']) && floatval($v['extra']['discount'])) { $order['products'][$k]['discount'] = $v['extra']['discount']; $order['use_discount'] = true; } if (!empty($v['extra']['promotions'])) { $order['products'][$k]['promotions'] = $v['extra']['promotions']; } if (isset($v['extra']['base_price'])) { $order['products'][$k]['base_price'] = floatval($v['extra']['base_price']); } else { $order['products'][$k]['base_price'] = $v['price']; } $order['products'][$k]['original_price'] = $order['products'][$k]['base_price']; // Form hash key for this product $order['products'][$k]['cart_id'] = $v['item_id']; $deps['P_' . $order['products'][$k]['cart_id']] = $k; // Unserialize and collect product options information if (!empty($v['extra']['product_options'])) { if ($format_info == true) { if (!empty($v['extra']['product_options_value'])) { $order['products'][$k]['product_options'] = $v['extra']['product_options_value']; } else { $order['products'][$k]['product_options'] = fn_get_selected_product_options_info($v['extra']['product_options'], $lang_code); } } $product_options_value = $skip_static_values == false && !empty($v['extra']['product_options_value']) ? $v['extra']['product_options_value'] : array(); if (empty($v['extra']['stored_price']) || !empty($v['extra']['stored_price']) && $v['extra']['stored_price'] != 'Y') { // apply modifiers if this is not the custom price $order['products'][$k]['original_price'] = fn_apply_options_modifiers($v['extra']['product_options'], $order['products'][$k]['base_price'], 'P', $product_options_value, array('product_data' => $v)); } } $order['products'][$k]['extra'] = $v['extra']; $order['products'][$k]['tax_value'] = 0; $order['products'][$k]['display_subtotal'] = $order['products'][$k]['subtotal'] = $v['price'] * $v['amount']; // Get information about edp if ($get_edp_files == true && $order['products'][$k]['extra']['is_edp'] == 'Y') { $order['products'][$k]['files'] = db_get_array("SELECT ?:product_files.file_id, ?:product_files.activation_type, ?:product_files.max_downloads, " . "?:product_file_descriptions.file_name, ?:product_file_ekeys.active, ?:product_file_ekeys.downloads, " . "?:product_file_ekeys.ekey, ?:product_file_ekeys.ttl FROM ?:product_files " . "LEFT JOIN ?:product_file_descriptions ON ?:product_file_descriptions.file_id = ?:product_files.file_id " . "AND ?:product_file_descriptions.lang_code = ?s " . "LEFT JOIN ?:product_file_ekeys ON ?:product_file_ekeys.file_id = ?:product_files.file_id " . "AND ?:product_file_ekeys.order_id = ?i WHERE ?:product_files.product_id = ?i", $lang_code, $order_id, $v['product_id']); } // Get shipments information // If current edition is FREE, we still need to check shipments accessibility (need to display promotion link) if (isset($shipped_products[$k])) { $order['products'][$k]['shipped_amount'] = $shipped_products[$k]; $order['products'][$k]['shipment_amount'] = $v['amount'] - $shipped_products[$k]; } else { $order['products'][$k]['shipped_amount'] = 0; $order['products'][$k]['shipment_amount'] = $v['amount']; } if ($order['products'][$k]['shipped_amount'] < $order['products'][$k]['amount']) { if (!empty($order['shipping'])) { $group_key = empty($v['extra']['group_key']) ? 0 : $v['extra']['group_key']; $order['shipping'][$group_key]['need_shipment'] = true; } else { $order['need_shipment'] = true; } } // Check if the order needs the shipping method if (!($v['extra']['is_edp'] == 'Y' && (!isset($v['extra']['edp_shipping']) || $v['extra']['edp_shipping'] != 'Y'))) { $order['need_shipping'] = true; } // Adds flag that defines if product page is available $order['products'][$k]['is_accessible'] = fn_is_accessible_product($v); fn_set_hook('get_order_items_info_post', $order, $v, $k); } // Unserialize and collect taxes information if (!empty($additional_data['T'])) { $order['taxes'] = unserialize($additional_data['T']); if (is_array($order['taxes'])) { foreach ($order['taxes'] as $tax_id => $tax_data) { if (Registry::get('settings.General.tax_calculation') == 'unit_price') { foreach ($tax_data['applies'] as $_id => $value) { if (strpos($_id, 'P_') !== false && isset($deps[$_id])) { $order['products'][$deps[$_id]]['tax_value'] += $value; if ($tax_data['price_includes_tax'] != 'Y') { $order['products'][$deps[$_id]]['subtotal'] += $value; $order['products'][$deps[$_id]]['display_subtotal'] += Registry::get('settings.Appearance.cart_prices_w_taxes') == 'Y' ? $value : 0; } } if (strpos($_id, 'S_') !== false) { if ($tax_data['price_includes_tax'] != 'Y') { $order['shipping_cost'] += $value; $order['display_shipping_cost'] += Registry::get('settings.Appearance.cart_prices_w_taxes') == 'Y' ? $value : 0; } } } } if ($tax_data['price_includes_tax'] != 'Y') { $order['tax_subtotal'] += $tax_data['tax_subtotal']; } } } else { $order['taxes'] = array(); } } if (!empty($additional_data['C'])) { $order['coupons'] = unserialize($additional_data['C']); } if (!empty($additional_data['R'])) { $order['secondary_currency'] = unserialize($additional_data['R']); } if (!empty($order['issuer_id'])) { $order['issuer_data'] = fn_get_user_short_info($order['issuer_id']); } // Recalculate subtotal $order['subtotal'] = $order['display_subtotal'] = 0; foreach ($order['products'] as $v) { $order['subtotal'] += $v['subtotal']; $order['display_subtotal'] += $v['display_subtotal']; } // Unserialize and collect payment information if (!empty($additional_data['P'])) { $order['payment_info'] = unserialize(fn_decrypt_text($additional_data['P'])); } if (empty($order['payment_info']) || !is_array($order['payment_info'])) { $order['payment_info'] = array(); } // Get shipping information if (!empty($additional_data['G'])) { $order['product_groups'] = unserialize($additional_data['G']); } $order['doc_ids'] = db_get_hash_single_array("SELECT type, doc_id FROM ?:order_docs WHERE order_id = ?i", array('type', 'doc_id'), $order_id); } fn_set_hook('get_order_info', $order, $additional_data); return $order; } return false; }
} return array(CONTROLLER_STATUS_REDIRECT, "events.search"); } elseif ($mode == 'unsubscribe') { db_query("DELETE FROM ?:giftreg_event_subscribers WHERE event_id = ?i AND email = ?s", $_REQUEST['event_id'], $_REQUEST['email']); fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('text_event_unsubscribe')); return array(CONTROLLER_STATUS_REDIRECT, "events.search"); } elseif ($mode == 'view') { $event_data = db_get_row("SELECT * FROM ?:giftreg_events WHERE event_id = ?i", $_REQUEST['event_id']); fn_add_breadcrumb($event_data['title']); $event_data['fields'] = db_get_hash_single_array("SELECT * FROM ?:giftreg_event_fields WHERE ?:giftreg_event_fields.event_id = ?i", array('field_id', 'value'), $_REQUEST['event_id']); $event_data['products'] = fn_get_event_product($_REQUEST['event_id'], Registry::get('settings.Appearance.products_per_page'), empty($_REQUEST['page']) ? 1 : $_REQUEST['page']); foreach ($event_data['products'] as $k => &$product) { $product['extra'] = unserialize($product['extra']); $product_options = $product['extra']; $product['product_options_ids'] = $product_options; $product['product_options'] = fn_get_selected_product_options_info($product_options, CART_LANGUAGE); $product['price'] = fn_get_product_price($product['product_id'], 1, $auth); $product['avail_amount'] = $product['amount'] - $product['ordered_amount']; // selected options combination $product['product_options_combination'] = fn_get_options_combination($product_options); fn_gather_additional_product_data($product, true, false, false, true); // If option combination image is exists than replace the main image with it $_options = $product_options; if (!empty($product['product_options']) && is_array($product['product_options'])) { foreach ($product['product_options'] as $_k => $_v) { if ($_v['inventory'] == 'N') { unset($_options[$_v['option_id']]); } } } $combination_hash = fn_generate_cart_id($product['product_id'], array('product_options' => $_options));
function fn_get_order_info($order_id, $native_language = false, $format_info = true, $get_edp_files = false, $skip_static_values = false) { if (!empty($order_id)) { $condition = fn_get_company_condition(); $order = db_get_row("SELECT * FROM ?:orders WHERE ?:orders.order_id = ?i {$condition}", $order_id); if (empty($order)) { return false; } $lang_code = $native_language == true ? $order['lang_code'] : CART_LANGUAGE; $order['payment_method'] = fn_get_payment_method_data($order['payment_id'], $lang_code); if (!empty($order)) { // Get additional profile fields $additional_fields = db_get_hash_single_array("SELECT field_id, value FROM ?:profile_fields_data WHERE object_id = ?i AND object_type = 'O'", array('field_id', 'value'), $order_id); $order['fields'] = $additional_fields; $order['items'] = db_get_hash_array("SELECT ?:order_details.*, ?:product_descriptions.product, ?:product_descriptions.short_description FROM ?:order_details LEFT JOIN ?:product_descriptions ON ?:order_details.product_id = ?:product_descriptions.product_id AND ?:product_descriptions.lang_code = ?s WHERE ?:order_details.order_id = ?i ORDER BY ?:product_descriptions.product", 'item_id', $lang_code, $order_id); $order['promotions'] = unserialize($order['promotions']); if (!empty($order['promotions'])) { // collect additional data $params = array('promotion_id' => array_keys($order['promotions'])); list($promotions) = fn_get_promotions($params); foreach ($promotions as $pr_id => $p) { $order['promotions'][$pr_id]['name'] = $p['name']; $order['promotions'][$pr_id]['short_description'] = $p['short_description']; } } // Get additional data $additional_data = db_get_hash_single_array("SELECT type, data FROM ?:order_data WHERE order_id = ?i", array('type', 'data'), $order_id); $order['taxes'] = array(); $order['tax_subtotal'] = 0; $order['display_shipping_cost'] = $order['shipping_cost']; // Replace country, state and title values with their descriptions fn_add_user_data_descriptions($order, $lang_code); $order['need_shipping'] = false; $deps = array(); // Get shipments common information if (Registry::get('settings.General.use_shipments') == 'Y') { $order['shipment_ids'] = db_get_fields('SELECT sh.shipment_id FROM ?:shipments AS sh LEFT JOIN ?:shipment_items AS s_items ON (sh.shipment_id = s_items.shipment_id) WHERE s_items.order_id = ?i GROUP BY s_items.shipment_id', $order_id); $_products = db_get_array("SELECT item_id, SUM(amount) AS amount FROM ?:shipment_items WHERE order_id = ?i GROUP BY item_id", $order_id); $shipped_products = array(); if (!empty($_products)) { foreach ($_products as $_product) { $shipped_products[$_product['item_id']] = $_product['amount']; } } unset($_products); } foreach ($order['items'] as $k => $v) { //Check for product existance if (empty($v['product'])) { $order['items'][$k]['deleted_product'] = true; } $order['items'][$k]['discount'] = 0; $v['extra'] = @unserialize($v['extra']); if ($skip_static_values == false && !empty($v['extra']['product'])) { $order['items'][$k]['product'] = $v['extra']['product']; preg_match("/\\[(.*?)\\]/", $v['extra']['product'], $resmath); $order['items'][$k]['art'] = $resmath[1]; } $order['items'][$k]['company_id'] = empty($v['extra']['company_id']) ? 0 : $v['extra']['company_id']; if (!empty($v['extra']['discount']) && floatval($v['extra']['discount'])) { $order['items'][$k]['discount'] = $v['extra']['discount']; $order['use_discount'] = true; } if (!empty($v['extra']['promotions'])) { $order['items'][$k]['promotions'] = $v['extra']['promotions']; } if (isset($v['extra']['base_price'])) { $order['items'][$k]['base_price'] = floatval($v['extra']['base_price']); } else { $order['items'][$k]['base_price'] = $v['price']; } $order['items'][$k]['original_price'] = $order['items'][$k]['base_price']; // Form hash key for this product $order['items'][$k]['cart_id'] = $v['item_id']; $deps['P_' . $order['items'][$k]['cart_id']] = $k; //$order['items'][$k]['sklad'] = fn_numsklad($order['items'][$k]['product']); // Unserialize and collect product options information if (!empty($v['extra']['product_options'])) { if ($format_info == true) { $order['items'][$k]['product_options'] = $skip_static_values == false && !empty($v['extra']['product_options_value']) ? $v['extra']['product_options_value'] : fn_get_selected_product_options_info($v['extra']['product_options'], $lang_code); } if (empty($v['extra']['stored_price'])) { // apply modifiers if this is not the custom price $order['items'][$k]['original_price'] = fn_apply_options_modifiers($v['extra']['product_options'], $order['items'][$k]['base_price'], 'P', $skip_static_values == false && !empty($v['extra']['product_options_value']) ? $v['extra']['product_options_value'] : array()); } } $img = db_get_field("SELECT cscart_images.image_path FROM cscart_images_links LEFT \nJOIN cscart_images ON cscart_images_links.image_id = cscart_images.image_id \nWHERE cscart_images_links.object_id = ?i", $order['items'][$k]['product_id']); $imgid = db_get_field("SELECT cscart_images_links.image_id FROM cscart_images_links \nWHERE cscart_images_links.object_id = ?i", $order['items'][$k]['product_id']); $order['items'][$k]['extra'] = $v['extra']; $order['items'][$k]['img'] = fn_get_image($imgid, "product"); $order['items'][$k]['tax_value'] = 0; $order['items'][$k]['display_subtotal'] = $order['items'][$k]['subtotal'] = $v['price'] * $v['amount']; $order['items'][$k]['display_per_subtotal'] = $order['items'][$k]['original_price'] * $v['amount']; // Get information about edp if ($get_edp_files == true && $order['items'][$k]['extra']['is_edp'] == 'Y') { $order['items'][$k]['files'] = db_get_array("SELECT ?:product_files.file_id, ?:product_files.activation_type, ?:product_files.max_downloads, ?:product_file_descriptions.file_name, ?:product_file_ekeys.active, ?:product_file_ekeys.downloads, ?:product_file_ekeys.ekey, ?:product_file_ekeys.ttl FROM ?:product_files LEFT JOIN ?:product_file_descriptions ON ?:product_file_descriptions.file_id = ?:product_files.file_id AND ?:product_file_descriptions.lang_code = ?s LEFT JOIN ?:product_file_ekeys ON ?:product_file_ekeys.file_id = ?:product_files.file_id AND ?:product_file_ekeys.order_id = ?i WHERE ?:product_files.product_id = ?i", $lang_code, $order_id, $v['product_id']); } // Get shipments information if (Registry::get('settings.General.use_shipments') == 'Y') { if (isset($shipped_products[$k])) { $order['items'][$k]['shipped_amount'] = $shipped_products[$k]; $order['items'][$k]['shipment_amount'] = $v['amount'] - $shipped_products[$k]; } else { $order['items'][$k]['shipped_amount'] = 0; $order['items'][$k]['shipment_amount'] = $v['amount']; } if ($order['items'][$k]['shipped_amount'] < $order['items'][$k]['amount']) { $order['need_shipment'] = true; } } // Check if the order needs the shipping method if (!($v['extra']['is_edp'] == 'Y' && (!isset($v['extra']['edp_shipping']) || $v['extra']['edp_shipping'] != 'Y'))) { $order['need_shipping'] = true; } } if (fn_check_suppliers_functionality()) { $order['companies'] = fn_get_products_companies($order['items']); $order['have_suppliers'] = fn_check_companies_have_suppliers($order['companies']); } // Unserialize and collect taxes information if (!empty($additional_data['T'])) { $order['taxes'] = unserialize($additional_data['T']); if (is_array($order['taxes'])) { foreach ($order['taxes'] as $tax_id => $tax_data) { foreach ($tax_data['applies'] as $_id => $value) { if (strpos($_id, 'P_') !== false && isset($deps[$_id])) { $order['items'][$deps[$_id]]['tax_value'] += $value; if ($tax_data['price_includes_tax'] != 'Y') { $order['items'][$deps[$_id]]['subtotal'] += $value; $order['items'][$deps[$_id]]['display_subtotal'] += Registry::get('settings.Appearance.cart_prices_w_taxes') == 'Y' ? $value : 0; $order['tax_subtotal'] += $value; } } if (strpos($_id, 'S_') !== false && Registry::get('settings.Appearance.cart_prices_w_taxes') == 'Y') { if ($tax_data['price_includes_tax'] != 'Y') { $order['display_shipping_cost'] += $value; } } } } } else { $order['taxes'] = array(); } } if (!empty($additional_data['C'])) { $order['coupons'] = unserialize($additional_data['C']); } if (!empty($additional_data['R'])) { $order['secondary_currency'] = unserialize($additional_data['R']); } // Recalculate subtotal $order['subtotal'] = $order['display_subtotal'] = 0; foreach ($order['items'] as $v) { $order['subtotal'] += $v['subtotal']; $order['display_per_subtotal'] += $v['display_per_subtotal']; $order['display_subtotal'] += $v['display_subtotal']; } // Unserialize and collect payment information if (!empty($additional_data['P'])) { $order['payment_info'] = unserialize(fn_decrypt_text($additional_data['P'])); } if (empty($order['payment_info']) || !is_array($order['payment_info'])) { $order['payment_info'] = array(); } // Get shipping information if (!empty($additional_data['L'])) { $order['shipping'] = unserialize($additional_data['L']); } $order['doc_ids'] = db_get_hash_single_array("SELECT type, doc_id FROM ?:order_docs WHERE order_id = ?i", array('type', 'doc_id'), $order_id); } fn_set_hook('get_order_info', $order, $additional_data); //echo $_SERVER['REMOTE_ADDR']; if ($_SERVER['REMOTE_ADDR'] == "188.123.241.2") { // echo ; } $order['subtotal_discount'] = $order['subtotal_discount'] == "0.00" ? $order['discount'] : $order['subtotal_discount']; $metro = db_get_field("SELECT description FROM cscart_profile_field_descriptions WHERE object_type = 'V' AND object_id = ?i", $order['fields'][44]); //$firma = db_get_field("SELECT description FROM cscart_profile_field_descriptions WHERE object_type = 'V' AND object_id = ?i", $order['fields'][65]); $q = "SELECT value FROM cscart_profile_fields_data WHERE object_id =" . $order_id . " AND field_id = 65"; $vals = db_get_array($q); //var_dump($vals); //$firma = db_get_field("SELECT value FROM cscart_profile_fields_data WHERE object_id = ?i", $order['fields'][65]); $order['metro'] = $metro; $order['firma'] = $vals[0]["value"]; return $order; } return false; }
function content_55dc81a5ed2a88_04135619($_smarty_tpl) { if (!is_callable('smarty_function_math')) { include '/var/www/html/market/app/lib/vendor/smarty/smarty/libs/plugins/function.math.php'; } if (!is_callable('smarty_function_script')) { include '/var/www/html/market/app/functions/smarty_plugins/function.script.php'; } if (!is_callable('smarty_block_hook')) { include '/var/www/html/market/app/functions/smarty_plugins/block.hook.php'; } fn_preload_lang_vars(array('add_product', 'position_short', 'name', 'deleted_product', 'no_items', 'editing_defined_products', 'defined_items', 'name', 'quantity', 'options', 'any_option_combinations', 'deleted_product', 'no_items', 'add_products', 'add_products')); echo smarty_function_math(array('equation' => "rand()", 'assign' => "rnd"), $_smarty_tpl); ?> <?php $_smarty_tpl->tpl_vars["data_id"] = new Smarty_variable((string) $_smarty_tpl->tpl_vars['data_id']->value . "_" . (string) $_smarty_tpl->tpl_vars['rnd']->value, null, 0); $_smarty_tpl->tpl_vars["view_mode"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['view_mode']->value) === null || $tmp === '' ? "mixed" : $tmp, null, 0); $_smarty_tpl->tpl_vars["start_pos"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['start_pos']->value) === null || $tmp === '' ? 0 : $tmp, null, 0); echo smarty_function_script(array('src' => "js/tygh/picker.js"), $_smarty_tpl); ?> <?php if ($_smarty_tpl->tpl_vars['item_ids']->value && !is_array($_smarty_tpl->tpl_vars['item_ids']->value) && $_smarty_tpl->tpl_vars['type']->value != "table") { ?> <?php $_smarty_tpl->tpl_vars["item_ids"] = new Smarty_variable(explode(",", $_smarty_tpl->tpl_vars['item_ids']->value), null, 0); } ?> <?php if ($_smarty_tpl->tpl_vars['view_mode']->value != "list") { ?> <?php if ($_smarty_tpl->tpl_vars['placement']->value == 'right') { ?> <div class="clearfix"> <div class="pull-right"> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['type']->value != "single") { ?> <a data-ca-external-click-id="opener_picker_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="cm-external-click btn <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['meta']->value, ENT_QUOTES, 'UTF-8'); ?> "><i class="icon-plus"></i> <?php echo $_smarty_tpl->__("add_product"); ?> </a> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['placement']->value == 'right') { ?> </div> </div> <?php } } ?> <?php if ($_smarty_tpl->tpl_vars['view_mode']->value != "button") { if ($_smarty_tpl->tpl_vars['type']->value == "links") { ?> <input type="hidden" id="p<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> _ids" name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['input_name']->value, ENT_QUOTES, 'UTF-8'); ?> " value="<?php if ($_smarty_tpl->tpl_vars['item_ids']->value) { echo htmlspecialchars(implode(",", $_smarty_tpl->tpl_vars['item_ids']->value), ENT_QUOTES, 'UTF-8'); } ?> " /> <?php $_smarty_tpl->_capture_stack[0][] = array("products_list", null, null); ob_start(); ?> <table class="table table-middle"> <thead> <tr> <?php if ($_smarty_tpl->tpl_vars['positions']->value) { ?> <th><?php echo $_smarty_tpl->__("position_short"); ?> </th><?php } ?> <th width="100%"><?php echo $_smarty_tpl->__("name"); ?> </th> <th> </th> <th> </th> </tr> </thead> <tbody id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="<?php if (!$_smarty_tpl->tpl_vars['item_ids']->value) { ?> hidden<?php } ?> cm-picker-product"> <?php echo $_smarty_tpl->getSubTemplate("pickers/products/js.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('clone' => true, 'product' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "product" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'root_id' => $_smarty_tpl->tpl_vars['data_id']->value, 'delete_id' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "delete_id" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'type' => "product", 'position_field' => $_smarty_tpl->tpl_vars['positions']->value, 'position' => "0"), 0); ?> <?php if ($_smarty_tpl->tpl_vars['item_ids']->value) { ?> <?php $_smarty_tpl->tpl_vars["product"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["product"]->_loop = false; $_from = $_smarty_tpl->tpl_vars['item_ids']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars["product"]->index = -1; $_smarty_tpl->tpl_vars['smarty']->value['foreach']["items"]['iteration'] = 0; foreach ($_from as $_smarty_tpl->tpl_vars["product"]->key => $_smarty_tpl->tpl_vars["product"]->value) { $_smarty_tpl->tpl_vars["product"]->_loop = true; $_smarty_tpl->tpl_vars["product"]->index++; $_smarty_tpl->tpl_vars["product"]->first = $_smarty_tpl->tpl_vars["product"]->index === 0; $_smarty_tpl->tpl_vars['smarty']->value['foreach']["items"]['first'] = $_smarty_tpl->tpl_vars["product"]->first; $_smarty_tpl->tpl_vars['smarty']->value['foreach']["items"]['iteration']++; ?> <?php echo $_smarty_tpl->getSubTemplate("pickers/products/js.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_id' => $_smarty_tpl->tpl_vars['product']->value, 'product' => ($tmp = @fn_get_product_name($_smarty_tpl->tpl_vars['product']->value)) === null || $tmp === '' ? $_smarty_tpl->__("deleted_product") : $tmp, 'root_id' => $_smarty_tpl->tpl_vars['data_id']->value, 'delete_id' => $_smarty_tpl->tpl_vars['product']->value, 'type' => "product", 'first_item' => $_smarty_tpl->getVariable('smarty')->value['foreach']['items']['first'], 'position_field' => $_smarty_tpl->tpl_vars['positions']->value, 'position' => $_smarty_tpl->getVariable('smarty')->value['foreach']['items']['iteration'] + $_smarty_tpl->tpl_vars['start_pos']->value), 0); ?> <?php } ?> <?php } ?> </tbody> <tbody id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> _no_item"<?php if ($_smarty_tpl->tpl_vars['item_ids']->value) { ?> class="hidden"<?php } ?> > <tr class="no-items"> <td colspan="<?php if ($_smarty_tpl->tpl_vars['positions']->value) { ?> 4<?php } else { ?> 3<?php } ?> "><p><?php echo ($tmp = @$_smarty_tpl->tpl_vars['no_item_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("no_items") : $tmp; ?> </p></td> </tr> </tbody> </table> <?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(); } ?> <?php if ($_smarty_tpl->tpl_vars['picker_view']->value) { ?> <div class="shift-button"> <?php echo $_smarty_tpl->getSubTemplate("common/popupbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "inner_" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'link_text' => count($_smarty_tpl->tpl_vars['item_ids']->value), 'act' => "link", 'content' => Smarty::$_smarty_vars['capture']['products_list'], 'text' => __("editing_defined_products"), 'picker_meta' => "cm-bg-close", 'method' => "GET", 'no_icon_link' => true), 0); echo $_smarty_tpl->__("defined_items"); ?> </div> <?php } else { ?> <?php echo Smarty::$_smarty_vars['capture']['products_list']; ?> <?php } } elseif ($_smarty_tpl->tpl_vars['type']->value == "table") { ?> <?php if (!isset($_smarty_tpl->tpl_vars['display']->value)) { ?> <?php $_smarty_tpl->tpl_vars["display"] = new Smarty_variable("options", null, 0); ?> <?php } ?> <table class="table table-middle"> <thead> <tr> <th width="80%"><?php echo $_smarty_tpl->__("name"); ?> </th> <th class="center"><?php echo $_smarty_tpl->__("quantity"); ?> </th> <?php $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "product_picker:table_header")); $_block_repeat = true; echo smarty_block_hook(array('name' => "product_picker:table_header"), null, $_smarty_tpl, $_block_repeat); while ($_block_repeat) { ob_start(); ?> <?php $_block_content = ob_get_clean(); $_block_repeat = false; echo smarty_block_hook(array('name' => "product_picker:table_header"), $_block_content, $_smarty_tpl, $_block_repeat); } array_pop($_smarty_tpl->smarty->_tag_stack); ?> <th> </th> </tr> </thead> <tbody id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="<?php if (!$_smarty_tpl->tpl_vars['item_ids']->value) { ?> hidden <?php } ?> cm-picker<?php if ($_smarty_tpl->tpl_vars['display']->value) { ?> -options<?php } ?> "> <?php $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "product_picker:table_rows")); $_block_repeat = true; echo smarty_block_hook(array('name' => "product_picker:table_rows"), null, $_smarty_tpl, $_block_repeat); while ($_block_repeat) { ob_start(); ?> <?php if ($_smarty_tpl->tpl_vars['item_ids']->value) { ?> <?php $_smarty_tpl->tpl_vars["product"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["product"]->_loop = false; $_smarty_tpl->tpl_vars["product_id"] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['item_ids']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["product"]->key => $_smarty_tpl->tpl_vars["product"]->value) { $_smarty_tpl->tpl_vars["product"]->_loop = true; $_smarty_tpl->tpl_vars["product_id"]->value = $_smarty_tpl->tpl_vars["product"]->key; ?> <?php if ($_smarty_tpl->tpl_vars['display']->value) { ?> <?php $_smarty_tpl->_capture_stack[0][] = array("product_options", null, null); ob_start(); ?> <?php $_smarty_tpl->tpl_vars["prod_opts"] = new Smarty_variable(fn_get_product_options($_smarty_tpl->tpl_vars['product']->value['product_id']), null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['prod_opts']->value && !$_smarty_tpl->tpl_vars['product']->value['product_options']) { ?> <span><?php echo $_smarty_tpl->__("options"); ?> : </span> <?php echo $_smarty_tpl->__("any_option_combinations"); ?> <?php } elseif ($_smarty_tpl->tpl_vars['product']->value['product_options']) { ?> <?php if ($_smarty_tpl->tpl_vars['product']->value['product_options_value']) { ?> <?php echo $_smarty_tpl->getSubTemplate("common/options_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_options' => $_smarty_tpl->tpl_vars['product']->value['product_options_value']), 0); ?> <?php } else { ?> <?php echo $_smarty_tpl->getSubTemplate("common/options_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_options' => fn_get_selected_product_options_info($_smarty_tpl->tpl_vars['product']->value['product_options'])), 0); ?> <?php } ?> <?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(); } ?> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['product']->value['product']) { ?> <?php $_smarty_tpl->tpl_vars["product_name"] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value['product'], null, 0); ?> <?php } else { ?> <?php $_smarty_tpl->tpl_vars["product_name"] = new Smarty_variable(($tmp = @fn_get_product_name($_smarty_tpl->tpl_vars['product']->value['product_id'])) === null || $tmp === '' ? $_smarty_tpl->__("deleted_product") : $tmp, null, 0); ?> <?php } ?> <?php echo $_smarty_tpl->getSubTemplate("pickers/products/js.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product' => $_smarty_tpl->tpl_vars['product_name']->value, 'root_id' => $_smarty_tpl->tpl_vars['data_id']->value, 'delete_id' => $_smarty_tpl->tpl_vars['product_id']->value, 'input_name' => (string) $_smarty_tpl->tpl_vars['input_name']->value . "[" . (string) $_smarty_tpl->tpl_vars['product_id']->value . "]", 'amount' => $_smarty_tpl->tpl_vars['product']->value['amount'], 'amount_input' => "text", 'type' => "options", 'options' => Smarty::$_smarty_vars['capture']['product_options'], 'options_array' => $_smarty_tpl->tpl_vars['product']->value['product_options'], 'product_id' => $_smarty_tpl->tpl_vars['product']->value['product_id'], 'product_info' => $_smarty_tpl->tpl_vars['product']->value), 0); ?> <?php } ?> <?php } ?> <?php $_block_content = ob_get_clean(); $_block_repeat = false; echo smarty_block_hook(array('name' => "product_picker:table_rows"), $_block_content, $_smarty_tpl, $_block_repeat); } array_pop($_smarty_tpl->smarty->_tag_stack); ?> <?php echo $_smarty_tpl->getSubTemplate("pickers/products/js.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('clone' => true, 'product' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "product" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'root_id' => $_smarty_tpl->tpl_vars['data_id']->value, 'delete_id' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "delete_id" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'input_name' => (string) $_smarty_tpl->tpl_vars['input_name']->value . "[" . (string) $_smarty_tpl->tpl_vars['ldelim']->value . "product_id" . (string) $_smarty_tpl->tpl_vars['rdelim']->value . "]", 'amount' => "1", 'amount_input' => "text", 'type' => "options", 'options' => (string) $_smarty_tpl->tpl_vars['ldelim']->value . "options" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, 'product_id' => ''), 0); ?> </tbody> <tbody id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> _no_item"<?php if ($_smarty_tpl->tpl_vars['item_ids']->value) { ?> class="hidden"<?php } ?> > <tr class="no-items"> <td colspan="<?php echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['colspan']->value) === null || $tmp === '' ? "3" : $tmp, ENT_QUOTES, 'UTF-8'); ?> "><p><?php echo ($tmp = @$_smarty_tpl->tpl_vars['no_item_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("no_items") : $tmp; ?> </p></td> </tr> </tbody> </table> <?php } elseif ($_smarty_tpl->tpl_vars['type']->value == "single") { ?> <div class="cm-display-radio" id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <input id="<?php if ($_smarty_tpl->tpl_vars['input_id']->value) { echo htmlspecialchars($_smarty_tpl->tpl_vars['input_id']->value, ENT_QUOTES, 'UTF-8'); } else { ?> c<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> _ids<?php } ?> " type="hidden" class="cm-picker-value" name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['input_name']->value, ENT_QUOTES, 'UTF-8'); ?> " value="<?php if (is_array($_smarty_tpl->tpl_vars['item_ids']->value)) { echo htmlspecialchars(implode(",", $_smarty_tpl->tpl_vars['item_ids']->value), ENT_QUOTES, 'UTF-8'); } ?> " /> <div class="input-append choose-input"> <?php echo $_smarty_tpl->getSubTemplate("pickers/products/js.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_id' => '', 'holder' => $_smarty_tpl->tpl_vars['data_id']->value, 'hide_input' => $_smarty_tpl->tpl_vars['hide_input']->value, 'input_name' => $_smarty_tpl->tpl_vars['input_name']->value, 'hide_link' => $_smarty_tpl->tpl_vars['hide_link']->value, 'hide_delete_button' => $_smarty_tpl->tpl_vars['hide_delete_button']->value, 'type' => "single"), 0); ?> <?php echo Smarty::$_smarty_vars['capture']['add_buttons']; ?> </div> </div> <?php } } if ($_smarty_tpl->tpl_vars['view_mode']->value != "list") { ?> <div class="hidden"> <?php if ($_smarty_tpl->tpl_vars['extra_var']->value) { ?> <?php $_smarty_tpl->tpl_vars["extra_var"] = new Smarty_variable(rawurlencode($_smarty_tpl->tpl_vars['extra_var']->value), null, 0); ?> <?php } ?> <?php if (!$_smarty_tpl->tpl_vars['no_container']->value) { ?> <div class="buttons-container"><?php } if ($_smarty_tpl->tpl_vars['picker_view']->value) { ?> [<?php } ?> <?php echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_id' => "opener_picker_" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'but_href' => fn_url("products.picker?display=" . (string) $_smarty_tpl->tpl_vars['display']->value . "&company_id=" . (string) $_smarty_tpl->tpl_vars['company_id']->value . "&company_ids=" . (string) $_smarty_tpl->tpl_vars['company_ids']->value . "&picker_for=" . (string) $_smarty_tpl->tpl_vars['picker_for']->value . "&extra=" . (string) $_smarty_tpl->tpl_vars['extra_var']->value . "&checkbox_name=" . (string) $_smarty_tpl->tpl_vars['checkbox_name']->value . "&aoc=" . (string) $_smarty_tpl->tpl_vars['aoc']->value . "&data_id=" . (string) $_smarty_tpl->tpl_vars['data_id']->value), 'but_text' => ($tmp = @$_smarty_tpl->tpl_vars['but_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("add_products") : $tmp, 'but_role' => "add", 'but_target_id' => "content_" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'but_meta' => "cm-dialog-opener"), 0); ?> <?php if ($_smarty_tpl->tpl_vars['picker_view']->value) { ?> ]<?php } if (!$_smarty_tpl->tpl_vars['no_container']->value) { ?> </div><?php } ?> <div class="hidden" id="content_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['data_id']->value, ENT_QUOTES, 'UTF-8'); ?> " title="<?php echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['but_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("add_products") : $tmp, ENT_QUOTES, 'UTF-8'); ?> "> </div> </div> <?php } }