Sunday, March 3, 2013

How to edit Contact Us page in magento

Q. How do I add extra information like company name, address and phone to the contact us page?

A. Dear friends,
You can edit this page for the same on this location 

Your  site /app/design/frontend/base/default/template/contacts/form.phtml 
Your  site/app/code/core/Mage/Contacts/controllers/IndexController.php

magento How to call static block in phtml

Dear friends,
You Can use this Code For call static Blocks as html

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_left_links')->toHtml(?>

Monday, February 4, 2013

Magento How to resize product thumbnail Size in magento

Dear ,

Stap :1
Go to this location 

\design\frontend\default\ them name /template/catalog/product/list.phtml
  
and find this code 

 php 

    $_columnCount = $this->getColumnCount(); 

    if($_columnCount == 4){
        $imgSize = 155;
    }elseif($_columnCount == 3){
        $imgSize = 245;
    }

?>

 And replace with this code according your them image size Width and height :

php 
  $_columnCount = $this->getColumnCount(); 
  if( $_columnCount == 4 ) {
    $imgSizeWidth = 200;
    $imgSizeHeight = 300;
  } elseif( $_columnCount == 3 ) {
    $imgSizeWidth = 500;
    $imgSizeHeight = 800;
  }
?>

Stap :2
 Find this code on current page 

 helper('catalog/image')->init($_product, 'small_image')->keepFrame(true)->resize( $imgSize); ?>" alt="stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /> 
 Or find only resize( $imgSize)
 And replace With 
helper('catalog/image')->init($_product, 'small_image')->keepFrame(true)->resize( $imgSizeWidth, $imgSizeHeight ); ?>" alt="stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

 Or Only With resize( $imgSizeWidth, $imgSizeHeight )
Thanks:)

Tuesday, November 20, 2012

Magento How to Remove price Decimal in magento

Change the price from Rs. 150.00 to Rs . 150 for example.
 For this, you need to edit code/core/Mage/Directory/Model/Currency.php
Open  code/core/Mage/Directory/Model/Currency.php
 Find the following :-
 public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
    {
return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);
    }
And
Change this code to:-
 public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
    {
return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);
    }
0 – Denotes the precision point for price..
The most important thing is still left.
- Clear the Cache.
- Go to System –> Cache Management
- Refreh Cache.
- If you have not enabled the Cache OR if it didn’t work even after refreshing the cache, then
- delete the cache folder present inside var (var/cache)
Thanks :)

Friday, November 2, 2012

Magento How to Create New Cms Layout in Magento

Dear All,
Here are the steps to create a NEW layout:-
1. Copy app/code/core/Mage/Page/etc/config.xml File to app/code/local/Mage/Page/etc/config.xml and between “..........
” tag paste the code below If u have no  app/code/local/Mage/Page/etc/config.xml on this link then please copy app/code/core/Mage Folder To past on this location app/code/local/Mage
<homepage module="page" translate="label">
    <
label>Home Page</label>
    <
template>page/home-page.phtml</template>
    <
layout_handle>home_page</layout_handle>
</
homepage>
2. Register your custom module by adding a new file (Mage_Local.xml) to app/etc/modules by pasting the code below 
="1.0"?><config>
    <
modules>
        <
Mage_Page>
            <
active>true</active>
            <
codePool>local</codePool>
            <
depends>
                <
Mage_Core/>
            </
depends>
        </
Mage_Page>
    </
modules>
</
config>
After this go to Admin->CMS->Pages->Add New Page->Design........here into the “Layout” dropdown you must see the new layout name you just created ("Home Page” in my case). Now create a New page and assignt this layout ("Home Page") to it.
3. Now create a file with the name home-page.phtml under app/design/frontend/default/default/template/page and create own layout as per design 
Thanks :) 

Wednesday, March 2, 2011

What Beautiful HTML Code Looks Like

I originally wrote this over two years ago. It was getting a little long in the tooth, especially now that HTML5 has come along and made HTML far more beautiful than even XHTML 1.1 was. So I updated it!
I can’t help but view source on every nice looking website I see. It’s like if you had x-ray glasses that allowed you to see any person you ever saw in their underwear at will. How could you not? It’s just so tempting to see if a beautiful website is built with beautiful code as well, or if its beauty if only skin-deep. Code? Beautiful? Sure. After all, Code is Poetry. This is just HTML, so it can’t be quite as intricate and elegant as a dynamic language, but it still bears the brush strokes of its creator.
It gets me to thinking, what makes beautiful code? In HTML, it comes down to craftsmanship. Let’s take a look at some markup written they way markup should be written and see how beautiful it can be.

It’s big enough to print out and tape up inside your locker to impress your friends. Well, it might be a bit of an awkward size. I’ll make the PSD available in case you want to alter it.
* HTML5 – HTML5 and it’s new elements make for the most beautiful HTML yet.
* DOCTYPE – HTML5 has the best DOCTYPE ever
* Indentation – Code is indented to show parent/child relationships and emphasize hierarchy.
* Charset – Declared as first thing in the head, before any content.
* Title – Title of the site is simple and clean. Purpose of page is first, a separator is used, and ends with title of the site.
* CSS – Only one single stylesheet is used (media types declared inside stylesheet), and only served to good browsers. IE 6 and below are served a universal stylesheet.
* Body – ID applied to body to allow for unique page styling without any additional markup.
* JavaScript – jQuery (the most beautiful JavaScript library) is served from Google. Only a single JavaScript file is loaded. Both scripts are referenced at the bottom of the page.
* File Paths – Site resources use relative file paths for efficiency. Content file paths are absolute, assuming content is syndicated.
* Image Attributes – Images include alternate text, mostly for visually impaired uses but also for validation. Height and width applied for rendering efficiency.
* Main Content First – The main content of the page comes after basic identity and navigation but before any ancillary content like sidebar material.
* Appropriate Descriptive Block-Level Elements – Header, Nav, Section, Article, Aside… all appropriately describe the content they contain better than the divs of old.
* Hierarchy – Title tags are reserved for real content, and follow a clear hierarchy.
* Appropriate Descriptive Tags – Lists are marked up as lists, depending on the needs of the list: unordered, ordered, and the underused definition list.
* Common Content Included – Things common across multiple pages are inserted via server side includes (via whatever method, language, or CMS that works for you)
* Semantic Classes – Beyond appropriate element names, classes and IDs are semantic: they describe without specifying. (e.g. “col” is much better than “left”)
* Classes – Are used any time similar styling needs to be applied to multiple elements.
* IDs – Are used any time an element appears only once on the page and cannot be targeted reasonably any other way.
* Dynamic Elements – Things that need to be dynamic, are dynamic.
* Characters Encoded – If it’s a special character, it’s encoded.
* Free From Styling – Nothing on the page applies styling or even implies what the styling might be. Everything on the page is either a required site resource, content, or describing content.
* Comments – Comments are included for things that may not be immediately obvious upon reviewing the code.
* Valid – The code should adhere to W3C guidelines. Tags are closed, required attributes used, nothing deprecated, etc.

Sunday, January 10, 2010