Magento themes and extensions

Ajax Registration form in magento

Share
Posted on September 23rd, 2011 | Posted by admin

In this article we are going to create a custom registration form in magento with Ajax functionality. The default magento registration form does the email verification of the user in the server side i.e After form submission. We are going to make it interactive.

Step 1: After creating the basic module,we need to override the default register.phtml and include our own template file. Magento has a built in prototype java script library support i.e prototype.js. In this example we are going to use Ajax with built in prototype.js library. The same result can also be achieved using jQuery but it requires a few more steps and also we need to write jQuery code to avoid conflicting with prototype library.

Step 2: We need a controller action for processing the client request through Ajax, it fetches the email address entered by user and it passes to the controller action. The controller action will check the email with the database and returns a message depending upon the condition.

How to show products with toolbar and pagination in magento static block

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

It is common in all Magento sites to show the product list in Home page using CMS feature in admin. Recently i had a requirement to display special products in clearance category. I need to create a static block which calls the custom product list block with special product filtering and include it in a category called clearance.

But in the latest version of Magneto 1.4 we can’t use XML Layout for static blocks, of course we can use XML Layout in CMS Pages which will include the toolbar and pagination. After doing lot of trial and error i found out a way to show products in static block with toolbar and pagination. The below method will show the product listing with pagination and toolbar in static block.

We can pass the arguments in the block call as shown below.

{{block type=”yourmodule/blockname” name=”product_list” category_id=”6″ column_count=”3″ count=”6″ limit=”4″ mode=”grid” toolbar_block_name=”product_list_toolbar” template=”catalog/product/list.phtml”}}

By Including the above block in StaticBlock we can even set category id, column count, count(product count), product limit per page (limit) and even the mode (Grid mode or list mode) etc.

Hope this will be useful for anyone who wants to show the products in static block.

Magento cron job issue solution

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

Recently While developing a custom module with cron job i faced an issue, my cron job was not executed successfully. When i inspected the cron_schedule table in database it shows the status as error and the below message was found in messages field.
‘Mage_Core_Exception’ with message ‘Invalid callback: mymodel/observer::observermethod doesn’t exist
My model class is not recognized. But i have my observer class in the Model directory. I have my config.xml as below

<crontab>
<jobs>
<mycompany_modulename>
<schedule>
<cron_expr>*/5 * * * *</cron_expr>
</schedule>
<run>
<model>modulename/observer::methodcall</model>
</run>
</mycompany_modulename>
</jobs>
</crontab>

Install Magento Locally with MAMP PRO

Share
Posted on September 19th, 2011 | Posted by admin

Note: for Windows users use XAMPP

1. Set up a new enviroment in MAMP PRO

2. Use the web browser to access to it. Verify it’s working.

Moving the Magento Store Switcher / Selector

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

Anyone who has dabbled in making multiple stores in Magento has eventually wanted to change the way the Magento store switcher (also referred to as the Magento store selector) works. By default Magento provides a store switcher in the form of a select menu. The store switcher is located in the footer of the site by default.  This post will cover how to move the store switcher (store selector) from the footer to the header.

Moving the Magento Store Switcher to the Header

First off, you will want to locate your “page.xml” file. This is located in the ‘app/design/frontend/base/default/layout’ directory. (Note: If you are using your own template your path may be different.) Open it with your favorite text editor and find the line of code below.

1 <block type="page/switch" name="store_switcher" as="store_switcher"template="page/switch/stores.phtml"/>

This line is located in the “page/html_footer” block. Cut the line and paste it just under the “page/html_header” block as shown below.