JQuery 取得checkbox值

06 2 条评论
	var cardids='';
	var j=0;
	var expcode;
	$("input[name='BatchDelCardId']").each(function(){
		   if($(this).attr("checked")==true){
				if(j==0)
				{
					expcode='';
				}
				else
				{
					expcode=',';
				}
				cardids += expcode+$(this).attr("value");
				j++;
		   }
     });
    alert(cardids);

JQuery checkbox 全选 反选 取消选择

06

JS菜,留作备注

JQuery checkbox 全选

function CheckAllCard()
{
	$("input[name='BatchDelCardId']").attr("checked", true);
}

JQuery checkbox 反选

function InvertAllCard()
{
	$("input[name='BatchDelCardId']").each(function(){
   		$(this).attr("checked",!this.checked);
     });
}

JQuery checkbox 取消选择

function UnselectAllCard()
{
	$("input[name='BatchDelCardId']").attr("checked", false);
}

帝国CMS商城代码解析1 – 购物车cookie

02 12°

题外:
每天博客也没什么好写的,如果把一个系统用的透透彻彻那就是进步了,如果内部结构了解的透透彻彻了应该是成长了,如果是分析的透透彻彻那应该是上一个层次了,trylife现在做第二步,并向第三步骤发展;希望写出来的内容同样对大家有帮助,另外一系列的内容比较容易集中探讨问题,文章水平比较烂,有什么不足的地方请多指教,有什么要关于这个系列《帝国CMS购物车代码解析》要讨论我们可以在评论里讨论,当然有什么好问题更欢迎,本身博客要交换,更多是为浏览者而存在,也许你的问题就是下一篇博文呢。

帝国CMS商城前台相关文件

e/class/ShopSysFun.php 商城核心函数文件
e/ShopSys/buycar/index.php 商城购物车
e/ShopSys/order/index.php 订单信息填写页
e/ShopSys/SubmitOrder/index.php 订单确认提交页
e/ShopSys/ListDd/index.php 前台会员查看订单列表
e/ShopSys/ShowDd/index.php 前台会员查看订单详细

e/template/ShopSys/buycar.php 商城购物车模板
e/template/ShopSys/order.php 订单信息填写页模板
e/template/ShopSys/SubmitOrder.php 订单确认提交页模板
e/template/ShopSys/ListDd.php 前台会员查看订单列表模板
e/template/ShopSys/ShowDd.php 前台会员查看订单详细模板

增加订单入口链接

/e/enews/?enews=AddBuycar&classid=[!--classid--]&id=[!--id--]

增加订单函数

AddBuycar($classid,$id)
$classid 为栏目ID
$id 为文章ID

购物车cookie声明与读取

声明: SetBuycar($buycar) e/class/ShopSysFun.php
读取: $buycar=getcvar(‘mybuycar’);
帝国CMScookie操作函数查看《esetcookie() getcvar() -帝国CMS cookie 操作函数》

增加订单系统流程简介

1.从入口链接GET得到栏目ID和内容ID
2.判断信息在数据表中是否存在
3.设置购物车cookie
4.跳转购物车地址e/ShopSys/buycar/index.php
5.购物车(e/ShopSys/buycar/index.php)将会读取COOKIE分离后得到栏目ID,内容ID,购买数量

购车COOKIE格式

一种商品:|栏目ID,内容ID|购买数量!
二种商品:|栏目ID,内容ID|购买数量!|栏目ID,内容ID|购买数量!
三种商品:|栏目ID,内容ID|购买数量!|栏目ID,内容ID|购买数量!|栏目ID,内容ID|购买数量!
备注:查看购物车cookie可以在e/ShopSys/buycar/index.php中找到$buycar=getcvar(‘mybuycar’);修改为echo $buycar=getcvar(‘mybuycar’); 打开购物车就可以看到购物车COOKIE了

帝国CMS商城购物车 cookie开发示例:在购物车直接删除某件商品

分析:根据购物车COOKIE的格式,我们得到栏目ID,内容ID,购买数量(不一定是必须的),之后组合格式,删除COOKIE中的此段内容,重新打开购物车/或刷新购物车页面,这样就可以不用调整购物车,二直接删除某件商品;

要点:
1.需要一个PHP脚本页从用户删除商城COOKIE中删除提交的商品
2.为了直观方便体验好,还是使用AJAX效果(trylife使用的是JQuery),所以又下面2条
3.给购物车商品行加个ID格式为:product-栏目ID-信息ID-购买数量
3.商品行每行增加一个删除按钮
3.一个ajax函数用于处理删除动作

文件修改与增加:
修改文件:e/template/ShopSys/buycar.php 商城购物车模板
增加问津:e/trylife/ShopSys-demo/del-product.php 删除单个商品处理文件

最终效果截图:

示例下载与安装:
1.点击下载帝国CMS商城购物车 AJAX删除商品插件示例
2.解压后上传trylife目录到e目录
3.buycar.php上传覆盖到e/template/ShopSys/buycar.php 或对照修改

