Search This Blog

Monday, 31 December 2012

Download a file using PHP script

Wednesday, 12 December 2012

Integrating with Facebook with Wordpress

1. Install the APP in Facebook http://apps.facebook.com/rssgraffiti/
a. This will just push the post to Face Book

2. Create an application in Facebook https://developers.facebook.com/blog/post/2012/06/12/facebook-integration-for-wordpress/ and Install the WP Extension http://wordpress.org/extend/plugins/facebook/
a. Like, Send, Subscribe buttons
b. WP Widgets for following:
i. Recommendations
ii. Recent Activity
iii. Like, Send, and Subscribe buttons.
c. Short codes for Like and Send buttons

Force URLs to lowercase with Apache rewrite and PHP

Force URLs to lowercase with Apache rewrite and PHP:
#### Add following code to HTaccess ###########
RewriteEngine on
RewriteBase /
# force url to lowercase if upper case is found
RewriteCond %{REQUEST_URI} [A-Z]
# Exclude images being redirected
RewriteCond %{REQUEST_URI} !(\.jpg|\.png|\.gif|\.css|\.jpeg|\.js|\.bmp|\.swf)$ [NC]
# ensure it is not a file on the drive first
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule (.*) rewrite-strtolower.php?rewrite-strtolower-url=$1 [QSA,L]


######## Create PHP file with name rewrite-strtolower.php and add the followinf code into that file. Place this php file smae folder as htaccess

if(isset($_GET['rewrite-strtolower-url'])) {
    $url = $_GET['rewrite-strtolower-url'];
    unset($_GET['rewrite-strtolower-url']);
    $params = http_build_query($_GET);
    if(strlen($params)) {
        $params = '?' . $params;
    }
    header('Location: http://' . $_SERVER['HTTP_HOST'] . '/' . strtolower($url) . $params, true, 301);
    exit;
}
header("HTTP/1.0 404 Not Found");
die('Unable to convert the URL to lowercase. You must supply a URL to work upon.');

Monday, 10 December 2012

Adding upload field in contact form and send as attachment


Adding upload field in contact form and send as attachment
http://www.blog.magepsycho.com/adding-upload-field-in-contact-form-and-send-as-attachment/

Create Dynamic CMS Navigation For Magento Frontend
http://www.blog.magepsycho.com/create-dynamic-cms-navigation-for-magento-frontend/


Merging registration form with default login page of magento (creating mini registration form)
http://www.blog.magepsycho.com/merging-registration-form-with-default-login-page-of-magento-creating-mini-registration-form/

Disable Local Modules:
Even you disable all the local modules using following code in app/etc/local.xml:
<disable_local_modules>true</disable_local_modules>

or

using following code in app/etc/modules/*.xml
<active>false</active>

How to check if customer is already logged in from another location?
http://www.blog.magepsycho.com/how-to-check-if-customer-is-already-logged-in-from-another-location/

Configuring Magento for Development / Debug Mode
http://www.blog.magepsycho.com/configuring-magento-for-development-debug-mode/

How to use WYSIWYG editor (TinyMCE) in custom Admin Magento Module
http://www.blog.magepsycho.com/how-to-use-wysiwyg-editor-tinymce-in-custom-admin-magento-module/

Updating product qty in Magento in an easier & faster way
http://www.blog.magepsycho.com/updating-product-qty-in-magento-in-an-easier-faster-way/

Using Magento header / footer outside of Magento
http://www.blog.magepsycho.com/using-magento-header-footer-outside-of-magento/

Usage of <can_be_empty> tag for system configuration multi-select field
http://www.blog.magepsycho.com/usage-of-can_be_empty-tag-for-system-configuration-multi-select-field/







Sunday, 9 December 2012

Adding a mass action to Magento Grid

http://www.blog.magepsycho.com/adding-new-mass-action-to-admin-grid-in-magento/

Adding a new button on order view page:
http://stackoverflow.com/questions/10691895/magento-add-button-to-sales-order-view-page-observer-event

Add a comments field to checkout page for the order:
http://www.magecorner.com/magento-order-comments/

Adding custom system config xml in Magento:
http://www.ecomdev.org/2010/10/27/custom-configuration-fields-in-magento.html

Adding a button to system configuration:
http://www.atwix.com/magento/add-button-to-system-configuration/


DB queries profiler:
Magento provides an ability for developers to track database queries. For this purpose you should use a built in DB resource profiler. It can help you to inspect database queries, detect the longest query, detect the slowest query, etc.. Here is a small example on how to use a DB profiler for your own needs :
$profiler = Mage::getSingleton('core/resource')->getConnection('core_write')->getProfiler();
foreach ($profiler->getQueryProfiles() as $query) {
    $queryTime[] = $query->getElapsedSecs(); // Get the query execution time
    $queryRaw[] = $query->getQuery(); // Get the query text
}