Friday, 23 November 2012

Using php to display visitor / user information such as their IP address

$ip = $_SERVER['REMOTE_ADDR'];
$hostaddress = gethostbyaddr($ip);
$browser = $_SERVER['HTTP_USER_AGENT'];
$referred = $_SERVER['HTTP_REFERER']; // a quirky spelling mistake that stuck in php

print "Display IP address:
\n";
print "$ip

\n";
print "More detailed host address:
\n";
print "$hostaddress

\n";
print "Display browser info:
\n";
print "$browser

\n";
print "Where you came from (if you clicked on a link to get here:
\n";
if ($referred == "") {
print "Page was directly requested";
}
else {
print "$referred";
}

Most Important Tables in magento are: eav_attribute and eav_entity_type

PRODUCT

                Main Table: catalog_product_entity

                                catalog_product_entity_datetime

 catalog_product_entity_decimal

 catalog_product_entity_gallery

                catalog_product_entity_int

 catalog_product_entity_media_gallery

 catalog_product_entity_media_gallery_value

catalog_product_entity_text

                catalog_product_entity_tier_price

 catalog_product_entity_varchar


CATEGORY

                Main Table: catalog_category_entity

                                catalog_category_entity_datetime

 catalog_category_entity_decimal

 catalog_category_entity_int

 catalog_category_entity_text

 catalog_category_entity_varchar

catalog_category_product



PARTY

                Main Table: customer_entity   and customer_address_entity

                                customer_entity_datetime

 customer_entity_decimal

 customer_entity_int

 customer_entity_text

 customer_entity_varchar

 customer_group

 customer_address_entity_datetime

 customer_address_entity_decimal

 customer_address_entity_int

 customer_address_entity_text

 customer_address_entity_varchar


ORDER

Main Table: sales_flat_order

 sales_flat_order_address

 sales_flat_order_grid

 sales_flat_order_item

 sales_flat_order_payment

 sales_flat_order_status_history

Wednesday, 21 November 2012

my paypal details

my paypal details :

Login : mayank.patel@live.in

Seller Account : mayank_1354093144_biz@live.in / mayank_seller
Buyer Account : mayank_1354092969_per@live.in / mayank_buyer

Clean Magento database

TRUNCATE TABLE `dataflow_batch_export`;
TRUNCATE TABLE `dataflow_batch_import`;
TRUNCATE TABLE `log_customer`;
TRUNCATE TABLE `log_quote`;
TRUNCATE TABLE `log_summary`;
TRUNCATE TABLE `log_summary_type`;
TRUNCATE TABLE `log_url`;
TRUNCATE TABLE `log_url_info`;
TRUNCATE TABLE `log_visitor`;
TRUNCATE TABLE `log_visitor_info`;
TRUNCATE TABLE `log_visitor_online`;
TRUNCATE TABLE `report_viewed_product_index`;
TRUNCATE TABLE `report_compared_product_index`;
TRUNCATE TABLE `report_event`;

magento: insert query for a custom table

$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$connection->beginTransaction();

$sql = 'INSERT INTO tableName (`field1`, `field2`) VALUES (?, ?)';
$bind = array('value1', 'value2');
$connection->query($sql, $bind);
$connection->commit();

Show subcategory in a category page

If you're comfortable editing your theme, this code snippet will bring you a list of all sub-categories of the current category (from the session, so this should work anywhere in your theme). I typically use this in app/design/frontend/default/*theme_name*/template/catalog/category/view.phtml

<?php
$_category  = $this->getCurrentCategory();
$collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id);
$helper     = Mage::helper('catalog/category');
?>

<ul>
<?foreach ($collection as $cat):?>
<?php if($_category->getIsActive()):?>
<?php
$cur_category = Mage::getModel('catalog/category')->load($cat->getId());
$_img = $cur_category->getImageUrl();
?>
<li>
<a href="<?php echo $helper->getCategoryUrl($cat);?>">
<img src="<?php echo $_img?>" title="$cat->getName()"/>
<cite><?php echo $cat->getName();?></cite>
</a>
</li>
<?php endif?>
<?php endforeach;?>
</ul>

how do i change the price filter attributes price range with text

You can configure step of price ranges via admin panel. Log in into admin panel and go to System->Configuration->Catalog->Catalog->Layered Navigation. There select "Manual" in dropdown Price Navigation Step Calculation and enter prefered value into next input field.

Magento – Show Quantity Box in Products List

Find the following line on list.phtml file

 

<?php if($_product->isSaleable()): ?>
<button onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?<')">>span>
<?php echo $this->__('Add to Cart') ?></span></button>


 

Replace with:

 

<form action="
<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId(); ?>">
<input name="qty" type="text" id="qty" maxlength="12" value="
<?php echo $this->getMinimalQty($_product) ?>" />
<button" onclick="productAddToCartForm_
<?php echo $_product->getId(); ?>.submit()"><span>
<?php echo $this->__('Add to Cart') ?></span></button>
</form>
<script type="text/javascript">
var productAddToCartForm_
<?php echo $_product->getId(); ?> = new VarienForm('product_addtocart_form_
<?php echo $_product->getId(); ?>');
productAddToCartForm_
<?php echo $_product->getId(); ?>.submit = function(){
if (this.validator.validate()) {
this.form.submit();
}
}.bind(productAddToCartForm_<?php echo $_product->getId(); ?>);
</script>


 

 

Javascript – get Url

window.location.href - get entire url
window.location.protocol - get protocol: "http" / "https"
window.location.host - get hostname, e.g: "www.g31zone.com"
window.location.pathname - get script name, e.g: "example/index.html"

Tuesday, 20 November 2012

Moving Magento From One Host To Another

1. take buckup of your database
2. take backup of your files.
3. create new database on your new host
4. save your database and password of your database
5. open local.xml in magento folder on path app\etc change infomation of  previous database with new.

<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[username]]></username>
<password><![CDATA[password]]></password>
<dbname><![CDATA[databasename]]></dbname>
<active>1</active>
</connection>
6. upload all your files to you new host.
7. go to you new host database open table `core_config_data` change the value of your old host name with new host name

example:

Before Changing Host

config_id     scope  scope_id    path                           value
Edit     Delete     2     default     0     web/unsecure/base_url     http://localhost/oldhost/
Edit     Delete     3     default     0     web/secure/base_url     http://localhost/oldhost/

After Changing Host

config_id     scope  scope_id    path                           value
Edit     Delete     2     default     0     web/unsecure/base_url     http://localhost/newhost/
Edit     Delete     3     default     0     web/secure/base_url     http://localhost/newhost/

Running script out side Magento Folder and Updating Project Database

Place this script 'image.php' out side magento folder and run this with http://yoursite/image.php, this will update all product images if there is no small or thumbnail image.
It will make first image as thumb and small image.

An example to run script out side magento folder.

<?php
require 'app/Mage.php';
Mage::app();

$products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
foreach ($products as $product) {
if (!$product->hasImage()) continue;
if (!$product->hasSmallImage()) $product->setSmallImage($product->getImage());
if (!$product->hasThumbnail()) $product->setThumbnail($product->getImage());
$product->save();
}

Get productID from specific order in Magento



$order = Mage::getModel('sales/order')->load($order_id);

$items = $order->getAllItems();

$itemcount=count($items);

$name=array();

$unitPrice=array();

$sku=array();

$ids=array();

$qty=array();

foreach ($items as $itemId => $item)

{

    $name[] = $item->getName();

    $unitPrice[]=$item->getPrice();

    $sku[]=$item->getSku();

    $ids[]=$item->getProductId();

    $qty[]=$item->getQtyToInvoice();

}


Magento addAttributeToFilter


Get all product collection with the below code:

$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect('*');


Add different types of filters  on collection. example shown below

//  Equal To (eq)
$collection->addAttributeToFilter('status', array('eq' => 1));

// Not Equal To (neq)
$collection->addAttributeToFilter('visibility', array('neq' => 1));

// Greater Than (gt)
$collection->addAttributeToFilter('price', array('gt' => 3.99));

// Less Than (lt)
$collection->addAttributeToFilter('price', array('lt' => 3.99));

// Greater Than or Equal To (gteq)
$collection->addAttributeToFilter('price', array('gteq' => 4.99));

// Less Than or Equal To (lteq)
$collection->addAttributeToFilter('price', array('lteq' => 4.99));

// Contains (like) - also uses % wildcards
$collection->addAttributeToFilter('sku', array('like' => 'DVD%'));

// Does Not Contain (nlike) - also uses % wildcards
$collection->addAttributeToFilter('sku', array('nlike' => 'ABC%'));

// In Array (in)
$collection->addAttributeToFilter('id', array('in' => array(1,3,12)));

// Not In Array (nin)
$collection->addAttributeToFilter('id', array('nin' => array(1,2,12)));

// Is NULL (null)
$collection->addAttributeToFilter('description', 'null');

// Is Not NULL (notnull)
$collection->addAttributeToFilter('description', 'notnull');

