我已经安装了magento 1.8.1,我想在横幅部分之后立即显示我的购物车。我将代码放在banner.phtml文件中,它似乎工作,但问题是它没有显示购物车项目和成本等东西。 任何人都可以分享一些可以在.phtml文件中的任何地方使用的通用代码。 我的源代码如下:
<div class="slider-mycart">
<div class="block block-verticalmenu">
<div>
<div class="block-cart">
<?php $_cartQty = $this->getSummaryCount() ?>
<!--<span class="top-cart-icon"></span>-->
<span>
<!--<span>Shopping Cart</span><br/>-->
<?php echo $this->__('My Cart') ?>: <?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?></span>
<div class="top-cart-content">
<?php $_items = $this->getRecentItems() ?>
<?php if(count($_items)): ?>
<ol id="cart-sidebar" class="mini-products-list">
<?php foreach($_items as $_item): ?>
<?php echo $this->getItemHtml($_item) ?>
<?php endforeach; ?>
</ol>
<script type="text/javascript">decorateList('cart-sidebar', 'none-recursive')</script>
<?php else: ?>
<p class="empty"><?php echo $this->__('You have no items in your shopping cart.') ?></p>
<?php endif ?>
<?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>
<div class="actions">
<?php echo $this->getChildHtml('extra_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>
</div>
<?php endif ?>
</div>
</div>
</div>
</div>
</div>