仿淘宝商品详细页加入购物车效果
goods.dwt页面
和默认的链接有点点区别 大家对比添加
要显示的层添加到这个叶面的底部
复制代码
我把样式也贴出来 供大家参考 .cartSure{
position:absolute;
left:0;
top:545px;
width:405px;
height:90px;
z-index:999;
background:url(images/cartSure_bg.gif) 0 0 no-repeat;
font-size:12px;
}.mesgCon{
float:left;
background:url(images/mesg.png) no-repeat 18px 9px;
color:#666;
line-height:21px;
padding:0 0 0 100px;
width:320px;
}.mesgCon h3{
float:left;
width:320px;
color:#333;
font-size:14px;
margin:-1px 0 6px;
height:auto;
line-height:20px;
background:none;
text-align:left;
padding:0;
font-weight:bold;
}.mesgCon input{float:left; margin:0 11px 0 0}
.mesgCon div{float:left; font-size:13px}
.mesgCon div span{font-size:14px; font-weight:bold; color:#F80}
.cartSure .btn{float:left; padding:5px; width:390px}
.cartSure .btn a{
background:url(images/close_bg.gif) no-repeat 0 0;
float:right;
height:13px;
overflow:hidden;
text-indent:-5000px;
width:38px;
}.cartSure .btn a:hover{background-position:0 -12px}
复制代码
打开js/common.js文件 修改 addToCart函数 修改后:
function addToCart(goodsId, parentId,is_ajax)
{
var goods = new Object();
var spec_arr = new Array();
var fittings_arr = new Array();
var number = 1;
var formBuy = document.forms['ECS_FORMBUY'];
var quick = 0;
// 检查是否有商品规格
if (formBuy)
{
spec_arr = getSelectedAttributes(formBuy);if (formBuy.elements['number'])
{
number = formBuy.elements['number'].value;
}quick = 1;
}goods.quick = quick;
goods.spec = spec_arr;
goods.goods_id = goodsId;
goods.number = number;
goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);if(is_ajax == 1){
Ajax.call('flow.php教程?step=add_to_cart', 'goods=' + goods.toJS**tring(), addToCartResp**e_ajax, 'POST', 'JSON');
}else{
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJS**tring(), addToCartResp**e, 'POST', 'JSON');
}
}
复制代码
添加几个js函数 /* *
* 处理添加商品到购物车的反馈信息
*/
function addToCartResp**e_ajax(result)
{
if (result.error > 0)
{
// 如果需要缺货登记,跳转
if (result.error == 2)
{
if (confirm(result.message))
{
location.href = 'user.php?act=add_booking&id=' + result.goods_id + '&spec=' + result.product_spec;
}
//opendiv_booking();}
// 没选规格,弹出属性选择框
else if (result.error == 6)
{
openSpeDiv(result.message, result.goods_id, result.parent);
}
else
{
alert(result.message);
}
}
else
{
var cartInfo = document.getElementById('ECS_CARTINFO');
var cart_url = 'flow.php?step=cart';
if (cartInfo)
{
cartInfo.innerHTML = result.content;
}if (result.one_step_buy == '1')
{
location.href = cart_url;
}
else
{
switch(result.confirm_type)
{
case '1' :
if (confirm(result.message)) location.href = cart_url;
break;
case '2' :
if (!confirm(result.message)) location.href = cart_url;
break;
case '3' :
divTipmiddle(result);
//refresh_cart();
document.getElementById('jdiv').innerHTML = result.cj;
break;
default :
break;
}
}
}
}
//购物车提示框JS
function closeTipBox(){
document.getElementById('cartSureBox').style.display="none";
}
function divTipmiddle(result){
openTipBox(result);
var a = document.getElementById("cartSureBox");
a.style.left=(document.body.clientWidth/2-a.clientWidth/2+245)+"px";
}
function openTipBox(result){
document.getElementById('ECS_GOODS_PRICE').innerHTML = result.goods_price;
document.getElementById('ECS_GOODS_NUMBER').innerHTML = result.goods_number;
document.getElementById('cartSureBox').style.display="block";
}
function opendiv_booking()
{
document.getElementById('buyTip2').style.display="block";}
//购物车提示框JS
function closeTipBox(){
document.getElementById('cartSureBox').style.display="none";
}
复制代码
打开flow.php 167行左右添加 /* 取得商品列表,计算合计 */
$cart_goods = get_cart_goods();
//$smarty->assign('total', $cart_goods['total']);
$result['goods_price'] = $cart_goods['total']['goods_price'];
$result['goods_number'] = $cart_goods['total']['real_goods_count'];
复制代码
根据以上操作可实现 效果大家应该都知道 如图:实现方法:
goods.dwt页面和默认的链接有点点区别 大家对比添加
要显示的层添加到这个叶面的底部
复制代码
我把样式也贴出来 供大家参考 .cartSure{
position:absolute;
left:0;
top:545px;
width:405px;
height:90px;
z-index:999;
background:url(images/cartSure_bg.gif) 0 0 no-repeat;
font-size:12px;
}.mesgCon{
float:left;
background:url(images/mesg.png) no-repeat 18px 9px;
color:#666;
line-height:21px;
padding:0 0 0 100px;
width:320px;
}.mesgCon h3{
float:left;
width:320px;
color:#333;
font-size:14px;
margin:-1px 0 6px;
height:auto;
line-height:20px;
background:none;
text-align:left;
padding:0;
font-weight:bold;
}.mesgCon input{float:left; margin:0 11px 0 0}
.mesgCon div{float:left; font-size:13px}
.mesgCon div span{font-size:14px; font-weight:bold; color:#F80}
.cartSure .btn{float:left; padding:5px; width:390px}
.cartSure .btn a{
background:url(images/close_bg.gif) no-repeat 0 0;
float:right;
height:13px;
overflow:hidden;
text-indent:-5000px;
width:38px;
}.cartSure .btn a:hover{background-position:0 -12px}
复制代码
打开js/common.js文件 修改 addToCart函数 修改后:
function addToCart(goodsId, parentId,is_ajax)
{
var goods = new Object();
var spec_arr = new Array();
var fittings_arr = new Array();
var number = 1;
var formBuy = document.forms['ECS_FORMBUY'];
var quick = 0;
// 检查是否有商品规格
if (formBuy)
{
spec_arr = getSelectedAttributes(formBuy);if (formBuy.elements['number'])
{
number = formBuy.elements['number'].value;
}quick = 1;
}goods.quick = quick;
goods.spec = spec_arr;
goods.goods_id = goodsId;
goods.number = number;
goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);if(is_ajax == 1){
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJS**tring(), addToCartResp**e_ajax, 'POST', 'JSON');
}else{
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJS**tring(), addToCartResp**e, 'POST', 'JSON');
}
}
复制代码
添加几个js函数 /* *
* 处理添加商品到购物车的反馈信息
*/
function addToCartResp**e_ajax(result)
{
if (result.error > 0)
{
// 如果需要缺货登记,跳转
if (result.error == 2)
{
if (confirm(result.message))
{
location.href = 'user.php?act=add_booking&id=' + result.goods_id + '&spec=' + result.product_spec;
}
//opendiv_booking();}
// 没选规格,弹出属性选择框
else if (result.error == 6)
{
openSpeDiv(result.message, result.goods_id, result.parent);
}
else
{
alert(result.message);
}
}
else
{
var cartInfo = document.getElementById('ECS_CARTINFO');
var cart_url = 'flow.php?step=cart';
if (cartInfo)
{
cartInfo.innerHTML = result.content;
}if (result.one_step_buy == '1')
{
location.href = cart_url;
}
else
{
switch(result.confirm_type)
{
case '1' :
if (confirm(result.message)) location.href = cart_url;
break;
case '2' :
if (!confirm(result.message)) location.href = cart_url;
break;
case '3' :
divTipmiddle(result);
//refresh_cart();
document.getElementById('jdiv').innerHTML = result.cj;
break;
default :
break;
}
}
}
}
//购物车提示框JS
function closeTipBox(){
document.getElementById('cartSureBox').style.display="none";
}
function divTipmiddle(result){
openTipBox(result);
var a = document.getElementById("cartSureBox");
a.style.left=(document.body.clientWidth/2-a.clientWidth/2+245)+"px";
}
function openTipBox(result){
document.getElementById('ECS_GOODS_PRICE').innerHTML = result.goods_price;
document.getElementById('ECS_GOODS_NUMBER').innerHTML = result.goods_number;
document.getElementById('cartSureBox').style.display="block";
}
function opendiv_booking()
{
document.getElementById('buyTip2').style.display="block";}
//购物车提示框JS
function closeTipBox(){
document.getElementById('cartSureBox').style.display="none";
}
复制代码
打开flow.php 167行左右添加 /* 取得商品列表,计算合计 */
$cart_goods = get_cart_goods();
//$smarty->assign('total', $cart_goods['total']);
$result['goods_price'] = $cart_goods['total']['goods_price'];
$result['goods_number'] = $cart_goods['total']['real_goods_count'];
复制代码
根据以上操作可实现
实现方法:
goods.dwt页面和默认的链接有点点区别 大家对比添加
要显示的层添加到这个叶面的底部
复制代码
我把样式也贴出来 供大家参考 .cartSure{
position:absolute;
left:0;
top:545px;
width:405px;
height:90px;
z-index:999;
background:url(images/cartSure_bg.gif) 0 0 no-repeat;
font-size:12px;
}.mesgCon{
float:left;
background:url(images/mesg.png) no-repeat 18px 9px;
color:#666;
line-height:21px;
padding:0 0 0 100px;
width:320px;
}.mesgCon h3{
float:left;
width:320px;
color:#333;
font-size:14px;
margin:-1px 0 6px;
height:auto;
line-height:20px;
background:none;
text-align:left;
padding:0;
font-weight:bold;
}.mesgCon input{float:left; margin:0 11px 0 0}
.mesgCon div{float:left; font-size:13px}
.mesgCon div span{font-size:14px; font-weight:bold; color:#F80}
.cartSure .btn{float:left; padding:5px; width:390px}
.cartSure .btn a{
background:url(images/close_bg.gif) no-repeat 0 0;
float:right;
height:13px;
overflow:hidden;
text-indent:-5000px;
width:38px;
}.cartSure .btn a:hover{background-position:0 -12px}
复制代码
打开js/common.js文件 修改 addToCart函数 修改后:
function addToCart(goodsId, parentId,is_ajax)
{
var goods = new Object();
var spec_arr = new Array();
var fittings_arr = new Array();
var number = 1;
var formBuy = document.forms['ECS_FORMBUY'];
var quick = 0;
// 检查是否有商品规格
if (formBuy)
{
spec_arr = getSelectedAttributes(formBuy);if (formBuy.elements['number'])
{
number = formBuy.elements['number'].value;
}quick = 1;
}goods.quick = quick;
goods.spec = spec_arr;
goods.goods_id = goodsId;
goods.number = number;
goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);if(is_ajax == 1){
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJS**tring(), addToCartResp**e_ajax, 'POST', 'JSON');
}else{
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJS**tring(), addToCartResp**e, 'POST', 'JSON');
}
}
复制代码
添加几个js函数 /* *
* 处理添加商品到购物车的反馈信息
*/
function addToCartResp**e_ajax(result)
{
if (result.error > 0)
{
// 如果需要缺货登记,跳转
if (result.error == 2)
{
if (confirm(result.message))
{
location.href = 'user.php?act=add_booking&id=' + result.goods_id + '&spec=' + result.product_spec;
}
//opendiv_booking();}
// 没选规格,弹出属性选择框
else if (result.error == 6)
{
openSpeDiv(result.message, result.goods_id, result.parent);
}
else
{
alert(result.message);
}
}
else
{
var cartInfo = document.getElementById('ECS_CARTINFO');
var cart_url = 'flow.php?step=cart';
if (cartInfo)
{
cartInfo.innerHTML = result.content;
}if (result.one_step_buy == '1')
{
location.href = cart_url;
}
else
{
switch(result.confirm_type)
{
case '1' :
if (confirm(result.message)) location.href = cart_url;
break;
case '2' :
if (!confirm(result.message)) location.href = cart_url;
break;
case '3' :
divTipmiddle(result);
//refresh_cart();
document.getElementById('jdiv').innerHTML = result.cj;
break;
default :
break;
}
}
}
}
//购物车提示框JS
function closeTipBox(){
document.getElementById('cartSureBox').style.display="none";
}
function divTipmiddle(result){
openTipBox(result);
var a = document.getElementById("cartSureBox");
a.style.left=(document.body.clientWidth/2-a.clientWidth/2+245)+"px";
}
function openTipBox(result){
document.getElementById('ECS_GOODS_PRICE').innerHTML = result.goods_price;
document.getElementById('ECS_GOODS_NUMBER').innerHTML = result.goods_number;
document.getElementById('cartSureBox').style.display="block";
}
function opendiv_booking()
{
document.getElementById('buyTip2').style.display="block";}
//购物车提示框JS
function closeTipBox(){
document.getElementById('cartSureBox').style.display="none";
}
复制代码
打开flow.php 167行左右添加 /* 取得商品列表,计算合计 */
$cart_goods = get_cart_goods();
//$smarty->assign('total', $cart_goods['total']);
$result['goods_price'] = $cart_goods['total']['goods_price'];
$result['goods_number'] = $cart_goods['total']['real_goods_count'];
复制代码
根据以上操作可实现
实现方法:
goods.dwt页面和默认的链接有点点区别 大家对比添加
要显示的层添加到这个叶面的底部
复制代码
我把样式也贴出来 供大家参考 .cartSure{
position:absolute;
left:0;
top:545px;
width:405px;
height:90px;
z-index:999;
background:url(images/cartSure_bg.gif) 0 0 no-repeat;
font-size:12px;
}.mesgCon{
float:left;
background:url(images/mesg.png) no-repeat 18px 9px;
color:#666;
line-height:21px;
padding:0 0 0 100px;
width:320px;
}.mesgCon h3{
float:left;
width:320px;
color:#333;
font-size:14px;
margin:-1px 0 6px;
height:auto;
line-height:20px;
background:none;
text-align:left;
padding:0;
font-weight:bold;
}.mesgCon input{float:left; margin:0 11px 0 0}
.mesgCon div{float:left; font-size:13px}
.mesgCon div span{font-size:14px; font-weight:bold; color:#F80}
.cartSure .btn{float:left; padding:5px; width:390px}
.cartSure .btn a{
background:url(images/close_bg.gif) no-repeat 0 0;
float:right;
height:13px;
overflow:hidden;
text-indent:-5000px;
width:38px;
}.cartSure .btn a:hover{background-position:0 -12px}
复制代码
打开js/common.js文件 修改 addToCart函数 修改后:
function addToCart(goodsId, parentId,is_ajax)
{
var goods = new Object();
var spec_arr = new Array();
var fittings_arr = new Array();
var number = 1;
var formBuy = document.forms['ECS_FORMBUY'];
var quick = 0;
// 检查是否有商品规格
if (formBuy)
{
spec_arr = getSelectedAttributes(formBuy);if (formBuy.elements['number'])
{
number = formBuy.elements['number'].value;
}quick = 1;
}goods.quick = quick;
goods.spec = spec_arr;
goods.goods_id = goodsId;
goods.number = number;
goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);if(is_ajax == 1){
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJS**tring(), addToCartResp**e_ajax, 'POST', 'JSON');
}else{
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJS**tring(), addToCartResp**e, 'POST', 'JSON');
}
}
复制代码
添加几个js函数 /* *
* 处理添加商品到购物车的反馈信息
*/
function addToCartResp**e_ajax(result)
{
if (result.error > 0)
{
// 如果需要缺货登记,跳转
if (result.error == 2)
{
if (confirm(result.message))
{
location.href = 'user.php?act=add_booking&id=' + result.goods_id + '&spec=' + result.product_spec;
}
//opendiv_booking();}
// 没选规格,弹出属性选择框
else if (result.error == 6)
{
openSpeDiv(result.message, result.goods_id, result.parent);
}
else
{
alert(result.message);
}
}
else
{
var cartInfo = document.getElementById('ECS_CARTINFO');
var cart_url = 'flow.php?step=cart';
if (cartInfo)
{
cartInfo.innerHTML = result.content;
}if (result.one_step_buy == '1')
{
location.href = cart_url;
}
else
{
switch(result.confirm_type)
{
case '1' :
if (confirm(result.message)) location.href = cart_url;
break;
case '2' :
if (!confirm(result.message)) location.href = cart_url;
break;
case '3' :
divTipmiddle(result);
//refresh_cart();
document.getElementById('jdiv').innerHTML = result.cj;
break;
default :
break;
}
}
}
}
//购物车提示框JS
function closeTipBox(){
document.getElementById('cartSureBox').style.display="none";
}
function divTipmiddle(result){
openTipBox(result);
var a = document.getElementById("cartSureBox");
a.style.left=(document.body.clientWidth/2-a.clientWidth/2+245)+"px";
}
function openTipBox(result){
document.getElementById('ECS_GOODS_PRICE').innerHTML = result.goods_price;
document.getElementById('ECS_GOODS_NUMBER').innerHTML = result.goods_number;
document.getElementById('cartSureBox').style.display="block";
}
function opendiv_booking()
{
document.getElementById('buyTip2').style.display="block";}
//购物车提示框JS
function closeTipBox(){
document.getElementById('cartSureBox').style.display="none";
}
复制代码
打开flow.php 167行左右添加 /* 取得商品列表,计算合计 */
$cart_goods = get_cart_goods();
//$smarty->assign('total', $cart_goods['total']);
$result['goods_price'] = $cart_goods['total']['goods_price'];
$result['goods_number'] = $cart_goods['total']['real_goods_count'];

百度网盘群怎么加入?百度网盘中是可以加入到群聊,但是多数的小伙伴不知道百度网盘中如何加入到群聊中,接下来就是小编为用户带来的百度网盘群加入方法图文教程,感兴趣的用户快来一起看看吧!百度网盘群怎么加入1、首先打开百度网盘APP,主页面底部【共享】点击进入专区;2、然后在下图所示共享界面,点击右上角【+】号;3、之后下方展开窗口,选择【加好友/群】功能;4、最后输入群账号或者扫一扫都可以添加群聊。

在我们日常生活中,网上购物已经成为非常普遍的消费方式,而购物车功能也是网上购物的重要组成部分之一。那么,本文将为大家介绍如何利用PHP语言来实现购物车的相关功能。一、技术背景购物车是一种在线购物网站常见的功能。当用户在一个网站上浏览一些商品,他们可以将这些商品添加到一个虚拟的购物车中,以便于在后续的结账过程中选择和管理。购物车通常包括以下基本功能:添加商品:

PHP商城开发技巧:设计购物车和订单同步功能在一个商城网站中,购物车和订单是不可或缺的功能。购物车用于用户选购商品并保存到临时购物车中,而订单则是用户确认购买商品后生成的记录。为了提升用户体验和减少错误,设计一个购物车和订单同步的功能非常重要。一、购物车和订单的概念购物车通常是一个临时的容器,用于保存用户选购的商品。用户可以将商品加入购物车,方便浏览和管理。

如何利用Redis和JavaScript实现购物车功能购物车是电商网站中非常常见的功能之一,它允许用户将感兴趣的商品添加到购物车中,方便用户随时查看和管理购买的商品。在本文中,我们将介绍如何利用Redis和JavaScript实现购物车功能,并提供具体的代码示例。一、准备工作在开始之前,我们需要确保已经安装并配置好Redis,可以通过官方网站[https:/

如何在MySQL中设计商城的购物车表结构?随着电子商务的快速发展,购物车已成为在线商城的重要组成部分。购物车用于保存用户选购的商品和相关信息,为用户提供方便快捷的购物体验。在MySQL中设计一个合理的购物车表结构,可以帮助开发人员有效存储和管理购物车数据。本文将介绍如何在MySQL中设计商城的购物车表结构,以及提供一些具体的代码示例。首先,购物车表应该包含以

如何使用PHP实现一个简单的购物车功能购物车功能是电子商务网站中必不可少的一部分,它允许用户将感兴趣的商品添加到购物车中,随后可以进行结算或继续浏览和添加商品。本文将介绍如何使用PHP实现一个简单的购物车功能,并提供具体的代码示例。创建数据库和表格首先,我们需要创建一个数据库和一个用于存储购物车数据的表。CREATEDATABASEshopping_ca

我们在使用这款平台来进行一些多方面选择的时候,我们所购买到的一些商品,尤其是我们所购买的鞋子,自己花钱买来,不确定是不是假货,所以为了能够让我们自己安心一些,就只有进行一些商品方面的一些鉴定,这样才能可以知道是否是真的假的,这让自己买起来也比较放心一些,也是说花钱也能够更踏实一点,至少不用穿假货对不对,所以今日为了能够让更多的用户们可以知道怎么去进行商品的一些鉴别,今日小编就来给大家伙们好好的讲解一下上面的一些内容资讯,所以有想法的朋友们一定不能够错过了,赶紧和小编一起来看看吧。 鉴别真假

如何在MySQL中设计商城的商品表结构?MySQL是一种常用的关系型数据库管理系统,广泛应用于各种类型的网站和应用程序中。在设计商城的商品表结构时,需要考虑到商品的属性、分类以及库存等因素。下面将详细介绍如何在MySQL中设计商城的商品表结构,并给出具体的代码示例。商品表的基本信息:在设计商品表结构时,首先需要确定商品的基本信息,如商品名称、价格、描述、图片


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

mPDF
mPDF是一个PHP库,可以从UTF-8编码的HTML生成PDF文件。原作者Ian Back编写mPDF以从他的网站上“即时”输出PDF文件,并处理不同的语言。与原始脚本如HTML2FPDF相比,它的速度较慢,并且在使用Unicode字体时生成的文件较大,但支持CSS样式等,并进行了大量增强。支持几乎所有语言,包括RTL(阿拉伯语和希伯来语)和CJK(中日韩)。支持嵌套的块级元素(如P、DIV),

SublimeText3 Linux新版
SublimeText3 Linux最新版

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具