display product in magento with sql in list.phtml file

Place this following code in your  phtml file where you want to display particular category products this will return array of products and you can use this array to display product of particular category.
$sql = “SELECT product_id  FROM catalog_category_product WHERE category_id=57″;
$data = Mage::getSingleton(‘core/resource’) ->getConnection(‘core_read’)->fetchAll($sql);

Display All Product Attribute in Mageto Shopping Cart

Open the location given below
note: path can differ according to templete

app\design\frontend\base\default\template\checkout\cart\item\default.phtml

use the Code below in default.phtml.

<?php
$product = Mage::getModel(‘catalog/product’)->load($this->getProduct()->getId());
$attributes = $product->getAttributes();

foreach ($attributes as $attribute) {
if ($attribute->getIsVisibleOnFront() && $attribute->getIsUserDefined()) {
$value = $attribute->getFrontend()->getValue($product);
if (strlen($value) && $product->hasData($attribute->getAttributeCode())) {
$data[$attribute->getAttributeCode()] = array(
‘label’ => $attribute->getFrontend()->getLabel(),
‘value’ => $value //$product->getData($attribute->getAttributeCode())
);
?>
<span style=”font-weight:bold;”><?php echo $data[$attribute->getAttributeCode()]['label']; ?></span>: <span><?php echo $data[$attribute->getAttributeCode()]['value']; ?></span>
<?php
}
}
}
?>

Magento Image Switcher On MouseOver

Step1. open file on location given below
app/design/frontend/default/default/template/catalog/product/view/media.phtml

 

Step2. Search the code in media.phtml file
<a onclick="popWin('&lt;?php echo $this-&gt;getGalleryUrl($_image) ?&gt;', 'gallery', 'width=300,height=300,left=50,top=50,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" href="#"> <!--nested img tag stays the same--></a>

 

Step 3. Replace searched code with code below.
<a title="&lt;?php echo $_product-&gt;getName();?&gt;" onmouseover="$('image').src = this.href; return false;" href="&lt;?php echo $this-&gt;helper('catalog/image')-&gt;init($this-&gt;getProduct(), 'image', $_image-&gt;getFile()); ?&gt;"> <img src="&lt;?php echo $this-&gt;helper('catalog/image')-&gt;init($this-&gt;getProduct(), 'thumbnail', $_image-&gt;getFile())-&gt;resize(56); ?&gt;" alt="&lt;?php echo $this-&gt;htmlEscape($_image-&gt;getLabel()) ?&gt;" width="56" height="56" /></a>

Import/Export Magento Category Extension

Import/Export Magento Category Extension

Magento GooglePlusOne Extension

Magento GooglePlusOne Extension

Magento ajax add to cart extension

Magento ajax add to cart extension

Tuesday, 6 November 2012

Magento create order programatically

Magento create order programatically

Magento export order csv script

Magento export order csv script

php script to change order status

php script to change order status

Magento script to clear cache

clearcache magento script

Sending email from local system in magneto OR Sending email from magento in local system

1) make sure you did setting in php.ini

i'e

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = mail.yourdomine.com
; http://php.net/smtp-port
smtp_port = 25

and in magento go to admin

System->Configuration->System->Mail Sending Setting->host

replace host from localhost to mail.yourdomine.com

Magento redirect url

Mage::app()->getResponse()->setRedirect(Mage::getUrl("checkout/cart/"));

Magento - How to get all Product details in magento Programmatically?

<?php
require_once 'app/Mage.php';
umask(0);
Mage::app('default');

function empty_pk($data){
if($data!=''){return $data;}
else {return "&nbsp;";}
}
$collection = Mage::getModel('catalog/product')->getCollection();

echo '<table border="1"> ';
echo '<tr>';
echo "<th>sku<th />";
echo "<th>name<th />";
echo "<th>qty<th />";
echo "<th>is_in_stock<th />";
echo "<th>price<th />";
echo '</tr>';

foreach ($collection as $product_all) {
//echo '<pre>';print_r($product);echo '</pre>';

$sku = $product_all['sku'];
// retrieve product id using sku
$product_id = Mage::getModel('catalog/product')->getIdBySku($sku);
// call product model and create product object
$product    = Mage::getModel('catalog/product');
// Load product using product id
$product ->load($product_id);

$pk_sku = empty_pk($product['sku']);
$pk_name = empty_pk($product['name']);

$stockData = $product->getStockData();

$pk_qty = empty_pk($stockData['qty']);
$pk_in_stock = empty_pk($stockData['is_in_stock']);
$pk_price = empty_pk($product['price']);

echo '<tr>';
echo "<td>".$pk_sku."<td />";
echo "<td>".$pk_name."<td />";
echo "<td>".$pk_qty."<td />";
echo "<td>".$pk_in_stock."<td />";
echo "<td>".$pk_price."<td />";

echo '</tr>';

}
echo '</table>';
?>

Magento - How to get all Magento Database hosting details?

<?php
require_once 'app/Mage.php';
umask(0);
Mage::app('default');
$resource = Mage::getConfig()->getNode('global/resources')->asArray();

echo '<pre>';

print_r($resource);
echo '</pre>';
$db_host = $resource['default_setup']['connection']['host'];
$db_user = $resource['default_setup']['connection']['username'];
$db_pass = $resource['default_setup']['connection']['password'];
$db_name = $resource['default_setup']['connection']['dbname'];

echo '<br />host : '.$db_host;
echo '<br />username : '.$db_user;
echo '<br />password : '.$db_pass;
echo '<br />dbname : '.$db_name;
?>

Magento - How to get all order details into table format?

<?php
require_once('app/Mage.php');
Mage::app('admin');
Mage::getSingleton("core/session", array("name" => "adminhtml"));
Mage::register('isSecureArea',true);
$collection = Mage::getResourceModel('sales/order_collection')
->addAttributeToSelect('*');
//->addFieldToFilter('hpc_order_id', array('neq' => '',))
//->addFieldToFilter('hpc_order_from', array('eq' => 'ebay',)));

//->addFieldToFilter('status', 'complete')->load(); //pending,complete

//$collection->addAttributeToSort('created_at', 'desc');

$min_diff = '60';
$from_date = date("Y-m-d H:i:s", strtotime("-".$min_diff." minute"));
$to_date = date("Y-m-d H:i:s");
$collection->addAttributeToFilter('updated_at', array(
'from' => $from_date,
'to' => $to_date
));

/*
echo '<pre>';
print_r($collection);
echo '</pre>';
*/
echo "<br />supplement order start";
echo '<table border="1" style="1px solid #cccccc">';
echo '<tr>';
echo '<th>Order Id</th>';
echo '<th>Order Created at</th>';
echo '<th>Order Updated at</th>';
echo '<th>Order State</th>';
echo '<th>Order Status</th>';
echo '<th>HPC Order ID</th>';
echo '<th>HPC Order from</th>';
echo '</tr>';

foreach ($collection as $col) {
echo '<tr>';
echo "<td>".$col->getIncrementId()."</td>";
echo "<td>".$col->getCreatedAt()."</td>";
echo "<td>".$col->getUpdatedAt()."</td>";
echo "<td>".$col->getState()."</td>";
echo "<td>".$col->getStatus()."</td>";
echo "<td>".$col->getHpcOrderId()."</td>";
echo "<td>".$col->getHpcOrderFrom()."</td>";
echo '</tr>';
}
echo '</table>';

echo "<br />supplement order ends";

Magento - Steps to moving magento from one server to other

Step 1:

clear the /var/cache and /var/session directory which is allow more space to you
then add your magento folder into zip/rar file and extract them on the target server.

Step 2:

once you finished with the copying then you should set the correct permissions for
magento files and folders
as
/var and contents should have permissions “777″
/media and contents should have permissions “777″
/app/etc and contents should have permissions “777″

Step 3:

Now important part is that set the new database connection settings in the
file /app/etc/local.xml
as


<resources>
<db>
<table_prefix><![CDATA[db_prefix]]></table_prefix>
</db>
<default_setup>
<connection>
<host><![CDATA[db_host]]></host>
<username><![CDATA[db_user]]></username>
<password><![CDATA[db_password]]></password>
<dbname><![CDATA[db_name]]></dbname>
<initstatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdotype><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_setup>
</resources>

You need to replace db_prefix db_host db_user db_password etc.. with your values.

Step 4:

Now goto your Database admin panel like phpmyadmin and run the query below


UPDATE core_config_data SET VALUE="http://newhostsite.com/"
WHERE path="web/unsecure/base_url";
UPDATE core_config_data SET VALUE="http://newhostsite.com/"
WHERE path="web/unsecure/base_url";

Where “newhostsite.com” is a new server domain name.

Magento - Store Information

Get store data

Mage::app()->getStore();

Store Id

Mage::app()->getStore()->getStoreId();

Store code

Mage::app()->getStore()->getCode();

Website Id

Mage::app()->getStore()->getWebsiteId();

