Two way integration of WordPress with Magento

Most of the Magento users are aware of integrating WordPress with Magento using Fishpig. But Fishpig has some limitation like user can’t use Custom posts, Custom Fields or WordPress codes without using additional paid plugin.

To overcome this, we have found a way. Please follow below steps, this will help you use any WordPress code withing you Magento Installation.

Step 1: Install Fishpig plugin in Magento http://www.magentocommerce.com/magento-connect/wordpress-integration-3795.html

Step 2: Install WordPress plugin and follow installation steps given in it https://wordpress.org/plugins/magento-wordpress-integration/

Step 3: Add below code in index.php file
<?php
$admin = 'admin';
$uri = $_SERVER['REQUEST_URI'];
if(!strpos($uri, $admin) && !strpos($uri, 'downloader')) {
require_once(dirname(__FILE__).'/wordpress/wp-load.php');
}

Thats it, your installation should work now.

Advertisements

Get Product Image based on its Position – Magento

You might have seen website where the product images changes when you move mouse on it. In this tutorial i’ll show you how to do it with Magento.

You need to create a small module to achieve this. We will add this function in the helper file of the module so it can be called globally anywhere using helper function.

If you are not familiar with module creation i’ll list the steps below:

Step 1: Create a file in “app/etc/modules” named “Greeting_Imagealt.xml”. The content of the file will be.

<?xml version="1.0"?>
<config>
<modules>
<Greeting_Imagealt>
<active>true</active>
<codePool>local</codePool>
</Greeting_Imagealt>
</modules>
</config>

Continue reading

Magento – Install and Upgrade Database script

I struggled a lot to find a method to install a simple database script in Magento for creating a table or upgrading field or column. In the end I thought why not write one for reference. This post is mainly for my reference 😉

Initially you need to create a small extension to install the db script. You can also use the existing one if you want. But i have written a small extension just for the purpose of adding and updating database tables.

Below is the step by step procedure for executing Database queries

1) I have created a small extension named database. Create a file in “app/etc/modules” named “Greeting_Database.xml”.
The content of the file will be.

<?xml version="1.0"?>
<config>
<modules>
<Greeting_Database>
<active>true</active>
<codePool>local</codePool>
</Greeting_Database>
</modules>
</config>

This is just a basic file to let Magento know you have a module named Database. Greeting is the Company name of the module.
Continue reading

Passing values and parameters to template file using XML and ShortCode from Magento Admin

At times there is a need to pass some parameters to template file in Magento. Some of the conditions are as follow:

1) Category Id is needed to be passed to display all the products of that particular category
2) Static block id needs to be passed to call it in template file.

We can pass any parameters in the template file from Magento Admin using two methods

1) Using the shortcode: By using shortcode we can pass the parameter as follows

{{block type="greeting_products/productslider" category_id="11" product_count="10" title="Featured Products" template="greeting/products/featuredslider.phtml" }}

Here category_id and product_count are passed in the file featuredslider.phtml

{{block type="core/template" name="contactForm"  form_action="contacts/index/post"  template="contacts/form.phtml"}}

Here form_action URL is passed as a form action in contact form which will be passed to postAction method of IndexController.php file.
Continue reading

Reset Order id after clearing dummy Orders in Magento

After developing a website, Developers delete all the dummy order placed using either a SQL script or using one of the free extension available on Magento Connect.

After deleting orders, the Order Id still continues to be in the previous range ie if last Order Id was #100000123 the new Order Id will be #100000124. To reset the Order Id to default value ie: #100000001 we need to perform some SQL Queries on our Database.

The queries are as follows :

1) UPDATE eav_entity_store SET increment_last_id = ‘000000000’ WHERE entity_type_id = ‘5’;

2) UPDATE eav_entity_store SET increment_last_id = ‘000000000’ WHERE entity_type_id = ‘6’;

3) UPDATE eav_entity_store SET increment_last_id = ‘000000000’ WHERE entity_type_id = ‘7’;

4) UPDATE eav_entity_store SET increment_last_id = ‘000000000’ WHERE entity_type_id = ‘8’;

Here

5 is for Orders
6 is for Invoice
7 is for Credit Memo
8 is for Shipment

How to install/setup language pack in Magento

Are you confused with installing language pack in Magento? Don’t be its too easy 😉

In this post we will go through

Installing language pack in Magento

Step 1 : Select the language you want to set on your website. Download the desired language pack from this link Language Packs

Step 2 : Put the language pack folder in app/locale. Suppose we are installing a spanish language pack so the name of the folder would be es_ES.

Step 3 : Create a new store view for your language. Suppose for spain Goto System->Manage Stores->Create Store View. Add the name, code, status and priority of your store.

Step 4 : Configure your language with your store view. Goto System->Configuration->General->General. Follow the steps as below screenshot.

Select the newly created store.
step1

Select relevant Locale and save it. For our case its spain so i have selected spain.
step2

Step 5 : Thats it. Now goto frontend and enjoy your multi lingual website. Though to display the flag as shown in the screenshot you need to do little programming. I’ll try to cover it in future.

step3

In Next tutorial i’ll post how to do custom inline translations for backend and frontend in Magento. Please leave your comments and suggestion below.

Create Custom Post Type with Texamony(Categories) in WordPress

Custom Post types are very handy tool in wordpress. To create a custom Post Type is pretty easy.

Goto functions.php file of your theme folder and copy the below code. You will get the new section for adding posts. These can be used for many stuffs like creating a small plugin for News, FAQ’s etc.

Below is the code to be added in functions.php. I have added the comment wherever required.

wp-custom-post

Continue reading