Magento CheatSheet

September 21, 2011  |  No Comments  |  by Raj (MagePsycho)  |  Latest, Magento

I have been using this great cheat-sheet from my initial days of Magento development.
Hope you will find this useful too.

Download CheatSheet
Thanks Vinai for providing this great cheatsheet for Magento Developer.

Cheers!!

Usage of ob_start() in fixing onepage checkout issues

September 21, 2011  |  3 Comments  |  by Raj (MagePsycho)  |  Latest, Magento, PHP

Onepage checkout steps are so sensitive that even a single character echo’ed from anywhere (due to some mistakes or php errors) will make your checkout steps not working.

I just recently faced one issue: Onepage checkout was not redirecting to order confirmation page after clicking on Place Order button (Review Page). When i checked the console via firebug i found the following ajax response:
f{"success":true,"error":false}
You can note there there is extra character ‘f’ which makes the json response invalid and the opcheckout.js can’t operate properly & hence no further redirection to third party or order confirmation page.

Since the client was in rush, i solved the issue using the concept of ob_start() function of php as:
File: app/code/core/Mage/Checkout/OnepageController.php

public function saveOrderAction()
{
	ob_start();
	//....
	$outputBuffer = ob_get_contents();
	ob_end_clean();
	Mage::log('outputTrapped::' . $outputBuffer, null, 'onepagecheckout.log');
	$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}

By using the ob_start() on the start of the function, output are captured in the buffer instead of direct output to the browser.

I know best bet is to find the related place and prevent the direct output to the browser but i just posted this as an example on dealing with ob_start() in case of onepage checkout steps.

Hope this gave some idea.

Hello world!

September 17, 2011  |  No Comments  |  by Raj (MagePsycho)  |  Javascript, jQuery, Latest, Linux, Magento, Mysql, PHP, Web Service

Dear All
I am trying to share my knowledge gained so far in web development fields from now onwards via this blog.
I will be sharing stuffs related to PHP/Mysql, Magento & more.
Well nothing more to say, just stay tuned with my blog 🙂

Lastly, your suggestion/feedback is always valuable and will make my blog alive.

This much for now.
Thanks