Store Name

Mage::app()->getStore()->getName();

Is Active

Mage::app()->getStore()->getIsActive();

Store Home Url

Mage::app()->getStore()->getHomeUrl();

Magento - Import Manufacturers

1> Create a file in the root of magento dir: manufacturer_import.php

2> Write the following code there:

 

<?php
require_once 'app/Mage.php';
umask(0);
Mage::app('default');
$_manufacturers = file('manufacturers.txt');
$_attribute =  Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'manufacturer');
$manufacturers = array('value' => array(), 'order' => array(), 'delete' => array());
$i = 0;
foreach($_manufacturers as $_manufacturer){
$i++;
$manufacturers['value']['option_' . $i] = array($_manufacturer);
}
$_attribute->setOption($manufacturers);
try{
$_attribute->save();
echo 'Manufacturer successfully imported';
}catch(Exception $e){
echo 'Import Error::'.$e->getMessage();
}
?>

 
3> Note i have used manufacturers.txt in the root dir with the values of manufacturers in newline format. For example:



Dell
Toshiba
Sony
Fujitsu



Magento Set, Retrieve and Unset Session Variables

To set a Magento session variable:

$myValue = 'Hello World';
Mage::getSingleton('core/session')->setMyValue($myValue);

To Retrieve:

$myValue = '';
$myValue=Mage::getSingleton('core/session')->getMyValue();

To Unset:

Mage::getSingleton('core/session')->unsMyValue();

Note that ‘MyValue’ can be any text you want but ‘set’, ‘get’ and ‘uns’ prefixes are required.

How to add product programmatically in magento 1.7.0 with image and custom field

Magento add product script

Magento script to make is anchor yes to all categories.

isanchoryesIs anchor yes to all categories in magento

Monday, 5 November 2012

Magento important tables

sales_flat_quote -> magento cart master table.
sales_flat_order -> magento order master table.
eav_attribute -> magento attribute master table.
catalog_product_entity -> product master table.
catalog_product_entity_varchar -> product master table values.
catalog_category_entity -> category master table.
catalog_category_entity_varchar -> category master table values.
core_resource -> plugin table.
newsletter_subscriber -> newsletter subscriber master table.
review -> review master table.
review_detail -> review detail table.
customer_entity -> customer main table
wishlist -> wishlist main table.
admin_user -> admin user master table.
cms_block -> cms block master table.
cms_page -> cms page master table.

Saturday, 3 November 2012

Magento: How to delete test orders in magento


  1. Login to Admin Panel and go to Sales-->Orders.

  2. Note down your test order ids, for example: 100000001,100000002,100000003,100000111,100000112,100000199

  3. Now create a php file in magento root directory and name it: deleteOrders.php

  4. Now copy below code and paste it in your file:
    <?php

    require 'app/Mage.php';
    Mage::app('admin')->setUseSessionInUrl(false);                                                                                                                 //replace your own orders numbers here:
    $test_order_ids=array(
    '100000001',
    '100000002',
    '100000003',
    '100000109',
    '100000112',
    '100000134'
    );
    foreach($test_order_ids as $id){
    try{
    Mage::getModel('sales/order')->loadByIncrementId($id)->delete();
    echo "order #".$id." is removed".PHP_EOL;
    }catch(Exception $e){
    echo "order #".$id." could not be remvoved: ".$e->getMessage().PHP_EOL;
    }
    }
    echo "complete."

     ?>



  5. Now go to your browsers address bar and run file from here like:
    [Your_Magento_Base_URL] /deleteOrders.php

  6. At the end, delete deleteOrders.php.

    That's All.. Cheers :)

How to change the Magento Admin Panel Title?

If you want to change default title of Magento Admin, there is an easy solution:
Just open the main.xml file, which is located in app/design/adminhtml/default/default/layout folder.

Find line like below:

<action method="setTitle" translate="title"><title>Magento Admin</title></action>

 and replace the words Magento Admin with the words you like to be in default title.

Hide Attributes which have no value in Magento

Open attribute.phtml, which is located in app/design/frontend/[your package]/[your theme]/template/catalog/product/view folder, and find code like this:

 

<?php foreach ($_additional as $_data): ?>
<tr>
<th><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
</tr>
<?php endforeach; ?>


Now replace this by:



<?php foreach ($_additional as $_data): ?>
<?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != ")) { ?>
<tr>
<th><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
</tr>
<?php } ?>
<?php endforeach; ?>

Magento: How to view Magento version

Create file versionTest.php parallel to index.php in root folder.
Now copy and paste following code in versionTest.php:
<?php
include_once(‘App/Mage.php’);
Mage::app();
echo Mage::getVersion();
?>

Magento - Reset the admin password

UPDATE admin_user SET password=CONCAT(MD5('admin123')) WHERE username='admin';

Script for to remove the cache - Magento

 <?php require_once ("app/Mage.php"); umask(0); Mage::run(); Mage::app()->getCache()->clean(); exit("done"); ?> 



can call that file with :http://yourdomainname/cache-clear.php


Magento Add Free Shipping promotions to the sidebar my cart block

app/design/frontend/base/default/template/checkout/cart/sidebar.phtml

 

 

replace the following code :

 

 
        <!--The section we want is around line 48-->
<p>
<?php if ($this->canApplyMsrp()): ?>
<span><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
<?php else: ?>
<span><?php echo $this->__('Cart Subtotal:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>
<?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
<br />(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)
<?php endif; ?>
<?php endif; ?>
</p>
</div>
<?php endif ?>
<!--Here is our conditional statement, if more that $60 in cart, then $free_delivery is less than zero, and first message gets displayed -->
<?php $free_delivery=60-$this->getSubtotal();?>
<?php if ($free_delivery<0): ?>
<br /><p><b>Free UPS Ground delivery with this order!</b></p>
<!--Here is the second part, if less that $60 in cart, then $free_delivery message displays a teaser to add more stuff to cart-->
<?php else: ?>
<br /><p>Free UPS Ground delivery when spending $60 or more!
<!--Here is where the amount they need to spend is displayed-->
<br><b>Spend another <?php echo Mage::helper('checkout')->formatPrice($free_delivery) ?> to get free delivery with this order!</b></p>
<?php endif ?>
<?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>

Thursday, 1 November 2012

Customizing Onepage Checkout - Remove login

removelogin_oncheckout

Billing same as Shipping Address / Remove Billing Options

removeshippingsteps

 

bilingshipping

Show subcategory in a category page

If you're comfortable editing your theme, this code snippet will bring you a list of all sub-categories of the current category (from the session, so this should work anywhere in your theme). I typically use this in app/design/frontend/default/*theme_name*/template/catalog/category/view.phtml

<?php
$_category  = $this->getCurrentCategory();
$collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id);
$helper     = Mage::helper('catalog/category');
?>

<ul>
<?foreach ($collection as $cat):?>
<?php if($_category->getIsActive()):?>
<?php
$cur_category = Mage::getModel('catalog/category')->load($cat->getId());
$_img = $cur_category->getImageUrl();
?>
<li>
<a href="<?php echo $helper->getCategoryUrl($cat);?>">
<img src="<?php echo $_img?>" title="$cat->getName()"/>
<cite><?php echo $cat->getName();?></cite>
</a>
</li>
<?php endif?>
<?php endforeach;?>
</ul>

Delete all product from cart

I have add a function in the app\code\core\Mage\Checkout\controllers\CartController.php
public function deleteallAction()
{
$cartHelper = Mage::helper('checkout/cart');
$items = $cartHelper->getCart()->getItems();
foreach ($items as $item)
{
$itemId = $item->getItemId();
$cartHelper->getCart()->removeItem($itemId)->save();
}
$this->_redirectReferer(Mage::getUrl('*/*'));
}


 
if you call this it will delete all item in the cart.


the url should be http://www.yoursite.com/index.php/checkout/cart/deleteall/

Wednesday, 31 October 2012

Redirecting www to non-www Using .htaccess

The Apache Web server supports URL rewriting with the mod_rewrite engine. Placing custom rules in an .htaccess file lets you do all sorts of useful things to keep your URLs tidy. One really handy thing you can do for search engines and visitors is redirecting traffic from www to non-www version of your domain (and vice versa).


Some people prefer to use www.somesite.com, but some people prefer the shorter somesite.com. There isn't really a right or wrong way to do it, but whatever you choose you can make sure all of your visitors get sent to the same place. With a few simple rules on the server you can choose from non-www to www, or redirecting from www to non-www.

If you already have a file named .htaccess on your Website you can add to it. If not, create one (yes, include the period at the beginning). Add either of the following rules and save. Replace yourdomain.com with your actual domain name.

Redirect www to non-www:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]


Redirect non-www to www:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]


Both of these rules send a full search engine friendly 301 HTTP redirect. They also preserve the entire URL (so yoursite.com/about redirects to www.yoursite.com/about).

Search engines can usually figure out which format is preferred, but since you're showing the same page for www and non-www URLs it can't hurt to be consistent about it.

