Add “You Save” amount and percentage to Special Price in Magento

Share
Posted on May 24th, 2013 | Posted by admin

In order to display a “You Save” for “Special Price” products in magento–to make it look similar to amazon’s price display–you can do the following:

Copy app/design/frontend/base/default/template/catalog/product/price.phtml
to
app/design/frontend/default/YOURTEMPLATE/template/catalog/product/price.phtml

Then in price.phtml that you just copied, right above:

<?php endif; /* if ($_finalPrice == $_price): */ ?>

Insert:


<?php // KZN Show discounted percentage and price ?>
<?php if($_finalPrice < $_price): ?>
<?php
$_savePercent = 100 - round(($_finalPrice / $_price) * 100);
$_saveAmount = number_format(($_price - $_finalPrice), 2);
?>
<p class="yousave">
<span class="price-label label">You Save: </span>

Magento – Get Cart Quantity Within A Session

Share
Posted on May 23rd, 2013 | Posted by admin
View code in Magento
<?php
  function getCartQuantity () {
	  $cart = Mage::getModel('checkout/cart')->getQuote()->getData();
	  if (isset($cart['items_qty']))
	 	return (int)$cart['items_qty'];
	  else
	  	return 0;
  }
  echo getCartQuantity ().' Item(s)';
?>

Multiple Base Prices in Magento: Updated

Share
Posted on May 22nd, 2013 | Posted by admin

It is possible to have multiple base prices in Magento but you need to set up different websites:

Step 1. In Magento product price scope can be kept either global or per website, so you can have only one base price currency for a website. To set the Catalog Price Scope to website log into the Admin and go to System – > Configuration -> Catalog -> Price

Step 2. Set up multiple websites in Configuration > Manage Stores (you will need to creat a website/view and store for your new shop)

Step 3. Set the pricing for each one in Configuration > {switch store} > Currency Set up

Magento: Moving Cart from Sidebar to Header

Share
Posted on May 21st, 2013 | Posted by admin

In this Magento tutorial we will demonstrate how to move the mini-cart that resides in the right column of a fresh Magento install into the header section. This can be a popular request as the header section of a e-commerce store is a great place to include the cart especially if you are using a one column template on important pages like the homepage.

1) Now open layout\page.xml from within your theme folder and look for the following lines of code:

1 <block type="page/html_header" name="header" as="header">

and add the following line before before the closing </block> tag:

Create a ‘Show All’ link on product links

Share
Posted on May 20th, 2013 | Posted by admin

Magento by default now has the ability from the admin area to create a ‘show all’ link via the Products per Page on Grid Allowed Values section of the catalog area. This by default is great, it works fine and should be a great asset to your product listing pages. But you may run into a client who just wants to have a ‘view all‘ link and nothing else which by default is not in Magento just yet; so we have to come up with a solution to this. And the solution is as follows:

First thing to do is to navigate to /app/design/frontend/theme/default/template/page/html/pager.phtml, once you have opened the page add this code to were you want your ‘view all‘ link to be placed.

1
<br>&lt;a href="&lt;?php echo $this-&gt;getLimitUrl('all')?&gt;" title="&lt;?php echo $this-&gt;__('View All Products') ?&gt;"&gt;<br><br>&lt;?php echo $this-&gt;__('View All') ?&gt;<br>&lt;/a&gt;<br>

This segment of code generates our link with ‘limit’ parameter set to ‘all’. Now when we click on it, it will give us a full category listing.

Page 1 of 15412345»102030...Last »