$base_url .= '&keywords=' . $array_search['keywords']; } if (!empty($array_search['from'])) { $base_url .= '&from=' . $array_search['from']; } if (!empty($array_search['to'])) { $base_url .= '&to=' . $array_search['to']; } while ($view = $sth->fetch()) { $view['full_name'] = !empty($view['last_name']) ? $view['first_name'] . ' ' . $view['last_name'] : $view['username']; $view['addtime'] = nv_date('H:i d/m/Y', $view['addtime']); $result = $db->query('SELECT price, money_unit FROM ' . $db_config['prefix'] . '_' . $module_data . '_warehouse_logs WHERE wid=' . $view['wid']); $view['total_product'] = $result->rowCount(); $view['total_price'] = 0; while ($row = $result->fetch()) { $view['total_price'] += nv_currency_conversion($row['price'], $row['money_unit'], $pro_config['money_unit']); } $view['total_price'] = nv_number_format($view['total_price']); $view['link'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&wid=' . $view['wid']; $xtpl->assign('VIEW', $view); $xtpl->parse('main.list.loop'); } $generate_page = nv_generate_page($base_url, $num_items, $per_page, $page); if (!empty($generate_page)) { $xtpl->assign('NV_GENERATE_PAGE', $generate_page); $xtpl->parse('main.list.generate_page'); } $xtpl->parse('main.list'); } $xtpl->parse('main'); $contents = $xtpl->text('main');
/** * detail_product() * * @param mixed $data_content * @param mixed $data_unit * @param mixed $data_others * @param mixed $array_other_view * @param mixed $content_comment * @return */ function detail_product($data_content, $data_unit, $data_others, $array_other_view, $content_comment, $compare_id, $popup, $idtemplate, $array_keyword) { global $module_info, $lang_module, $module_file, $module_name, $module_upload, $pro_config, $global_config, $global_array_group, $array_wishlist_id, $client_info, $global_array_shops_cat, $meta_property, $pro_config, $user_info, $discounts_config, $my_head, $my_footer; $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '='; $link2 = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '='; $xtpl = new XTemplate('detail.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('GLANG', $lang_module); $xtpl->assign('LANG', $lang_module); $xtpl->assign('MODULE', $module_name); $xtpl->assign('MODULE_FILE', $module_file); $xtpl->assign('TEMPLATE', $module_info['template']); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('SELFURL', $client_info['selfurl']); $xtpl->assign('POPUP', $popup); $xtpl->assign('LINK_LOAD', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=loadcart'); $xtpl->assign('THEME_URL', NV_BASE_SITEURL . 'themes/' . $module_info['template']); $xtpl->assign('LINK_PRINT', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=print_pro&id=' . $data_content['id']); if (!empty($data_content)) { $xtpl->assign('proid', $data_content['id']); $xtpl->assign('CAT_TITLE', $global_array_shops_cat[$data_content['listcatid']]['title']); $xtpl->assign('SRC_PRO_FULL', $global_config['site_url'] . $data_content['homeimgthumb']); $xtpl->assign('SRC_PRO', $data_content['homeimgthumb']); $xtpl->assign('SRC_PRO_LAGE', $data_content['homeimgfile']); if (!empty($data_content['homeimgfile']) and file_exists(NV_ROOTDIR . $data_content['homeimgfile'])) { $xtpl->assign('SRC_PRO_LAGE_INFO', nv_is_image(NV_ROOTDIR . $data_content['homeimgfile'])); } $xtpl->assign('TITLE', $data_content[NV_LANG_DATA . '_title']); $xtpl->assign('NUM_VIEW', $data_content['hitstotal']); $xtpl->assign('DATE_UP', $lang_module['detail_dateup'] . ' ' . nv_date('d-m-Y h:i:s A', $data_content['publtime'])); $xtpl->assign('DETAIL', $data_content[NV_LANG_DATA . '_bodytext']); $xtpl->assign('LINK_ORDER', $link2 . 'setcart&id=' . $data_content['id']); $price = nv_get_price($data_content['id'], $pro_config['money_unit']); $xtpl->assign('PRICE', $price); $xtpl->assign('PRODUCT_CODE', $data_content['product_code']); $xtpl->assign('PRODUCT_NUMBER', $data_content['product_number']); $xtpl->assign('pro_unit', $data_unit['title']); if ($pro_config['active_gift'] and !empty($data_content[NV_LANG_DATA . '_gift_content']) and NV_CURRENTTIME >= $data_content['gift_from'] and NV_CURRENTTIME <= $data_content['gift_to']) { $xtpl->assign('gift_content', $data_content[NV_LANG_DATA . '_gift_content']); $xtpl->parse('main.gift'); } // Hien thi du lieu tuy bien o phan gioi thieu if (!empty($data_content['array_custom']) and !empty($data_content['array_custom_lang'])) { $custom_data = nv_custom_tpl('tab-introduce' . '.tpl', $data_content['array_custom'], $data_content['array_custom_lang'], $idtemplate); $xtpl->assign('CUSTOM_DATA', $custom_data); $xtpl->parse('main.custom_data'); } // San pham yeu thich if ($pro_config['active_wishlist']) { if (!empty($array_wishlist_id)) { if (in_array($data_content['id'], $array_wishlist_id)) { $xtpl->parse('main.wishlist.disabled'); } } $xtpl->parse('main.wishlist'); } $exptime = $data_content['exptime'] != 0 ? date('d-m-Y', $data_content['exptime']) : 'N/A'; $xtpl->assign('exptime', $exptime); $xtpl->assign('height', $pro_config['homeheight']); $xtpl->assign('width', $pro_config['homewidth']); if ($pro_config['active_showhomtext'] == '1') { $xtpl->assign('hometext', $data_content[NV_LANG_DATA . '_hometext']); $xtpl->parse('main.hometext'); } if (!$popup) { // Hien thi tabs if (!empty($data_content['tabs'])) { $i = 0; foreach ($data_content['tabs'] as $tabs_id => $tabs_value) { $tabs_content = ''; $tabs_key = $tabs_value['content']; if ($tabs_key == 'content_detail') { $tabs_content = $data_content[NV_LANG_DATA . '_bodytext']; } elseif ($tabs_key == 'content_download' and $pro_config['download_active'] == 1) { $download_content = nv_download_content($data_content, $tabs_key . '-' . $tabs_id); $tabs_content = !empty($download_content) ? $download_content : ''; } elseif ($tabs_key == 'content_otherimage') { $tabs_content = nv_display_othersimage($data_content['otherimage']); } elseif ($tabs_key == 'content_comments') { $tabs_content = $content_comment; } elseif ($tabs_key == 'content_rate') { if (!empty($data_content['allowed_rating']) and !empty($pro_config['review_active'])) { $tabs_content = nv_review_content($data_content); } } elseif ($tabs_key == 'content_customdata') { if (!empty($data_content['array_custom']) and !empty($data_content['array_custom_lang'])) { $tabs_content = nv_custom_tpl('tab-' . strtolower(change_alias($data_content['tabs'][$tabs_id][NV_LANG_DATA . '_title'])) . '.tpl', $data_content['array_custom'], $data_content['array_custom_lang'], $idtemplate); } } if (!empty($tabs_content)) { $xtpl->assign('TABS_TITLE', $tabs_value[NV_LANG_DATA . '_title']); $xtpl->assign('TABS_ID', $tabs_id); $xtpl->assign('TABS_KEY', $tabs_key); if (!empty($tabs_value['icon'])) { $xtpl->assign('TABS_ICON', NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $tabs_value['icon']); $xtpl->parse('main.product_detail.tabs.tabs_title.icon'); } else { $xtpl->parse('main.product_detail.tabs.tabs_title.icon_default'); } $xtpl->assign('TABS_CONTENT', $tabs_content); if ($i == 0) { $xtpl->parse('main.product_detail.tabs.tabs_title.active'); $xtpl->parse('main.product_detail.tabs.tabs_content.active'); } $xtpl->parse('main.product_detail.tabs.tabs_title'); $xtpl->parse('main.product_detail.tabs.tabs_content'); } $i++; } $xtpl->parse('main.product_detail.tabs'); } if (!empty($array_keyword)) { $t = sizeof($array_keyword) - 1; foreach ($array_keyword as $i => $value) { $xtpl->assign('KEYWORD', $value['keyword']); $xtpl->assign('LINK_KEYWORDS', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=tag/' . urlencode($value['alias'])); $xtpl->assign('SLASH', $t == $i ? '' : ', '); $xtpl->parse('main.product_detail.keywords.loop'); } $xtpl->parse('main.product_detail.keywords'); } if (!empty($data_others)) { $hmtl = view_home_all($data_others, $compare_id); $xtpl->assign('OTHER', $hmtl); $xtpl->parse('main.product_detail.other'); } if (!empty($array_other_view)) { $hmtl = view_home_all($array_other_view, $compare_id); $xtpl->assign('OTHER_VIEW', $hmtl); $xtpl->parse('main.product_detail.other_view'); } if (defined('NV_IS_MODADMIN')) { $xtpl->assign('ADMINLINK', nv_link_edit_page($data_content['id']) . ' - ' . nv_link_delete_page($data_content['id'])); $xtpl->parse('main.adminlink'); } if ($data_content['rating_total'] > 0 and $data_content['rating_point'] > 0) { $xtpl->assign('RATE_TOTAL', $data_content['rating_total']); $xtpl->assign('RATE_VALUE', $data_content['rating_point']); $xtpl->parse('main.allowed_rating_snippets'); } $xtpl->parse('main.product_detail'); $xtpl->parse('main.social_icon'); if (!empty($data_content['homeimgfile'])) { $xtpl->parse('main.imagemodal'); } } if (!empty($pro_config['show_product_code']) and !empty($data_content['product_code'])) { $xtpl->parse('main.product_code'); } } // Nhom san pham $listgroupid = GetGroupID($data_content['id'], 1); if (!empty($listgroupid) and !empty($global_array_group)) { $have_group = 0; foreach ($listgroupid as $gid => $subid) { $parent_info = $global_array_group[$gid]; if ($parent_info['in_order']) { $have_group = 1; $xtpl->assign('GROUPID', $parent_info['groupid']); $xtpl->assign('HEADER', $parent_info['title']); $xtpl->parse('main.group.items.header'); if (!empty($subid)) { foreach ($subid as $sub_gr_id) { $sub_info = $global_array_group[$sub_gr_id]; if ($sub_info['in_order']) { $xtpl->assign('GROUP', $sub_info); if (sizeof($subid) == 1) { $xtpl->parse('main.group.items.loop.active'); $xtpl->parse('main.group.items.loop.checked'); } $xtpl->parse('main.group.items.loop'); } } } $xtpl->parse('main.group.items'); } } if ($have_group) { $xtpl->parse('main.group'); } } // Hien thi danh sach nhom san pham $i = 0; foreach ($listgroupid as $gid => $subid) { $parent_info = $global_array_group[$gid]; if ($parent_info['indetail']) { $xtpl->assign('MAINTITLE', $parent_info['title']); $xtpl->parse('main.group_detail.loop.maintitle'); if (!empty($subid)) { foreach ($subid as $sub_gr_id) { $sub_info = $global_array_group[$sub_gr_id]; if ($sub_info['indetail']) { $xtpl->assign('SUBTITLE', $sub_info['title']); $xtpl->parse('main.group_detail.loop.subtitle.loop'); } } $xtpl->parse('main.group_detail.loop.subtitle'); } $i++; } if ($i > 0) { $xtpl->parse('main.group_detail.loop'); } } if ($i > 0) { $xtpl->parse('main.group_detail'); } if ($global_array_shops_cat[$data_content['listcatid']]['typeprice'] == 2) { $price_config = unserialize($data_content['price_config']); if (!empty($price_config) and sizeof($price_config) > 1) { $before = 1; foreach ($price_config as $items) { $items['number_from'] = $before; $items['price'] = nv_currency_conversion($items['price'], $data_content['money_unit'], $pro_config['money_unit']); $items['price'] = nv_number_format($items['price'], nv_get_decimals($pro_config['money_unit'])); $xtpl->assign('ITEMS', $items); $xtpl->parse('main.typepeice.items'); $before = $items['number_to'] + 1; } $xtpl->assign('money_unit', $price['unit']); $xtpl->parse('main.typepeice'); } } if ($pro_config['active_price'] == '1') { if ($data_content['showprice'] == '1') { if ($data_content['discount_id'] and $price['discount_percent'] > 0) { $xtpl->parse('main.price.discounts'); } else { $xtpl->parse('main.price.no_discounts'); } $xtpl->parse('main.price'); $xtpl->parse('main.price1'); } else { $xtpl->parse('main.contact'); } } if ($pro_config['active_order'] == '1') { if ($data_content['showprice'] == '1') { if ($data_content['product_number'] > 0 or $pro_config['active_order_number']) { if (!$pro_config['active_order_number']) { $xtpl->parse('main.order_number.product_number'); $xtpl->parse('main.order_number_limit'); $xtpl->parse('main.check_price'); } $xtpl->parse('main.order_number'); $xtpl->parse('main.order'); } else { $xtpl->parse('main.product_empty'); } } } if (!empty($data_content['allowed_send'])) { $xtpl->parse('main.allowed_send'); } if (!empty($data_content['allowed_print'])) { $xtpl->parse('main.allowed_print'); $xtpl->parse('main.allowed_print_js'); } if (!empty($data_content['allowed_save'])) { $xtpl->parse('main.allowed_save'); } if (!defined('FACEBOOK_JSSDK')) { $lang = NV_LANG_DATA == 'vi' ? 'vi_VN' : 'en_US'; $facebookappid = $pro_config['facebookappid']; $xtpl->assign('FACEBOOK_LANG', $lang); $xtpl->assign('FACEBOOK_APPID', $facebookappid); $xtpl->parse('main.facebookjssdk'); if (!empty($facebookappid)) { $meta_property['fb:app_id'] = $facebookappid; } define('FACEBOOK_JSSDK', true); } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_shipping_price() * * @param mixed $weight * @param mixed $weight_unit * @param mixed $location_id * @param mixed $carrier_id * @param mixed $config_id * @return */ function nv_shipping_price($weight, $weight_unit, $location_id, $shops_id, $carrier_id) { global $db, $db_config, $module_data, $pro_config; $array_weight_config = array(); $array_location_config = array(); $price = array(); $sql = 'SELECT config_id FROM ' . $db_config['prefix'] . '_' . $module_data . '_shops_carrier WHERE shops_id = ' . $shops_id . ' AND carrier_id = ' . $carrier_id; $result = $db->query($sql); list($config_id) = $result->fetch(3); if ($config_id) { $sql = 'SELECT iid FROM ' . $db_config['prefix'] . '_' . $module_data . '_carrier_config_location WHERE cid = ' . $config_id . ' AND lid = ' . $location_id; $result = $db->query($sql); list($iid) = $result->fetch(3); if ($iid) { // Weight config $sql = 'SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_carrier_config_weight WHERE iid = ' . $iid . ' ORDER BY weight'; $result = $db->query($sql); while ($array_weight = $result->fetch()) { $array_weight_config[$array_weight['iid']][] = $array_weight; } } } if (!empty($array_weight_config)) { foreach ($array_weight_config as $weight_config) { foreach ($weight_config as $config) { $config['weight'] = nv_weight_conversion($config['weight'], $config['weight_unit'], $weight_unit); if ($weight < $config['weight']) { $price = nv_currency_conversion($config['carrier_price'], $config['carrier_price_unit'], $pro_config['money_unit']); break; } else { // Vuot muc gia cau hinh } } } } return $price; }
$xtpl->assign('MODULE_NAME', $module_name); $xtpl->assign('OP', $op); $per_page = 20; $page = $nv_Request->get_int('page', 'get', 1); $base_url = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op; $count = 0; $order_info = array('num_items' => 0, 'sum_price' => 0, 'sum_unit' => ''); // Fetch Limit $db->sqlreset()->select('COUNT(*)')->from($table_name)->where('1=1 ' . $where); $num_items = $db->query($db->sql())->fetchColumn(); $order_info['num_items'] = $num_items; $db->select('*')->where('1=1 ' . $where)->order('order_id DESC')->limit($per_page)->offset(($page - 1) * $per_page); $query = $db->query($db->sql()); while ($row = $query->fetch()) { $acno = 0; $price = nv_currency_conversion($row['order_total'], $row['unit_total'], $pro_config['money_unit']); $order_info['sum_price'] = $order_info['sum_price'] + $price; if ($row['transaction_status'] == 4) { $row['status_payment'] = $transaction_status[4]; } elseif ($row['transaction_status'] == 3) { $row['status_payment'] = $transaction_status[3]; } elseif ($row['transaction_status'] == 2) { $row['status_payment'] = $transaction_status[2]; } elseif ($row['transaction_status'] == 1) { $row['status_payment'] = $transaction_status[1]; } elseif ($row['transaction_status'] == 0) { $row['status_payment'] = $transaction_status[0]; } elseif ($row['transaction_status'] == -1) { $row['status_payment'] = $transaction_status[-1]; } else { $row['status_payment'] = "ERROR";
<?php /** * @Project NUKEVIET 4.x * @Author VINADES., JSC (contact@vinades.vn) * @Copyright (C) 2014 VINADES ., JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate Dec 29, 2010 10:42:00 PM */ if (!defined('NV_IS_MOD_SHOPS')) { die('Stop!!!'); } require_once NV_ROOTDIR . "/modules/" . $module_file . "/payment/nganluong.class.php"; $receiver = $payment_config['receiver_pay']; $return_url = $global_config['site_url'] . "/?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=complete&payment=nganluong"; $price = $data['order_total']; $price_vn = nv_currency_conversion($price, $pro_config['money_unit'], "VND"); $order_code = $data['order_code']; $transaction_info = $data['order_note']; $nl = new NL_Checkout($payment_config['checkout_url'], $payment_config['merchant_site'], $payment_config['secure_pass']); $url = $nl->buildCheckoutUrl($return_url, $receiver, $transaction_info, $order_code, $price_vn); $url .= "&key_refer=5c429fb7cc74299b5d1e53fb0906b8cb";
// Merchant ID $array_post['vpc_AccessCode'] = $payment_config['vpc_AccessCode']; // Merchant AccessCode $array_post['vpc_Version'] = $payment_config['vpc_Version']; // Phien ban $array_post['vpc_Command'] = $payment_config['vpc_Command']; // Pay $array_post['vpc_Locale'] = $payment_config['vpc_Locale']; // Viet Nam $array_post['vpc_Currency'] = 'VND'; // Viet Nam Dong $array_post['vpc_MerchTxnRef'] = nv_genpass(20); // ID giao dich tu tang $array_post['vpc_OrderInfo'] = $data['order_code']; // Ten hoa don $order_chage = nv_currency_conversion($data['order_total'], $pro_config['money_unit'], "VND"); $array_post['vpc_Amount'] = 100 * intval($order_chage); // So tien can thanh toan $array_post['vpc_ReturnURL'] = NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=complete&payment=" . $payment; // URL tra ve $array_post['vpc_TicketNo'] = $client_info['ip']; // IP nguoi mua $array_post['vpc_Customer_Phone'] = $data['order_phone']; // Dien thoai nguoi mua //$array_post['vpc_Customer_Phone'] = nv_EncString($data['order_phone'] ); // Dien thoai nguoi mua $array_post['vpc_Customer_Email'] = $data['order_email']; // Email nguoi mua $stringHashData = ""; ksort($array_post); $appendAmp = 0; foreach ($array_post as $key => $value) {
if (empty($listprice[$i])) { $listprice[$i] = 0; } if (empty($listnum[$i])) { $listnum[$i] = 0; } $temppro[$proid] = array('price' => $listprice[$i], 'num' => $listnum[$i]); $arrayid[] = $proid; $i++; } if (!empty($arrayid)) { $templistid = implode(',', $arrayid); $sql = 'SELECT t1.id, t1.listcatid, t1.' . NV_LANG_DATA . '_title, t1.money_unit FROM ' . $db_config['prefix'] . '_' . $module_data . '_rows AS t1 LEFT JOIN ' . $db_config['prefix'] . '_' . $module_data . '_units AS t2 ON t1.product_unit = t2.id WHERE t1.id IN (' . $templistid . ') AND t1.status =1'; $result = $db->query($sql); while (list($id, $listcatid, $title, $money_unit) = $result->fetch(3)) { $itemAmount = nv_currency_conversion($temppro[$id]['price'], $money_unit, 'USD'); $itemAmount = new BasicAmountType($currencyCode, $itemAmount); $itemTotalValue += $itemAmount->value; $itemDetails = new PaymentDetailsItemType(); $itemDetails->Name = $title; $itemDetails->Amount = $itemAmount; $itemDetails->Quantity = $temppro[$id]['num']; $itemDetails->ItemCategory = "Digital"; $itemDetails->Tax = new BasicAmountType($currencyCode, 0); $paymentDetails->PaymentDetailsItem[$i] = $itemDetails; } } // Giá trị tổng cộng của đơn hàng $orderTotalValue = $shippingTotal->value + $handlingTotal->value + $insuranceTotal->value + $itemTotalValue + $taxTotalValue; // Thông tin thanh toán chi tiết $paymentDetails->ShipToAddress = $address;