Create your .htaccess rewrite code:
Use our www Redirect Generator tool to automatically generate the required redirect code.

Magento product details store tablename

Product name store in : catalog_product_entity_varchar
product id store in : catalog_product_entity_int
product price store in : catalog_product_entity_decimal

How to Call Newsletter in footer in Magento

To show Newsletter in footer go to app/design/frontend/default/YourTheme/layout/newsletter.xml and add the following lines in default
<reference name="footer">
<block type="newsletter/subscribe" name="footer.newsletter"

template="newsletter/subscribe.phtml"/>
</reference>

and add the following line in app/design/frontend/default/YourTheme/template/page/html/footer.phtml
<?php echo $this->getChildHtml('footer.newsletter'); ?>

Remove Category option from Layered Navigation options list in magnto

This is what I did to remove the “Category” section from my layered navigation so I wouldnt have any repeat information with the attributes I wanted in the layered navigation.
go to app/design/frontend/default/default/template/catalog/layer and open up view.phtml for edit.
 


<dl id="narrow-by-list"><?php $_filters = $this->getFilters() ?>
<?php foreach ($_filters as $_filter): ?>
<?php if($_filter->getItemsCount()): ?>
<?php if($_filter->getName() != "Category"){ ?><dt><?php echo $this->__($_filter->getName()) ?></dt>
<dd><?php echo $_filter->getHtml() ?></dd><?php } endif; ?>
<?php endforeach; ?></dl>

Removing dropdowns from Product List Pager in magnto

1. Open up template/catalog/product/list/toolbar.phtml, and look for the “Sort By” div. Completely replace the select and dropdown options with:
<?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
<a href=”<?php echo $this->getOrderUrl($_key, ‘asc’) ?>” ><?php echo $this->__($_order) ?></a>
<?php endforeach; ?>

2. In the same file, look for the “Limiter” div and replace with:
<div class=”limiter”>
<label><?php echo $this->__(‘Show’) ?></label>
<?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
<a href=”<?php echo $this->getLimitUrl($_key) ?>”><?php echo $_limit ?></a>
<?php endforeach; ?>
<?php echo $this->__(‘per page’) ?>
</div>

Magento: Get store information

Get store data
Mage::app()->getStore();

Store Id
Mage::app()->getStore()->getStoreId();

Store code
Mage::app()->getStore()->getCode();

Website Id
Mage::app()->getStore()->getWebsiteId();

Store Name
Mage::app()->getStore()->getName();

Is Active
Mage::app()->getStore()->getIsActive();

Store Home Url
Mage::app()->getStore()->getHomeUrl();

Delete all Products and ResetProduct id’s in Magento

TRUNCATE TABLE `catalog_product_bundle_option`; 

TRUNCATE TABLE `catalog_product_bundle_option_value`; 

TRUNCATE TABLE `catalog_product_bundle_selection`; 

TRUNCATE TABLE `catalog_product_entity_datetime`;

TRUNCATE TABLE `catalog_product_entity_decimal`;

TRUNCATE TABLE `catalog_product_entity_gallery`; 

TRUNCATE TABLE `catalog_product_entity_int`;

TRUNCATE TABLE `catalog_product_entity_media_gallery`;

TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;

TRUNCATE TABLE `catalog_product_entity_text`;

TRUNCATE TABLE `catalog_product_entity_tier_price`; 

TRUNCATE TABLE `catalog_product_entity_varchar`;

TRUNCATE TABLE `catalog_product_link`; 

TRUNCATE TABLE `catalog_product_link_attribute`;

TRUNCATE TABLE `catalog_product_link_attribute_decimal`; 

TRUNCATE TABLE `catalog_product_link_attribute_int`; 

TRUNCATE TABLE `catalog_product_link_attribute_varchar`; 

TRUNCATE TABLE `catalog_product_link_type`; 

TRUNCATE TABLE `catalog_product_option`; 

TRUNCATE TABLE `catalog_product_option_price`; 

TRUNCATE TABLE `catalog_product_option_title`; 

TRUNCATE TABLE `catalog_product_option_type_price`;

TRUNCATE TABLE `catalog_product_option_type_title`; 

TRUNCATE TABLE `catalog_product_option_type_value`;

TRUNCATE TABLE `catalog_product_super_attribute`;

TRUNCATE TABLE `catalog_product_super_attribute_label`;

TRUNCATE TABLE `catalog_product_super_attribute_pricing`;

TRUNCATE TABLE `catalog_product_super_link`; 

TRUNCATE TABLE `catalog_product_enabled_index`; 

TRUNCATE TABLE `catalog_product_website`;

TRUNCATE TABLE `catalog_product_entity`;
 TRUNCATE TABLE `cataloginventory_stock`;

TRUNCATE TABLE `cataloginventory_stock_item`;

TRUNCATE TABLE `cataloginventory_stock_status`;

Truncate all categories and and Reset Categoryt id’s in Magento

TRUNCATE TABLE `catalog_category_entity`;TRUNCATE TABLE `catalog_category_entity_datetime`;
TRUNCATE TABLE `catalog_category_entity_decimal`;TRUNCATE TABLE `catalog_category_entity_int`; 
TRUNCATE TABLE `catalog_category_entity_text`;TRUNCATE TABLE `catalog_category_entity_varchar`; 
TRUNCATE TABLE `catalog_category_product`;TRUNCATE TABLE `catalog_category_product_index`;

Magento: How to solve indexing problem?

open your phpmyadmin.and run below given Query in sql tab.



DROP TABLE IF EXISTS `index_process_event`;
DROP TABLE IF EXISTS `index_event`;
DROP TABLE IF EXISTS `index_process`;


