JQuery – Ajax request with jQuery

Perform an Ajax request with jQuery: jQuery.ajax({ url: ‘url_of_ajax_request’, success: function(response) { alert(‘Response from url is: ‘ + response) } }); Source: JQuery Ajax

Magento get parameters

Get a parameter value: $paramValue = $this->getRequest()->getParam($paramName); Get all parameters and values: $allParams = $this->getRequest()->getParams();

Magento get subcategories

Get subcategories of a main category: $_cat = Mage::getModel(‘catalog/category’)->load($cat_id); $_subcats = $_cat->getChildrenCategories(); foreach ($_subcats as $subcat) { echo “<h1>” . $subcat->getName() . “<h1>”; } Get…

Magento Installation – 404 not found

Hack to solve the “404 Not Found error” after magento installation: Replace in the original index.php: Mage::run(”); with Mage::run(‘default’); Instead of ‘default’ can be used…

Magento – TinyMCE Image Uploader / Image incorrect URL

Small hack in file: app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php to correct image url from something like: <img src=”http://www.mysite.com//index.php/admin/cms_wysiwyg/directive/___directive/e3ttZWRpYSB1cmw9Ii9jbGFzc2lmaWVkVUwuanBnIn19/key/f90eef374eaee0f5b76fc9783680c059/” /> into the correct image url. public function getImageHtmlDeclaration($filename, $asIs =…

MySQL – create user and grant all privileges

Create user with mysql command: CREATE USER ‘username’@’localhost’ IDENTIFIED BY ‘password’; Add all privilleges to databases for user: GRANT ALL ON *.* TO ‘username’@’localhost’;