Example #1
0
 * @Createdate 3-6-2010 0:14
 */
if (!defined('NV_IS_MOD_SHOPS')) {
    die('Stop!!!');
}
if ($nv_Request->isset_request('check_quantity', 'post')) {
    $id_pro = $nv_Request->get_int('id_pro', 'post', 0);
    $unit = $nv_Request->get_string('pro_unit', 'post', '');
    $listid = $nv_Request->get_string('listid', 'post');
    $listid = explode(',', $listid);
    asort($listid);
    $quantity = $db->query('SELECT quantity FROM ' . $db_config['prefix'] . '_' . $module_data . '_group_quantity WHERE pro_id = ' . $id_pro . ' AND listgroup="' . implode(',', $listid) . '"')->fetchColumn();
    if (empty($quantity)) {
        $sum = 0;
        $count = 0;
        $listgroupid = GetGroupID($id_pro, 1);
        if (!empty($listgroupid) and !empty($global_array_group)) {
            foreach ($listgroupid as $gid => $subid) {
                $parent_info = $global_array_group[$gid];
                if ($parent_info['in_order']) {
                    $count++;
                }
            }
        }
        $result = $db->query('SELECT listgroup, quantity FROM ' . $db_config['prefix'] . '_' . $module_data . '_group_quantity WHERE pro_id = ' . $id_pro);
        while (list($listgroup, $quantity) = $result->fetch(3)) {
            $listgroup = explode(',', $listgroup);
            $_t = 0;
            foreach ($listgroup as $_idgroup) {
                if (in_array($_idgroup, $listid)) {
                    $_t = $_t + 1;
Example #2
0
        }
    }
}
$j = 0;
foreach ($data_pro as $pdata) {
    $xtpl->assign('product_code', $pdata['product_code']);
    $xtpl->assign('product_name', $pdata['title']);
    $xtpl->assign('product_number', $pdata['product_number']);
    $xtpl->assign('product_price', nv_number_format($pdata['product_price'], nv_get_decimals($pro_config['money_unit'])));
    $xtpl->assign('product_price_total', nv_number_format($pdata['product_price_total'], nv_get_decimals($pro_config['money_unit'])));
    $xtpl->assign('product_unit', $pdata['product_unit']);
    $xtpl->assign('link_pro', $pdata['link_pro']);
    $xtpl->assign('pro_no', $j + 1);
    // Nhóm hiển thị cùng sản phẩm
    foreach ($array_group_main as $group_main_id) {
        $array_sub_group = GetGroupID($pdata['id']);
        for ($i = 0; $i < count($array_group_main); $i++) {
            $data = array('title' => '', 'link' => '');
            foreach ($array_sub_group as $sub_group_id) {
                $item = $global_array_group[$sub_group_id];
                if ($item['parentid'] == $group_main_id) {
                    $data['title'] = $item['title'];
                    $data['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=group/' . $item['alias'];
                }
            }
            $xtpl->assign('SUB_GROUP', $data);
        }
        $xtpl->parse('main.loop.sub_group');
    }
    // Nhóm thuộc tính sản phẩm khách hàng chọn
    if (!empty($pdata['product_group'])) {
Example #3
0
/**
 * wishlist()
 *
 * @param mixed $data_content
 * @param string $html_pages
 * @return
 */
function wishlist($data_content, $compare_id, $html_pages = '')
{
    global $module_info, $lang_module, $module_file, $pro_config, $op, $array_displays, $array_wishlist_id, $module_name, $global_array_shops_cat, $global_array_group, $my_head;
    $xtpl = new XTemplate('wishlist.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('TEMPLATE', $module_info['template']);
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('CSS_PRODUCT_CODE', !empty($pro_config['show_product_code']) ? ' show-product-code' : '');
    $xtpl->assign('num', 24 / $pro_config['per_row']);
    if (!empty($data_content)) {
        foreach ($data_content as $data_row) {
            $xtpl->assign('ID', $data_row['id']);
            $xtpl->assign('LINK', $data_row['link_pro']);
            $xtpl->assign('TITLE', $data_row['title']);
            $xtpl->assign('TITLE0', nv_clean60($data_row['title'], 40));
            $xtpl->assign('IMG_SRC', $data_row['homeimgthumb']);
            $xtpl->assign('LINK_ORDER', $data_row['link_order']);
            $xtpl->assign('height', $pro_config['homeheight']);
            $xtpl->assign('width', $pro_config['homewidth']);
            $xtpl->assign('hometext', $data_row['hometext']);
            $xtpl->assign('PRODUCT_CODE', $data_row['product_code']);
            $newday = $data_row['publtime'] + 86400 * $data_row['newday'];
            if ($newday >= NV_CURRENTTIME) {
                $xtpl->parse('main.items.new');
            }
            if ($pro_config['active_order'] == '1' and $pro_config['active_order_non_detail'] == '1') {
                if ($data_row['showprice'] == '1') {
                    if ($data_row['product_number'] > 0) {
                        // Kiem tra nhom bat buoc chon khi dat hang
                        $listgroupid = GetGroupID($data_row['id']);
                        $group_requie = 0;
                        if (!empty($listgroupid) and !empty($global_array_group)) {
                            foreach ($global_array_group as $groupinfo) {
                                if ($groupinfo['in_order']) {
                                    $group_requie = 1;
                                    break;
                                }
                            }
                        }
                        $group_requie = $pro_config['active_order_popup'] ? 1 : $group_requie;
                        $xtpl->assign('GROUP_REQUIE', $group_requie);
                        $xtpl->parse('main.items.order');
                    } else {
                        $xtpl->parse('main.items.product_empty');
                    }
                }
            }
            if ($pro_config['active_price'] == '1') {
                if ($data_row['showprice'] == '1') {
                    $price = nv_get_price($data_row['id'], $pro_config['money_unit']);
                    $xtpl->assign('PRICE', $price);
                    if ($data_row['discount_id'] and $price['discount_percent'] > 0) {
                        $xtpl->parse('main.items.price.discounts');
                        $xtpl->parse('main.items.price.discounts.standard');
                    } else {
                        $xtpl->parse('main.items.price.no_discounts');
                    }
                    $xtpl->parse('main.items.price');
                } else {
                    $xtpl->parse('main.items.contact');
                }
            }
            if ($pro_config['active_tooltip'] == 1) {
                $xtpl->parse('main.items.tooltip');
            }
            if (!empty($pro_config['show_product_code']) and !empty($data_row['product_code'])) {
                $xtpl->parse('main.items.product_code');
            }
            if (defined('NV_IS_MODADMIN')) {
                $xtpl->assign('ADMINLINK', nv_link_edit_page($data_row['id']) . '&nbsp;-&nbsp;' . nv_link_delete_page($data_row['id']));
                $xtpl->parse('main.items.adminlink');
            }
            // Qua tang
            if ($pro_config['active_gift'] and !empty($data_row['gift_content']) and NV_CURRENTTIME >= $data_row['gift_from'] and NV_CURRENTTIME <= $data_row['gift_to']) {
                $xtpl->parse('main.items.gift');
            }
            // So sanh san pham
            if ($pro_config['show_compare'] == 1) {
                if (!empty($compare_id)) {
                    $ch = in_array($data_row['id'], $compare_id) ? ' checked="checked"' : '';
                    $xtpl->assign('ch', $ch);
                }
                $xtpl->parse('main.items.compare');
            }
            if ($data_row['discount_id'] and $price['discount_percent'] > 0 and $data_row['showprice']) {
                $xtpl->parse('main.items.discounts');
            }
            // Hien thi bieu tuong tich luy diem
            if ($pro_config['point_active'] and $global_array_shops_cat[$data_row['listcatid']]['cat_allow_point'] and !empty($global_array_shops_cat[$data_row['listcatid']]['cat_number_point'])) {
                $xtpl->assign('point', $global_array_shops_cat[$data_row['listcatid']]['cat_number_point']);
                $xtpl->assign('point_note', sprintf($lang_module['point_product_note'], $global_array_shops_cat[$data_row['listcatid']]['cat_number_point']));
                $xtpl->parse('main.items.point');
            }
            $xtpl->parse('main.items');
        }
        if (!defined('MODAL_LOADED')) {
            $xtpl->parse('main.modal_loaded');
            define('MODAL_LOADED', true);
        }
        if (!empty($html_pages)) {
            $xtpl->assign('generate_page', $html_pages);
            $xtpl->parse('main.pages');
        }
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
Example #4
0
/**
 * nv_del_group()
 *
 * @param mixed $groupid
 * @return
 */
function nv_del_group($groupid)
{
    global $db, $module_data, $db_config;
    $allgroupid = GetGroupID($groupid);
    if ($db->query("DELETE FROM " . $db_config['prefix'] . "_" . $module_data . "_group WHERE groupid=" . $groupid)) {
        // Loai bo san pham ra khoi nhom
        $db->query('DELETE FROM ' . $db_config['prefix'] . '_' . $module_data . '_group_items WHERE group_id = ' . $groupid);
        // Xoa cateid
        $db->query('DELETE FROM ' . $db_config['prefix'] . '_' . $module_data . '_group_cateid WHERE groupid = ' . $groupid);
        // Xoa chi tiet nhap kho, neu nhu chi tiet nhap kho co nhom nay, thi xoa luon chi tiet nhap kho
        $result = $db->query('SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_group_quantity');
        while ($row = $result->fetch()) {
            if (in_array($groupid, explode(',', $listgroup))) {
                $db->query('DELETE FROM ' . $db_config['prefix'] . '_' . $module_data . '_group_quantity WHERE pro_id = ' . $row['pro_id'] . ' AND listgroup=' . $db->quote($row['listgroup']));
            }
        }
        nv_fix_group_count($allgroupid);
    }
}
Example #5
0
     }
     $row['listgroup'] = $array_group;
     $array_data[$row['id']] = $row;
 }
 $xtpl = new XTemplate("warehouse.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file);
 $xtpl->assign('LANG', $lang_module);
 $xtpl->assign('WAREHOUSE', $array_warehouse);
 if (!empty($array_data)) {
     $i = 1;
     foreach ($array_data as $data) {
         $data['no'] = $i;
         $data['product_unit'] = $array_unit[$data['product_unit']]['title'];
         $data['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_shops_cat[$data['listcatid']]['alias'] . '/' . $data['alias'] . $global_config['rewrite_exturl'];
         $xtpl->assign('DATA', $data);
         // Nhom san pham
         $listgroup = GetGroupID($data['id']);
         $have_group = 0;
         if (!empty($listgroup)) {
             $parent_id = array();
             foreach ($listgroup as $group_id) {
                 $parent_id[] = $global_array_group[$group_id]['parentid'];
             }
             $parent_id = array_unique($parent_id);
             if (!empty($parent_id)) {
                 if (empty($data['listgroup'])) {
                     $data['listgroup'][] = implode(',', $listgroup);
                 }
                 foreach ($parent_id as $parent_id_i) {
                     $parent = $global_array_group[$parent_id_i];
                     if ($parent['in_order']) {
                         $xtpl->assign('PARENT', $parent);
/**
 * nv_del_content_module()
 *
 * @param mixed $id
 * @return
 */
function nv_del_content_module($id)
{
    global $db, $module_name, $module_data, $title, $db_config;
    $content_del = 'NO_' . $id;
    $title = '';
    list($id, $listcatid, $title) = $db->query('SELECT id, listcatid, ' . NV_LANG_DATA . '_title FROM ' . $db_config['prefix'] . '_' . $module_data . '_rows WHERE id=' . intval($id))->fetch(3);
    if ($id > 0) {
        $number_no_del = 0;
        $array_catid = explode(',', $listcatid);
        if ($number_no_del == 0) {
            $sql = 'DELETE FROM ' . $db_config['prefix'] . '_' . $module_data . '_rows WHERE id=' . $id;
            if (!$db->exec($sql)) {
                ++$number_no_del;
            }
        }
        if ($number_no_del == 0) {
            // Xoa binh luan
            $db->query('DELETE FROM ' . NV_PREFIXLANG . '_comment WHERE module=' . $db->quote($module_name) . ' AND id = ' . $id);
            // Xoa block san pham
            $db->query('DELETE FROM ' . $db_config['prefix'] . '_' . $module_data . '_block WHERE id = ' . $id);
            // Xoa du lieu nhom san pham
            $groupid = GetGroupID($id);
            if ($db->query('DELETE FROM ' . $db_config['prefix'] . '_' . $module_data . '_group_items WHERE pro_id = ' . $id)) {
                nv_fix_group_count($groupid);
            }
            // Xoa tai lieu
            $db->query('DELETE FROM ' . $db_config['prefix'] . '_' . $module_data . '_files_rows WHERE id_rows=' . $id);
            $content_del = 'OK_' . $id;
        } else {
            $content_del = 'ERR_' . $lang_module['error_del_content'];
        }
    }
    return $content_del;
}