cart subtotal and quantity in Magento

Hello FriendsIf you want to get cart subtotal and quantity in Magento then you can use my below script$items = Mage::getSingleton(‘checkout/session’)->getQuote()->getAllItems(); foreach($items as $item) {echo ‘ID: ‘.$item->getProductId().’‘;echo ‘Name: ‘.$item->getName().’‘;echo ‘Sku: ‘.$item->getSku().’‘;echo ‘Quantity: ‘.$item->getQty().’‘;echo ‘Price: ‘.$item->getPrice().’‘;echo ““;} Get total items and total quantity in cart :- $totalQuantity = Mage::getModel(‘checkout/cart’)->getQuote()->getItemsQty();Get subtotal and grand total price of cart […]

Read More »

Remove .html from URL in Magento

Hello FriendsIf you want to Remove .html from URL in Magento then you can use my below method If you want to remove .html from all Magento’s category URL then Follow the below steps     Go to System -> Config -> Catalog -> Search Engine Optimizations tab    Delete “.html” from Category URL Suffix.    Go to […]

Read More »

change the page tittle in Magento

Hello FriendsIf you want to change the page tittle in Magento then you can use my below method,Which are given as follows: (1) CMS page: Go to backend and open CMS > Manage Pages. Select page to edit and you can set title in ‘Page Title’ field. (2) In frontend and any module, you can […]

Read More »

call a phtml file from controller in magento

Hello FriendsIf you want to call phtml file from controller in magento then use my below script<?phpclass Namespace_Module_DisplayController extends Mage_Core_Controller_Front_Action{public function popupAction(){$block = $this->getLayout()->createBlock(‘core/template’)->setTemplate(‘zipcode/popup.phtml’);$this->getResponse()->setBody($block->toHtml());}}?>

Read More »

Get database connection details Magento

Hello FriendsIf you want to get database details in magento then you can use my below script $config  = Mage::getConfig()->getResourceConnectionConfig(“default_setup”);        $_host = $config->host;        $_uname = $config->username;        $_pass = $config->password;        $_dbname = $config->dbname;        echo $_host;  Let me know if you have any query

Read More »

Get customer order count in Magento

Hello FriendsIf you want to get order count of particular customer in magento from customer id then you can use my below script$customer_id = 5;$_orders = Mage::getModel(‘sales/order’)->getCollection()->addFieldToFilter(‘customer_id’,$customer_id);                       $_orderCnt = $_orders->count(); //orders countecho ‘Customer with ID ‘.$customer_id.’ has ‘.$_orderCnt.’ orders’;Let me know if you have any query

Read More »

get admin path in magento

Hello FriendsIf you want to get admin path name then use my below codeecho (string)Mage::getConfig()->getNode(‘admin/routers/adminhtml/args/frontName’);It will return admin or your admin custom path nameLet me know your comment if its not work for you

Read More »

Read config XML magento

Hello Friends Here, I will be showing you how you can read XML nodes from config.xml file of your module. It’s through the Magento way with Mage::getConfig()->getNode() function. 🙂Here is the XML code of my config.xml file. I will be reading the nodes of this XML file.<default>    <catalog>        <mypage>            <name>myname</name>            <age>100</age>            <address_one>earth</address_one>        </mypage>    </catalog></default>Here is […]

Read More »

Global, Website, Store, Store View magento

Hello FriendsIf you want to know about keyword like Global, Website, Store, Store View in magento then read my below article Global: This refers to the entire installation.    Website: Websites are ‘parents’ of stores.  A website consists of one or more stores. Websites can be set up to share customer data, or not to share any data    Store […]

Read More »

Create an external database connection magento

Hello FriendsIF you want to add external database connection or custom database connection or multiple database connection in magento then you can use below config.xml file from app>code>codepool>packagename>modulename>etc>config.xml Add the following code  to your config.xml under global tagConsider keyur_shah module<global>        <resources>            <test_write>                <connection>    […]

Read More »