Wednesday, November 21, 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

Insert query for custom table

Show subcategory in a category page

Show subcategory in a category page

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

Show Quantity Box in Products List

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"

Moving Magento From One Host To Another

Moving Magento From One Host To Another

Running script out side Magento Folder and Updating Project Database

Magento Folder and Updating

Get productID from specific order in Magento

specific order in Magento

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);

Magento addAttributeToFilter

Magento addAttributeToFilter

Tuesday, November 6, 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 frommagento in local system

local system

Magento redirect url

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

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

magento Programmatically

Magento - How to get all Magento Database hosting details?

Database hosting details

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

order details into table format

Magento - Steps to moving magento from one server to other

magento from one server to other

Magento - Store Information

Store Information

Magento - Import Manufacturers

Import Manufacturers

Magento Set, Retrieve and Unset Session Variables

Retrieve and Unset Session Variables

How to add product programmatically in magento 1.7.0 with image andcustom field

Magento add product script

Magento script to make is anchor yes to all categories.

isanchoryesIs anchor yes to all categories in magento

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, November 3, 2012

Magento: How to delete test orders in magento

delete test orders in magento

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

no value in Magento

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

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

Add Free Shipping promotions

Thursday, November 1, 2012

Customizing Onepage Checkout - Remove login

removelogin_oncheckout

Billing same as Shipping Address / Remove Billing Options

removeshippingsteps

 

bilingshipping

Delete all product from cart

Delete all product from cart

Redirecting www to non-www Using .htaccess

non-www Using .htaccess

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

footer in Magento

Remove Category option from Layered Navigation options list in magnto

Remove Category option

Removing dropdowns from Product List Pager in magnto

List Pager in magnto

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

ResetProduct id’s in Magento

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

Reset Categoryt id’s in Magento

Magento: How to solve indexing problem?

solve indexing problem

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 />";
}

Tuesday, October 23, 2012

Redirect site from non-www to www

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

Tuesday, October 16, 2012

Tuesday, September 18, 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

multiple mp4 player play alternate

multiple-mp4-player-alternate-play

page not found concept

page-not-found

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

javascript add n-number of textbox

urb

Core php insert delete update show with session

webApp

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 intosession

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 Read curl and display api data

read_curl

PHP Login remember script

remember_me

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?

page template in wordpress

Monday, September 17, 2012

Php script to force pdf file download

download_pdf_file

 

Php script to download forcefully pdf files instead of display in browser

Thursday, September 6, 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.
Ajaxscroll

List of tables to store product

List of tables to store product

How to delete customers in magento?

delete customers in magento

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

How to display random tweets on our website?

display random tweets

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?

display random tweets on our website

Saturday, August 18, 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');

Tuesday, August 14, 2012

Magento display date format

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

Monday, August 13, 2012

How to display manufacturer attributes on product listing page in magento?

Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('manufacturer');

Thursday, August 9, 2012

magento custom add to cart link

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

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, August 7, 2012

Magento solve enable cookies

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

Remove Price from Custom Options

catalog.xml


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

Friday, July 20, 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)?

<?php echo Mage::getStoreConfig('web/unsecure/base_url');?>

Wednesday, July 18, 2012

How to play youtube videos in magento website?

Youtube Videos

social networking links to count likes

<div class="social_share">
    <ul>
        <li>
            <iframe src="//www.facebook.com/plugins/like.php?href=<?php echo $strEncodedProductUrl; ?>&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
        </li>
        <li>
            <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo $strProductUrl ?>">Tweet</a>
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
        </li>
        <li>
            <!-- Place this tag in your head or just before your close body tag. -->
            <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
            <!-- Place this tag where you want the +1 button to render. -->
            <div class="g-plusone" data-href="<?php echo $strProductUrl ?>"></div>
        </li>
        <li>
            <a href="http://pinterest.com/pin/create/button/?url=<?php echo $strEncodedProductUrl; ?>&media=<?php echo $strProductImage; ?>&description=<?php echo $strProductDescription; ?>" class="pin-it-button" count-layout="horizontal">
                <img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />
            </a>
        </li>
    </ul>
</div>

Tuesday, July 17, 2012

How to get Subtotal of current cart in magento?

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

Saturday, July 14, 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();

Friday, July 13, 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, July 9, 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 fetch all root categories and its subcategories in magento?

Fetch Records Magento

Sunday, July 8, 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;
}

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 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 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 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

