How to make custom mini shopping cart in header magento
Kindly Copy the below code and paste it into your header.phtml file.
<div class="shopping_cart active">
<?php $cart = Mage::getModel('checkout/cart')->getQuote(); ?>
<?php $cnt = Mage::helper('checkout/cart')->getSummaryCount(); ?>
<div class="icon">
<i class="shopping-bag-icon v-middle"></i>
<span class="count-number"><?php if($cnt > 0){echo $cnt;}else{echo "0";} ?></span>
</div>
<span class="block-cart hidden-xs hidden-sm">
<b class="hidden-xs hidden-sm m-l-sm">MY BAG</b>
<p>item(s)</p>
</span>
<?php if($cnt > 0): ?>
<div class="cart_block cart-block exclusive">
<div class="block_content">
<p class="cart-subtitle">Recently added item(s)</p>
<div class="cart_block_list">
<div class="products">
<?php foreach ($cart->getAllVisibleItems() as $item): ?>
<?php $_product =
Mage::getModel('catalog/product')->load($item->getProduct()->getId());
?>
<div class="product-item-list">
<a href="<?php echo $_product->getProductUrl() ?>" class="cart-images">
<img src="<?php echo
$this->helper('catalog/image')->init($_product,
'small_image')->keepFrame(false)->resize(72, 99); ?>"
class="img-responsive"></a>
<div class="cart-info">
<div class="product-name">
<a href="<?php echo
$_product->getProductUrl() ?>"
class="cart_block_product_name"><?php echo
$_product->getName(); ?></a>
</div>
<span><?php echo $item->getQty(); ?> x </span>
<span
class="price"><?php echo
Mage::helper('core')->currency($_product->getFinalPrice(), 2);
?> </span>
</div>
<span class="remove_link"><a href="<?php echo $this->getUrl('checkout/cart/delete',array('id'=>$item->getId(),Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->helper('core/url')->getEncodedUrl())); ?>" rel="nofollow" title="remove this product from my cart"><i class="delet-item"></i>
</a>
</span>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="buttons m-t-sm">
<div class="row">
<div class="col-xs-6 p-r-xs">
<button onclick="setLocation('<?php echo
$this->getUrl('checkout/cart'); ?>')" type="button" title="View
Bag" class="btn btn-theme btn-block"><span>VIEW
BAG</span> </button>
</div>
<div class="col-xs-6 p-l-xs">
<button onclick="setLocation('<?php echo
$this->getUrl('onepagecheckout'); ?>')" class="btn brown-btn
btn-block" title="Checkout"
type="button"><span>CHECKOUT</span> </button>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
No comments:
Post a Comment