Home > Magento Tips > Optimised Magento Store Information

Optimised Magento Store Information

Posted on: 16th Aug 2010 By: Adam Moss No Comments

If you have a Magento installation with multiple websites or store views set up on it, you want to cut down on duplications of content wherever possible. It’s good for Magento SEO, and it’s good for occasions when you have to change something such as a store name. Rather than change it wherever it’s mentioned, just change it in one place in the backend and it will update throughout the site. It’s exactly the same as using PHP includes, in fact they are PHP includes. This type of include makes it easy to customise each store on the installation with it’s own logo, own name & URL etc, without having to code it more than once. It’s also useful for performing your own PHP scripts based on which store ID is loaded.

Anyway, here’s a good list to start you off. If you have any more, please let me know them:

Store data
:

<?php echo Mage::app()->getStore(); ?>

Store Id
:

<?php echo Mage::app()->getStore()->getStoreId(); ?>

Store code:

<?php echo Mage::app()->getStore()->getCode(); ?>

Website Id
:

<?php echo Mage::app()->getStore()->getWebsiteId(); ?>

Store Name
:

<?php echo Mage::app()->getStore()->getName(); ?>

Is Active:

<?php echo Mage::app()->getStore()->getIsActive(); ?>

Store Home Url:

<?php echo Mage::app()->getStore()->getHomeUrl(); ?>

Store Logo:

<a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a>

I’ve added the PHP tags for you since I’m such a nice guy… err anyway, thanks for reading the Magento Blog at Ecommerce Web Design. Look out for our new design within the next couple of weeks!

Post A Comment

Your comments:
Enclose code snippets within the appropriate tags: [php][/php]   [js][/js]   [xml][/xml]   [css][/css]   [html][/html]
E.g: [php]<?php echo "hello world"; ?>[/php]

Search Blog

Archives

For the record...

Views & opinions in this blog are those of the individual and do not necessarily reflect those of E-commerce Web Design or the Creare Group.