<script type="text/javascript" language="javascript">
var dataForm = new VarienForm('contactForm');
Validation.addAllThese(
[
['validate-number-tel', '<?php echo $this->__('Please Enter Valid telephone number and pincode') ?>', function(v) {
if(document.getElementById("telephone1").value == "" || document.getElementById("telephone2").value == "")
{
return false;
}
else
{
return true;
}
}],
['validate-captcha', 'Your Captcha Entry Mismatch', function(v) {
if(document.getElementById("hdnRandomString1").value != document.getElementById("recaptcha_response_field1").value)
{
return false;
}
else
{
return true;
}
}]
]
);
</script>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
//]]>
</script>
<script type="text/javascript" language="javascript">
function validateNumberKey(event) {
var key = window.event ? event.keyCode : event.which;
if (event.keyCode == 8 || event.keyCode == 46
|| event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9) {
return true;
}
else if ( key < 48 || key > 57 ) {
return false;
}
else return true;
}
</script>

How to get special price end date in magento?

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

Default toggle text in input text box magento

<script language="javascript">
var comment = document.getElementById('comment');
comment.onfocus = hideText;
comment.onblur  = showText;
function hideText()
{
if(this.value == this.defaultValue){
this.value = '';
this.style.color = '#666666';
}
}
function showText()
{
if(this.value == ''){
this.value = this.defaultValue;
this.style.color = '#cccccc';
}
}
</script>

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

<catalog_product_view translate="label">
  <label>Catalog Product View (Any)</label>
      <reference name="root">
        <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
      </reference>
</catalog_product_view>

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

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

<reference name="left">
<block name="left.permanent.callout" template="callouts/left_col.phtml" type="core/template">
<action method="setImgSrc"><src>images/media/col_left_callout.jpg</src></action>
<action method="setImgAlt" module="catalog" translate="alt"><alt>Our customer service is available 24/7. Call us at (555) 555-0123.</alt></action>
<action method="setLinkUrl"><url>checkout/cart</url></action>
</block>
</reference>

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

<button onclick="location.href ='{{config path="web/unsecure/base_url"}}/checkout/cart/add?product=1&qty=1′">Buy It Now</button>

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));

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

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 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;

How to display price with currency and format?

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

How to define image on backend editor?

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

How to define block on cms pages on admin

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

How to define homepagecontent from backend page in magento?

Magento Home Page Define

List of basic magento extensions

Magent Version > 1.5
1. Easy Tabs: http://connect20.magentocommerce.com/community/magento_easy_tabs
2. CueBlock Zoom: http://connect20.magentocommerce.com/community/CueBlocks_Zoom
3. Vert Navigation: http://connect20.magentocommerce.com/community/RicoNeitzel_VertNav
4. Tell A Friend: http://connect20.magentocommerce.com/community/Mp_Tell_A_Friend
5.Multiple Table Reates
http://connect20.magentocommerce.com/community/Pw_Multipletablerates
6. Magento easy lightbox : http://connect20.magentocommerce.com/community/magento_easy_lightbox
FACEBOOK CONNECT:http://inchoo.net/ecommerce/magento/facebook-connect-magento-extension/
http://www.magentocommerce.com/magento-connect/eitai2001/extension/1468/order-status
http://www.magentocommerce.com/magento-connect/FOOMAN/extension/957/fooman_sameorderinvoicenumber
http://www.magentocommerce.com/magento-connect/i960/extension/1477/admin-custom-shipping-rate
http://www.magentocommerce.com/magento-connect/centerax/extension/2927/automatic-db-backups
http://www.magentocommerce.com/magento-connect/plieninger/extension/2586/editable-order
http://www.magentocommerce.com/magento-connect/MageParts/extension/1621/commercial-extension-manager
http://www.magentocommerce.com/magento-connect/bleulliette/extension/7619/bl_customgrid
http://www.magentocommerce.com/magento-connect/ifuel/extension/7302/seevolution_connector
http://www.google.com/support/merchants/bin/answer.py?answer=188494#GB

Change Magento Admin URL


All you need is to properly set your custom admin url in the config file /app/etc/local.xml. In this file change this:
to this:

contact us email settings on magento..

system/configuration/contacts/ --------- contactus and email options
system/configuration/system/ ----------- mail sending settings
app/code/core/mage/core/model/email/template.php