CREATE TABLE `index_event` (
`event_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`type` VARCHAR(64) NOT NULL,
`entity` VARCHAR(64) NOT NULL,
`entity_pk` BIGINT(20) DEFAULT NULL,
`created_at` DATETIME NOT NULL,
`old_data` MEDIUMTEXT,
`new_data` MEDIUMTEXT,
PRIMARY KEY (`event_id`),
UNIQUE KEY `IDX_UNIQUE_EVENT` (`type`,`entity`,`entity_pk`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;

CREATE TABLE `index_process` (
`process_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`indexer_code` VARCHAR(32) NOT NULL,
`status` ENUM('pending','working','require_reindex') NOT NULL DEFAULT 'pending',
`started_at` DATETIME DEFAULT NULL,
`ended_at` DATETIME DEFAULT NULL,
`mode` ENUM('real_time','manual') NOT NULL DEFAULT 'real_time',
PRIMARY KEY (`process_id`),
UNIQUE KEY `IDX_CODE` (`indexer_code`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;

INSERT INTO `index_process`(`process_id`,`indexer_code`,`status`,`started_at`,`ended_at`,`mode`) VALUES (1,'catalog_product_attribute','pending','2010-02-13 00:00:00','2010-02-13 00:00:00','real_time'),(2,'catalog_product_price','pending','2010-02-13 00:00:00','2010-02-13 00:00:00','real_time'),(3,'catalog_url','pending','2010-02-13 19:12:15','2010-02-13 19:12:15','real_time'),(4,'catalog_product_flat','pending','2010-02-13 00:00:00','2010-02-13 00:00:00','real_time'),(5,'catalog_category_flat','pending','2010-02-13 00:00:00','2010-02-13 00:00:00','real_time'),(6,'catalog_category_product','pending','2010-02-13 00:00:00','2010-02-13 00:00:00','real_time'),(7,'catalogsearch_fulltext','pending','2010-02-13 00:00:00','2010-02-13 00:00:00','real_time'),(8,'cataloginventory_stock','pending','2010-02-13 00:00:00','2010-02-13 00:00:00','real_time');

CREATE TABLE `index_process_event` (
`process_id` INT(10) UNSIGNED NOT NULL,
`event_id` BIGINT(20) UNSIGNED NOT NULL,
`status` ENUM('new','working','done','error') NOT NULL DEFAULT 'new',
PRIMARY KEY (`process_id`,`event_id`),
KEY `FK_INDEX_EVNT_PROCESS` (`event_id`),
CONSTRAINT `FK_INDEX_EVNT_PROCESS` FOREIGN KEY (`event_id`) REFERENCES `index_event` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_INDEX_PROCESS_EVENT` FOREIGN KEY (`process_id`) REFERENCES `index_process` (`process_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=INNODB DEFAULT CHARSET=utf8;

Magento Database Connection

$sql = Mage::getSingleton('core/resource')->getConnection('core_write');
$result = $sql->query("SELECT class_name from tax_class");

while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
echo $row['class_name']."<br />";
}

my authorize.net details

Authorize.net Zip

 

Tuesday, 23 October 2012

Redirect site from non-www to www

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Thursday, 11 October 2012

How to integrate datepicker in magento backend side

magento_admin_date_picker

 

Date function in PHP

echo(“Result with date():”);
echo(date(“l”) . “”);
echo(date(“l dS \of F Y h:i:s A”) . “”);
echo(“Oct 3,1975 was on a “.date(“l”, mktime(0,0,0,10,3,1975)).””);
echo(date(DATE_RFC822) . “”);
echo(date(DATE_ATOM,mktime(0,0,0,10,3,1975)) . “”);


echo(“Result with gmdate():”);
echo(gmdate(“l”) . “”);
echo(gmdate(“l dS \of F Y h:i:s A”) . “”);
echo(“Oct 3,1975 was on a “.gmdate(“l”, mktime(0,0,0,10,3,1975)).””);
echo(gmdate(DATE_RFC822) . “”);
echo(gmdate(DATE_ATOM,mktime(0,0,0,10,3,1975)) . “”);


 


 


Output:


Result with date():
Tuesday
Tuesday 24th of January 2006 02:41:22 PM
Oct 3,1975 was on a Friday
Tue, 24 Jan 2006 14:41:22 CET
1975-10-03T00:00:00+0100


Result with gmdate():
Tuesday
Tuesday 24th of January 2006 01:41:22 PM
Oct 3,1975 was on a Thursday
Tue, 24 Jan 2006 13:41:22 GMT
1975-10-02T23:00:00+0000

Wednesday, 10 October 2012

Add twitter button on product detail page in magento

<a href="http://twitter.com/share" data-count="vertical">Tweet</a>

<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

 

<a href="http://twitter.com/share" data-count="horizontal">Tweet</a>

<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

 

<a href="http://twitter.com/share" data-count="none">Tweet</a>

<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

 

Add facebook like button on product detail page in magento

<p><?php $currentUrl = $this->helper('core/url')->getCurrentUrl(); ?><br />
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="<?php echo $currentUrl ?>" show_faces="false" width="450" font=""></fb:like>

 

<?php $currentUrl = $this->helper('core/url')->getCurrentUrl(); ?>
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo $currentUrl ?>&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;font&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

 

<?php $currentUrl = $this->helper('core/url')->getCurrentUrl();  ?>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="<?php echo $currentUrl ?>" layout="button_count" show_faces="true" width="450" font=""></fb:like></p>

 

<p><?php $currentUrl = $this->helper('core/url')->getCurrentUrl(); ?><br />
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo $currentUrl ?>&amp;layout=button_count&amp;show_faces=true&amp;width=450&amp;action=like&amp;font&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe></p>

Magento Hint Websites

http://www.wpbeginner.com/wp-themes/wordpress-theme-cheat-sheet-for-beginners/
http://ivvy.ru/en/bloggy
http://sushilshirbhate.wordpress.com/2011/07/07/magento-theme-development-cheat-sheet/
http://magento4u.wordpress.com/2011/03/28/add-extra-fields-in-registration-page/
http://www.magento.cc/custom-accountregistration-fields.html
http://www.magento.cc/category/magento/cms
http://www.magento.cc/category/magento/module
http://www.pauldonnellydesigns.com/blog/magento-display-address-fields-in-create-an-account/
http://www.excellencemagentoblog.com/magento-blogs/
http://www.itoris.com/magento-ajax-login-registration.html
http://www.magentoworks.net/magento-extension
http://www.cutehits.com/2011/07/overriding-core-controller-in-magento/
http://nickwan.wordpress.com/
http://blog.ecommercesoftwaresolutionsonline.com/archives/category/magento-developer-notes
http://oaktondata.com
http://wordcastnet.com/2009/speed-up-wordpress-with-google-gears-and-the-turbo-feature/
http://kb.magenting.com/category/5/general-configuration.html
http://www.webspeaks.in/2011/03/override-controllers-in-magento.html
http://learntipsandtricks.com/blog/magento/149/How-to-enable-Address-Information-on-Magento-Customer-Registration-Page
http://www.phptechi.com/category/php/magento
http://www.westwideweb.com/wp/page/4/
http://ultimento.com/wiki/blog/
http://xhtmlandcsshelp.blogspot.in/
http://xhtmlandcsshelp.blogspot.in/search?updated-max=2010-11-30T19:48:00%2B05:30&max-results=10&start=50&

by-date=false
http://alanstorm.com/category/magento
http://dbhoopendra.blogspot.in/search/label/Magento
http://www.learnmagento.org/magento-tutorials/how-to-install-sample-data-in-a-magento-site/#
http://www.devraju.com/category/magento/
http://www.johannreinke.com/en/category/php/magento/
http://www.webspeaks.in/
http://magentoshare.blogspot.in/
http://www.fmeextensions.com/
http://blog.magentoconnect.us/page/3/
http://blog.ecommercesoftwaresolutionsonline.com/archives/1036/magento-how-to-place-facebook-like-and-twitter-buttons-

in-the-products-view-page.html

Tuesday, 18 September 2012

Display n-categories like magento front end.

n-category-dropdown-like magento

Php script to read doc file

doc

store image in database

blob

video playlist

videoplaylist

video and audio together playlist

video-audio-playlist

page not found concept

page-not-found

multiple mp4 player play alternate

multiple-mp4-player-alternate-play

multiple mp3 player play alternate

multiple-mp3-player-alternate-play

mp3 playlist

mp3playlist

jquery form submit

jqueryform

javascript image preloader

imagepreloader

Disable control key

disable-control-key

Audio playlist

audioplaylist

How to create custom module in admin in magento?

howtocreateamagentoadminhtmlcontrollerinmagentoextension-110815035450-phpapp02

Magento Guide for beginners

designers_guide_to_magento

How to play mp3 in browser (jplayer)

mp3player

Wordpress after setup

wordpress_development11

Core php insert delete update show with session

webApp

javascript add n-number of textbox

urb

PHP Email sending with custom template variables

template_email

jQuery tagging (auto complete search separeted by comma)

tag_jquery

jQuery to display dropdown with custom css

style_select

Email sending through smtp

smtp

PHP Core script to register and login and store user details into session

Session

PHP Send email with attached files

send_email_with_attached_file

jQuery get screen width and apply css through jquery

resize_both_size

PHP Image resize both side

resize_both_size

PHP Login remember script

remember_me

PHP Read curl and display api data

read_curl

PHP File handling concept override txt files (read and write files)

read_and_write_directory_example

Javascript on keypress numeric,alphabetic and alphanumeric validation

javascript numeric and alphanumeric validaton

javascript disable select

not_select_html

jquery upload multiple files

n-files-upload-jquery

jQuery upload n-number of file

jquery upload multiple file

How to display google maps with distance line?

Google maps with distance line

How to implement ajax on backend side in magento?

magento backend ajax integration

jQuery create album and upload n-photos in album like urboon.com

jQuery upload n-number of files

Javascript multiple fields validation (alert messages)

javascript_validation_multiple_fields_alert

Magento inline custom validation

custom_inline_validation(1)

jquery cycle integration in wordpress

jQuery cycle in wordpress

PHP Script to display image in proper dimension

Display image at center of contene

PHP Script to get country code and country name from IP Address

GEO IP Download

PHP FCK Editor implementation

Fckeditor Implementation

PHP script login with facebook

Php script login with facebook

Create custom component in joomla1.5

Employee management system

PHP script sending email with cc and bcc

Sending email with cc and bcc

jquery onchange display dynamic values

Onchange display dynamic content

PHP script to read doc file

PHP script to read doc file

jQuery distance calculation from current position

Calculate distance from current position

Disable right click on image

Disable right click on image

jQuery datatable example

Datatables

Php script to create custom module like listing,searching.sorting

Custom core module

Magento hello world module

create new module in magento

jquery onclick copy to clipboard

Copy to clipboard script

Php script to copy directory

copy directory

jquery color picker

jquery color picker

Javascript checkall with select atleast one validation

Javascript checkall function

Php recursive function to calculate n-level of category

Recursion

Custom math captcha

Custom math captcha

Php Script to calculate days after 10 days or 1 months

Date calculate

Apply css according to browser

Apply browserwise css

Magento banner slider

Banner Manager


Banner Slider

Magento simple banner manager

Banner Manager

Magento attribute logo extension

Magento Attribute logo manager

jQuery date range picker

Date range picker

Slider menu with ajax content

Slider with ajax content

PHP script to create subdomains

Php Script to create subdomain

Javascript for google map with multiple points pointed

Google Map with multiple points

CMS html template for admin panel

Free Html Template for admin panel

jQuery image preview like monster.com

Click here to download  imagepreview

How to create and custom page template in wordpress?

1). create a file : D:\xampp\htdocs\wp-register\wp-content\themes\twentyeleven\test.php

2). Paste the following code :
<?php
/*
Template Name: test
*/
get_header();
?>
<?php echo "test page is called";?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

3). Open wp-admin and create new page : view template on right side : select "test" option.
4). Done.

Monday, 17 September 2012

Thursday, 13 September 2012

CSV to HTML using PHP

<?php

$file_handle = fopen("path/to/file/Book2.csv", "r");

