Category: Magento
-
Magento: How to get increment id of an Order by order id in magento
In most cases, an user (A developer) need to write own code to generate an order, generate invoice for an order or generate shipment for an order then he need both order id and its increment id. You can get this increment value by following code: $order = Mage::getModel(‘sales/order’); $order->load(Mage::getSingleton(‘sales/order’)->getLastOrderId()); $orderIncrementId = $order->getIncrementId(); Tweet This…
-
Magento: Fatal error: Call to undefined method Mage_Adminhtml_Block_Abstract::getexceptions()
When I tried to export or import any profile, then I got a fatal error: Fatal error: Call to undefined method Mage_Adminhtml_Block_Abstract::getexceptions() in …….\app\code\core\Mage\Adminhtml\Block\System\Convert\Profile\Run.php on line 167 To remove this problem follow below process: 1. Go to file which showing in fatal error. 2. Comment line 167 and 168, then it will show like: //…
-
How to find Server time in magento
Many times developer gets the time problem during project development. Because he works on date function which provides by PHP but site works on different server which time is different from developer country. So for this case you can use magento time which priovides by Magento self. It Manage the server time. This line will…
-
Magento: How to get value of custom created category attribute at front side?
According to magento characteristics, we can get the custom created product attributes at front side in easy way by $_product->getCustomCreateAttribute() But when we create an attribute for an category then magento does not show by $_main_category->getCustomCreateAttribute() Magento only show the attribute value at front side which created by system or Magento. So for this we…
-
Magento : add two column value in collection
many times we need to do operation on two column values and show in the admin panel. for this we have to follow these steps: 1. Add column in your Grid.php file: 2. Now create a folder in the AdminHtml folder with name ‘Renderer’ 3. Create a new php file with name ‘Qty.php’ 4. Write…
-
Magento: How to retrieve products with a specific attribute?
Mostly all Models in the Magento have a corresponding Collection object that can be used to fetch multiple instances of a Model. To instantiate a Product collection, do the following $collection = Mage::getModel(‘catalog/product’)->getCollection(); Products are a Magento EAV style Model, so you’ll need to add on any additional attributes that you want to return. $collection…
-
get the table name with prefix in magento
This is most useful when you don’t know that what will be table prefix on server side. This situation may be generate when you are developing project at local system and you know table prefix and you have no access on server side so you are not able to know what table prefix used during…
-
Print magento Sql at run time
Any developer wants to check what sql is executing during page load. so he can check and identify the getting errors: To print the sql go to folder : app\code\core\Mage\Catalog\Model\ and open file Layer.php search the function : and replace : to and save and run front page again… you will see all Sqls are…
-
Retrieving all URL paths in Magento
Magento comes with built in function for retrieving URL paths. Function is called getBaseUrl() and its located under Mage class. However, function is not documented as it should be. Documentation only states that function retrieves $type parametar which is by default equal to “base”. Here is the list of all the available parameters I found.…
-
Calling a static block in phtml template file
First create a static block from admin >> CMS >> static blocks and write this code in your phtml file : Tweet This Post
-
Magento admin login page problem
Hi magento developers, if you are getting problem in login in admin panel after fresh magento installation on your system then I have a solution for magento version 1.4.x.x go to: app/code/core/Mage/Core/Model/Session/Abstract and open up varien.php, and comment the lines from 77 to 94 so it will look like: and save it and now try…
-
Get the current currency code and symbol in magento
I have tried many times but I didn’t got success . But today I got the solution to show the currency symbol of product price: Currency Code : <?php echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?> Currency Symbol : <?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); ?> Tweet This Post