public function getMail() { if (is_null($this->_mail)) { $my_smtp_host = Mage::getStoreConfig('system/smtp/host'); $my_smtp_port = Mage::getStoreConfig('system/smtp/port'); $config = array( 'port' => $my_smtp_port, //optional - default 25 'auth' => 'login', 'username' => 'test@sankhalainfo.co.in', 'password' => 'info#1234' ); $transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config); Zend_Mail::setDefaultTransport($transport); /*End Hack*/ $this->_mail = new Zend_Mail('utf-8'); } return $this->_mail; }

how to display all countries in magento ?

$countryList = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false); print_r( $countryList);

how to fetch all states of country in magento?


$countryList = Mage::getResourceModel('directory/country_collection') ->loadData() ->toOptionArray(false);
$regionCollection = Mage::getModel('directory/region') ->getResourceCollection() ->addCountryFilter('IN')->load();

how to view recent products in magento?

Magento Recent Product

how to check home page in magento?

if(Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' )

how to view all brands in magento containing products?

View all brands in magento

How to view recent sold product of current category in magento?


load(3);
$_productCollection = $cats->getProductCollection() ->addAttributeToFilter('visibility',4);
$intNumRecord = Mage::getStoreConfig('banner/carousel_configuration/bestseller_number_product');
$_productCollection = $_productCollection ->setPageSize($intNumRecord);
if($_productCollection->count()) { ?>
load($_products->getId());?>

how to view popular products in magento? or maximum sold products in store


getStore()->getStoreId(); $this->_productCollection = Mage::getResourceModel('reports/product_collection');
if ($this->getTimeLimit())
{
$product = Mage::getModel('catalog/product');
$todayDate = $product->getResource()->formatDate(time());
$startDate = $product->getResource() ->formatDate(time() - 60 * 60 * 24 * $this ->getTimeLimit());
$this->_productCollection = $this->_productCollection ->addOrderedQty($startDate, $todayDate);
}
else
{
$this->_productCollection = $this->_productCollection ->addOrderedQty();
}
$intNumRecord = Mage::getStoreConfig('banner/carousel_configuration/bestseller_number_product');
$this->_productCollection = $this->_productCollection ->addAttributeToSelect('*') ->setStoreId($storeId) ->addStoreFilter($storeId) ->setOrder('ordered_qty', 'desc') ->setPageSize($intNumRecord);
$_productCollection = $this->_productCollection ->setPageSize($intNumRecord);
if($_productCollection->count())
{ ?>
load($_products->getId());?>getShortDescription();if(strlen($strproductdescription)>82) $strproductdescription = trim(substr($strproductdescription,0,81)."...");$strProductName = $_product->getName(); ?> 22){$strProductName =  substr($strProductName,0,21)."...";}?>
<a href="getProductUrl() ?>" title="stripTags($_product->getName(), null, true) ?>">

<a href="getUrl('popular-products');?>">__('More...');?>

How to display add to cart url on any page on magento?


<?php if(isSaleable()): ?>
 <button type="button" title="__(‘Add to Cart’) ?>” class=”button btn-cart” onclick=”setLocation(‘getLayout()->createBlock(‘catalog/product_list’)->getAddToCartUrl($objProduct) ?>’)”>__(‘Add to Cart’) ?>
__(‘Out of stock’) ?>

How to display total reviews of product in magento?

$intTotalReviewPerProduct = $objCategoryBanners->fnGetTotalProductReview($_product);

How to display image of current product on magento?

<a href="getProductUrl();?>">
<img src="helper('catalog/image')->init($objProduct, 'small_image')->resize(60,110); ?>" alt="getName();?>">

How to display total reviews of product in magento?

$intTotalReviewPerProduct = $objCategoryBanners->fnGetTotalProductReview($_product);

How to display average ratings of product in magento?


public function fnGetTotalProductReview($objCurrentProduct)
{
$objReview = Mage::getModel('review/review');
return $objReview ->getTotalReviews($objCurrentProduct->getId(),true);
}
$intTotalReviewPerProduct = fnGetTotalProductReview($_product);
if($intTotalReviewPerProduct > 0){echo $this ->getLayout() ->createBlock('catalog/product_list') ->getReviewsSummaryHtml($_product);
}

How to show all the manufactures or brand list in magento?


$product = Mage::getModel('catalog/product');
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter('attribute_code', 'manufacturer');
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);
foreach ($manufacturers as $manufacturer)
{
echo Mage::getBaseUrl(); ?>catalogsearch/advanced/result/?manufacturer[]=$manufacturer['value']
echo Mage::getBaseUrl(); ?>catalogsearch/advanced/result/?manufacturer[]=$manufacturer['label']
}

How to get the customer login, logout, register and checkout url?

Mage::getUrl('customer/account/login'); //login url
Mage::getUrl('customer/account/logout'); //logout url
Mage::getUrl('customer/account'); //My Account url
Mage::getUrl('customer/account/create'); // Register url
Mage::getUrl('checkout/cart'); //Checkout url

How to show all the manufactures or brand list in magento?


$product = Mage::getModel('catalog/product');
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter('attribute_code', 'manufacturer');
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);
foreach ($manufacturers as $manufacturer)
{
echo Mage::getBaseUrl(); ?>catalogsearch/advanced/result/?manufacturer[]=$manufacturer['value']
echo Mage::getBaseUrl(); ?>catalogsearch/advanced/result/?manufacturer[]=$manufacturer['label']
}

How to get the customer login, logout, register and checkout url?

Mage::getUrl('customer/account/login'); //login url
Mage::getUrl('customer/account/logout'); //logout url
Mage::getUrl('customer/account'); //My Account url
Mage::getUrl('customer/account/create'); // Register url
Mage::getUrl('checkout/cart'); //Checkout url

set or get magento session


//Setting session
Mage::getSingleton('core/session')->setMySessionVariable('value');
//Getting session
Mage::getSingleton('core/session')->getMyDesignProductVariable()
//Unset session
Mage::getSingleton('core/session')->setTestingMagento();
//(Use customer or core session in frontend. Use adminhtml session in the backend.)
Core Session:- Mage::getSingleton(‘core/session’)
Customer Session:- Mage::getSingleton(‘customer/session’)
Admin Session:- Mage::getSingleton(‘adminhtml/session’)

How to get cms content from cms id in magento?

$objCmsPage = Mage::getModel('cms/page')->getCollection()->addFieldToFilter('identifier','next-day');
foreach($objCmsPage as $objCmsPageContent)
{
break;
}
$objCmsHelper = Mage::helper('cms');
$objProcessor = $objCmsHelper->getPageTemplateProcessor();
echo $objProcessor->filter($objCmsPageContent->getContent());

How to get cms content from cms id in magento?

$objCmsPage = Mage::getModel('cms/page')->getCollection()->addFieldToFilter('identifier','next-day');
foreach($objCmsPage as $objCmsPageContent)
{
break;
}
$objCmsHelper = Mage::helper('cms');
$objProcessor = $objCmsHelper->getPageTemplateProcessor();
echo $objProcessor->filter($objCmsPageContent->getContent());

How To fetch all categories and subcategories in magento?

$_helper = Mage::helper(‘catalog/category’)
$_categories = $_helper->getStoreCategories()
$currentCategory = Mage::registry(‘current_category’)
if (count($_categories) > 0)
{
foreach($_categories as $_category)
{
echo $_category->getName()
$_category = Mage::getModel(‘catalog/category’)->load($_category->getId())
$_subcategories = $_category->getChildrenCategories()
if (count($_subcategories) > 0)
{
foreach($_subcategories as $_subcategory)
{
echo $_subcategory->getName()
}
}
}
}

How to define custom layout in magento like 1column,2-column right,3-columns


template/page/2columns-aboutus.phtml
-----------------------------------------------------------------------
layout/page.xml
-----------------------------------------------------------------------
find All Two-Column Layout Pages (Left Column) and place
-----------------------------------------------------------------------
<page_two_columns_aboutus translate="label">
<label>All Two-Column Layout Pages (About us Column)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-aboutus.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
</page_two_columns_aboutus>
-----------------------------------------------------------------------
now define global object in xml
app/code/local/companyname/modulename/etc/config.xml
<two_columns_aboutus module="page" translate="label">
<label>2 columns with About Us</label>
<template>page/2columns-aboutus.phtml</template>
<layout_handle>page_two_columns_aboutus</layout_handle>
</two_columns_aboutus>
Now go to admin login pages/ -----> 2 columns with About Us

How to define store path on backend side while create static block

{{store url='company-history'}}

How to get request on magento?

echo $this->getRequest()->getParams())

How to get cms page title in magento?

$pageTitle = Mage::getSingleton('cms/page')->getTitle();

How to get product details from product id in magento?

$model = Mage::getModel('catalog/product');
$_product = $model->load($productId);
echo $_product->getShortDescription();
echo $_product->getDescription();
echo $_product->getName();
echo $_product->getPrice();
echo $_product->getSpecialPrice();
echo $_product->getProductUrl();
echo $_product->getImageUrl();
echo $_product->getSmallImageUrl();
echo $_product->getThumbnailUrl();

How to get category details from category id on magento?

$category = Mage::getModel('catalog/category')->load($_category);
echo $category->getUrl();// category url
echo $category->getName();
echo $category->getImageUrl();
$categoryImage = $category->getImage();

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

Magento all paths.


Mage::getBaseUrl() => Gets base url path e.g. http://my.website.com/
Mage::getBaseUrl(‘media’) => Gets MEDIA folder path e.g. http://my.website.com/media/
Mage::getBaseUrl(‘js’)                => Gets JS folder path e.g. http://my.website.com/js/
Mage::getBaseUrl(‘skin’)              => Gets SKIN folder path e.g. http://my.website.com/skin/
Mage::getBaseDir()             => Gives you your Magento installation folder / root folder e.g. /home/kalpesh/
Mage::getBaseDir(‘app’)             => Gives you your Magento’s APP directory file location e.g. /home/kalpesh/
Mage::getBaseDir(‘design’)            => Gives you your Magento’s DESIGN directory file location e.g. /home/kalpesh/wo
Mage::getBaseDir(‘media’) => Gives MEDIA directory file path
Mage::getBaseDir(‘code’) => Gives CODE directory file path
Mage::getBaseDir(‘lib’) => Gives LIB directory file path
Get Current URL – whole URL path
Mage::helper(‘core/url’)->getCurrentUrl()

How to change default image white space(background) on magento?

app/code/core/mage/catalog/model/Product/image.php

How to display product price with currency on magento?

$formattedPrice = Mage::helper('core')->currency($objProduct->getPrice(),true,false);

How to change default image white space(background) on magento?

app/code/core/mage/catalog/model/Product/image.php

How to display product price with currency on magento?

$formattedPrice = Mage::helper('core')->currency($objProduct->getPrice(),true,false);

How to get products available stock quantity in magento?

echo $qtyStock = (int) Mage::getModel('cataloginventory/stock_item') ->loadByProduct($_product) ->getQty();

How to display static block content on front side?

$this->getLayout()->createBlock('cms/block')->setBlockId('identifier')->toHtml()

How to check customer is login or not?

Mage::getSingleton('customer/session')->isLoggedIn());

