<div class="row">
					<div class="col-xs-12">
						<button>Inventory</button>
					</div>
				</div>
			</div>
			<?php 
        }
        ?>
		</div>
		<p class="mobile-only text-center"><strong>Click or Swipe to See Floorplans</strong></p>
		<div class="text-content">
			<div class="row">
				<div class="col-md-8">
					<h3><span>About</span> <?php 
        echo get_brand(get_the_id())->name . ' ' . get_the_title();
        ?>
</h3>
					<?php 
        the_content();
        ?>
				</div>
				<div class="col-md-4">
					<?php 
        if (has_post_thumbnail()) {
            the_post_thumbnail();
        }
        ?>
				</div>
			</div>
		</div>
function nzshpcrt_submit_ajax()
{
    global $wpdb, $user_level, $wp_rewrite;
    get_currentuserinfo();
    if (get_option('permalink_structure') != '') {
        $seperator = "?";
    } else {
        $seperator = "&";
    }
    /* update shopping cart*/
    if (isset($_GET['ajax']) and $_GET['ajax'] == "true" && $_GET['user'] == "true" && is_numeric($_POST['prodid'])) {
        $sql = "SELECT * FROM `wp_product_list` WHERE `id`='" . $_POST['prodid'] . "' LIMIT 1";
        $item_data = $wpdb->get_results($sql, ARRAY_A);
        $item_quantity = 0;
        if (isset($_SESSION['nzshpcrt_cart']) and $_SESSION['nzshpcrt_cart'] != null) {
            foreach ($_SESSION['nzshpcrt_cart'] as $cart_key => $cart_item) {
                if ($cart_item->product_id == $_POST['prodid']) {
                    $item_quantity += $_SESSION['nzshpcrt_cart'][$cart_key]->quantity;
                } else {
                    $item_quantity += 0;
                }
            }
        } else {
            // set new session for cart
            $_SESSION['nzshpcrt_cart'] = array();
        }
        if (isset($_SESSION['nzshpcrt_cart'])) {
            $cartcount = count($_SESSION['nzshpcrt_cart']);
            //echo "cartcount: ".$cartcount;
            if (isset($_POST['variation']) && is_array($_POST['variation'])) {
                $variations = $_POST['variation'];
            } else {
                $variations = null;
            }
            $updated_quantity = false;
            if ($_SESSION['nzshpcrt_cart'] != null) {
                foreach ($_SESSION['nzshpcrt_cart'] as $cart_key => $cart_item) {
                    if ($cart_item->product_id == $_POST['prodid']) {
                        //ales
                        if (isset($_POST['license'])) {
                            $_SESSION['nzshpcrt_cart'][$cart_key]->license = $_POST['license'];
                        } else {
                            $_SESSION['nzshpcrt_cart'][$cart_key]->license = 'l1_price';
                        }
                        if (isset($brand_id)) {
                            $_SESSION['nzshpcrt_cart'][$cart_key]->author = get_brand($brand_id);
                        }
                        if ($_SESSION['nzshpcrt_cart'][$cart_key]->product_variations === $variations) {
                            $_SESSION['nzshpcrt_cart'][$cart_key]->quantity = 1;
                            $updated_quantity = true;
                        }
                    }
                }
            }
            if ($updated_quantity === false) {
                if (isset($_POST['quantity']) && is_numeric($_POST['quantity'])) {
                    if ($_POST['quantity'] > 0) {
                        $new_cart_item = new cart_item($_POST['prodid'], $variations, $_POST['quantity']);
                    }
                } else {
                    $new_cart_item = new cart_item($_POST['prodid'], $variations);
                }
                $_SESSION['nzshpcrt_cart'][$cartcount + 1] = $new_cart_item;
            }
        }
        $quantity_limit = false;
        if (isset($_SESSION['nzshpcrt_cart'])) {
            $cart = $_SESSION['nzshpcrt_cart'];
        } else {
            $cart = null;
        }
        echo nzshpcrt_shopping_basket_internals($cart, $quantity_limit);
        exit;
    } else {
        if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && (isset($_POST['user']) and $_POST['user'] == "true") && $_POST['emptycart'] == "true") {
            $_SESSION['nzshpcrt_cart'] = array();
            $cart = $_SESSION['nzshpcrt_cart'];
            //ales cart
            //echo nzshpcrt_shopping_basket_internals($cart);
            exit;
        }
    }
    /* fill product form */
    if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['admin'] == "true" && isset($_POST['prodid']) && is_numeric($_POST['prodid'])) {
        if ($_POST['prodid'] == '000') {
            echo "<h3>Нет картинки с таким номером</h3>";
            exit;
        }
        echo nzshpcrt_getproductform($_POST['prodid']);
        exit;
    } else {
        if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['admin'] == "true" && isset($_POST['catid']) && is_numeric($_POST['catid'])) {
            echo nzshpcrt_getcategoryform($_POST['catid']);
            exit;
        } else {
            if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['admin'] == "true" && is_numeric($_POST['brandid'])) {
                echo nzshpcrt_getbrandsform($_POST['brandid']);
                exit;
            } else {
                if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['admin'] == "true" && is_numeric($_POST['variation_id'])) {
                    echo nzshpcrt_getvariationform($_POST['variation_id']);
                    exit;
                }
            }
        }
    }
    /* rate item */
    if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['rate_item'] == "true" && is_numeric($_POST['product_id']) && is_numeric($_POST['rating'])) {
        $nowtime = time();
        $prodid = $_POST['product_id'];
        $ip_number = $_SERVER['REMOTE_ADDR'];
        $rating = $_POST['rating'];
        $cookie_data = explode(",", $_COOKIE['voting_cookie'][$prodid]);
        if (is_numeric($cookie_data[0]) && $cookie_data[0] > 0) {
            $vote_id = $cookie_data[0];
            $wpdb->query("UPDATE `wp_product_rating` SET `rated` = '" . $rating . "' WHERE `id` ='" . $vote_id . "' LIMIT 1 ;");
        } else {
            $insert_sql = "INSERT INTO `wp_product_rating` ( `id` , `ipnum`  , `productid` , `rated`, `time`) VALUES ( '', '" . $ip_number . "', '" . $prodid . "', '" . $rating . "', '" . $nowtime . "');";
            $wpdb->query($insert_sql);
            $data = $wpdb->get_results("SELECT `id`,`rated` FROM `wp_product_rating` WHERE `ipnum`='" . $ip_number . "' AND `productid` = '" . $prodid . "'  AND `rated` = '" . $rating . "' AND `time` = '" . $nowtime . "' ORDER BY `id` DESC LIMIT 1", ARRAY_A);
            $vote_id = $data[0]['id'];
            setcookie("voting_cookie[{$prodid}]", $vote_id . "," . $rating, time() + 60 * 60 * 24 * 360);
        }
        $output[1] = $prodid;
        $output[2] = $rating;
        echo $output[1] . "," . $output[2];
        exit;
    }
    if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['get_rating_count'] == "true" && is_numeric($_POST['product_id'])) {
        $prodid = $_POST['product_id'];
        $data = $wpdb->get_results("SELECT COUNT(*) AS `count` FROM `wp_product_rating` WHERE `productid` = '" . $prodid . "'", ARRAY_A);
        echo $data[0]['count'] . "," . $prodid;
        exit;
    }
    if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['remove_variation_value'] == "true" && is_numeric($_POST['variation_value_id'])) {
        if ($user_level >= 7) {
            $wpdb->query("DELETE FROM `wp_variation_values_associations` WHERE `value_id` = '" . $_POST['variation_value_id'] . "'");
            $wpdb->query("DELETE FROM `wp_variation_values` WHERE `id` = '" . $_POST['variation_value_id'] . "' LIMIT 1");
            exit;
        }
    }
    if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['list_variation_values'] == "true" && is_numeric($_POST['variation_id'])) {
        if ($user_level >= 7) {
            $variation_processor = new nzshpcrt_variations();
            //product_variations_"+(parseInt(child_element_count)+1)
            echo "variation_value_id = \"" . $_POST['variation_id'] . "\";\n";
            echo "variation_value_html = \"" . $variation_processor->display_variation_values($_POST['prefix'], $_POST['variation_id']) . "\";\n";
            exit;
        }
    }
    if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['remove_form_field'] == "true" && is_numeric($_POST['form_id'])) {
        if ($user_level >= 7) {
            $wpdb->query("UPDATE `wp_collect_data_forms` SET `active` = '0' WHERE `id` ='" . $_POST['form_id'] . "' LIMIT 1 ;");
            exit;
        }
    }
    if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['remove_form_field'] == "true" && is_numeric($_POST['form_id'])) {
        if ($user_level >= 7) {
            $wpdb->query("UPDATE `wp_collect_data_forms` SET `active` = '0' WHERE `id` ='" . $_POST['form_id'] . "' LIMIT 1 ;");
            exit;
        }
    }
    if (isset($_POST['ajax']) and $_POST['ajax'] == "true" && $_POST['user'] == "true" && $_POST['drag_and_drop_cart'] == "true") {
        drag_and_drop_cart_contents();
        exit;
    }
    if (isset($_POST['language_setting']) && ($_GET['page'] = 'wp-shopping-cart/options.php')) {
        if ($user_level >= 7) {
            update_option('language_setting', $_POST['language_setting']);
        }
    }
    if (isset($_POST['language_setting']) && ($_GET['page'] = 'wp-shopping-cart/options.php')) {
        if ($user_level >= 7) {
            update_option('language_setting', $_POST['language_setting']);
        }
    }
    if (isset($_GET['rss']) and $_GET['rss'] == "true" && $_GET['action'] == "product_list") {
        $sql = "SELECT id, name, description, image FROM `wp_product_list` WHERE active='1' and approved='1' and visible='1' Order by id DESC LIMIT 40";
        $product_list = $wpdb->get_results($sql, ARRAY_A);
        header("Content-Type: application/xml; charset=utf-8");
        header('Content-Disposition: inline; filename="cartoonbank.rss"');
        $output = '';
        $output .= "<?xml version='1.0'?>\n\r";
        $output .= "<rss version='2.0'>\n\r";
        $output .= "xmlns:content='http://purl.org/rss/1.0/modules/content/'\n\r";
        $output .= "xmlns:wfw='http://wellformedweb.org/CommentAPI/'\n\r";
        $output .= "xmlns:dc='http://purl.org/dc/elements/1.1/'\n\r";
        $output .= "xmlns:atom='http://www.w3.org/2005/Atom'\n\r";
        $output .= "xmlns:sy='http://purl.org/rss/1.0/modules/syndication/'\n\r";
        $output .= "xmlns:slash='http://purl.org/rss/1.0/modules/slash/'\n\r";
        $output .= "xmlns:georss='http://www.georss.org/georss' xmlns:geo='http://www.w3.org/2003/01/geo/wgs84_pos#' xmlns:media='http://search.yahoo.com/mrss/'>\n\r";
        $output .= "  <channel>\n\r";
        $output .= "    <title>Cartoonbank new images</title>\n\r";
        $output .= "    <link>" . SITEURL . "</link>\n\r";
        $output .= "    <description>This is the Russian Cartoon Bank RSS feed</description>\n\r";
        $output .= "    <generator>Cartoonbank.ru</generator>\n\r";
        foreach ($product_list as $product) {
            $purchase_link = get_option('product_list_url') . "&cartoonid=" . stripslashes($product['id']);
            $output .= "    <item>\n\r";
            $output .= "      <title>" . stripslashes($product['name']) . "</title>\n\r";
            $output .= "      <link>" . SITEURL . "?page_id=29&amp;cartoonid=" . stripslashes($product['id']) . "</link>\n\r";
            $output .= "      <description>" . stripslashes($product['description']) . "<![CDATA[<a href='" . SITEURL . "?page_id=29&amp;cartoonid=" . stripslashes($product['id']) . "'><br /><img title='" . stripslashes($product['name']) . "' src='http://sl.cartoonbank.ru/" . stripslashes($product['image']) . "' alt='" . stripslashes($product['name']) . "' /></a>]]></description>\n\r";
            $output .= "      <pubDate>" . date("r") . "</pubDate>\n\r";
            $output .= "      <guid>" . SITEURL . "?page_id=29&amp;cartoonid=" . stripslashes($product['id']) . "</guid>\n\r";
            $output .= '    ';
            $output .= "    </item>\n\r";
        }
        $output .= "  </channel>\n\r";
        $output .= "</rss>";
        echo $output;
        exit;
    }
    if (isset($_GET['purchase_log_csv']) and $_GET['purchase_log_csv'] == "true" && $_GET['rss_key'] == 'key' && is_numeric($_GET['start_timestamp']) && is_numeric($_GET['end_timestamp'])) {
        $form_sql = "SELECT * FROM `wp_collect_data_forms` WHERE `active` = '1' AND `display_log` = '1';";
        $form_data = $wpdb->get_results($form_sql, ARRAY_A);
        $start_timestamp = $_GET['start_timestamp'];
        $end_timestamp = $_GET['end_timestamp'];
        $data = $wpdb->get_results("SELECT * FROM `wp_purchase_logs` WHERE `date` BETWEEN '{$start_timestamp}' AND '{$end_timestamp}' ORDER BY `date` DESC", ARRAY_A);
        header('Content-Type: text/csv');
        header('Content-Disposition: inline; filename="Purchase Log ' . date("M-d-Y", $start_timestamp) . ' to ' . date("M-d-Y", $end_timestamp) . '.csv"');
        $output .= "\"" . TXT_WPSC_PRICE . "\",";
        foreach ($form_data as $form_field) {
            $output .= "\"" . $form_field['name'] . "\",";
        }
        if (get_option('payment_method') == 2) {
            $output .= "\"" . TXT_WPSC_PAYMENT_METHOD . "\",";
        }
        $output .= "\"" . TXT_WPSC_STATUS . "\",";
        $output .= "\"" . TXT_WPSC_DATE . "\"\n";
        foreach ($data as $purchase) {
            $country_sql = "SELECT * FROM `wp_submited_form_data` WHERE `log_id` = '" . $purchase['id'] . "' AND `form_id` = '" . get_option('country_form_field') . "' LIMIT 1";
            $country_data = '';
            //$wpdb->get_results($country_sql,ARRAY_A);
            $country = $country_data[0]['value'];
            $output .= "\"" . nzshpcrt_find_total_price($purchase['id'], $country) . "\",";
            foreach ($form_data as $form_field) {
                $collected_data_sql = "SELECT * FROM `wp_submited_form_data` WHERE `log_id` = '" . $purchase['id'] . "' AND `form_id` = '" . $form_field['id'] . "' LIMIT 1";
                $collected_data = $wpdb->get_results($collected_data_sql, ARRAY_A);
                $collected_data = $collected_data[0];
                $output .= "\"" . $collected_data['value'] . "\",";
            }
            if (get_option('payment_method') == 2) {
                $gateway_name = '';
                foreach ($GLOBALS['nzshpcrt_gateways'] as $gateway) {
                    if ($purchase['gateway'] != 'testmode') {
                        if ($gateway['internalname'] == $purchase['gateway']) {
                            $gateway_name = $gateway['name'];
                        }
                    } else {
                        $gateway_name = "Manual Payment";
                    }
                }
                $output .= "\"" . $gateway_name . "\",";
            }
            if ($purchase['processed'] < 1) {
                $purchase['processed'] = 1;
            }
            $stage_sql = "SELECT * FROM `wp_purchase_statuses` WHERE `id`='" . $purchase['processed'] . "' AND `active`='1' LIMIT 1";
            $stage_data = $wpdb->get_results($stage_sql, ARRAY_A);
            $output .= "\"" . $stage_data[0]['name'] . "\",";
            $output .= "\"" . date("jS M Y", $purchase['date']) . "\"\n";
        }
        echo $output;
        exit;
    }
    if (isset($_GET['remove']) and is_numeric($_GET['remove']) && $_SESSION['nzshpcrt_cart'] != null) {
        $key = $_GET['remove'];
        if (isset($_SESSION['nzshpcrt_cart'][$key]) && is_object($_SESSION['nzshpcrt_cart'][$key])) {
            $_SESSION['nzshpcrt_cart'][$key]->empty_item();
        }
        unset($_SESSION['nzshpcrt_cart'][$key]);
    }
    if (isset($_GET['cart']) and $_GET['cart'] == 'empty') {
        $_SESSION['nzshpcrt_cart'] = '';
        $_SESSION['nzshpcrt_cart'] = array();
    }
    if (isset($_POST['quantity']) and is_numeric($_POST['quantity']) && is_numeric($_POST['key'])) {
        $quantity = $_POST['quantity'];
        $key = $_POST['key'];
        if (is_object($_SESSION['nzshpcrt_cart'][$key])) {
            if ($quantity > 0) {
                $_SESSION['nzshpcrt_cart'][$key]->quantity = $quantity;
            } else {
                $_SESSION['nzshpcrt_cart'][$key]->empty_item();
                unset($_SESSION['nzshpcrt_cart'][$key]);
            }
        }
    }
}
Beispiel #3
0
        $role = get_role('role_id IN(' . KEFU . ',' . KEFU2 . ')');
        $sql_select = 'SELECT ui.receive_time,ui.confirm_time,ui.validity,ui.exchange_points,ui.pre_points,ui.increase_reduce,u.user_name,r.rank_name,a.user_name as admin_name,i.integral_title,u.rank_points cur_integral,o.goods_amount FROM ' . $GLOBALS['ecs']->table('user_integral') . ' AS ui LEFT JOIN ' . $GLOBALS['ecs']->table('users') . ' AS u ON ui.user_id=u.user_id LEFT JOIN ' . $GLOBALS['ecs']->table('admin_user') . ' AS a ON u.admin_id=a.user_id LEFT JOIN ' . $GLOBALS['ecs']->table('integral') . ' AS i ON ui.integral_id=i.integral_id LEFT JOIN ' . $GLOBALS['ecs']->table('order_info') . ' AS o ON ui.source_id=o.order_id LEFT JOIN ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ON u.user_rank=r.rank_id WHERE ui.confirm=1 AND u.user_name IS NOT NULL AND u.role_id IS NOT NULL ORDER BY ui.confirm_time  DESC,ui.receive_time DESC' . ' LIMIT ' . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
    } elseif (admin_priv('ch_points_history', '', false)) {
        $role = get_role("role_id={$_SESSION['role_id']}");
    }
    echo $sql_select;
    exit;
    $result = $GLOBALS['db']->getAll($sql_select);
    foreach ($result as &$val) {
        $val['receive_time'] = date('m月d H:i', $val['receive_time']);
        $val['confirm_time'] = date('m月d H:i', $val['confirm_time']);
        $val['validity'] = date('Y-m-d H:i', $val['validity']);
    }
    //默认列出本部门的会员积分变化记录
    $smarty->assign('integral', $result);
    $smarty->assign('brand', get_brand());
    $smarty->assign('role', $role);
    $smarty->assign('filter', $filter);
    $res['main'] = $smarty->fetch('integral_log.htm');
    die($json->encode($res));
} elseif ($_REQUEST['act'] == 'show_vips') {
    $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
    if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
        $filter['page_size'] = intval($_REQUEST['page_size']);
    } else {
        $filter['page_size'] = 20;
    }
    $rank_id = intval($_REQUEST['rank_id']);
    //等级id
    $res['row_id'] = intval($_REQUEST['row_id'] + 1);
    $by_upgrade = mysql_real_escape_string($_REQUEST['by_upgrade']);