10
Run Magento Indexer From Command Line
In some situation when you want to re-index Magento catalog you will get an error message or reindex process will be broken or processing..This problem is appearing when you have a lot of products in database and limited server resource. You can try to reindex from command line or shell.
Step 01: loginto your server using ssh.
Step 02: goto your magento installed folder
cd /your-magento-path
Step 03: type below command to index all
php shell/indexer.php --reindexall
some extra options
* To check the status
php shell/indexer.php --status
* To get information
php shell/indexer.php info
* To see other available options
php -f shell/indexer.php help
That’s all for now…
29
Reindex Catalog URL Rewrites and other index options on magento using command line
You need catalog URL rewrites to make your catalog work properly. Also it takes too much of time to execute. most of the time it failed due to php maximum execution time settings. If you don’t know how to set it or if you don’t have permission to do it, here is another simple solution…
Step01: First you need to log in to your server.
ssh username@yourserverName
then enter your password
Step02: go to magento directory
cd yourmagentofolderName
Step03: simply type below command
php shell/indexer.php reindexall
That’s it…

1
Simple ways to get magento base URLs
Hi All, most of the time we need to get magento base URL on template files. so there are several ways to do that. Here is the one of best way to use that on template files.
Option 01:
<?php echo $this->getUrl('') ?>
Returns : http://www.magento.lk/
Option 02:
<?php </code><code>echo</code> <code>Mage::getBaseUrl(); ?>
Returns : http://www.magento.lk/
Option 03:
<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>
Returns : http://www.magento.lk/
Option 04: for static blocks
</code><a href="{{store url=""}}">Link to Base URL</a><code>
Returns : http://www.magento.lk/
If you have any issue, please comment...
27
How to remove parent category path from sub category url in Magento
Step 01:
Go to app/code/core/Mage/Catalog/Model/
Step 02:
Open Url.php and search
if (null === $parentPath) {
Step 03:
comment as follows
//if (null === $parentPath) {
// $parentPath = $this->getResource()->getCategoryParentPath($category);
// }
// elseif ($parentPath == '/') {
$parentPath = '';
// }
Step 04:
Now save and upload the file. Login to admin panel of your site then go to System->Config->Index Management and click on select all then select Reindex Data from the Action Dropdown then click on submit.
29
Detect product page on magento
Yesterday one of our client want to show block only for the product page. he want to show some SEO content only for the product page. so there are several ways to add this. if you want to put some content on magento footer. you need to add your content to footer.phtml located on /app/design/
I have used following code for that.
if(Mage::registry('current_category'))
{
$category=Mage::registry('current_category');
$category_level=$cat->getLevel();
$category_id=$cat->getId();
$_id= Mage::app()->getRequest()->getParam('id', false);
if($_id!=$catId)
{
//add your condition here
}
}
Don’t forget to comment if you have any issue…
1
add a static block to contact page – magento
most of the time clients ask to add some extra content to magento core template files. most of the time they asked to add some static content on contact form page.. Mmmm… yes you can add any static block on your page..
Step 01: First log in to you Magento admin panel. Go to CMS>>>Static Blocks.
Step 02: add identifier and other content.
Step 03: open app/design/frontend/default/YOURTHEME/template/contacts/form.phtml
search below code
</div>
</form>
add following content before end tag of
<table width=”100%” border=”0″ cellspacing=”4″ cellpadding=”4″>
<tr><td>
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('branch-network')->toHtml(); ?>
</td></tr>
</table>
“branch-network” is the static block identifier.
Save the file
Reload your contact us page.. You have done. update your client immediately.
27
Disable Footer block Caching in Magento
sometimes we need to call some dynamic content on the footer, but due to magento default footer cache it cache the whole footer content. here is the small tip to remove cache from footer block…
open /app/code/core/Mage/Page/Block/Html/Footer.php file and search the constructor function
protected function _construct()
{
$this->addData(array(
'cache_lifetime'=> false,
'cache_tags' => array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG)
));
}
just comment the cache by commenting addData section..
protected function _construct()
{
/*$this->addData(array(
'cache_lifetime'=> false,
'cache_tags' => array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG)
));*/
}
Any Comments are welcome…
26
Add additional fields to Magento contact us form
Magento contact us form is very simple form, some developers want to add some extra fields on their contact us page. so this guide will help you.
Step 01: Open and Modify the /app/design/frontend/(Your interface)/(Your theme)/template/contacts/form.phtml file.
lets assume that we want to add “subject”
<li>
<label for="subject"><!--?php echo Mage::helper('subject')--->__('Subject') ?></label>
<div class="input-box">
<input id="subject" class="input-text" title="<?php echo Mage::helper('subject')->__('Subject') ?>" name="subject" type="text" /></div></li>
add above code in between any
<li></li>
Step 02: Create the new Transactional E-Mail.
1) Go to Magento Admin panel select System→Transactional E-mails
2) Click “Add New Template”
3) From the “Template” dropdown box select “Contact Form” (Select “Locale” if you want)
4) Click “Load Template”
5) then template content loaded as follows:
Name: {{var data.name}}
E-mail: {{var data.email}}
Telephone: {{var data.telephone}}
Comment: {{var data.comment}}
Add your new field:
Name: {{var data.name}}
E-mail: {{var data.email}}
Telephone: {{var data.telephone}}
Subject: {{var data.subject}}
Comment: {{var data.comment}}
Step 03:
Then you need to save this template with new name.
Step 04:
Select System→Configuration and select “Contacts” on the left hand menu. Select your newly saved template from the “Email Template” dropdown list.
Wooohaaa…. Now reload your contact form page…
Get Premium Tutorials Free
Recent Posts
Archives
- May 2012 (2)
- April 2012 (3)
- March 2012 (6)
- February 2012 (5)
- January 2012 (4)
- December 2011 (8)
- November 2011 (9)
- October 2011 (6)
- September 2011 (3)
- August 2011 (2)
- July 2011 (3)
- June 2011 (45)
- May 2011 (3)