while (!feof($file_handle) ) {

$line_of_text = fgetcsv($file_handle, 1024);

print "<p>" . $line_of_text[0] . "</p>";
print "<p>" . $line_of_text[1] . "</p>";
print "<p>" . $line_of_text[2] . "</p>";

}

fclose($file_handle);

?>

Thursday, 6 September 2012

Magento Ajax scrolling functionality on product and search listing page

1. Download the zip, version 1.1 (DUH!)
2. Extract it’s contents to the root of your Magento installation. You can use FTP to do that. It’s the directory containing index.php [App] [Skin] [Media] among others
3. Log in to your Magento backend
4. Go to System -> Cache Management, select all options, and in the action dropdown select “Refresh”. Then click Submit.
5. Log out/in to your backend
6. Go to System -> Configuration -> Catalog and drop down the “Front-end” selection
7. The extension adds a new option here; “Use jQuery Infinite Ajax Scroll” and this new version adds the option “Use jQuery UItoTop”.
8. Set both “Use jQuery Infinite Ajax Scroll” and “Use jQuery UItoTop” to “Yes”
9. Click save config.
10. All done!

 

 

Ajaxscroll

How to delete customers in magento?

TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;

TRUNCATE `customer_address_entity_decimal`;

TRUNCATE `customer_address_entity_int`;

TRUNCATE `customer_address_entity_text`;

TRUNCATE `customer_address_entity_varchar`;

TRUNCATE `customer_entity`;

TRUNCATE `customer_entity_datetime`;

TRUNCATE `customer_entity_decimal`;

TRUNCATE `customer_entity_int`;

TRUNCATE `customer_entity_text`;

TRUNCATE `customer_entity_varchar`;

TRUNCATE `log_customer`;

TRUNCATE `log_visitor`;

TRUNCATE `log_visitor_info`;


ALTER TABLE `customer_address_entity` AUTO_INCREMENT=1;

ALTER TABLE `customer_address_entity_datetime` AUTO_INCREMENT=1;

ALTER TABLE `customer_address_entity_decimal` AUTO_INCREMENT=1;

ALTER TABLE `customer_address_entity_int` AUTO_INCREMENT=1;

ALTER TABLE `customer_address_entity_text` AUTO_INCREMENT=1;

ALTER TABLE `customer_address_entity_varchar` AUTO_INCREMENT=1;

ALTER TABLE `customer_entity` AUTO_INCREMENT=1;

ALTER TABLE `customer_entity_datetime` AUTO_INCREMENT=1;

ALTER TABLE `customer_entity_decimal` AUTO_INCREMENT=1;

ALTER TABLE `customer_entity_int` AUTO_INCREMENT=1;

ALTER TABLE `customer_entity_text` AUTO_INCREMENT=1;

ALTER TABLE `customer_entity_varchar` AUTO_INCREMENT=1;

ALTER TABLE `log_customer` AUTO_INCREMENT=1;

ALTER TABLE `log_visitor` AUTO_INCREMENT=1;

ALTER TABLE `log_visitor_info` AUTO_INCREMENT=1;

List of tables to store product

catalog_product_entity
catalog_product_entity_datetime
catalog_product_entity_decimal
catalog_product_entity_gallery
catalog_product_entity_int
catalog_product_entity_media_gallery
catalog_product_entity_media_gallery_value
catalog_product_entity_text
catalog_product_entity_tier_price
catalog_product_entity_varchar
catalog_product_link
catalog_product_link_attribute
catalog_product_link_attribute_decimal
catalog_product_link_attribute_int
catalog_product_link_attribute_varchar
catalog_product_link_type
catalog_product_super_attribute
catalog_product_super_attribute_label
catalog_product_super_attribute_pricing
catalog_product_super_link
catalog_product_website

List of tables to store category

catalog_category_entity
catalog_category_entity_datetime
catalog_category_entity_decimal
catalog_category_entity_int
catalog_category_entity_text
catalog_category_entity_varchar
catalog_category_flat

How to display random tweets on our website?


Friday, 17 August 2012

Magento get store config


$strFbLink = Mage::getStoreConfig('banner/socialnetworking/banner_facebook_url');
$strTwLink = Mage::getStoreConfig('banner/socialnetworking/banner_twitter_url');
$strLiLink = Mage::getStoreConfig('banner/socialnetworking/banner_linkedin_url');

Monday, 13 August 2012

Magento display date format

                            $strReviewDate = $_review->getCreatedAt();
                            $arrReviewDate = explode(' ',$strReviewDate);
                            $intReviewDate = strtotime($arrReviewDate[0]);
                            $dtReviewDate = date('d F, Y',$intReviewDate);
                            echo " - ".$dtReviewDate;
                            ?>

Sunday, 12 August 2012

Thursday, 9 August 2012

magento custom add to cart link

getLayout()->createBlock('catalog/product_list')->getAddToCartUrl($_product) ?>

Wednesday, 8 August 2012

How to display final price on listing page in magento?

                            $_coreHelper = $this->helper('core'); 
                            $_taxHelper = $this->helper("tax"); 
                            $_finalPriceInclTax = $_taxHelper->getPrice($_product, $_product->getFinalPrice(), true); 
                            $_finalPriceFormated = $_coreHelper->currency($_finalPriceInclTax,true,false); 
                            echo $_finalPriceFormated;
                            //echo $this->getPriceHtml($_product, true) ?>

Tuesday, 7 August 2012

Magento solve enable cookies

http://ka.lpe.sh/2011/07/09/magento-cant-loginadd-items-in-chrome-and-ie/

Monday, 6 August 2012

Remove Price from Custom Options

catalog.xml


Comment following line
<reference name="content">
    <
remove name="product.clone_prices"/>
reference>

Thursday, 19 July 2012

To Be implement in magento?

http://www.rapidcommerce.eu/blog/2012/05/magento-product-list-ajax-scroll/
http://bluezeal.in/ccavenue4magento/ccavenue-payment-module-for-magento
http://keertikiran.blogspot.in/2012/05/display-date-in-specified-format-in.html
product question extension....
http://www.magentocommerce.com/magento-connect/cueblocks-zoom.html
Mturbo cache management
http://www.tonecruisers.com/OurMusic.html (to create playlist)
http://www.magentocommerce.com/magento-connect/cueblocks-zoom.html
http://www.magentocommerce.com/magento-connect/gala-color-swatches-free-9787.html
http://www.uniformadvantage.com/

magento base url without index.php (relative url)?

Wednesday, 18 July 2012

How to play youtube videos in magento website?


Create an attribute "video_embed_code"

Now go to attribute set :  Default
assign this attribute to general.

When you add product it shows on left side label Video Enbed Code : 12AvSETQ
Now save the product

While displaying product on product detail view page :


getData('video_embed_code')): ?>
            getResource()->getAttribute('video_embed_code')->getFrontend()->getValue($_product); ?>
           
           

Tuesday, 17 July 2012

How to get Subtotal of current cart in magento?

$objCheckout = $this->getLayout()->createBlock('checkout/cart_sidebar');
        $intTotal = $objCheckout->getSubtotal();

Sunday, 15 July 2012

How to implement ajax in magento? (frontend side)

ajax.phtml
------------






app/code/local/companyname/helloworld/controllers/indexController.php
---------------
class Companyname_HelloWorld_IndexController extends Mage_Core_Controller_Front_Action
  {  
    public function AjaxAction()  
      {  
       $this->loadLayout();  
       $this->renderLayout();  
      }
  }

app/design/frontend/default/themename/layout/helloworld.xml
-----------------------
  
         
          
      
  
         
          
      
  
  

  
app/design/frontend/default/themename/template/page/ajax.phtml
--------------------------------
getChildHtml('content'); ?>

app/design/frontend/default/themename/template/helloworld/ajaxresponse.phtml
--------------------------------
echo "response of ajax is executed";
?>

How to implement module creater in magento?

Download module creater from following link
--------------------------------------------------------------------------------
www.magentocommerce.com/magento-connect/modulecreator.html


install into local server  and execute by folllowing url
--------------------------------------------------------------------------------

http://127.0.0.1/modulecreater/

Namespace : Your company name
Module : module name
Root Directory :    ..\magento_blank (magento project name)
Design : default

Friday, 13 July 2012

How to get attribute details from attribute in magento?

$intAttributeId = '672';
$intAttributeLabel = 'color';
$objAttributeInfo = Mage::getModel('eav/entity_attribute')->load($intAttributeId);           
$strFrontendLabel = $objAttributeInfo->getFrontendLabel();

Thursday, 12 July 2012

How to display mysql query in magento?

$objCategoryProducts = Mage::getModel('catalog/category')->load($intCategoryId)->getProductCollection()->addAttributeToFilter(array(array('attribute' => 'product_status','eq' => '126'),array('attribute' => 'product_stock_status','eq' => '486')))->setPageSize(1);

//echo $objCategoryProducts->printLogQuery(true);die;

