Magento Themes and Magento Extensions

Custom typography in Magento – @font-face

Share
Posted on June 24th, 2011 | Posted by admin

If you want to add some juice to your e-commerce website, and be different from the others, you could add some custom fonts for you headings, product titles or prices.
The best technique these days, in my opinion, is to use browser’s native method: @font-face. With a little tweaking, you can make it work in almost all browsers.

Usage

The basic usage would be to add @font-face rule to your stylesheet, with a path to your font file.

1
2
3
4
@font-face {
font-family: KomikaDisplayRegular;
src: url(/KomikaDisplayRegular.otf);
}

Magento custom model with custom validation rules

Share
Posted on June 24th, 2011 | Posted by admin

Creating your own Magento module usually goes along with creating your own models within the module. Either you write one or multiple models per module, its a good idea to implement model validation method which you might/should call prior to model save. Good example of Magento’s model that use validation are Mage_Customer_Model_Customer and Mage_Customer_Model_Address_Abstract models. Quick look into the “public function validate()” methods of those two models reveal the simplicity of validation process.

Usually the validation is done by utilizing the available Zend validation method “Zend_Validate::is($filter)” with various built in filters. Here are few examples:

Custom typography in Magento – Cufón

Share
Posted on June 22nd, 2011 | Posted by admin

Are you sick and tired of boring, old web-safe fonts? For some time now, there are a couple of really quality solutions for their replacement. I believe Cufón is one of the most popular. This article will help you learn how to implement it in your Magento online store.

Follow these steps (and you might find white rabbit):

  1. Choose the font you want to use. Make sure the EULAs of these fonts allow Web Embedding.
  2. Go to Cufón website , upload you font, let the Cufón do its magic and download your .font.js file.
  3. While you’re there, download cufon-yui.js , you’ll need it too.
  4. Place downloaded files in js/cufon/ folder on your server.
  5. Open page.xml file of your theme and place this code inside your head section
    1
    2
    <action method="addJs"><script>cufon/cufon-yui.js</script></action>
    <action method="addJs"><script>cufon/YourFontFile.font.js</script></action>
  6. Open head.phtml file of your theme and place this code right before the end of it.
    1
    <script type="text/javascript">Cufon.replace('h1, h2');</script>

Magento: Display Static Block via Custom Layout Update

Share
Posted on June 20th, 2011 | Posted by admin

We were needing to display a static block in the left column (of the 2-columns-left template). We only needed to display it for a few specific products though. There are a couple ways you can do it via Custom Layout Updates. In our case, the products were all in a specific category, and we wanted the static block to show up on the list view AND the product view. So, we put this code in on the product level and the category level:

<reference name="left">
    <block type="cms/block" name="static_block_identifier" before="-">
        <action method="setBlockId"><block_id>static_block_identifier</block_id></action>
    </block>
</reference>

Add custom renderer for a custom column in Magento grid

Share
Posted on June 17th, 2011 | Posted by admin

Every now or then we need new column on some grid listing in Magento. It is quite simple task, but you will probably want to format values way you want or whatever.
This is where writing your own renderer would be usefull and simple.

To pull this out, you would overide some grid,  add column  to it and write custom renderer.

How it works in real life situations.?!
Let’s take a look at product listing admin grid.
Overide block class called Mage_Adminhtml_Block_Catalog_Product_Grid located in /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php file.

Page 4 of 8« First...«23456»...Last »