Since Magento has built in functionality for currencies, it shouldn’t be too hard to create custom currency selector and put it to the header. You might say this tutorial is for beginners, since it’s pretty much straightforward.
Read moreProgramming
Our latest launch from Australia: Australian Gifts Online
Australian Gifts Online is an Australian family business, owned by Paul and Jill Leach who have been selling online since February 2006. Last year, they decided to move their storefront to join the Magento Community. However, since they are constantly moving forward to keep up with the latest e-commerce trends, Paul approached Inchoo Australia’s office in Sydney looking towards improving the overall user experience, Magento design and performance.
Read morePrevent PO Boxes in shipping address field on Checkout
We recently integrated a feature that would prevent users from creating an order with a PO Box in Australia. Since we are already familiar with Australia Post shipping integration (and heavy modifications of it, I might add :)), the first thing that came to mind is to have a look if there’s some API or web interface that can be used to filter out post codes that are linked to PO Boxes. Many high volume addresses and/or PO Boxes in Australia have their own post code, so it looked like an obvious solution. It turns out that it’s not that simple or logical, since there are many edge cases where you can not reliably tell if you should filter the code out or not. There is a guide made by Fontis that shows how to validate the input fields in order to filter out PO Boxes. However, in our case we had some dynamic content loading with Temando shipping method integrated. This guide is intended as a more general solution that is compatible with Checkout page’s dynamic content and third party Shipping methods integration like Temando.
Read moreCustom router in Magento
Creating the custom router could be very useful thing when we want to separate some business logic that can be applied on same route (url) without redirecting to different routes inside the controller.
Why don’t we create separate route for different logic and we are done?
Read moreBuilding Magento marketplace for aescripts.com
Aescripts is an online store and tutorial website featuring a marketplace for 2D and 3D artists selling digital goods such as Adobe After Effects scripts and plugins, Maxon Cinema 4D plugins, Photoshop plugins, Premiere plugins and other.
Read moreProgrammatically create, apply and delete Shopping Cart Price Rule in Magento
Default Magento installation has this great feature called “Promotions”. There are two types of promotions: Catalog Price Rules, Shopping Cart Price Rules. In this article I will show you how to programmatically create, apply and delete Shopping Cart Price Rule.
Read moreInjecting Variables into a Magento CMS static block
In this tutorial i’ll show you how to inject any custom variable you need into a cms static block in place of a {{var variable_name}} tag. You’ve seen this in the email templates if you were working on them (in the matter of fact the model (filter) we’re calling is extending the same filter the email templates are using for injecting the variables).
Read moreValidate your input, Magento style
I’m sure most fo you will agree that Magento’s frontend validation for form input fields is a nice feature. All it takes is for you to add some CSS classes to the input fields and then upon form submission validation is triggered that outputs, by default, red colored messages that point the possible validation failures etc. This validation is done on the client side via Java Script.
Read moreGuide through Magento’s timezones
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!
Read moreEmulate store in Magento
Magento 1.5 introduced very interesting piece of code that enables easy store emulation when programming, Emulation model a.k.a. Mage_Core_Model_App_Emulation class.
Read moreLayered navigation, but not quite
Recently I got a chance to rewrite Magento’s layered navigation standard functionality. The request was very specific as the client wanted to keep all of the “filters” visible all the time. For example if you wish to filter your results by Color (let’s say you have yellow, green, red, blue and magenta) products are filtered but the layered navigation displays all filters. This way a costumer can re-filter the products in current category without the need to return to the category view.
Read moreConfigurable product modification in Magento
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.
Read moreLogging user/customer actions in Magento
Recently I wrote a Magento extension called ActionLogger, inspired (thematically) by the “Logging of Administrator Actions” feature available in Magento Enterprise. ActionLogger is pretty simple extension, working on pretty simple but powerful concept of Magento controllers predispatch action.
All you need to do is to create event observer/observers for “controller_action_predispatch” event. This event is fired on every controller action call.
Read moreMagento PDF invoice with product images extension
Hello everyone, short while after I wrote article Add custom attribute to Magento’s PDF invoice I received quite a number of requests for explanation on how to add products images to PDF invoice. As I had some time, I’ve created an extension that will do just that.
Read moreCreate configuration for your Magento extension
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:
Magento code library – Handling files and folders
Among most often custom coding tasks are usually those related to some import/export between Magento and other system. Usually existing store owners when switching from their current shop system to Magento want to transfer all of their products, orders, and most importantly customers.
Most of the time, standard Magento product/customer import/export is not sufficient for the task at hand. Limitations like file size upload and structure of original data require you to do a custom scripts that will handle the job of data transfer. Think of shops with several tens of thousands of orders, customers, products.
Read moreProgrammatically change Magento’s core config data
Every Magento installation has certain core configuration data already set. When you update those values from the administration interfaces, changes are saved mainly to core_config_data database table. It seems important and something that you shouldn’t touch, right? As always, there are times you will wish to get your hands on it. In some cases you will wish to chance settings directly from the code. This article demonstrates the proper way.
Read moreSetting up Magento debug enviroment using xdebug and Aptana Studio
I’m using Aptana studio for few months already.
It is Eclipse/PDT based so I’m sure all this can be achieved in any Eclipse based platform.
Load XLS files into Magento modules using PHP-ExcelReader class
Recently I had a small problem and it turned out that it wasn’t small as a initially thought. I had to read XLS (Microsoft Excel document) into PHP. After I spent almost 2 hours browsing through internet, I found myself most satisfied with open source project “PHP-ExcelReader class“. It has everything I needed (multiple sheets support and it could read data from both Excel 2000 and 2007). On the other hand, Magento doesn’t support XLS, and I decided to write a small method that you can implement in any Magento class.
Read moreProgrammatically create order in Magento
Surprisingly one of the trickiest parts of “under the hood” Magento is how to create order programmatically. At least for me, this was/is the most complex area of Magento development. Reason why it is so difficult is that the order creation process is all but not straightforward. You cannot simply instantiate order model, set some data and call upon the save() method. If you ask me, this is how it should be done.
Read moreMysteries of Magento Encryption Key
If you ever went through Magento installation process, you know that at some point you are asked for Magento Encryption key. Magento will automatically generate one for you if you do not enter anything in this field. For first installation, this is just fine. You will see a note that Magento uses this key to encrypt passwords, credit cards and more. Is this really the case?
Read moreProgramatically create attribute in Magento, useful for the “on the fly” import system
Sometimes when doing an import in Magento from old shop system you are faced with lot of issues related to attributes. For instance your old shop system might have several product attributes that simply do not fit into the default Magento attributes. In such cases you need to create these attributes manually in the Magento admin, assign them to the appropriate attribute set and then construct a valid CSV file with valid column names for these new attributes.
Read moreGit ignore (.gitignore) file for Magento project
Yesterday I was determined to write a detailed walk-trough on setting up the SVN for Magento development. After some minor frustrations I decided to let go of the SVN and make my self learn Git.
Read moreInline translation in Magento
If you need translations for your site but translation packs are not fully translated, then inline translation is very nice feature.
In this post I will cover entire process for inline translation in Magento.
Creating cron script in Magento
Creating Magento cron script is very simple thing. First of all we have to create the module, (I hope that you know how to create magento module) and add in config.xml file next code:
Read moreChange any page title in Magento
Here’s a quicky one 🙂 How do you change page title of every Magento page if some titles are hardcoded into controller?
Read moreMagento Hello world module (extension)
Previously I already wrote how to build custom module (extension) in Magento. Here is a new, refreshed article on that subject.
We will start by creating a simple “Hello world” module. However, you will soon see that simple takes a new meaning with Magento. Creating a bare bone module requires at least two files in Magento. For your module to work you need /app/etc/modules/MyCompany_MyModule.xml, app/code/local/MyCompany/MyModule/etc/config.xml. But, barebone module will not give you a “Hello developer” 🙂 -So, we need to add few more files to the game.
Read moreProgramatically create Magento blocks and inject them into layout
Imagine a scenario where you wish to simply create a view file like custom-note.phtml and show this view file on some new url inside the Magento store. One way to do this is to create a CMS page and call that block from within CMS page. But what if you wish to create and append this block to other areas of Magento layout that are inaccessible from CMS page interface form admin? What if I want to add new div element under the breadcrumbs and append new block under it?
Read moreAdd breadcrumbs in Magento to pages that miss them
Here is one solution on how to add breadcrumbs to pages in Magento that by default do not have breadcrumbs. Recently we had a client that requested a basic breadcrumb to be shown on pages that Magento does not serve breadcrumbs.
<?php
/**
*
* CUSTOM BREADCRUMBS
*
* Adds url breadcrumbs for pages that do not have breadcrumbs by default
*
*/
?>
<?php if(is_null($crumbs)): ?>
<?php
/**
* NOTE
* On some servers use ->getServer('PATH_INFO')
* and on some ->getServer('ORIG_PATH_INFO')
*/
$urlRequest = Mage::app()->getFrontController()->getRequest();
$urlPart = $urlRequest->getServer('ORIG_PATH_INFO');
if(is_null($urlPart))
{
$urlPart = $urlRequest->getServer('PATH_INFO');
}
$urlPart = substr($urlPart, 1 );
$currentUrl = $this->getUrl($urlPart);
//$controllerName = Mage::app()->getFrontController()->getRequest()->getControllerName();
//$controllerName = ucfirst($controllerName);
$controllerName = str_replace("/", " ", $urlPart);
$controllerName = str_replace("_", " ", $controllerName);
$controllerName = str_replace("-", " ", $controllerName);
$controllerName = ucfirst($controllerName);
?>
<span class="breadcrumbs">
<strong class="float"><?php echo $this->__("You're currently on: ") ?></strong>
<ul class="breadcrumbs">
<li class="home">
<a title="<?php echo $this->__('Go to Home Page') ?>" href="<?php echo $this->getUrl() ?>"><?php echo $this->__('Home') ?></a>
</li>
<li> / </li>
<li class="<?php echo strtolower($controllerName) ?>">
<strong><?php echo $this->__($controllerName) ?></strong>
</li>
</ul>
</span>
<?php endif; /* END OF CUSTOM BREADCRUMBS */ ?>
Read moreHow to add login form to home page in Magento
I found a interesting question on Magento forums. There was a request to add a login page to a home page. I guess somebody wants to show a products only to a registered customers. Here is a quick guide how to do it.
Read more