Monday, 9 July 2012

in_array example

$arrDefaultArray = Array ( [0] => 64 [1] => 66 [2] => 62 [3] => 61 [4] => 60 )
$intProductCategoryId = 66;
if(in_array($intProductCategoryId,$arrDefaultArray))
{}

How to get prarent category id from current category in magento?

$objParentCat = 20;
$objCurrCat = Mage::getModel('catalog/category')->load($objParentCat->getParentId());

How to fetch all categories of product in magento (on product details page)?

$product_model = Mage::getModel('catalog/product');
    $_product = $product_model->load($intCurrentProductId);
    $arrAllCurrentProductCategories = $product_model->getCategoryIds($_product);

How to getch all root categories and its subcategories in magento?

$intRootCategoryId = Mage::app()->getStore()->getRootCategoryId();
$objParentCategories = Mage::getModel('catalog/category')->getCollection()->addAttributeToFilter('parent_id',$intRootCategoryId)->addAttributeToFilter('is_active',1)->setOrder('position','ASC');
foreach($objParentCategories as $objSpecParentCategory)
{                                                          
    $objFinalCategory = Mage::getModel('catalog/category')->load($objSpecParentCategory->getId());
    $objSubCategories = Mage::getModel('catalog/category')->getCollection()->addAttributeToFilter('parent_id',$objSpecParentCategory->getId())->addAttributeToFilter('is_active',1)->setOrder('position','ASC');
   
    if ($objSubCategories->count())
    {
        foreach($objSubCategories as $objSpecSubCategory)
        {
            $objFinalSubCategory = Mage::getModel('catalog/category')->load($objSpecSubCategory->getId());
            $objFinalSubCategory->getUrl();
            $objFinalSubCategory->getName();
        }   
    }
}

Sunday, 8 July 2012

Some Useful links

torrent like for download    http://torrentz.eu/

resume format    http://speckyboy.com/2010/05/05/10-free-professional-html-and-css-templates/

for upload n number of files    http://www.mediafire.com/myfiles.php?r=hjyye

torrent like for downloads    http://www.picktorrent.com/

rajesh blog    http://linuxopensourceindia.blogspot.com/

magento extension link    http://www.magentocommerce.com/magento-connect/

vizualize me resume update site    http://vizualize.me/

online recharge    http://www.paytm.com/

for buying domain    http://www.godaddy.com/

jobs website    http://www.jobrapido.co.in/

online shopping link    http://www.homeshop18.com/

xml and rss feed links    http://www.w3schools.com/php/php_ajax_rss_reader.asp

for good sms    http://www.feelings2share.com/

links for download serial keys    http://www.serials.ws/index.php

light box important link    http://orangoo.com/labs/GreyBox/

javascript key event code link    http://www.webonweboff.com/tips/js/event_key_codes.aspx

trace mobile number (check mobile number is of which state and city)    http://trace.bharatiyamobile.com/

websites ratings    http://www.seomoz.org/web2.0

website for download document    http://www.docstoc.com/

mysql cookbook    http://www.freeopenbook.com/mysqlcookbook/mysqlckbk-chp-5.html

calculate internet speed    http://pcnineoneone.com/speedtest.php

sms sending site with no site name come on footer    http://www.site2sms.com/user/send_sms_next.asp

online tshirt purchase    http://www.tshirts.in/

pick torrent    http://www.picktorrent.com/

torrent links for download    http://www.torrentportal.com/

torrent links for download    http://extratorrent.com/

jquery slider carhousies    http://www.designdim.com/2011/01/19-outstanding-jquery-sliders-and-carousels/

http://thomaslanciaux.pro/jquery/jquery_carousel.htm

How to create custom themes in magento ?

Z:\p\app\design\frontend\base\default --- copy all
Z:\angelsincrib\app\design\frontend\default\angelsincrib --- paste to here
Z:\angelsincrib\skin\frontend\default\ create folder ---- angelsincrib
Z:\angelsincrib\skin\frontend\base\default --- copy all
Z:\angelsincrib\skin\frontend\default\angelsincrib ----- paste to all
Z:\angelsincrib\skin\frontend\default\default ---- copy all
Z:\angelsincrib\skin\frontend\default\angelsincrib --- paste to here and overwrite all
Goto admin System->configuration->leftside Design -> themes (translations->angelsincrib, Templates->angelsincrib, Skin (Images / CSS) ->angelsincrib,Layout->angelsincrib)
Now System -> Cache management -> Select All -> Actions=disable->Submit
Now System -> Index Management -> Select All -> Actions=Reindex Data->Submit

How to get number of items in cart in magento?

Mage::helper('checkout/cart')->getSummaryCount()

How to get price symbol of current store in magento?

Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
Mage::helper('checkout')->formatPrice($this->getSubtotal())

How to redirect in magento?

Mage::app()->getFrontController()->getResponse()->setRedirect($strUrl);

How to get all subcategory details of current category in magento?

function fnGetSubCategories($intParentCategoryId) { $objData = Mage::getSingleton('core/resource')->getConnection('core_write'); $sqlQuery = " SELECT distinct(cce.entity_id) FROM catalog_category_entity cce INNER JOIN catalog_category_entity_int ccei ON cce.entity_id = ccei.entity_id WHERE cce.parent_id = '".$intParentCategoryId."' AND ccei.attribute_id = 119 AND ccei.value = 1 ORDER BY cce.position ASC"; $arrSubCategories = array(); $resSubcategories = $objData->query($sqlQuery); $arrAllSubcategories = $resSubcategories->fetchAll(PDO::FETCH_ASSOC); if(count($arrAllSubcategories)) { foreach($arrAllSubcategories as $aSubCat) { $arrSubCategories[] = $aSubCat['entity_id']; } } return $arrSubCategories;
}

How to show total shopping cart price in Header Magento?

$count = $this->helper('checkout/cart')->getSummaryCount();  //get total items in cart
$total = $this->helper('checkout/cart')->getQuote()->getGrandTotal(); //get total price
if($count==0)
{
echo $this->__('Items: %s',$count);
}
if($count==1)
{
echo $this->__(' Item: %s',$count);
}
if($count>1)
{
echo $this->__(' Items: %s',$count);
}
echo $this->__(' Total: %s', $this->helper('core')->formatPrice($total, false));

Magento Pagination Without Toolbar?

Add the below code to your end of "template/catalog/product/list.phtml" file
$toolbar = $this->getToolbarBlock();
$toolbar->setCollection($_productCollection);
if($toolbar->getCollection()->getSize() > 0):
echo $toolbar->getPagerHtml(); //Pager
echo $toolbar-> __('Items %s to %s of %s total', $toolbar->getFirstNum(), $toolbar->getLastNum(),
$toolbar ->getTotalNum());
endif;

How to remove index.php from URL magento?

If you are using Magento and in your shop URL, if you see “index.php” and wanted to remove it then here is the solution.
- Login to Magento admin panel
- Go to System -> Configuration -> Web -> Search Engines Optimization -> Use Web Server Rewrites
- Select ‘Yes’ from the selection list and Save.
- Goto your site root folder and you can find the .htaccess file. Just edit that. Open it on a text editor and find this line, #Rewrite Base /magento/ . Just replace it with Rewrite Base / .
- Then goto your Cache Management page ( System > Cache Management) and refresh your Cache and also refresh the Web Redirects.
And, you are done. Now, index.php is gone from your Magento shop URL.

How to send email easily in magento?

public function sendEmail()
{
$fromEmail = "from@example.com"; // sender email address
$fromName = "John Doe"; // sender name
$toEmail = "to@example.com"; // recipient email address
$toName = "Mark Doe"; // recipient name
$body = "This is Test Email!"; // body text
$subject = "Test Subject"; // subject text
$mail = new Zend_Mail();
$mail->setBodyText($body);
$mail->setFrom($fromEmail, $fromName);
$mail->addTo($toEmail, $toName);
$mail->setSubject($subject);
try
{
$mail->send();
}
catch(Exception $ex)
{
// If you are using this code in your custom module use 'yourmodule' name.
// If not, you may keep 'customer' instead of 'yourmodule'.
Mage::getSingleton('core/session')
->addError(Mage::helper('yourmodule')
->__('Unable to send email.'));
}
}

Get Customer Shipping/Billing Address

$customerAddressId = Mage::getSingleton('customer/session') ->getCustomer() ->getDefaultShipping();
if ($customerAddressId)
{
$address = Mage::getModel('customer/address')->load($customerAddressId);
}
else
{
$address = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();
}

How to speed up Magento?

Many Magento users faces the site loading problem. If we have larger amount of data the magento site becomes down. The recommended way to speed up Magento's performance is to enable its Compilation function. The performance increase is between 25%-50% on page loads.
You can enable Magento Compilation from your Magento admin panel > System > Tools > Compilation.

How to show only first name in magento welcome message?

