Convert long url to short url using tinyurl api

Tinyurl provides us a short and simple service to convert long URL to small(tiny) URL. We can send email without link breakage.Here is the tinyurl api to get shorten url. You can use any of the method. Method 1: Use file_get_contents to fetch tinyurl. echo file_get_contents(‘http://tinyurl.com/api-create.php?url=http://www.websnippetz.com’); file_get_contents is not working? If your are able to […]

Read More…

Modify item price in cart after placing order using sales_quote_add_item

We can easily modify product price after placing order in magento using the event sales_quote_add_item. We can see this hook registered in app/code/core/Mage/Sales/Model/Quote.php line:874. This is the event created by magento.Mage::dispatchEvent(‘sales_quote_add_item’, array(‘quote_item’ => $item)); We can access $item values using its registered event name sales_quote_add_item and we can modify the price with our logic. Follow […]

Read More…

Send email from xampp localhost

Send email from xampp localhost. Follow the easy steps Goto http://glob.com.au/sendmail/, download latest sendmail package. Extract the zip file and copy the files into your xamppsendmail folder(Replace every file in the existing folder). Update the sendmail.ini file in sendmail folder with the following details, and make sure it is not commented(;). smtp_server=smtp.gmail.comsmtp_port=25error[email protected][email protected]com Here i have […]

Read More…

Unzip file in server using PHP ZipArchive

Once i wanted to upload WordPress folder which contains 1000’s of files, if i choose to upload those files using FTP it will take much time.So i decided to upload it as zip file and extract it using php code. After googling i got a good source, how to extract / unzip file in server. […]

Read More…

Override magento controller

Modifying magento core file is not at all good idea. All core files that we have modified will be smashed while magento upgrade.Magento have a feature to keep our custom code in local(app/code/local) folder. Inside that folder we can keep our custom codes safely.There are 2 way to override magento core module. Create same folder […]

Read More…

Delete single order in magento using SQL query

Here is the query to delete single order in magento. All we need to do is just replace ‘xxxxxxxxx’ with your order_id and run it in phpMyAdmin. It works fine in Magento 1.4.x and 1.7.x version. SET @orderId = ‘XXXXXXXXX’; #replace this WITH your ORDER NUMBERSET FOREIGN_KEY_CHECKS = 1;DELETE FROM sales_flat_order WHERE increment_id = @orderId;DELETE […]

Read More…