Magento Themes and Magento Extensions

Migrate Your Magento Website Quickly

Share
Posted on October 10th, 2012 | Posted by admin

At the end of developing period of Magento site, the website may migrate to client’s server or live onsite. In this cases, if you follow the path like uploading (or sometimes downloading ) file by file, exporting and imporing database throught phpmyadmin, you will find it seems to a long-period exhausting tasks, but actually it should take too many time in development.

As an example, we are going to migrate “www.example-src.com” to “www.example-dst.com” in short, also you could just download shell script here.

After development and testing period of a Magento website, you’ll need to migrate it to a live server. Sometimes, you’ll need to migrate a Magento website from one server to another. However, there’re thousands of files in Magento and if you upload the whole Magento website through FTP, it will usually take a long time. Meanwhile, exporting and importing database through phpMyadmin sometimes doesn’t work well due to internet connection issue, especially when the database is huge. In this article, we introduce you how to migrate your Magento website quickly.

Displaying New Products in Magento

Share
Posted on October 9th, 2012 | Posted by admin

This method allow you to add new products to a Magento CMS page or Block.
Go to “CMS >> Manage Pages” and select “Your Page” from the list of pages.
Go to “CMS >> Static Blocks” and select “Your Block” from the list of blocks.

Use this code snippet to show new products on your front page:

{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template=
"catalog/product/new.phtml"}}

To change the number of columns in the “New Products” view:
column_count=”6″

Generated Magento Model Code

Share
Posted on October 8th, 2012 | Posted by admin

This is a quick one for advanced users, and was inspired by a recent question I answered over at StackOverflow.

One of the nice things about a well abstracted system like Magento is the opportunities it presents for meta-programming. Drop the following code in a controller action (yes, you can define an inner function in PHP)

function someAction()
{
        header('Content-Type: text/plain');
        $coupon = Mage::getModel('salesrule/rule')->load(1);        

        function outputValue($value)
        {
            switch(gettype($value))
            {
                case 'string':
                    echo "'".str_replace("'","\\'",$value)."'";
                    break;
                case 'array':
                    echo "array(";
                    foreach($value as $v)
                    {
                        outputValue($v);
                        echo ",";

Advanced search in Magento and how to use it in your own way

Share
Posted on October 7th, 2012 | Posted by admin

It’s been a while since my last post. I’ve been working on Magento quite actively last two months. I noticed this negative trend in my blogging; more I know about Magento, the less I write about it. Some things just look so easy now, and they start to feel like something I should not write about. Anyhow…. time to share some wisdom with community
Our current client uses somewhat specific (don’t they all) store set. When I say specific, i don’t imply anything bad about it. One of the stand up features at this clients site is the advanced search functionality. One of the coolest features of the built in advanced search is the possibility to search based on attributes assigned to a product.

To do the search by attributes, your attributes must have that option turned on when created (or later, when editing an attribute). In our case we had a client that wanted something like

Get Total Number Of Products From Within Any Category

Share
Posted on October 6th, 2012 | Posted by admin

To get the total number of products in a category and show it on the product list page, just add these three lines of code.

This has only been tested on Magento 1.5 but should work on previous versions, let me know in the comments if you have any issues.

In template/catalog/product/list.phtml add these two lines of code where you need the count.

$_productCollection = $this->getLoadedProductCollection();
$count = $_productCollection->getSize();
echo $count;