Magento Themes and Magento Extensions

“How to add series” #1: Adding new layout template for Magento

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

Hello everyone,
Today, Travis asked me to compete with him in sharing Magento knowledge in Magestore blog. Well, of course, I have no fear, and I want to start the competition with “How to add” series. And let’s start with How to add new layout template for Magento.
As we know, Magento provides some defined layouts: 1column, 2 columns (left and right), 3 columns. But I am sure that when working with Magento, sometimes you have to create a new layout for custom page, for example, 3 columns only for cms page.
You can make modification directly in app/code/core/Page/etc/config.xml but if you don’t want to touch core file, I recommend you to follow these steps:
Create config.xml under app/code/local/Magestore/Page/etc

Guide through Magento’s timezones

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

I’ll guide you through Magento’s timezone behavior, as I’ve noticed that people tend to get confused in cases when they have 2 or more websites with different timezones. If this is what you are searching for, read on!

First of all, let’s start with the Web server – Magento relation, and their times.
Web server – Magento relation
Let’s look at the following scenario. You want an online store – ok, you’ll need a web hosting for it (on some web hosting providers server). With classic low-level PHP development people tend to overlook server’s settings, and each server has it’s own time and timezone set. If you overlook that, each time your script executes any of time functions, it will take server time as actual one. So first thing you need to look at, is server location, and its time zone.

Magento CMS syntax – part2

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

Every Magento user noticed that there is special {{magentocode}} syntax available in cms pages and static blocks. We traced a bit to find out which params are available and what exactly they do.
Magento CMS syntax – part1 is first part of this series. Please read before this.

Since the part1 article 4 new codes were introduced in newer Magento versions, so now there’s 10 of them total: skin, media, htmlescape, store, block, layout, config, customvar, protocol and widget.

They are currently handled by Mage_Widget_Model_Template_Filter processor class (which extends Mage_Cms_Model_Template_Filter which extends Mage_Core_Model_Email_Template_Filter).

How to create custom attribute source type?

Share
Posted on August 16th, 2011 | Posted by admin

Have you ever need to create custom attribute source type? This is small example which will help you to create custom source type. I hope that it will be helpful.

Let’s go….
First of all you need to create sql setup file which will add attribute to your system with custom source type. Source type is defined in array : ‘source’ => ‘sourcetype/attribute_source_type’.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
startSetup();
$installer->addAttribute('catalog_product', 'product_type', array(
'group' => 'Product Options',
'label' => 'Product Type',
'note' => '',
'type' => 'int', //backend_type
'input' => 'select', //frontend_input

Create language packages for an extension in Magento

Share
Posted on August 16th, 2011 | Posted by admin

Dear my friends, last post I wrote about “How to create a multiple language website in Magento”, now I’ll continue with a related topic “How to create language packages for an extension in Magento”.
In this topic, I’ll use our FAQ extension as a real example.

  • Step 1: Edit config.xm file in : your_module/etc/config.xml
    Find section and add below piece of code:

    
    <translate>
                <modules>
                    <Magestore_Faq>
                        <files>
                            <default>Magestore_Faq.csv</default>
                        </files>
                    </Magestore_Faq>
                </modules>
            </translate>
    

    You need to change the namespace and module name to suit with your need.