Magento – Show Inventory Levels on Product Pages

Today I will show you how we can add Quantity on hand information on the product detail page.Normal Magento shows ‘Availability-In Stock’ by default. We need to change that Qty on hand like the below image

qtyonhand

For this you need to do the below steps :
Go to app/design/frontend/base/default/template/catalog/product/view/type/default.phtml.
Get a copy of that file and move it to your custom theme, making sure to add folders as needed to maintain the correct path. Here is the code snippet for adding Quantity on Hand to your product pages.

Replace below code

<?php if ($_product--->isAvailable()): ?>

with

<?php if ($_product--->isAvailable()): ?>
<?php $quantity1 = intval(Mage::getModel('cataloginventory/stock_item')--->loadByProduct($_product)->getQty()); ?>

<div class=”add-to-box”>

<?php if($quantity1 > 0) { ?>

<p class=”availability in-stock”>
<?php echo $this->__(‘Qty on Hand:’) ?>
<?php echo $quantity1;?>
</span>
</p>

<?php } elseif($quantity1 == 0) { ?>
<p class=”availability in-stock”><?php echo $this—>__(‘Qty on Hand:’) ?></p>
<?php foreach ($_product ->getTypeInstance(true)->getUsedProducts ( null, $_product) as $simple) { $stock = intval(Mage::getModel(‘cataloginventory/stock_item’)->loadByProduct($simple)->getQty()); echo $simple->getName().” “.$simple->getSize().” have a stock of $stock”; echo ‘<br>’; } ?>
</p>
<?php } ?>
</div>

How to change the Magento Admin URL

Here is a quick guide on how to change admin url path in Magento. To protect your Magento backend against hackers and brute-force attacks, we recommend that you change the default URL to the Magento Admin Panel is must. It is a quick and easy way to add an extra layer of security to your site.

Generally, Magento have ‘admin’ as the administrator path. So, the admin URL will be http://www.example.com/admin/

Here is process how you can do this :

1) Changing local.xml
– Open app/etc/local.xml
– Find the following:-

<admin>
<routers>
<adminhtml>
<args>
<frontName><![CDATA[admin]]></frontName>
</args>
</adminhtml>
</routers>
</admin>

– Go to this line
<frontName><![CDATA[admin]]></frontName>

and change “admin” as you desired the admin path like

<frontName><![CDATA[siteadmin]]></frontName>

and then upload file. After file update clear magento cache.

The process is now complete and you can login your magento with new url path

http://www.example.com/siteadmin/