隐藏顶部菜单上的购物车 当购物车为空时


Hide Shopping Cart on Top Menu When it is empty

有没有办法在顶部菜单上隐藏购物车?我相信它在 Links.php 文件中,但我不知道要添加什么代码。 此外,"链接.php"是一个核心文件,我正在考虑在本地为其创建一个新模块。行得通吗?谢谢。

购物车侧边栏为空时,隐藏它:

1. Open: app/design/frontend/default/<your template>/template/checkout/cart/sidebar.phtml
2. Go to line 32 Look for
<div class="box base-mini mini-cart">
3. Add these lines right before that opening div tag
<?php $_cartQty = $this->getSummaryCount() ?>
<?php if ($_cartQty >0): ?>
4.Add this line to the bottom of the file

仅当用户将商品添加到购物车时,购物车才会显示。

或者使用这些插件...这是一个免费的插件,可以在它的时候隐藏 空。。 Xogenics Hide购物车用于万磁王

要隐藏在标题菜单中,请使用

从标题菜单中删除"我的购物车"和"结帐"链接。的代码 这些链接位于checkout.xml文件中:

In Magento, on your ecommerce site may be you do not want to show MyCart or Checkout links.Follow the steps below to remove the link.
1. Copy the file checkout.xml from app/design/frontend/base/default/layout to app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout or app/design/frontend/default/YOUR_THEME/layout
2. Edit the checkout.xml copied to the app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout folder or app/design/frontend/default/YOUR_THEME/layout folder
3. Look for the following Code snippet
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>
4. Comment the following Lines
4.1 Comment the following Line to Remove My Cart Link from header
<!--<action method="addCartLink"></action>-->
4.2 Comment the following Line to Remove Checkout Link from header
<!--<action method="addCheckoutLink"></action>-->
5. Refresh the Magento Cache and Website Page to see the changes
$(document).ready(function(){
     $(".top-car").hide(); 
 });

首先检查购物车中是否有数量,当然是这样的:

$qty = $this->helper('checkout/cart')->getSummaryCount()

希望这对你有帮助