Posts

Showing posts from 2014

Adding Contact us link to Top Menu in Magento

Image
Create New Category " Contcat Us ". Set " Display Mode "=" static block only " from " Display Settings " Tab. Set below code in " Custom Layout Update " from " Custom Design " Tab. <reference name="content">             <block type="core/template" name="contactForm" template="contacts/form.phtml"/> </reference> Save it.... Enjoy...

Show Payment Method in Order Grid in Magento (Enhance Order Grid in admin side)

Image
Copy Grid.php "app\code\core\Mage\Adminhtml\Block\Sales\Order\Grid.php" and paste on below path. "app\code\local\Mage\Adminhtml\Block\Sales\Order". Find this code "$collection = Mage::getResourceModel($this->_getCollectionClass());". Put below line after find text. $collection->join(array('payment'=>'sales/order_payment'),'main_table.entity_id=parent_id','method'); After that put below code where you want to show Payment Method. After which column in grid you want to show. $this->addColumn('method', array( 'header' => Mage::helper('sales')->__('Payment Method'), 'index' => 'method', 'filter_index' => 'method', 'type' => 'text' ));

Currency converter in header in magento

Image
How to show currency switcher in header in magento Step 1 :-First open page.xml file.(app/design/frontend/default/Your_Theme/layout/page.xml)         Find below code. <block type="page/html_header" name="header" as="header"> Put below code after that line. <block type="directory/currency" name="currencyhead" template="directory/currency.phtml"/> Step 2 :-Put below code in header.phtml (app/design/frontend/default/Your_Theme/template/page/html/header.phtml) file where you want currency convertor. <?php echo $this->getChildHtml('currencyhead') ?> Clear Cache from admin side....... Enjoy.....................

Create a custom page in Magento

<!---- First Create One Phtml File  ----->     ==> Go to app/design/forntend/default/base/tamplet/catalog/product   ==> Here Copy any phtml file,   ==> Paste that copied file,   ==> Change the name with your Name   ==> Example ::=> categoryid.phtml   <!---- Second Create One Php File  ----->   ==> Go to app/code/core/mage/catalog/block/product   ==> Here Copy PHP file Which name is as your phtml file which you select and copy-paste,   ==> Paste that PHP copied file,   ==> Change the name with Same name of PHtml file and Must "First character be a Capital"   ==> Example ::=> Categoryid.php     <!---- Third Add this code in Product controller File  ----->   ==> Go to app/code/core/mage/catalog/controller   ==> Put belove code in this file      public function "Here your phtml file name in small letter"Action() ...

Magento create invoice of specific order by programmatically

<?php require_once('app/Mage.php'); Mage::app(); $orderId = '10508'; /////$order->getId(); $fullOrder = Mage::getModel('sales/order')->load($orderId); $fullOrder->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true); $fullOrder->setStatus('processing', false); $fullOrder->save(); try { if(!$fullOrder->canInvoice()) { Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.')); } $invoice = Mage::getModel('sales/service_order', $fullOrder)->prepareInvoice(); if (!$invoice->getTotalQty()) { Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.')); } $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE); $invoice->register(); $transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->ge...

Product Sharing in Magento

Facebook <a target="_blank" href="http://www.facebook.com/sharer.php?u=<?php echo $p_url;  ?>&t=Check+this+out"  class="addthis_button_preferred_1  class_social_facebook" title="Share on Facebook"></a>   Twitter     <a target="_blank" title="Share on Twitter!" href="http://twitter.com/home?status= <?php echo $this->htmlEscape($product->getName()) ?> at <?php echo $p_url;  ?>"  class="addthis_button_preferred_2 class_social_twitter"></a> Tumblr   <script src="http://platform.tumblr.com/v1/share.js"></script>    <a target="_blank" href="http://www.tumblr.com/share" title="Share on Tumblr" class="addthis_button_preferred_3 class_social_print"></a> Pinterest        <a target="_blank" href="http://pinterest.com/pin/create/button/?media=<?php echo $thi...

Credit card number for Testing payment methods

American Express: 378282246310005 3111111111111117 343434343434343 370000000000002 340000000000009 371449635398431 378734493671000 Visa: 4111111111111111 4007000000027 4222222222222 4012888888881881 MasterCard: 5105105105105100 5111111111111118 5454545454545454 5500000000000004 5555555555551111 5555555555554444 Discover: 6011111111111117 6011000000000004 6011000990139424 6011601160116611 6111111111111116 for expiry date select any feature month and year.... 

Remove index.php from url in magento

If you want to remove index.php from your magento store url then please follow below steps. Like http://www.magentosite.com/index.php     to     http://www.magentosite.com Go to admin side. Go to " System => Configuration =>Web =>Search Engine Optimization ". Use Web Server Rewrites : Yes. After that clear cache and index from Magento admin side. Enjoy...

Magento Admin in Debug Mode

Just run this query: ==> INSERT INTO core_config_data (scope, scope_id, path, value) VALUES ('default', 0, 'dev/debug/template_hints', 1), ('default', 0, 'dev/debug/template_hints_blocks', 1); To disable them again, run this query ==> UPDATE core_config_data set value = 0 where scope = 'default' and scope_id = 0 and path ='dev/debug/template_hints' To enable again run this query ==> UPDATE core_config_data set value = 1 where scope = 'default' and scope_id = 0 and path ='dev/debug/template_hints'

How to call static block in frontend in magento

echo $this->getLayout()->createBlock('cms/block')->setBlockId(''Here Block Identifire'')->toHtml();

Get Product Detail by product id in Magento

$model = Mage::getModel('catalog/product'); //getting product model $_product = $model->load($pro_id); //getting product object for particular product id echo $product = $_product->getid();  //Get Product Id echo $_product->getShortDescription(); //product's short description echo $_product->getDescription(); // product's long description echo $_product->getName(); //product name echo $_product->getPrice(); //product's regular Price echo $_product->getSpecialPrice(); //product's special Price echo $_product->getProductUrl(); //product url echo $_product->getImageUrl(); //product's image url