11/13/2010

How to remove index.php from url in magento

Default All url of a Magento website shows index.php .For search engine indexing it's necessary to remove index.php from all url.Then You need to login to your madento admin panel.

Go to System-> Configuration > Web > Search Engine Optimization. Make Yes from Use Web Server Rewrites Drop Down.

Now goto your Cache Management page and refresh your Cache ,then index.php will remove from all url of your magento website

How to change category page layout in Magento

Default Category page layout is written in page.xml file which resides in app/design/frontend/default/your-theme/layout/. Open Page.xml then change line number 35 or find .
<default translate="label" module="page">
<label>All Pages</label>
<block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">
Change default 3columns.phtml to 1Coloumn.phtml or 2columns-left/right.phtml .Then save and upload it .
Clear your cache to see the effects.
Note :: Changing all page layout doesn't effect other pages of magento it effects only the category page. So don't hesitate to change this.

11/12/2010

How to call a phtml file in magento cms page

You can't call a phtml file by writing php code in Magento admin panel as Magento admin panel doesn't support this. To call a PHTML write the folllowing code .

{{block type="core/template" name="a-name" template="cms/home.phtml"}}

inside template="" you can write your file path. and in name="" you can give proper and unique name , in type="" you can write your module directory also(e.g:- customer/account if you are calling login.phtml file).

One more way to call a phtml file. You can use your layout or xml file to do. For example i am going to attached home.phtml file which reside in cms folder of my thmeme template then I am writing the code given below

<reference name="content">
<block type="core/template" name="homepage" template="cms/homepage.phtml"/>
</reference>

How to Get skin url in magento admin panel cms page

In frontend to calll skin url we write
<?php echo $this->getSkinUrl('');?>
To call Skin Url in Magento admin panel you have to write
<img src="{{skin url='images/your-image-name'}}" alt="">
{{skin url='images/your-image-name'}}
You can write css/style.css to call style.css in your theme

How to Get store url in magento admin panel cms Page

In frontend to calll store url we write
<?php echo $this->getUrl('');?>
But in admin Panel we can't write php or echo like statement. So to call base Url in Magento CMS Page or store url you have to write like the code given below.
<a href="{{store url='index.php'}}">Home</a>
{{store url='index.php'}}
This the actually way to call store url in admin panel.
You can use your required link instead of index.php (e.g:- contacts to call Contact us page).

11/11/2010

How to Get value of a select box in JavaScript

If you are using Id to get a select box value then it's little bit easier . If you don't have id in your select box then you need to use name attribute to select the select box. I have used name tag to get the select box value.

<script type="text/javascript">
function slectBox()
{
var aa= document.form.selectBox.selectedIndex;
var ab= document.form.selectBox.options[aa].value;
alert(ab);
}
</script>

<form action="" name="form">
<select name="selectBox">
<option value="1">one</option>
<option value="2">Two</option>
</select>
<input type="button" onclick="slectBox()" value="clickme" />
</form>

This is the example how it works.try it

11/08/2010

Get Product price excluding Tax class in Magento

Normally in magento Price shown including Tax.But if you want to show Price Excluding Tax then you need to call the following helper class.


<?php echo $this->helper('checkout')->formatPrice($_product->getPrice())
// For Special Price write this
echo $this->helper('checkout')->formatPrice($_product->getSpecialPrice()) ?>

11/04/2010

get skin url, get js url, get media url, get store url ,get base url in magneto

These are the following methods to get Magento Base Url, Magento Skin Url, Magento Media Url, Magento Js Url.to get all write the following code

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); or you can write $this->getUrl();
e.g:- http://yoursite.com/index.php/

Get Magento Media Url
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
e.g:- http://yoursite.com/media/
Get Magento Skin Url

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); or you can write $this->getSkinUrl();
e.g:- http://yoursite.com/skin/

Get Magento Store Url
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
e.g:- http://yoursite.com/

Get Magento Js Url
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
http://www.yoursite.com/js

11/03/2010

How to find your blogger blogs sitemap Url

To find the location of your sitemap, use the following steps:

1. Open up your web browser, and type in your Blogger blog’s URL.
2. At the end of the URL add robots.txt.

For example, if the URL of your blog is http://myblog.blogspot.com, then enter http://myblog.blogspot.com/robots.txt
3. Some text should now be displayed in your browser. Look for a line that starts with Sitemap:. The URL after that label is the location of your sitemap.

Using the example above, the line would look like:

Sitemap: http://myblog.blogspot.com/feeds/posts/default?orderby=updated
4. Back in Google’s Webmaster Tools, the domain name part of the URL would already be included, so you would just need to specify the feeds/posts/default?orderby=updated portion of the sitemap URL. If other sites are able to accept a sitemap, then you may need to include the entire URL

11/01/2010

How to Show static block only on homepage in magento

If you are in header.phtml file then you can call $this->getIsHomepage();

But if you are not there then you must have to create instance of Mage_Page_Block_Html_Header(); then write the following code to check homepage

<?php
$ref = new Mage_Page_Block_Html_Header();
if($ref->getIsHomePage()){ ?>
<div class="homepage"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('Your_StaticBlock_Id')->toHtml();?></div>
<?php
}
?>