Log all SQL queries in Magento

Share
Posted on January 27th, 2013 | Posted by admin

Log all SQL queries in Magento

In Varien_Db_Adapter_Pdo_Mysql

Magento : lib/varien/Db/Adapter/Pdo/Mysql.php

set

protected $_debug               = true;
protected $_logAllQueries       = true;
 

and (if nor already there) create the folder defined in

Product level shipping in Magento

Share
Posted on January 7th, 2013 | Posted by admin

Magento don’t let you set shipping cost in product level. You can do it by flatrate shipping method
Create a attribute shipping_world and add to your default attribute set.
overwrite/extend the flatrate carrier model of magento.
The value given in shipping_world attribute of product will be the flat shipping rate of that product.

How to get ordered Items and their detail for an order ID in Magento?

Share
Posted on December 29th, 2012 | Posted by admin

How to get ordered Items and their detail for an order ID in Magento?

I tried to wrote this code when I was working on a cron file for all orders. My client wants a cron file that get all orders information including all ordered item and their detail.

First, I searched on google but I didn’t found any exact solution then I tried below code:

By below code I got all orders on site:

Magento:How to use ExtJs in Magento

Share
Posted on November 5th, 2012 | Posted by admin

Magento Module Development : ExtJs is a wonderful library for the RIA(Rich internet applications) , but to use in the magento is little tricky .

In most of the cases extjs gives the data in JSON format , we can use that data in this way in magento

foreach ($collection as $product) {

$Product = Mage::getModel('catalog/product');
$Product->load($product->getId());
$i++;
echo '[true,  false, '.$i.',  "'.$Product->getName().'", '.$Product->getPrice().', "'.$Product->getImageUrl().'",
 "'.$Product->getProductUrl().'", "", "", , ],';

Listing sub-categories on a category page in Magento

Share
Posted on November 2nd, 2012 | Posted by admin

In this tutorial I’m going to show you how to display a list of sub categories on a category page in Magento.

Lets say we have a category with lots of sub categories; if we could show these to our users then they might have an easier time finding what they’re looking for. We can achieve this with a simple bit of code.

First create a new phtml file and save it in your/app/design/frontend/default/yourTheme/template/catalog/category folder.

How will our code work?

When writing a new piece of code its always a good idea to have a think and write down in words exactly what you’re going to do. In this case we’re going to find the id of the category we’re looking at, then we’re going to find the sub-categories associated with that id, and then we’re going to display the relevant information for each of those subcategories.

So first we have to find the category id for the page we’re looking at. (This code will only be called when we’re on a category page). We find the id with the following code:

Page 2 of 3«123»