Add new product type for magento

Posted on July 23rd, 2011 | Posted by admin

Hi everyone!

As you may know, the resh version of Magento have five product types now :

  • Simple Product
  • Configurable Product
  • Group Product
  • Virtual Product
  • Downloadable Product.

You can create a new product type by yourself to embed to the Magento system. It’s easy to create a new product type, on this tutorial I will show you how to create a new product type. This step is to create a new product type on Magento:

  1. Create a new module by yourself or use module Creator.
  2. On file config.xml you define product by XML with tags like :

Add custom breadcrumbs to any pages

Posted on July 18th, 2011 | Posted by admin

Dear my friends,
Today I’ll write about the breadcrumbs. I’ll explain how to add breadcrumbs to your custom module (Due to default settings, your custom module doesn’t contain a breadcrumbs).
We will add links to breadcrumbs block of Magento.
Open the block that you want to add breadcrumbs then find function

public function _prepareLayout()

Sort by Price not work in Magento

Posted on July 18th, 2011 | Posted by admin

I recently added a large volume of products to Magento, however when I looked through the product listing, it was really strange.

All products were displayed correctly however the order was all wrong.  Instead of being ordered or sorted by price as default, the products were all over the place.

After a bit of searching I eventually found the problem is in the Magento cache system and specifically in the Layered Navigation indexes.

Logging in as admin and using the “System->Cache Management->Layered Navigation Indices->Refresh now” option resolved the issue.

However this process took a long time to complete on my server, so some patience may be required.

How to pack a Magento extension

Posted on July 18th, 2011 | Posted by admin

This admin page will help to pack your Magento extensions, such as modules, add-ons, language packs, interfaces and themes, into PEAR packages which you could upload to Magento Connect and share with other community members.

To start packing extensions, log in to Magento Admin panel and go to:
Admin Panel: » System » Magento Connect » Package Extenssions
You can easily follow the 5 step process to generate the extension that are described in the remaining article.

The extension packaging process includes generation of package.xml file with information about the package collected by the 5 steps below, and archiving content files and folders specified by the Contents step.

After package release is uploaded to MagentoConnect, it will be available for download and installation for other members, by pasting extension key into MagentoConnect downloader.

Quoting SQL in Magento

Posted on July 18th, 2011 | Posted by admin

Well, most of new Magento developers feel that writing queries again database is quite complicated. And so, they try to use the simplest way to do this:

$data = Mage::getSingleton(‘core/resource’) ->getConnection(‘core_read’)->query($sql);

However, sometimes you may make Mysql injection error by this way. To avoid this, the best way is using quoting sql supported by Zend Db before calling query().

There are 3 kinds of quoting: quote(), quoteInto() and quoteIdentifier(). It’s very important to use these functions before execute query. It helps us to defend against SQL injection issues.

1. quote(): this method is used to turn a string or variable into a quoted SQL string:

$where = $db->quote(“April’s coder”);

$db->query(“Select * from `coders` where `award`=$where”);

In the first command, we will have $where = ‘April\’s coder’; notice that 2 quotes added to the string.