Category Archives: Magento

Magento Currency Switcher Is Not Working If Products In Cart

I have added currency switcher on My Magento cart page, however when I change the currency if there are any products in the cart, Its returning 503 error or the blank page.

Usually, It is caused by following codes from any extensions/theme which will be used/executed on the current page

The reason is if you added products to the cart and change currency, an infinite loop of getting the quote items will be executed.

Try to find the above codes from your extensions or theme and replace with the following codes

Magento How To Filter Product Search Result By Category

How can I filter product search result by category, e.g I would like product search result only come from a specific category

You can use “addCategoryFilter” method to filter the product collection by a specific category from app/code/local/Mage/CatalogSearch/Model/Layer.php

P.S You can copy the file from “core” folder to “local” folder

How To Retrieve Saved Magento Session Value

How can I retrieve the Magento session value which I have saved in the past

You need to load Magento core/session object and call get method (based on what you have set when you are saving the Magento Session) to retrieve the Magento Session value

Saving the session value

Mage::getSingleton(“core/session”)->set[YOUR SESSION NAME]();

Retrieving the session value

Mage::getSingleton(“core/session”)->get[YOUR SESSION NAME]();

Here is the example

How To Save Value Into The Magento Session

How can save data into a Magento session object

You need to load Magento core/session object and call setValue method to save data into a Magento session object

How To Get Current Magento Category

How can I get current Magento category and retrieve the category ID

You can use method “getCurrentCategory” to retrieve the current Magento category and use getId to find out the current Magento category ID

How To Include Magento Block In CMS Page

How can I add or include the Magento block in Magento CMS page

Here is the example of how to include or add the Magento block in Magento CMS page

How To Save Data In Magento Cache Object

How can I store the info to the Magento cache object

You can init Magento cache object first and save data into the Magento cache object. Here is the example