Magento Themes and Magento Extensions

How to create a new product type in Magento

Share
Posted on May 27th, 2011 | Posted by admin
How to create a new product type in Magento

Magento comes packed with several product types: simple, grouped, configurable, virtual, bundle, downloadable. Sometimes clients request can reach beyond any of these built in product types functionality. In such cases, usual way of handling things is throwing some new attributes and hooking into some events from which you can handle and “re-route” certain logic.

In some cases, the required product logic can extend to such level that you are better of with building a new product type in Magento. Why, you might ask? Becase of the more finer control you can achieve on product trough your own models than to poke around on the existing stuff.

Attached to this article is a fully working extension I wrote that creates a new product type in your Magento store. This new product type uses code name “customproduct”. Its based on the Mage_Catalog_Model_Product_Type_Abstract class, the one on which the “simple” product is build upon. Unlike “simple” product type, this “customproduct” does not have any, whatsoever, additional logic built in. This, I leave to you.

Also, extension comes with several “hooks” to certain Magento controllers actions. If you open the app/code/local/Ajzele/CustomProduct/Model/Observer.php you will see implemented several “blank” methods as hooks. Going to config.xml file of this extension will show you what these methods “observe”.

Do you want more from your website?

Share
Posted on May 27th, 2011 | Posted by admin

Do you want more from your website

“Will my search engine rankings drop after the switch to Magento?” is one of the most often asked SEO questions I see regarding Magento. Unfortunately, there is no “Yes/No” answer. No matter which e-commerce solution you were using prior to switch, your rankings might get effected. Switching to Magento might change some of your on-site optimization elements including:

  • URL structure
  • Meta data
  • On-site elements structure
  • Internal linking
  • Distance of deep links from the homepage

All of these might influence your rankings in negative but also as likely in positive way. If you are attempting to move to Magento platform, I strongly advise you to seek for a Magento SEO expert first, to make sure your move is as smooth and as painless as possible for your rankings.

The most important thing to do when making a switch is to 301 redirect the old URLs to your new URLs, which will allow you to keep the link juice you collected so far. For everything else, consult with your Magento SEO professional.

Locked Out from Magento admin?

Share
Posted on May 27th, 2011 | Posted by admin

Locked Out from Magento admin?

Here’s the situation, you, client, webmaster, pet or whoever was playing with users and roles in your favorite store and deleted only main admin account or broke admin account privileges. If it happened to you and you’re locked out from your Magento store, read on.

This script creates new admin user associated to new Inchoo role with all privileges set. Of course, you have to have FTP access for this to work.

Download newadmin script, unpack it, open newadmin.php file (notepad will do) and define username, email and password of the new user. Username and email must be UNIQUE in Magento, so use some new ones and not the old ones that are already in the system, you’ll change it later after you login.
Connect with FTP and copy newadmin.php file to root of your store and run it through web browser like

http://www.yourstore.com/newadmin.php

The script will try to delete itself after user is created, but please make sure it’s removed from the server. Code is tested on 1.3.x versions of Magento and I don’t believe it will work on older versions, so please write some feedback.

Featured Products help with Magento’s SEO

Share
Posted on May 27th, 2011 | Posted by admin
Featured Products help with Magento’s SEO

When thinking about having featured products on your Magento store,  SEO benefit is probably not the first thing that comes to your mind, however, SEO benefit exists.

Since the web is constantly changing, search engines are following as well, and with the dawn of the real time web, SEOs noticed Google started giving some credit to the websites that are regularly updated. As the matter of fact, having a regularly updated homepage is often a solution for many SEO problems websites encounter.

I’ve seen a lot of  Magento stores that have a completely static homepage and experience some problems with indexing. You can see them complain at Magento forums every now and then about not being able to make Google index their online store.

I’m not saying that having featured products (regularly updated content on homepage) will fix all of your indexing problems, chances are your problems might be in some other aspect of on-site optimization, however, it’s something that will improve your indexing for sure.

Inchoo has developed a featured products extension for Magento that can be downloaded and used completely free via Magento connect. Feel free to test it and come back with any comments. It has already been downloaded over 1 000 times via Magento Connect.

Getting started with Magento ORM, setting up the model

Share
Posted on May 27th, 2011 | Posted by admin

Given the sheer size of Magento system, its quite easy to loose valuable time when trying to achieve even the basic things like “Creating simplest ORM model class”. Substantial amount of serious programming in Magento requires you to write some values to database.

By now, most of us have seen how “cool” Magento models are, and how “easy” it is to write values to models by using syntax like

1
2
3
4
5
6
7
8
9
10
11
12
13
//$someModel = new Company_Modul_Model_SomeModel();
//or the preferable way
$someModel = Magent::getModel('company/somemodel');
/* To use some existing model record from database */
//$someModel->load(); /* Some valid id in database */
//$someModel->setSomeField = 'Some value';
//or the preferable way
$someModel->setSomeField('Some value');
//Save model
$someModel->save();

Code example shown above is clean, easy to use, etc. Probably the main thing to note is the usage of “$someModel->someField = ‘Some value’;” or “$someModel->someField(Some value);”. Safest, and more “cooler” way would be to assign field values trough “virtual methods” like “$someModel->someField(Some value);”. By doing so you are preparing a “safe ground” for yourself for possible latter modifications on individual fields (attributes) of model before “save” operation.

Page 5 of 39« First...«34567»102030...Last »