Magento: Check & Get Secure URL

Here are the code snippets to check for different secure URLs in Magento. Secure URL can be enabled from configuration settings (System -> Configuration -> GENERAL -> Web -> Secure). Enable Secure URL in Frontend System -> Configuration -> GENERAL -> Web -> Secure -> Use Secure URLs in Frontend = Yes Enable Secure URL … Read more

Magento: Get currency code & currency rate

Here are the code snippets to get base currency code, default currency code, current currency code, all allowed currency code and current currency rate in Magento. Base currency is the currency that is used for online transaction from your store. Default currency is the currency used to display pricing in your store. Current currency is … Read more

Magento: Add Custom Selection List in System Configuration

This tutorial shows how to add a custom select list in configuration settings of a custom Magento module. Suppose, your module’s namespace is YourNamespace and your module’s name is YourModule. And, you want to add a selection list of Brands that contains mobile brand names like Samsung, Sony, Apple, etc. Here is the code to … Read more

Python: Print variable in human readable form like print_r in PHP

print_r prints a PHP variable into human readable form. The same can be achieved in Python using pprint module. Here is an example python code: from pprint import pprint student = {'Student1': { 'Age':10, 'Roll':1 }, 'Student2': { 'Age':12, 'Roll':2 }, 'Student3': { 'Age':11, 'Roll':3 }, 'Student4': { 'Age':13, 'Roll':4 }, 'Student5': { 'Age':10, 'Roll':5 … Read more

[SOLVED] Joomla: 404 error page after changing menu alias

Problem: The menus were working fine before. Then I changed alias of one menu. For example: I changed example.com/mymenu2 to example.com/mymenu3 Now, I am getting redirected to 404 error page on both for both of the above URLs. Solution: You can try Rebuilding the particular menu, clearing cache from Joomla admin, and/or clearing your browser’s … Read more

Ubuntu Linux: Increase decrease volume from command line & keyboard shortcut

Here are some linux commands (pactl and amixer) to increase and decrease volume. You can also use these commands to set keyboard shortcut to increase and decrease volume. pactl pactl command is used to control a running PulseAudio sound server. Increase volume by 10% pactl — set-sink-volume 0 +10% Decrease volume by 10% pactl — … Read more

Magento: [SOLVED] Mage_Eav_Model_Entity_Abstract setConnection() must be an instance of Zend_Db_Adapter_Abstract, string given

I got this error while I was installing a third party Magento module. Actually, the module was tested for higher Magento version than 1.4 and I had to install that module on Magento version 1.4. Cause: In older Magento versions, setConnection() function of Mage_Eav_Model_Entity_Abstract class expects the parameters only on Zend_Db_Adapter_Abstract type. Whereas, in newer … Read more

Magento: Clear / Delete Shopping Cart Items of Single or All Customers

Here is the code to delete all shopping cart items of currently logged in single customer: $cart = Mage::getSingleton('checkout/cart'); $quoteItems = Mage::getSingleton('checkout/session') ->getQuote() ->getItemsCollection(); foreach( $quoteItems as $item ){ $cart->removeItem( $item->getId() ); } $cart->save(); If you want to clear all shopping cart items of all customers then you can use the following code: $quoteCollection = … Read more