头部购物车里不显示商品的bug
来源:互联网 发布:如何在手机淘宝上开店 编辑:程序博客网 时间:2024/04/30 23:58
涉及到以下几个文件
app\design\frontend\default\theme508\template\checkout\cart\sidebar_header.phtml
<?php/** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE_AFL.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category design * @package base_default * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) *//** * Shoping cart sidebar * * @see Mage_Checkout_Block_Cart_Sidebar */?><?php if ($this->getIsNeedToDisplaySideBar()):?><div class="block-cart-header"> <?php $_cartQty = $this->getSummaryCount() ?> <h3><?php echo $this->__('Cart') ?>:</h3> <div class="block-content"> <?php if ($_cartQty>0): ?> <div class="summary"> <?php if ($_cartQty==1): ?> <p class="amount-2"><?php echo $this->__('<strong title="%s">%s item</strong>', $this->getUrl('checkout/cart'), $_cartQty) ?> -<?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?></p> <?php else: ?> <p class="amount-2"><?php echo $this->__('<strong title="%s">%s items</strong>', $this->getUrl('checkout/cart'), $_cartQty) ?> -<?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?></p> <?php endif ?></div> <div class="cart-content"> <div class="cart-indent"> <p class="subtotal"> <?php if ($this->canApplyMsrp()): ?> <span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span> <?php else: ?> <span class="label"><?php echo $this->__('Cart Subtotal:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?> <?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?> <br />(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>) <?php endif; ?> <?php endif; ?> </p> <?php endif ?> <?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?> <?php endif ?> <?php $_items = $this->getRecentItems() ?> <?php if(count($_items)): ?> <p class="block-subtitle"><?php echo $this->__('Recently added item(s)') ?></p><span style="background-color: rgb(255, 102, 102);"> <ol id="cart-sidebar" class="mini-products-list"> <?php foreach($_items as $_item): ?> <?php echo $_item; ?> <?php echo $this->getItemHtml($_item) ?> <?php endforeach; ?> </ol> </span> <div class="actions"> <button type="button" title="<?php echo $this->__('Checkout') ?>" class="button" onclick="setLocation('<?php echo $this->getCheckoutUrl() ?>')"><span><span><?php echo $this->__('Checkout') ?></span></span></button> <button type="button" title="<?php echo $this->__('My Cart') ?>" class="button" onclick="setLocation('<?php echo $this->getUrl('checkout/cart') ?>')"><span><span><?php echo $this->__('My Cart') ?></span></span></button> </div> <script type="text/javascript">decorateList('cart-sidebar', 'none-recursive')</script> </div> </div> <?php else: ?> <div class="empty"><?php echo $this->__('0 item(s)') ?> - <?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?> <div class="cart-content"><?php echo $this->__('You have no items in your shopping cart.') ?> </div> </div> <?php endif ?> </div></div><?php endif;?>
app\design\frontend\default\theme508\layout\page.xml
<block type="page/html_header" name="header" as="header"><block type="checkout/cart_sidebar" name="cart_header" template="checkout/cart/sidebar_header.phtml"> <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action> <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action> <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action> <block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout"> <label>Shopping Cart Sidebar Extra Actions</label> </block> </block> <block type="page/template_links" name="top.links" as="topLinks"/> <block type="page/template_links" name="top.links.left" as="topLinksLeft"/> <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/><block type="directory/currency" name="currency" template="directory/currency.phtml"/> <block type="core/text_list" name="top.menu" as="topMenu" translate="label"> <label>Navigation Bar</label> <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/> </block> <block type="page/html_wrapper" name="top.container" as="topContainer" translate="label"> <label>Page Header</label> <action method="setElementClass"><value>top-container</value></action> </block> </block>按以上逻辑,应该获取的是下面的模板
app\design\frontend\default\theme508\template\checkout\cart\sidebar\default.phtml
但是在less var/log/system.log 中找到如下错误
CRIT (2): Not valid template file:frontend/base/default/template/ajax/checkout/cart/sidebar/default.phtml
可见是去取了其他地方的模板
app\code\local\Excellence\Ajax\Block\Cart\Sidebar.php
<?phpclass Excellence_Ajax_Block_Cart_Sidebar extends Mage_Checkout_Block_Cart_Sidebar{public function getItemRenderer($type){if (!isset($this->_itemRenders[$type])) {$type = 'default';}if (is_null($this->_itemRenders[$type]['blockInstance'])) {$this->_itemRenders[$type]['blockInstance'] = $this->getLayout()->createBlock($this->_itemRenders[$type]['block'])->setTemplate('ajax/checkout/cart/sidebar/default.phtml')->setRenderedBlock($this);}if (is_null($this->_itemRenders[$type]['blockInstance'])) {$this->_itemRenders[$type]['blockInstance'] = $this->getLayout()->createBlock($this->_itemRenders[$type]['block'])->setTemplate('ajax/checkout/cart/sidebar_header.phtml')->setRenderedBlock($this);}return $this->_itemRenders[$type]['blockInstance'];}}
注释了还是没解决问题
故将 cp /home/promlove/public_html/app/design/frontend/default/theme508/template/checkout/cart/sidebar/default.phtml 复制到
/home/promlove/public_html/app/design/frontend/base/default/template/ajax/checkout/cart/sidebar/default.phtml
done!
0 0
- 头部购物车里不显示商品的bug
- Ecshop购物车或结算页面显示商品的品牌
- 以列表ListView显示购物车的商品
- 购物商品的系统
- 用jsp实现一个简单的购物车web应用系统。实现的添加购物商品,删除购物商品并且显示购物车信息。
- javaWeb购物商城设计---商品显示
- javaWeb购物商城设计---商品详情显示
- 用Cookie实现购物车中只显示最近浏览的五件商品
- Android 仿JD浏览商品。滑动头部隐藏显示
- 日语的商品购物与消费
- 商品加入购物车的动画
- 购物车商品的数据存储器实现
- jquery 商品飞入购物车的动画
- 商品详情的显示
- ASP.NET实现B2C显示购物车中的商品
- ###Jsp+Servlet购物商城day02.3:分页显示商品
- 商品详情页显示商品的详细信息
- Thinkphp——商品加入购物车在购物车列表显示(还有购物车删除)
- 程序员必须知道的10大基础实用算法及其讲解
- win8-txt文件不能默认记事本打开
- iOS-获取苹果设备信息
- test
- Android 主线程之旅——PSVM(public static void main)
- 头部购物车里不显示商品的bug
- Javascript 中的 && 和 || 使用小结
- 求助IPTABLES移植问题
- 21、MySQL-分组查询(GROUP BY)及二次筛选(HAVING)
- Django:快速搭建简单的Blog
- 《scrum实战-敏捷软件项目管理与开发》读书笔记
- 22、MySQL-对查询结果排序(ORDER BY)
- LeetCode之Pascal’s Triangle II
- 一切成功源于积累——20150305 典型美日上拉200点 高位盘整2小时 再上拉200点