Magento themes and extensions

How to get store URL by store code or store Id in magento

Share
Posted on April 1st, 2013 | Posted by admin

Here are 2 ways to get home URL of Magento stores

1. By store CODE

function getStoreByCode($storeCode)
{
$stores = array_keys(Mage::app()->getStores());
foreach($stores as $id){
$store = Mage::app()->getStore($id);
if($store->getCode()==$storeCode) {
return $store;
}
}

magento trace code from xml to template

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

I have beed doing this for quite some time. So i thought lets write it down on the blog as well, so that it is more clear for any one starting with magento. Here is the thing in magento once the control reaches the xml, it finds the corresponding template files to render. So suppose you are on the sales order view page in the admin. So the corresponding xml is lets say sales.xml. Now there will be a block written like this.

<block type=”adminhtml/template” name=”gift_options” template=”sales/order/giftoptions.phtml”>

Now i will explain what each element means here.

First “adminhtml/template” this means that the related block which will call this xml is adminhtml/template, so go to the app/code/core/Mage/Adminhtml/Block/Template.php. The file Template.php is what the block refers to for the functions in the template file “giftoptions.phtml”. Please note that i have highlighted the elements in bold in the path which are used to trace the code.

3 More Magento Code Snippets

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

here we are with another three Magento code snippets. This week: using your Magento classes outside a Magento file,

  1. OK, so first lets look at a code snippet which allows you to use your Magento code outside your Magento environment (i.e. outside the app folder). This is useful if you want to add a list of products to your self hosted WordPress blog for example (although I’ll be covering doing this a different way in a tutorial soon).To do this, you’ve got to add the following lines of code to the top of your php file:

Magento Google Analytics Code Has Errors

Share
Posted on November 26th, 2012 | Posted by admin

Last week we deployed another successful Magento ecommerce website. To track the visitors we signed up for a free Google Analytics account, and then plugged their tracking code into the admin section of the Magento administrator area. When we applied the API, the site quickly confirmed that the tracking code was in place through the Google Analytics dashboard.

Magento Google Analytics Code Has Errors

MAGENTO GET STORE BY STORE CODE

Share
Posted on July 6th, 2012 | Posted by admin

About MagNotes Series
In this blog I have always shared about what I’ve learned on Magento, which I felt is taken me one step closer to understanding Magento and Magento development. But during the course of time, I bump on some elementary things which are absolutely required. So just for those elementary things I’ve decided to create a series (MagNotes Series) , for myself as a reference or for whoever think this is helpful.

Page 1 of 212»