Magento Themes and Magento Extensions

Configurable product modification in Magento

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

In this article, I’ll give you extension that will change drop down selection (select field) to radio buttons on configurable products in Magento Community edition.

Well, what I had to do is rewrite Mage_Catalog_Block_Product_View_Type_Configurable block, and create a custom phtml file (configurable.phtml) with some custom validation on it.

Everything I just told you equals to this config.xml:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0"?>
<config>
<modules>
<Inchoo_Configurable>
<version>0.1.1</version>
</Inchoo_Configurable>
</modules>
<global>
<models>
<configurable>
<class>Inchoo_Configurable_Model</class>
</configurable>
</models>
<blocks>
<configurable>
<class>Inchoo_Configurable_Block</class>
</configurable>
<catalog>
<rewrite>
<product_view_type_configurable>Inchoo_Configurable_Block_Frontend_Configurable</product_view_type_configurable>
</rewrite>
</catalog>
</blocks>
</global>
<frontend>
<layout>
<updates>
<configurable module="Inchoo_Configurable">
<file>configurable.xml</file>
</configurable>
</updates>
</layout>
</frontend>
</config>

How you could build your Magento extensions without view files

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

The main idea behind this article is something I previously wrote, making your extensions more distributable, less error prone, less depended, less intrusive. Such extensions are then more “safer” to be fetched and installed via Magento Connect. When I say safer I am thinking in terms of your extension not breaking someone live store, etc.

I would dare to say that one of the most annoying and dangerous areas of extension development are the theme view files. For example, imagine an extension that adds some “color switcher” like functionality on the product view page.

Usually extension developer will create his alternative of /app/design/frontend/default/default/template/catalog/product/view.phtml or /app/design/frontend/default/default/template/catalog/product/view/media.phtml file placing it under the default theme.

How To Pre Populate Product Dropdown Attribute Values

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

If you are looking to pre-populate product drop down attributes (custom types) i.e. “Partners” attribute etc. then you must be wondering how to pre-populate the product drop down attribute values in that attribute. One option is to manually enter all the data which is time consuming specially if you are supposed to fill large data set. What if the source of the data is large enough to enter and update? Situation gets worse if you are asked to check whether the data is upto-date or not.

Lets take a scenario where people are coming to a separate part of your website and registering as a partner which is getting stored in other database (Non-Magento database).

Now, we have to fetch partners from this remote site and pre-populate (upto-date) data in our newly created custom attribute dropdown (partners).

Adding related products problem

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

Today I had a problem when I want to add related product to Magento Professional 1.9.0.0., it did not work. After some tracing thrown errors and comparing files with other Magento versions I found missing part. Magento Professional has missing lines of code in Related.php. So, if someone stuck on the same problem, here is the solution!

To correct this issue, do it in Magento way. So create your new module and rewrite that block. Here is the file where you can find these lines of code:
\app\code\core\Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Related.php

Create configuration for your Magento extension

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

Today I’m going to give you and quick HOW-TO for beginners on how to create simple configuration for your extension inside Magento’s configuration section.
If you’re interested, read on:

Well, fist you need an extension that you’re going to build configuration for. If you’re new to Magento and you don’t know how to create an extension of your own, there’s a bunch of articles on this site about that, but my suggestion is to start on fresh extension, for testing..

And now, on to the fun stuff. First, you need to add (or edit) your system.xml file.