本文整理汇总了PHP中add_style函数的典型用法代码示例。如果您正苦于以下问题:PHP add_style函数的具体用法?PHP add_style怎么用?PHP add_style使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_style函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_supplier_goods
function get_supplier_goods($gtype = 0, $limit = 10)
{
$gtype = intval($gtype);
if ($gtype <= 0) {
return;
}
$sql = "SELECT DISTINCT g.goods_id,g.* FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('supplier_goods_cat') . " AS gc, " . $GLOBALS['ecs']->table('supplier_cat_recommend') . " AS cr \n\tWHERE cr.recommend_type =" . $gtype . " AND cr.supplier_id =" . $_GET['suppId'] . " AND cr.cat_id = gc.cat_id AND gc.goods_id = g.goods_id \n\tAND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 \n\tORDER BY g.sort_order, g.last_update DESC LIMIT " . $limit;
$result = $GLOBALS['db']->getAll($sql);
$goods = array();
if ($result) {
foreach ($result as $idx => $row) {
if ($row['promote_price'] > 0) {
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
$goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
} else {
$goods[$idx]['promote_price'] = '';
}
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = isset($goods_data['brand'][$row['goods_id']]) ? $goods_data['brand'][$row['goods_id']] : '';
$goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
$goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
$goods[$idx]['market_price'] = price_format($row['market_price']);
$goods[$idx]['shop_price'] = price_format($row['shop_price']);
$goods[$idx]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
//$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
}
}
return $goods;
}
示例2: get_index_best
/**
* 获得推荐商品
*
* @access public
* @param string $type 推荐类型,可以是 best, new, hot
* @return array
*/
function get_index_best($limit = '')
{
$time = gmtime();
//取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中
$sql = 'SELECT g.goods_id, g.goods_name,g.click_count, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' ";
$sql .= ' WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_best = "best" ';
$sql .= ' ORDER BY g.sort_order, g.last_update DESC';
$sql .= " {$limit}";
$result = $GLOBALS['db']->getAll($sql);
foreach ($result as $idx => $row) {
if ($row['promote_price'] > 0) {
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
$goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
} else {
$goods[$idx]['promote_price'] = '';
}
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = isset($goods_data['brand'][$row['goods_id']]) ? $goods_data['brand'][$row['goods_id']] : '';
$goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
$goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
$goods[$idx]['market_price'] = price_format($row['market_price']);
$goods[$idx]['shop_price'] = price_format($row['shop_price']);
$goods[$idx]['thumb'] = '../' . get_image_path($row['goods_id'], $row['goods_thumb'], true);
$goods[$idx]['goods_img'] = '../' . get_image_path($row['goods_id'], $row['goods_img']);
$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
$goods[$idx]['sell_count'] = selled_count($row['goods_id']);
$goods[$idx]['pinglun'] = get_evaluation_sum($row['goods_id']);
$goods[$idx]['count'] = selled_count($row['goods_id']);
$goods[$idx]['click_count'] = $row['click_count'];
}
return $goods;
}
示例3: get_cat_id_goods_list
function get_cat_id_goods_list($cat_id = '', $num = '', $ext = '')
{
$sql = 'Select g.goods_id,g.guige, g.cat_id,c.parent_id, g.goods_name, g.goods_number, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, " . "g.is_best, g.is_new, g.is_hot, g.is_promote,b.brand_name " . 'FROM ' . $GLOBALS['hhs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['hhs']->table('category') . ' AS c ON c.cat_id = g.cat_id ' . "LEFT JOIN " . $GLOBALS['hhs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . " left join " . $GLOBALS['hhs']->table('brand') . " as b on g.brand_id=b.brand_id " . " Where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_new = 1 AND g.is_delete = 0 and g.is_mall=1 " . ($sql .= " AND (c.parent_id =" . $cat_id . " OR g.cat_id = " . $cat_id . " OR g.cat_id " . db_create_in(array_unique(array_merge(array($cat_id), array_keys(cat_list($cat_id, 0, false))))) . ")");
$sql .= $ext;
$sql .= " LIMIT {$num}";
$res = $GLOBALS['db']->getAll($sql);
$goods = array();
foreach ($res as $idx => $row) {
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['guige'] = $row['guige'];
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = $row['brand_name'];
$goods[$idx]['goods_number'] = $row['goods_number'];
$goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
$goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
$goods[$idx]['market_price'] = price_format($row['market_price']);
$goods[$idx]['shop_price'] = price_format($row['shop_price']);
$goods[$idx]['thumb'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];
$goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];
$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
if ($GLOBALS['SID']) {
$goods[$idx]['shop_price'] = price_format($row['s_goods_price']);
}
}
return $goods;
}
示例4: as_woo_enqueue_scripts
function as_woo_enqueue_scripts()
{
if (!function_exists('is_woocommerce_activated')) {
add_style('as-woocommerce', get_template_directory_uri() . '/css/woocommerce.css');
add_script('as-woocommerce', get_template_directory_uri() . '/js/woocommerce.js', array("jquery"), false, true);
add_script('as-elevatezoom', get_template_directory_uri() . '/js/libs/jquery.elevatezoom.js', array("jquery"), false, true);
}
}
示例5: exchange_get_goods
/**
* 获得分类下的商品
*
* @access public
* @param string $children
* @return array
*/
function exchange_get_goods($children, $min, $max, $ext, $size, $page, $sort, $order) {
$display = $GLOBALS['display'];
$where = "eg.is_exchange = 1 AND g.is_delete = 0 AND " .
"($children OR " . model('Goods')->get_extension_goods($children) . ')';
if ($min > 0) {
$where .= " AND eg.exchange_integral >= $min ";
}
if ($max > 0) {
$where .= " AND eg.exchange_integral <= $max ";
}
/* 获得商品列表 */
$start = ($page - 1) * $size;
$sort = $sort =='sales_volume'? 'xl.sales_volume': $sort;
$sql = 'SELECT g.goods_id, g.goods_name, g.market_price, g.goods_name_style, eg.exchange_integral, ' .
'g.goods_type, g.goods_brief, g.goods_thumb , g.goods_img, eg.is_hot ' .
'FROM ' . $this->pre . 'exchange_goods AS eg LEFT JOIN ' . $this->pre . 'goods AS g ' .
'ON eg.goods_id = g.goods_id ' . ' LEFT JOIN ' . $this->pre . 'touch_goods AS xl ' . ' ON g.goods_id=xl.goods_id ' .
" WHERE $where $ext ORDER BY $sort $order LIMIT $start ,$size ";
$res = $this->query($sql);
$arr = array();
foreach ($res as $row) {
$arr[$row['goods_id']]['goods_id'] = $row['goods_id'];
if ($display == 'grid') {
$arr[$row['goods_id']]['goods_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
} else {
$arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
}
$arr[$row['goods_id']]['name'] = $row['goods_name'];
$arr[$row['goods_id']]['goods_brief'] = $row['goods_brief'];
$arr[$row['goods_id']]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
$arr[$row['goods_id']] ['market_price'] = price_format($row ['market_price']);
$arr[$row['goods_id']]['exchange_integral'] = $row['exchange_integral'];
$arr[$row['goods_id']]['type'] = $row['goods_type'];
$arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$arr[$row['goods_id']]['url'] = build_uri('exchange_goods', array('gid' => $row['goods_id']), $row['goods_name']);
$arr[$row['goods_id']]['sc'] = model('GoodsBase')->get_goods_collect($row['goods_id']);
$arr[$row['goods_id']]['mysc'] = 0;
// 检查是否已经存在于用户的收藏夹
if ($_SESSION ['user_id']) {
unset($where);
// 用户自己有没有收藏过
$where['goods_id'] = $row ['goods_id'];
$where['user_id'] = $_SESSION ['user_id'];
$rs = $this->model->table('collect_goods')->where($where)->count();
$arr[$row['goods_id']]['mysc'] = $rs;
}
}
return $arr;
}
示例6: get_flash_sale_goods
/**
* 获得促销商品
*
* @access public
* @return array
*/
function get_flash_sale_goods($cats = '')
{
$time = gmtime();
$order_type = $GLOBALS['_CFG']['recommend_order'];
/* 取得促销lbi的数量限制 */
$num = get_library_number("recommend_promotion");
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, " . "g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . 'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ' . " AND g.is_promote = 1 AND promote_start_date <= '{$time}' AND promote_end_date >= '{$time}' ";
$sql .= $order_type == 0 ? ' ORDER BY g.sort_order, g.last_update DESC' : ' ORDER BY rnd';
$result = $GLOBALS['db']->getAll($sql);
$goods = array();
foreach ($result as $idx => $row) {
if ($row['promote_price'] > 0) {
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
$goods[$idx]['promote_price'] = $promote_price > 0 ? $promote_price : '';
} else {
$goods[$idx]['promote_price'] = '';
}
$sql = 'SELECT sum(goods_number) AS goods_number FROM ' . $GLOBALS['ecs']->table('order_goods') . ' WHERE goods_id =' . $row['goods_id'] . ' GROUP BY goods_id';
$goods_number = $GLOBALS['db']->getOne($sql);
if (empty($goods_number)) {
$goods_number = 0;
}
if (!empty($row['promote_end_date'])) {
$goods[$idx]['end_date'] = $row['promote_end_date'];
}
$goods[$idx]['soldnum'] = get_soldnum($row['goods_id']);
$goods[$idx]['jiesheng'] = $row['market_price'] - $row['promote_price'];
$goods[$idx]['zhekou'] = sprintf("%1\$.1f", $row['promote_price'] / $row['shop_price'] * 10);
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['number'] = $goods_number;
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = $row['brand_name'];
$goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
$goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
$goods[$idx]['market_price'] = $row['market_price'];
$goods[$idx]['shop_price'] = $row['shop_price'];
$goods[$idx]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
$properties = get_goods_properties($row['goods_id']);
// 获得商品的规格和属性
$goods[$idx]['pro'] = $properties['pro']['商品属性'];
}
return $goods;
}
示例7: as_on_add_styles
function as_on_add_styles()
{
// AS Icon Font
add_style('as-icon-font', TEMPLATEURL . '/css/as-icon-font.css', array(), '1.0', 'all');
// Dialog
add_style('as-dialog', TEMPLATEURL . '/css/libs/dialog/dialog.css', array(), '1.0', 'all');
add_style('as-dialog-wilma', TEMPLATEURL . '/css/libs/dialog/dialog-wilma.css', array('as-dialog'), '1.0', 'all');
// Style.css
add_style('as-style', get_stylesheet_uri());
// Responsive Style
add_style('responsive-style', TEMPLATEURL . '/css/responsive-style.css', array(), '1.0', 'all');
// Custom Style
add_style('custom', TEMPLATEURL . '/css/custom-style.php', array(), '1.0', 'all');
//video
add_style('video', TEMPLATEURL . '/css/libs/html5/video.css', array(), '1.0', 'all');
//audio
add_style('audio', TEMPLATEURL . '/css/libs/html5/audio.css', array(), '1.0', 'all');
add_style('popup', TEMPLATEURL . '/css/libs/popup.css', array(), '1.0', 'all');
}
示例8: index
function index()
{
add_style("box.css");
echo '<div class="content">';
echo '<h1>Thanks for using Rainframework!</h1>';
echo 'To Install and Use some Classes you will add some informations about you';
//load form class
$this->load_library("Form", "form");
$this->form->init_form(URL . "ajax.php/install/install", "post");
$this->form->open_table("Userdata");
$this->form->add_item("text", "adminname", "Admin-Name", "Enter here your Adminname maybe needed later!!", null, "required");
$this->form->add_item("text", "adminemail", "Admin-Email", "for Login", null, "required,email");
$this->form->add_item("password", "adminpassword1", "Admin-Password", "for Login", null, "required", array("id" => "adminpass1"));
$this->form->add_item("password", "adminpassword2", "Admin-Password2", "Repeat your Password", null, "required");
$this->form->add_button();
$this->form->add_validation("adminpassword2", 'equalTo="#adminpass1"', "not equalTo Admin-Password");
$this->form->close_table();
$this->form->draw($ajax = true, $return_string = false);
echo '<div style="text-align: right; font-size: 0.7em;">';
echo 'installerversion BETA.1.0';
echo '</div>';
}
示例9: cat_get_goods
function cat_get_goods($keywords, $children, $brand, $min, $max, $ext, $size, $page, $sort, $order)
{
$display = $GLOBALS['display'];
$where = "g.is_on_sale = 1 AND g.is_alone_sale = 1 AND " . ("g.is_delete = 0 AND (" . $children . " OR ") . get_extension_goods($children) . ")";
if ($keywords != "") {
$where .= " AND g.goods_name LIKE '%" . $keywords . "%' ";
}
if (0 < $brand) {
$where .= "AND g.brand_id=" . $brand . " ";
}
if (0 < $min) {
$where .= " AND g.shop_price >= " . $min . " ";
}
if (0 < $max) {
$where .= " AND g.shop_price <= " . $max . " ";
}
$sql = "SELECT g.goods_id, g.goods_name, g.goods_sn, g.goods_name_style, g.market_price,g.is_promote, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, " . ("IFNULL(mp.user_price, g.shop_price * '" . $_SESSION['discount'] . "') AS shop_price, g.promote_price, g.goods_type, ") . "(select AVG(r.comment_rank) from " . $GLOBALS['ecs']->table("comment") . " as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_rank, (select IFNULL(sum(r.id_value), 0) from " . $GLOBALS['ecs']->table("comment") . " as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_count, (select IFNULL(sum(og.goods_number), 0) from " . $GLOBALS['ecs']->table("order_goods") . " as og where og.goods_id = g.goods_id) AS sell_number, g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img FROM " . $GLOBALS['ecs']->table("goods") . " AS g LEFT JOIN " . $GLOBALS['ecs']->table("member_price") . " AS mp " . ("ON mp.goods_id = g.goods_id AND mp.user_rank = '" . $_SESSION['user_rank'] . "' ") . ("WHERE " . $where . " {$ext} ORDER BY {$sort} {$order}");
$res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
$arr = array();
while ($row = $GLOBALS['db']->fetchRow($res)) {
if (0 < $row['promote_price']) {
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
} else {
$promote_price = 0;
}
$watermark_img = "";
if ($promote_price != 0) {
$watermark_img = "watermark_promote_small";
} else {
if ($row['is_new'] != 0) {
$watermark_img = "watermark_new_small";
} else {
if ($row['is_best'] != 0) {
$watermark_img = "watermark_best_small";
} else {
if ($row['is_hot'] != 0) {
$watermark_img = "watermark_hot_small";
}
}
}
}
if ($watermark_img != "") {
$arr[$row['goods_id']]['watermark_img'] = $watermark_img;
}
$arr[$row['goods_id']]['goods_id'] = $row['goods_id'];
$arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
$arr[$row['goods_id']]['name'] = $row['goods_name'];
$arr[$row['goods_id']]['goods_sn'] = $row['goods_sn'];
$arr[$row['goods_id']]['comment_rank'] = $row['comment_rank'];
$arr[$row['goods_id']]['comment_count'] = $row['comment_count'];
$arr[$row['goods_id']]['sell_number'] = $row['sell_number'];
$arr[$row['goods_id']]['is_promote'] = $row['is_promote'];
$arr[$row['goods_id']]['is_new'] = $row['is_new'];
$arr[$row['goods_id']]['is_best'] = $row['is_best'];
$arr[$row['goods_id']]['is_hot'] = $row['is_hot'];
$arr[$row['goods_id']]['goods_brief'] = $row['goods_brief'];
$arr[$row['goods_id']]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
$arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);
$arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
$arr[$row['goods_id']]['type'] = $row['goods_type'];
$arr[$row['goods_id']]['promote_price'] = 0 < $promote_price ? price_format($promote_price) : "";
$arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], TRUE);
$arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$arr[$row['goods_id']]['url'] = build_uri("goods", array("gid" => $row['goods_id']), $row['goods_name']);
}
return $arr;
}
示例10: get_catindex_recommend_goods
function get_catindex_recommend_goods($type = '', $cats = '')
{
$sql = 'SELECT g.goods_id, g.goods_name,g.goods_brief, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb, goods_img ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . 'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ';
switch ($type) {
case 'best':
$sql .= ' AND is_best = 1';
break;
case 'new':
$sql .= ' AND is_new = 1';
break;
case 'hot':
$sql .= ' AND is_hot = 1';
break;
}
if (!empty($cats)) {
$sql .= " AND (" . $cats . " OR " . get_extension_goods($cats) . ")";
}
$sql .= ' ORDER BY g.sort_order, g.last_update DESC ';
$res = $GLOBALS['db']->selectLimit($sql, 8);
$idx = 0;
$goods = array();
while ($row = $GLOBALS['db']->fetchRow($res)) {
if ($row['promote_price'] > 0) {
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
} else {
$promote_price = 0;
}
$goods[$idx]['promote_price'] = $promote_price;
$goods[$idx]['shop_price'] = price_format($row['shop_price']);
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['goods_brief'] = $row['goods_brief'];
$goods[$idx]['goods_name'] = $row['goods_name'];
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = $row['brand_name'];
$goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$goods[$idx]['market_price'] = price_format($row['market_price']);
$goods[$idx]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
$idx++;
}
return $goods;
}
示例11: load_lang
<?php
/**
* RainFramework
* -------------
* Realized by Federico Ulfo & maintained by the Rain Team
* Distributed under MIT license http://www.opensource.org/licenses/mit-license.php
*/
// load language of the form
load_lang("form");
// add style
add_style("default.css", LIBRARY_DIR . "Form/tpl/");
// add javascript
add_script("jquery/jquery.min.js");
add_script("jquery/jquery.validate.min.js");
class Rain_Form
{
// form variable
private $name, $action, $method, $target;
// html generated
private $html;
// hidden inputs
private $hidden;
// flag
private $upload_file;
// flag
private $tiny_mce = false, $validation = false;
// form counter
private static $form_counter = 0;
function Rain_Form($action = null, $method = "get", $name = null, $target = null, $layout = "default")
{
示例12: index_topic_goods
function index_topic_goods($index_goods_id)
{
global $ecs, $db;
$buf = array();
$ids = explode(",", $index_goods_id);
$n_ids = array();
foreach ($ids as $k => $v) {
$v = intval(trim($v));
if (!$v) {
continue;
}
$n_ids[] = $v;
}
$index_goods_id = implode(",", $n_ids);
if (!$index_goods_id) {
return $buf;
}
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, " . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE g.goods_id in ({$index_goods_id})";
$res = $GLOBALS['db']->query($sql);
while ($row = $GLOBALS['db']->fetchRow($res)) {
$row['market_price'] = price_format($row['market_price']);
$row['shop_price'] = price_format($row['shop_price']);
$row['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
$row['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
$row['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
$row['short_name'] = sub_str($row['goods_name'], 8);
$row['short_name2'] = sub_str($row['goods_name'], 12);
$row['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$row['goods_img'] = get_image_path($row['goods_id'], $row['goods_thumb']);
$row['wap_count'] = selled_wap_count($row['goods_id']);
$row['short_style_name'] = add_style($row['short_name'], $row['goods_name_style']);
if ($display == 'grid') {
$row['goods_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
} else {
$row['goods_name'] = $row['goods_name'];
}
$buf[] = $row;
}
return $buf;
}
示例13: bargain_price
if ($row['promote_price'] > 0) {
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
$row['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
} else {
$row['promote_price'] = '';
}
if ($row['shop_price'] > 0) {
$row['shop_price'] = price_format($row['shop_price']);
} else {
$row['shop_price'] = '';
}
$row['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
$row['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
$row['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$row['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$row['short_style_name'] = add_style($row['short_name'], $row['goods_name_style']);
foreach ($arr as $key => $value) {
foreach ($value as $val) {
if ($val == $row['goods_id']) {
$key = $key == 'default' ? $_LANG['all_goods'] : $key;
$sort_goods_arr[$key][] = $row;
}
}
}
}
/* 模板赋值 */
assign_template();
$position = assign_ur_here();
$smarty->assign('page_title', $position['title']);
// 页面标题
$smarty->assign('ur_here', $position['ur_here'] . '> ' . $topic['title']);
示例14: get_exchange_recommend_goods
/**
* 获得指定分类下的推荐商品
*
* @access public
* @param string $type 推荐类型,可以是 best, new, hot, promote
* @param string $cats 分类的ID
* @param integer $min 商品积分下限
* @param integer $max 商品积分上限
* @param string $ext 商品扩展查询
* @return array
*/
function get_exchange_recommend_goods($type = '', $cats = '', $min = 0, $max = 0, $ext = '')
{
$price_where = $min > 0 ? " AND g.shop_price >= {$min} " : '';
$price_where .= $max > 0 ? " AND g.shop_price <= {$max} " : '';
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, eg.exchange_integral, ' . 'g.goods_brief, g.goods_thumb, goods_img, b.brand_name ' . 'FROM ' . $GLOBALS['ecs']->table('exchange_goods') . ' AS eg ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = eg.goods_id ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' . 'WHERE eg.is_exchange = 1 AND g.is_delete = 0 ' . $price_where . $ext;
$num = 0;
$type2lib = array('best' => 'exchange_best', 'new' => 'exchange_new', 'hot' => 'exchange_hot');
$num = get_library_number($type2lib[$type], 'exchange_list');
switch ($type) {
case 'best':
$sql .= ' AND eg.is_best = 1';
break;
case 'new':
$sql .= ' AND eg.is_new = 1';
break;
case 'hot':
$sql .= ' AND eg.is_hot = 1';
break;
}
if (!empty($cats)) {
$sql .= " AND (" . $cats . " OR " . get_extension_goods($cats) . ")";
}
$order_type = $GLOBALS['_CFG']['recommend_order'];
$sql .= $order_type == 0 ? ' ORDER BY g.sort_order, g.last_update DESC' : ' ORDER BY RAND()';
$res = $GLOBALS['db']->selectLimit($sql, $num);
$idx = 0;
$goods = array();
while ($row = $GLOBALS['db']->fetchRow($res)) {
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = $row['brand_name'];
$goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$goods[$idx]['exchange_integral'] = $row['exchange_integral'];
$goods[$idx]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$goods[$idx]['url'] = build_uri('exchange_goods', array('gid' => $row['goods_id']), $row['goods_name']);
$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
$idx++;
}
return $goods;
}
示例15: cat_get_goods
function cat_get_goods($keywords, $children, $brand, $min, $max, $ext, $size, $page, $sort, $order)
{
$display = $GLOBALS['display'];
$where = "g.is_on_sale = 1 AND g.is_alone_sale = 1 AND " . "g.is_delete = 0 AND ({$children} OR " . get_extension_goods($children) . ')';
if ($keywords != '') {
$where .= " AND g.goods_name LIKE '%{$keywords}%' ";
}
if ($brand > 0) {
$where .= "AND g.brand_id={$brand} ";
}
if ($min > 0) {
$where .= " AND g.shop_price >= {$min} ";
}
if ($max > 0) {
$where .= " AND g.shop_price <= {$max} ";
}
/* 获得商品列表 */
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_sn, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, g.goods_type, " . '(select AVG(r.comment_rank) from ' . $GLOBALS['ecs']->table('comment') . ' as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_rank, ' . '(select IFNULL(sum(og.goods_number), 0) from ' . $GLOBALS['ecs']->table('order_goods') . ' as og where og.goods_id = g.goods_id) AS sell_number, ' . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img, click_count ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE {$where} {$ext} ORDER BY {$sort} {$order}";
$res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
$arr = array();
while ($row = $GLOBALS['db']->fetchRow($res)) {
if ($row['promote_price'] > 0) {
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
} else {
$promote_price = 0;
}
/* 处理商品水印图片 */
$watermark_img = '';
if ($promote_price != 0) {
$watermark_img = "watermark_promote_small";
} elseif ($row['is_new'] != 0) {
$watermark_img = "watermark_new_small";
} elseif ($row['is_best'] != 0) {
$watermark_img = "watermark_best_small";
} elseif ($row['is_hot'] != 0) {
$watermark_img = 'watermark_hot_small';
}
if ($watermark_img != '') {
$arr[$row['goods_id']]['watermark_img'] = $watermark_img;
}
$arr[$row['goods_id']]['goods_id'] = $row['goods_id'];
if ($display == 'grid') {
$arr[$row['goods_id']]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
}
$arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
$arr[$row['goods_id']]['name'] = $row['goods_name'];
$arr[$row['goods_id']]['goods_sn'] = $row['goods_sn'];
$arr[$row['goods_id']]['comment_rank'] = $row['comment_rank'];
$arr[$row['goods_id']]['sell_number'] = $row['sell_number'];
$arr[$row['goods_id']]['is_new'] = $row['is_new'];
$arr[$row['goods_id']]['goods_brief'] = $row['goods_brief'];
$arr[$row['goods_id']]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
$arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);
$arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
$arr[$row['goods_id']]['type'] = $row['goods_type'];
$arr[$row['goods_id']]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
$arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$arr[$row['goods_id']]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
}
return $arr;
}