$customer = Mage::getSingleton('customer/session')->getCustomer()->getData();
if(Mage::getSingleton('customer/session')->isLoggedIn())
{
echo $this->__('Welcome, %s!', $customer['firstname']);
}
else
{
echo $this->__('Welcome Guest');
}

How to get Most Viewed products in Magento?

$productCount = 5;
$storeId    = Mage::app()->getStore()->getId();
$products = Mage::getResourceModel('reports/product_collection') ->addAttributeToSelect('*') ->setStoreId($storeId) ->addStoreFilter($storeId) ->addViewsCount() ->setPageSize($productCount);
Mage::getSingleton('catalog/product_status') ->addVisibleFilterToCollection($products);
Mage::getSingleton('catalog/product_visibility') ->addVisibleInCatalogFilterToCollection($products);
print_r($products);

How to interchange the left and right column sidebar in magento?



images/media/col_left_callout.jpg
Our customer service is available 24/7. Call us at (555) 555-0123.
checkout/cart

how to get all attribute details

$objEavAttribute = Mage::getModel('catalog/product') -> getResource() -> getAttribute('manufacturer');
if($objEavAttribute->getFrontendInput() == 'select' || $objEavAttribute->getFrontendInput() == 'multiselect' || $objEavAttribute->getFrontendInput() == 'boolean')
{
echo $_product->getAttributeText($value);
}
else
{
echo $_product->getData($value);
}

Custom javascript client side validation in magento on individual page



How to get special price end date in magento?

$this->formatDate($product->getSpecialToDate())

Default toggle text in input text box magento

How to remove right column sidebar from product view page in Magento?


  
      
        
      

Move or Remove Callouts on the left or right sidebar in magento



images/media/col_left_callout.jpg
Our customer service is available 24/7. Call us at (555) 555-0123.
checkout/cart

Add a custom "add to cart" button on Magento CMS pages

Buy It Now

Custom 'Sort by' drop-down menu options Lowest price, Higest price, Name A-Z, Name Z-A, Newest to Oldest & Oldest to Newest in magento

View following url
http://magento-talks.blogspot.in/2011/08/custom-sort-by-drop-down-menu-options.html

How to show total shopping cart price in Header Magento?

$count = $this->helper('checkout/cart')->getSummaryCount();  //get total items in cart
$total = $this->helper('checkout/cart')->getQuote()->getGrandTotal(); //get total price
if($count==0)
{
echo $this->__('Items: %s',$count);
}
if($count==1)
{
echo $this->__(' Item: %s',$count);
}
if($count>1)
{
echo $this->__(' Items: %s',$count);
}
echo $this->__(' Total: %s', $this->helper('core')->formatPrice($total, false));

How to add Quantity Box in the Category Products Listing Page in magento?

http://magento-talks.blogspot.in/2011/08/how-to-add-quantity-box-in-category.html

How to delete test orders from database in magento?

SET FOREIGN_KEY_CHECKS=0;
TRUNCATE `sales_order`;
TRUNCATE `sales_order_datetime`;
TRUNCATE `sales_order_decimal`;
TRUNCATE `sales_order_entity`;
TRUNCATE `sales_order_entity_datetime`;
TRUNCATE `sales_order_entity_decimal`;
TRUNCATE `sales_order_entity_int`;
TRUNCATE `sales_order_entity_text`;
TRUNCATE `sales_order_entity_varchar`;
TRUNCATE `sales_order_int`;
TRUNCATE `sales_order_text`;
TRUNCATE `sales_order_varchar`;
TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
TRUNCATE `sales_flat_quote_address_item`;
TRUNCATE `sales_flat_quote_item`;
TRUNCATE `sales_flat_quote_item_option`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;
ALTER TABLE `sales_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_datetime` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_decimal` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_int` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_text` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_varchar` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;
ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1;
ALTER TABLE `tag` AUTO_INCREMENT=1;
ALTER TABLE `tag_relation` AUTO_INCREMENT=1;
ALTER TABLE `tag_summary` AUTO_INCREMENT=1;
ALTER TABLE `wishlist` AUTO_INCREMENT=1;
ALTER TABLE `log_quote` AUTO_INCREMENT=1;
ALTER TABLE `report_event` AUTO_INCREMENT=1;

Delete test products, categories, customers, products reviews and ratings in magento

***************************************
SALES RELATED TABLES
***************************************
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_comment`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
TRUNCATE `sales_flat_order`;
TRUNCATE `sales_flat_order_address`;
TRUNCATE `sales_flat_order_grid`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sales_flat_order_payment`;
TRUNCATE `sales_flat_order_status_history`;
TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
TRUNCATE `sales_flat_quote_address_item`;
TRUNCATE `sales_flat_quote_item`;
TRUNCATE `sales_flat_quote_item_option`;
TRUNCATE `sales_flat_quote_payment`;
TRUNCATE `sales_flat_quote_shipping_rate`;
TRUNCATE `sales_flat_shipment`;
TRUNCATE `sales_flat_shipment_comment`;
TRUNCATE `sales_flat_shipment_grid`;
TRUNCATE `sales_flat_shipment_item`;
TRUNCATE `sales_flat_shipment_track`;
TRUNCATE `sales_invoiced_aggregated`;            # ??
TRUNCATE `sales_invoiced_aggregated_order`;        # ??
TRUNCATE `log_quote`;

ALTER TABLE `sales_flat_creditmemo_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_payment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_status_history` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_payment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_shipping_rate` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_track` AUTO_INCREMENT=1;
ALTER TABLE `sales_invoiced_aggregated` AUTO_INCREMENT=1;
ALTER TABLE `sales_invoiced_aggregated_order` AUTO_INCREMENT=1;
ALTER TABLE `log_quote` AUTO_INCREMENT=1;

#########################################
# DOWNLOADABLE PURCHASED
#########################################
TRUNCATE `downloadable_link_purchased`;
TRUNCATE `downloadable_link_purchased_item`;

ALTER TABLE `downloadable_link_purchased` AUTO_INCREMENT=1;
ALTER TABLE `downloadable_link_purchased_item` AUTO_INCREMENT=1;

#########################################
# RESET ID COUNTERS
#########################################
TRUNCATE `eav_entity_store`;
ALTER TABLE  `eav_entity_store` AUTO_INCREMENT=1;

##############################
# CUSTOMER RELATED TABLES
##############################
TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
TRUNCATE `customer_address_entity_text`;
TRUNCATE `customer_address_entity_varchar`;
TRUNCATE `customer_entity`;
TRUNCATE `customer_entity_datetime`;
TRUNCATE `customer_entity_decimal`;
TRUNCATE `customer_entity_int`;
TRUNCATE `customer_entity_text`;
TRUNCATE `customer_entity_varchar`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `tag_properties`;            ## CHECK ME
TRUNCATE `wishlist`;
TRUNCATE `log_customer`;

ALTER TABLE `customer_address_entity` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `tag` AUTO_INCREMENT=1;
ALTER TABLE `tag_relation` AUTO_INCREMENT=1;
ALTER TABLE `tag_summary` AUTO_INCREMENT=1;
ALTER TABLE `tag_properties` AUTO_INCREMENT=1;
ALTER TABLE `wishlist` AUTO_INCREMENT=1;
ALTER TABLE `log_customer` AUTO_INCREMENT=1;

##############################
# ADDITIONAL LOGS
##############################
TRUNCATE `log_url`;
TRUNCATE `log_url_info`;
TRUNCATE `log_visitor`;
TRUNCATE `log_visitor_info`;
TRUNCATE `report_event`;
TRUNCATE `report_viewed_product_index`;
TRUNCATE `sendfriend_log`;
### ??? TRUNCATE `log_summary`

ALTER TABLE `log_url` AUTO_INCREMENT=1;
ALTER TABLE `log_url_info` AUTO_INCREMENT=1;
ALTER TABLE `log_visitor` AUTO_INCREMENT=1;
ALTER TABLE `log_visitor_info` AUTO_INCREMENT=1;
ALTER TABLE `report_event` AUTO_INCREMENT=1;
ALTER TABLE `report_viewed_product_index` AUTO_INCREMENT=1;
ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1;
### ??? ALTER TABLE `log_summary` AUTO_INCREMENT=1;

SET FOREIGN_KEY_CHECKS=1;

How to display price with currency and format?

Mage::helper('core')->currency($this->getProduct()->getFinalPrice())

How to define block on cms pages on admin

{{block type="cms/block" block_id="my_block" template="cms/content-right "}}

How to define image on backend editor?

img src="{{skin url='images/footer-img1.png}}" alt=""

How to define homepagecontent from backend page in magento?


initially it will do on header.phtml file
Now open admin/cms/page/Home page/
on content add the following
{{block type="catalog/product_list" name="feature" template="catalog/product/homelist.phtml" category_id="36"}}
{{block type="catalog/product_list" name="feature" template="catalog/product/homecontent.phtml"}}
Now homecontent.phtml file is included into home page.
ALso product category page having category id 36 included on home page.


OR




   
            10
           
                                      
           

           product_list_toolbar