Tuesday, 21 August 2012
Magento : Enable / Disable magento admin 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'Thursday, 16 August 2012
Magento : After logout redirect on home directly
Put This on Customer/logout.phtml
In script
comment setTimeout(function(){ location.href = '<?php //echo $this->getUrl()?>'}5000);
replace with this
setTimeout(function(){ location.href = '<?php //echo $this->getUrl()
$customerLoginURL = Mage::getBaseUrl();
Mage::app()->getFrontController()->getResponse()->setRedirect
($customerLoginURL)->sendResponse();
?>'},5000);
In script
comment setTimeout(function(){ location.href = '<?php //echo $this->getUrl()?>'}5000);
replace with this
setTimeout(function(){ location.href = '<?php //echo $this->getUrl()
$customerLoginURL = Mage::getBaseUrl();
Mage::app()->getFrontController()->getResponse()->setRedirect
($customerLoginURL)->sendResponse();
?>'},5000);
Saturday, 28 July 2012
Magento : Get configurable product SKU and its simple product SKU in cart
Put this code at templet/checkout/cart/item/default.phtml
at line 26 or 27
after this line "$_item = $this->getItem();"
<?php
echo $temp = $_item->getProductId();
echo "<br/>";
$_product = Mage::getModel('catalog/product')->load($temp);
echo "Config. Product :";
echo $_product->getSku();
echo "<br/>";
echo "Simple Product :";
echo $_item->getSku();
?>
Magento : Programatically remove product form cart
<?php
$session= Mage::getSingleton('checkout/session');
$quote = $session->getQuote();
$cart = Mage::getModel('checkout/cart');
$cartItems = $cart->getItems();
foreach ($cartItems as $item)
{
if($item->getProductId()== 4)
{
$quote->removeItem($item->getId())->save();
}
}
?>
Magento : Add product to cart programatically
<?php
$cart = Mage::getSingleton('checkout/cart');
$product = new Mage_Catalog_Model_Product();
$product->load(4);
$cart->addProduct($product);
$cart->save();
?>
Friday, 27 July 2012
Magento : Get configurable product SKU and it's associated product SKU in Cart
Write This in "templet/checkout/cart/item/default.phtml"
<?php
$_item = $this->getItem();
echo $temp = $_item->getProductId();
echo "<br/>";
$_product = Mage::getModel('catalog/product')->load($temp);
echo "Config. Product :";
echo $_product->getSku();
echo "<br/>";
echo "Simple Product :";
echo $_item->getSku();
?>
Subscribe to:
Posts (Atom)