<?phprequire_once(‘app/Mage.php’); //Path to Magentoumask(0);Mage::app();// Run you code here?>
Useful Tricks
<?phpif($_product->getTypeId() == “configurable”) { $ids = $_product->getTypeInstance()->getUsedProductIds();?><ul> <?php foreach ($ids as $id) { $simpleproduct = Mage::getModel(‘catalog/product’) ->load($id); ?> <li> <?php…
Here, you will see how to create Catalog Price Rule in Magento through code. Catalog Rules are applied on products…
First, use get_class to get the name of an object’s class. <?php $class_name = get_class($object); ?> Then, pass that get_class_methods…
In /app/design/frontend/default/site/template/catalog/product/view/type/ <?php $_helper = $this->helper(‘catalog/output’); ?><?php $_associatedProducts = $this->getAllowProducts() ?><?php //var_dump($_associatedProducts); ?><br /><br /><?php if (count($_associatedProducts)): ?> <?php foreach…
<?php$currentCategory = Mage::registry(‘current_category’);$currentProduct = Mage::registry(‘current_product’);$currentCmsPage = Mage::registry(‘cms_page’);?>
<?php$cart = Mage::getModel(‘checkout/cart’)->getQuote()->getData();print_r($cart);$cart = Mage::helper(‘checkout/cart’)->getCart()->getItemsCount();print_r($cart);$session = Mage::getSingleton(‘checkout/session’);foreach ($session->getQuote()->getAllItems() as $item) { echo $item->getName(); Zend_Debug::dump($item->debug());}?>
Use the code below to delete a quote: <?php$quoteID = Mage::getSingleton(“checkout/session”) ->getQuote()->getId();if($quoteID){ try { $quote = Mage::getModel(“sales/quote”)->load($quoteID); $quote->setIsActive(false); $quote->delete(); return…
UPDATE`core_config_data`SET`value` = 0WHERE`path` = “dev/debug/template_hints”OR`path` = “dev/debug/template_hints_blocks”;
We can simply use the following code // To get the shipping and handling charge on shopping cart page Mage::getSingleton(‘checkout/session’)->getQuote()->getShippingAddress()->getShippingAmount();…