Pages

Wednesday, August 14, 2013

How to create Magento mobile site

Recent studies have shown that in the near future (by 2014) more people will use mobile devices ( iPod, iPhone, Tablet …) rather than computers, which can be a problem for the advancement of your business. Magento offers you an ideal solution how to overcome that problem. This tutorial will help you to install a mobile theme on your web site.
You can quickly and very easily create a storefront, which is suitable for mobile devices, so users can shop even when they aren´t near their computers.
Magento 1.7  uses HTML5 technology, which is supported by iPhone , Android, Opera Mini, iPod, Blackberry and many more.
HTML5 technology includes many out-of-the-box features, which give you many advantages such as:
• Specific video and audio media capabilities
• Simple search and results display
• Your display will be clean of product detail pages
• Swiping product images is very easy
• You can zoom in and zoom out
• Cross-sell and up-sell capabilities
• Drag-and-drop capabilities
If you want to activate the HTML5 mobile theme for Magento 1.7, you need to follow these instructions. There are only four steps in how to setup a mobile theme on your web site.


How to remove Shop by Options from the left bar in magento

In Catalog.xml

Please Comment following code
<!--<reference name="left"><block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
</reference>
-->

Sunday, August 11, 2013

To Change The Default Magento Logo

In ADMIN end
System -> Configuration->General->Design
Click on “Design” in the left side menu and open the “Header” section
Change the file name in the “Logo Image Src” to the file name you just uplaoded.Here you can also change the logo Alt message

Get Connection & Custom Query Execution in Magento

For database connection
$write = Mage::getSingleton('core/resource')->getConnection('core_write');

$qry=”Select * from tablename”;
$execute=$write->query($qry);
$fetch=$execute->fetch()
To get the Row Count
$count=$execute->rowCount();

Get Magento Urls in Phtml Page

Get Base Url :
Mage::getBaseUrl();
Get Store Url : 
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
Get Skin Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
$this->getSkinUrl(‘images/imagename.jpg’);
Get Media Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
Get Js Url : 
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
Get Current Url
Mage::helper(‘core/url’)->getCurrentUrl();
Get Home Url
Mage::helper(‘core/url’)->getHomeUrl();

Get Urls in Cms Pages or Static Blocks in Magento

Get Base Url :
{{store url=”"}}
Get Skin Url :
{{skin url=’images/imagename.jpg’}}
Get Media Url :
{{media url=’/imagename.jpg’}}
Get Store Url : 
{{store url=’mypage.html’}}

How to Call Magento Static Block in CMS Page and phtml in Magento

In PHTML
<?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘yourblockid’)->toHtml(); ?>
IN CMS
{{block type=”cms/block”  block_id=”yourblockid“}}

Get Top 10 Products in Magento

$collection= Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->setStoreId($storeId)
->addStoreFilter($storeId)

->setOrder(‘ordered_qty’, ’desc’)
->setPageSize(10) ;
foreach($collection as $product)
{
$name=$product->getName();
$productId=$product->getId();
$price=$product->getPrice();
}

Get Customer Details Using Customer Session in Magento

$customer = Mage::getSingleton(‘customer/session’)->getCustomer();
$email = $customer->getEmail(); // To get Email Address of a customer.
$firstname = $customer->getFirstname(); // To get Firstname of a customer.
$lastname= $customer->getLastname(); // To get Lastname of a customer.
$id =$customer->getId(); // To get Customer Id
//Get Details Using Customer Id
$customer = Mage::getModel(‘customer/customer’)->load($id)->getData();

Get Current Category Id in Magento

$layer = Mage::getSingleton(‘catalog/layer’);
$_category = $layer->getCurrentCategory();
$currentCategoryId= $_category->getId();