——————————————Exp.line———————————————
感谢凡姐关于JS的问题有问必答;各位朋友有关于帝国CMS商城的问题解析和本文的问题欢迎在本文下评论。《帝国CMS商城代码解析》下面的文章要写什么还是需要大家的方向标滴

帝国CMS不为人知的技巧 – 终极栏目自定义排序项

20 34°

一、概述

此文同属于《帝国CMS 会员信息加粗/加色/置顶》相关分享

如上图,默认的选择方式如绿色框圈出有5个选项,实际上是可以自定义新的排序方式,不限制在系统给定的5个,而是主表字段均可参与排序,例如:turetime(真实发布时间的UNIX时间戳),lastdotime(信息修改时间UNIX时间戳)所有主表字段包括自定义字段在内,同样可以多个排序参数一起用(truetime desc,lastdotime desc),实际情况我们我们先看代码;

二、探索

$query="select ".ReturnSqlListF($mid)." from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$yhadd."(".$whereclass.") and checked=1 order by ".ReturnSetTopSql('list').$addorder.$limit;

以下代码是e/class/functions.php中负责终极栏目查询的代码,有两个排序条件取得代码ReturnSetTopSql(‘list’)和$addorder;ReturnSetTopSql(‘list’)取得的是列表是否使用置顶排序,ReturnSetTopSql()定义在e/class/connect.php,相关设置在后台->系统设置->信息设置中;$addorder为以下代码判断获得的,大致意思是栏目设置中排序方式为空的话就默认用发布时间倒序排序,如果是不为空的话呢就使用栏目设置的排序;

//排序
if(empty($class_r[$classid][reorder]))
{
	$addorder="newstime desc";
}
else
{
	$addorder=$class_r[$classid][reorder];
}

三、总结

1.以会员信息置顶为例如果使用外置字段作为置顶字段,可以在栏目设置中添加排序选项,这样减少了修改系统文件
2.不同模型排序,复杂模型排序同样可以使用栏目设置的排序选项,方便;
3.不更改文件并且系统参数设置使用制定排序则置顶排序永远高于栏目设置的排序设置
4.必要的时候可以更改ReturnSetTopSql(‘list’)与$addorder前后顺序满足特殊排序需要(其他排序选项高于系统排序情况下)
5.最好的办法就是后台系统设置不设置置顶项参与排序,而在栏目设置中自己定义排序字段

四、相关文章推荐

帝国CMS模板不为人知的技巧2 – 对系统设置的重新赋值
帝国CMS模板不为人知的技巧 – 对语言包重新赋值应用

《帝国CMS 会员信息加粗/加色/置顶》 插件

20

一、帝国CMS 会员信息加粗/加色/置顶 展示

和以前做的有些不同,以前只做的是帝国CMS系统外置功能,就是不和系统的信息加色/加粗/置顶相关联的;以前《帝国CMS会员信息加色/置顶/加粗》地址:http://bbs.phome.net/showthread-13-115085-0.html;此版本客户要求按着系统内置的加粗/加色/置顶;于是出现新版本的截图如下:

二、帝国CMS 会员信息加粗/加色/置顶 相关分享

帝国CMS不为人知的技巧 – 自定义列表排序项

  • MySQL ./configure --helphow long does marijuana stay in your system
    How can i get thc out my system fast? If you're clean now and you don't smoke again between now and then, 3 weeks should be more than plenty of time for it to get out of your ...
  • 帝国CMS二次开发 迅雷/快车批量下载插件 (截图)SwopeWeep
    Portuguese, also as pairs of trail shoes for kinds race. I predicted it becoming heat in Brazil (becauseallow for air to circulate involving its consumer and the backpack by itself. This kind of bag technology will help preserve theare seriously PVC-free and supply memory becoming a member of plus new jersey ship regarding the safe. The foot of all thechallenge or take a seat to the sidelines and see we stay pass. A great thought is at present - we do not getIn contrast to a few other hiking footwear appears so basic, eye-catching Ugg boots continually shift their north face jackets winter things to do at bay. Enough purpose for 40 years of out of doorways gear design and style and screeningjackets and ski pants and foot wears designed to supply comfort and security to ski lovers. As ages pass bytrick: a aspect entrance. This additional entrance may make it a lot easier to identify things buried deep inside your bag.exclusive and trendy variations obviously suit present-day tendencies and furthermore meet kind wants. north encounter Jacketsfrom giving heat and defense through the elements, it also provides a enjoyable really feel. Luxurious in
  • make: ./libtool: Command not foundRegistry Cleaners
    Fascinating blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple tweeks would really make my blog jump out. Please let me know where you got your theme. Thank you
  • 开发使用并出售愤怒的站长
    :razz: 必须顶一个
  • 新的帝国CMS反馈发送邮箱示例
    邮件内容:联系人:$add['lianxiren'],联系手机:$add['tel'] , 不能读取字段;是什么原因?
  • 2147483647Alternative Healing Methods
    Cure physical and mental problems. Get information about various alternative healing methods.