This code will show you how to get the product id of the last product that was added to the shopping cart, and all the products currently in the shopping cart. $productID=Mage::getSingleton('checkout/session')->getLastAddedProductId(true); echo $productID."<br>"; $_product=Mage::getModel('catalog/product')->load($productID); echo $_product->getName()."<br>"; $session= Mage::getSingleton('checkout/session'); foreach($session->getQuote()->getAllItems() as $item) { $productID = $item->getProductId(); $productSku = $item->getSku(); $productName = $item->getName(); $productQty = $item->getQty(); Full Article…
Magento – Login Into Multiple Website Store
Problem Case: The problem we are trying to solve here is, suppose you have multiple magento website setup on different domains on the same magento instance, and you want that if a customer login’s on any one our your site he is gets logged into all other sites as well. Solution: The solution for this Full Article…
Magento – ADDATTRIBUTETOFILTER CONDITIONALS
addAttributeToFilter is a method that can be called on EAV collections in Magento. This includes product collections, category collections, customer collections and many more. In short, it adds a condition to the WHERE part of the MySQL query used to extract a collection from the database, therefore allowing you to filter the collection by custom Full Article…
Magento – List of Shopping Cart Price Rule Tables
Here is the table list of Shopping Cart Price Rule. 1. salesrule Create rule info will get it from here. 2. salesrule_coupon Coupon info will get here 3. salesrule_coupon_usage How many time used this coupon by customer ID 4. salesrule_customer 5. salesrule_customer_group Rule mapped to which customer groups 6. salesrule_label 7. salesrule_product_attribute attribute based rule Full Article…
Magento – Filtering results using LIKE
When you want to filter collection result by using like, you can use the following code: $collection->addAttributeToFilter('name', array( array('like' => '% '.$needle.' %'), //spaces on each side array('like' => '% '.$needle), //space before and ends with $needle array('like' => $needle.' %') // starts with needle and space after )); Passing the second parameter as an Full Article…
Magento – Set and unset system messages
You can use this code to clear error message Mage::getSingleton('core/session')->getMessages(true); // The true is for clearing them after loading them You can use the following code show the Magento message //A Success Message Mage::getSingleton('core/session')->addSuccess("Some success message"); //A Error Message Mage::getSingleton('core/session')->addError("Some error message"); //A Info Message (See link below) Mage::getSingleton('core/session')->addNotice("This is just a FYI message…"); //These Full Article…
CREATING CANADIAN TAX RULES IN MAGENTO
As a business owner and eMerchant operating and selling within Canada, it is important to know what the amount is to charge for sales tax on the goods and services that you offer your customers. This is vital in the online world of eCommerce as the customer base you sell to can also be nationwide. Full Article…
Magento – Update admin routers of custom module for patch
I managed to change my custom module to use the Magento new way as recommended with the patch 6788. So I give here as a reference for other. Change to router in the config.xml file: Before: <admin> <routers> <adminhello> <use>admin</use> <args> <module>Pulsestorm_Adminhello</module> <frontName>admin_adminhello</frontName> </args> </adminhello> </routers> </admin> After <admin> <routers> <adminhtml> <args> <modules> <adminhello before="Mage_Adminhtml">Pulsestorm_Adminhello_Adminhtml</adminhello> Full Article…
Magento – Access Denied errors after installing SUPEE-6285
After installing the SUPEE-6285 patch on our Magento 1.7.0.2 store the system is showing an "Access Denied" error when attempting to access all custom modules for users who have selective permissions (not all permissions). Screenshot below. ————————————————————————————– Solution: If you use restricted admin accounts, some menus of third party extensions might not work Full Article…
Magento – Get order detail from order id
Magento get order details : If you are working with magento order and looking for order details you can load order in two ways – Order – Load By Increment Id Order – Load By Entity Id You can use either method to load order in magento. We are going to explain the magento order Full Article…