How to Get current Url of the page in magento?

$this->helper('core/url')->getCurrentUrl();

How to display product with specific height and width in magento?


$productId = 1;
$product = Mage::getModel('catalog/product') ->load($productId);
$path = Mage::helper('catalog/image') ->init($product, 'image') ->resize(75, 75);

How to set number of columns on product listing page?


<?php $_columnCount = $this->getColumnCount(); ?>
              and replace it with:
<?php $_columnCount = 4; ?>

How to create module in magento?


app/etc/modules/Custom_Manufacturerlogo.xml
app/code/local/Custom/Manufacturerlogo/Block/Manufacturerlogo.php
app/code/local/Custom/Manufacturerlogo/controllers/IndexController.php
app/code/local/Custom/Manufacturerlogo/etc/config.xml
app/code/local/Custom/Manufacturerlogo/Model/Manufacturerlogo.php
app/code/local/Custom/Manufacturerlogo/Model/Mysql4/Manufacturerlogo.php
app/code/local/Custom/Manufacturerlogo/Model/Mysql4/Manufacturerlogo/Collection.php
app/code/local/Custom/Manufacturerlogo/Model/Status.php
app/code/local/Custom/Manufacturerlogo/sql/manufacturerlogo_setup/mysql4-install-0.1.0.php
app/design/frontend/default/default/layout/manufacturerlogo.xml
app/design/frontend/default/default/template/manufacturerlogo/manufacturerlogo.phtml
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo.php
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo/Edit.php
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo/Grid.php
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo/Edit/Form.php
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo/Edit/Tabs.php
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo/Edit/Tab/Form.php
app/code/local/Custom/Manufacturerlogo/controllers/Adminhtml/ManufacturerlogoController.php
app/code/local/Custom/Manufacturerlogo/Helper/Data.php
app/design/adminhtml/default/default/layout/manufacturerlogo.xml