magento促销方案之_-_购物车内点击赠送礼品.doc
上传人:sy****28 上传时间:2024-09-15 格式:DOC 页数:2 大小:18KB 金币:16 举报 版权申诉
预览加载中,请您耐心等待几秒...

magento促销方案之_-_购物车内点击赠送礼品.doc

magento促销方案之_-_购物车内点击赠送礼品.doc

预览

在线预览结束,喜欢就下载吧,查找使用更方便

16 金币

下载此文档

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

关于magento的另外一种HYPERLINK"http://sjolzy.cn/post/660"促销方案:在购物车根据客户购买商品数量赠送等数价格为0的小礼品。希望目标:在购物车页面左下角块中显示后台设置的赠品专区里的设定数量的商品,当用户点击某款赠品时,即添加到购物车。(根据用户购买商品数可选等量的赠品)实现:1,在后台建立一个专门存放价格为0的赠品的目录A。另外,将目录的GeneralInformation的IsActive属性设为NO,这样在前台商品目录就不会显示这个赠品目录,但在购物车那边客户读取这个目录的产品。2,然后向目录A添加几个测试商品a1,a2,a3...,注意在ProductInformation把Inventory里的Qty设为大于0、价格设为0、StockAvailability选项选为InStock、Websites里的站也要勾上,这样赠品添加完毕。3,代码修改a文件:/app/design/frontend/default/beautyard/template/checkout/cart.phtml头部加上:<script>varx=0,y=0;</script>b文件:/app/design/frontend/default/beautyard/template/checkout/cart/crosssell.phtml也是在头部加上():<?php$cartNumbers=Mage::helper('checkout/cart')->getCart()->getSummaryQty();$maxGift=3;//控制要显示的赠品数$categoryIds=726;//网站赠品目录的id$_productCollection=Mage::getResourceModel('reports/product_collection')->addAttributeToSelect('*')->addAttributeToFilter('category_ids',array('finset'=>$categoryIds));$category=Mage::getModel('catalog/category');$category->load($categoryIds);$collection=$category->getProductCollection();foreach($collectionas$product){$result[]=$product->getId();}?><divid="cartGift"name="cartGift"class="box-others-also-like"><ul><?phpif(count($result)>$maxGift){$ourneed=array_rand($result,$maxGift);foreach($ourneedas$cc){$thisproduct=Mage::getModel('catalog/product')->load($result[$cc]);?><li><ahref="/checkout/cart/add?product=<?phpecho$result[$cc];?>&qty=1"title="<?phpecho$thisproduct->getName();?>"><?phpecho$thisproduct->getName();?></a></li><?php}}?></ul></div><divid="cartGiftTips"name="cartGiftTips">chooseover</div><script>(x<=y)?($('cartGift').hide()&&$('cartGiftTips').show()):($('cartGift').show()&&$('cartGiftTips').hide())</script>c文件:/app/design/frontend/default/beautyard/template/checkout/cart/item/default.phtml160行左右加上:<?phpif($_item->getCalculationPrice()>0):?><script>x+=<?phpecho$this->getQty();?>;</script><?phpelse:?><script>y+=<?phpecho$this->getQty();?>;</script><?phpendif;?>接着更改之后的td:<tdclass="a-center"><inp