The hint
(Rubber ducks)
What’s the answer?
Technical
Technical posts on magento, wordpress and other general technical topics
How to add new Region/State in Magento
Magento by default has states only for few selected countries and you might want to include your country’s states in your site for various purpose, to give a select option in state on checkout page, to configure some rules etc.
There is no direct UI available as of now but otherwise also it is quite simple to upload this information using a CSV file and phpmyadmin. you need two to create two csv files
Step 1: directory_country_region.csv => this should include four colums region_id, country_id(in ISO-2), region code, region name.
region_id is nothing but auto incrmented id directory_country_region table, so fill this column with incremented numbers(greater then current auto_increment number)
country_id > ISO-2 code, ex. US, UK, IN
region_code => You can fill iso-2 codes for states(find it using google)
region_name => default name for the state
Step 2: directory_country_regions_name.csv => this should include 3 columns locale, region_id and region_name
locale => ex. en_us etc.
take region_id from previous file and change the default name to the locale.
It is not compulsory to fill this table, you can skip it, unless you want to support multiple locale.
I have created sample files for Indian states, directory_country_region_IN.csv and directory_country_regions_name_IN.csv
[Read more…]
Magento Plugin for Twitter Card
What is Twitter Card?
I recently came to know about twitter cards from my brother, As such twitter allows only 140 characters to tweet, but to compete with Facebook they have launched a feature called twitter cards. Basically after adding the specific twitter meta tags to your page, twitter will give an option to expand the post, after expanding the post, user will see photo, title, description with link to your site, for example visit this funnychutkule’s twitter page. This is a great feature from twitter to promote your website and in my point of view it is a must.
To know more about types of twitter cards please visits official twitter page
I have written a small Twitter card plugin to add the twitter meta tags to your website’s product page, Click here to visit official magento connect page of this twitter card plugin.
How to install Twitter card Magento plugin from puzzlersworld?
- Login to your magento admin panel.
- Go to System->Magento Connect->Magento Connect Manage.
- You need to login again with the same credentials as in first step.
- Paste this extension key http://connect20.magentocommerce.com/community/Pw_Twittercard under Install New Extensions section and click on install.
- Confirm the installation once again, after installation you have to set your twitter username.
HTML Escape | Escape Characters
I cam across HTML escaping/unscaping problem while i was writing a post with xml code to be displayed, then i did some research on HTML Escape. I also created a Html Escape/Unscape tool. Thought of sharing with you. hope it helps !
[break][/break]
What is Escaping
Converting a character to ASCII Format &#num; where num is replaced by its ASCII code.
[break][/break]Why to Escape HTML ?
Some characters holds special meaning in some context, then if we want to use those characters apart from that special meaning we have to escape them, for example web browsers parse html tags(whatever is inside <>) and does not display them, if you want display them properly, then you have to escape them by converting < to < and > to >.
[break][/break]HTML Escape tool
Here is the tool to Escape/Unescape html. Enjoy !
Before you start development on magento
I have wasted my lot of time while developing on magento. its only because i was not following some basic things needed before you start development on magento. In my opinion if you follow these 4 tips you should be okay!
[break][/break]1.) DISABLE CACHE : This is the first requirement before you start development on magento. I have seen many people struggling and wondering why their changes are not visible. I also read somewhere that on an average a new developer spends around 2 hours on magento platform wondering why his changes are not visible.
To disable cache
- Go to System > Cache Management
- Click on Select All(on left).
- Select disable from Action dropdown(on right).
- And Click on Submit.
2.) Enable Logging:
You might need this, as often which writing php code if you miss some braces or use a function which does not exist you will get error something like this:-
8 Steps guide on How to create Magento module
This is one of my first article in the series of How to’s in magento. But before you actually start any development on magento you must follow these guidelines.
Step 1: First create a magento module xml file
( app/etc/modules/Pw_Manageproducts.xml)
[break][/break]1 2 3 4 5 6 7 8 9 | <?xml version="1.0"?> <config> <modules> <Pw_Manageproducts> <active>true</active> <codePool>local</codePool> </Pw_Manageproducts> </modules> </config> |
This xml tells magento that module is active and will be available in local codePool.
At this point, you should be able to see your module in Magento Admin Panel. Go to System->Configuration->Advanced->Disable Modules Output. You should be able to see Pw_Manageproducts module listed there.