Thứ Tư, 6 tháng 10, 2010

Calling a static block into phtml file in Magento

To call a static block in Magento ,You can use the following code;


<?php

echo $this->getLayout()->createBlock('cms/block')->setBlockId('Your_Static_Block_Name')->toHtml();

?>


To create your Static Block you can log into your admin panel than go to CMS->Static Blocks. There create your static Block with a name, then write the name in setBlockId() to call that into phtml file.

add facebook share button in magento

You can get Facebook share button from http://www.facebook.com/share/. But to add this in magento you need to get the current page url.

From the below code you can get the Current page Url in magento

<?php 

echo $currUrl= $this->getUrl('').$_SERVER['REQUEST_URI'];

?>


Now Write this code into the header/footer section of your site To see the Share Button


<a name="fb_share" type="button" href="http://www.facebook.com/sharer.php?u=<?php echo $currUrl;?>">Share</a>

<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

How to get Current page url in magento

get Current page url in magento is so easy.You can get lots of solution in differnet site.But this one is the sort and best solution for getting Current page url.

<?php

echo $currUrl= $this->getUrl('').$_SERVER['REQUEST_URI'];

?>



You can also use the folllowing magento features to get current page Url.



echo $this->helper('core/url')->getCurrentUrl();

Thứ Ba, 14 tháng 9, 2010

change My Cart text in magento

To Chnage the text of My Cart in top links you need to go app/code/core/Mage/Checkout/Block/ there you will find Links.php .there will be below function




public function addCartLink()

{

if ($parentBlock = $this->getParentBlock()) {

$count = $this->helper(’checkout/cart’)->getSummaryCount();



if( $count == 1 ) {

$text = $this->__(’My Cart (%s item)’, $count);

} elseif( $count > 0 ) {

$text = $this->__(’My Cart (%s items)’, $count);

} else {

$text = $this->__(’My Cart’);

}



$parentBlock->addLink($text, ‘checkout/cart’, $text, true, array(), 50, null, ‘class="top-link-cart"’);

}

return $this;

}


Change “My Cart” to your required text and Upload it to server.then clear the catche to see the effect

Thứ Hai, 6 tháng 9, 2010

how to change theme in magento

To change theme of Magento you need to login to your admin panel.There is two way to change it

1) Go to System->Design .Click on Add Design Change ,there from Custom Design click on the DropDown to select your Design , then save it to change your theme

Change theme in Magento



2) Go to System->Configuration then click on Design,there from Themes Tab you can change your theme.Write your theme name in Templates and Skin (Images / CSS) Field. then click on save Config to save your theme.


Change theme in Magento



If you don't know you theme name then it is beter to choose First option,Because it is much easier than the second one.One more thing that if you have two store and you want to make 2 different Theme for that two store than you have to follow the first process.

Chủ Nhật, 5 tháng 9, 2010

difference between append() and html() in jquery

.aapend() and .html() is the most usefull method in jQuery.But these are far different from one another, .append() add some value with the existing one.whether .html() do the same but it removes the old value
Here is an example is given



<ul id="test">

<li>test</li>


</ul>




Now I will use .append() to add one
<li>, For that I will write

<script type="text/javascript>"

jQuery("#test").append("<li>test1</li>");

</script>




The output of this jQuery will be

<ul id="test">

<li>test</li>

<li>test1</li>

</ul>



Now if I
use .html() to add one <li>, For that I will write

<script type="text/javascript>"

jQuery("#test").html("<li>test1</li>");

</script>



The output of this Script will be

<ul id="test">

<li>test1</li>

</ul>



Here in this example .append() add one extra <li>, whether .html() removes the old one with new one. This is the main difference between .append() and .html() in Jquery

hide subcategory menu in magento

There is two way to hide subcategory menu.One is from admin panel and other is by css.



1) From Admin Panel :-

Login to admin panel of your magento site then go to System->Configuration. from the left hand side panel click on Catalog, then click on Category Top Navigation tab.Default the value written in the Maximal Depth is 0 , make it 1 to hide the submenu.



Hide Subcategory Menu

2) From Css :-

go to your ...