Get Cart Quantity in Magento

You can get the number of items currently in the cart using the following code. $cart = Mage::getModel(‘checkout/cart’)->getQuote()->getData(); echo (int)$cart[‘items_qty’]; However,if the cart is empty, writing only the above code will show error (Because $cart[‘items_qty’] is only set when there are items on the cart). For that you need to check if the value is… Continue reading Get Cart Quantity in Magento

Zen Cart "Invalid Country Code" problem with shipping and payment module

While using Zen Cart a common problem is the countries table. A lot of Shipping and Payment module throws errors and the reason is the invalid country code. The Zen Cart countries table at id 74 stores country “France, Metropolitan” with countries_iso_code_2 => FX and countries_iso_code_3 => FXX The problem is the ISO does not… Continue reading Zen Cart "Invalid Country Code" problem with shipping and payment module

Displaying Customized Error Message CakePHP 1.2

When we provide the error message in a particular model, then after validating, CakePHP automatically displays that error message below the respective input control, by creating their own div and error message class. But we can also show the error message in our own style using error function of form helper ($form->error()). Suppose there is… Continue reading Displaying Customized Error Message CakePHP 1.2

Write MySQL Database Query in Magento

If you need to execute a MySQL query anywhere in Magento (in the .php code files or .phtml template files), the following steps are required – $conn = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’); $conn->query(“insert into table name (fields) values (values) “);

Zen Cart debugmode – how to show errors on screen

To show the PHP errors on screen for debugging Zen-Cart follow these steps – 1. In folder /includes/local/ , create file configure.php 2. On it write – define(‘STRICT_ERROR_REPORTING’, true); That would show you the PHP errors on screen. To turn it off simple replace the true with false.

Creating a new page in Zen Cart

To create a new page in Zen Cart follow the below steps. We will be creating a new page called new_page and it will be accessible via browser using the following link http://www.your-zen-cart.com/index.php?main_page=new_page 1. Go to includes\modules\pages\ Create a folder new_page (the folder name should be same as the name of the page) Inside it… Continue reading Creating a new page in Zen Cart

How to import a controller in CakePHP

Suppose we have a controller named pages_controller.php, in which there is a function named index(). Now we are working in an another controller named users_controller.php, and we want to use the index function defined in Pages Controller. App::import(‘Controller’, ‘Pages’); class UsersController extends AppController { var $Pages; function beforeFilter() { $this->Pages =& new PagesController; /*Loads the… Continue reading How to import a controller in CakePHP

Javascript Visual Effects With Scriptaculous (script.aculo.us)

If you are using Prototype as your javascript framework (even if you are not using it) and want some out of the box user interface effects you can try Scriptaculous (script.aculo.us). It is an add-on for Prototype and is really light and handy. Try out the following links site : http://script.aculo.us/ quick start guide and… Continue reading Javascript Visual Effects With Scriptaculous (script.aculo.us)

Remove unwanted menu from Joomla Administrator

In Joomla Administrator, for removing the quick icons from the control panel :Go to the \administrator\modules\mod_quickicon\mod_quickicon.php and comment out the quickiconButton. For removing the menus and submenus from the Administrator main menu tab :Go to the \administrator\modules\mod_menu\helper.php and comment out the unwanted menu or submenu sections.