ArturoCivit
ArturoCivit

Reputation: 67

Magento Shopping Cart and Shopping Cart Info Links

I'm working on my first magento site and things are a little bit different than for example opencart but just trying to learn new things I decided to go with magento and try harder, however there's one thing that I git stuck and is this, I'm calling my shopping cart elements using this:

<div class="cart">
<?php
  $count = $this->helper('checkout/cart')->getSummaryCount();  //get total items in cart
  $total = $this->helper('checkout/cart')->getQuote()->getGrandTotal(); //get total price
  if($count==0)
  {
    echo $this->__('0 Items: %s',$count);
  }
  if($count==1)
  {
    echo $this->__(' Item: %s',$count);
  }
  if($count>1)
  {
    echo $this->__(' Items: %s',$count);
  }
  echo $this->__(' Total: %s', $this->helper('core')->formatPrice($total, false));
?>

</div>

</div>

That prints me out the following:

(Shopping cart icon image) Item: 1 Total: $24.95

But is not linking to the shopping cart, is there a way to, using the code above, modify it to act as a link?

Upvotes: 0

Views: 5183

Answers (1)

liyakat
liyakat

Reputation: 11853

you should have to add anchor link before you display your account like below

<div class="cart">
<a href="<?php echo $this->getUrl('checkout/cart'); ?>" title="<?php echo $this->__('My Cart') ?>">
<?php
  $count = $this->helper('checkout/cart')->getSummaryCount();  //get total items in cart
  $total = $this->helper('checkout/cart')->getQuote()->getGrandTotal(); //get total price
  if($count==0)
  {
    echo $this->__('0 Items: %s',$count);
  }
  if($count==1)
  {
    echo $this->__(' Item: %s',$count);
  }
  if($count>1)
  {
    echo $this->__(' Items: %s',$count);
  }
  echo $this->__(' Total: %s', $this->helper('core')->formatPrice($total, false));
?>

</a>

</div>

hope you can solve your issue.

Upvotes: 3

Related Questions