Monday, July 9, 2012

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