Thursday, June 6, 2013

server-side GZIP Script in php (define in .htaccess file)

#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
#End Gzip

Tuesday, June 4, 2013

Export Db as zip

Export Zip files

JQuery date picker

Date Picker

PHP Email Validation

<?php
$email_a = 'joe@example.coddddm';
$email_b = 'bogus';

if (filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
    echo "This (email_a) email address is considered valid.";
}
if (filter_var($email_b, FILTER_VALIDATE_EMAIL)) {
    echo "This (email_b) email address is considered valid.";
}
?>

PHP Script to for global timezone dropdown

Timezone Dropdown

PHP Script to export database.

Export Database

Friday, May 31, 2013

Jquery form submit and image upload through ajax

<a href="http://docs.google.com/file/d/0B4nDLq9K61UvaFhmQk15TEhwVkU/edit?usp=drive_web" target="_blank" class="fileitem-linked" rel="noreferrer">jquery-image-upload.zip</a>

CSS Hack for Google Chrome,Safari,ie7,ie8

@media screen and (-webkit-min-device-pixel-ratio:0)
{
.classname{ background:#ccc; } /*It will works on Google chrome and safari */
}

IE7

.classname{*background:#ccc; } /*It will works on IE7 */
.classname{background:#ccc \9; } /*It will works on IE8 */

Use Mini-Login in Header or anywhere you want!

add in app/design/frontend/default/default/layout/page.xml :
 <block type="customer/form_login" name="mini_login" template="customer/form/mini.login.phtml" />

Then, you just have to call the module : <?php echo $this->getChildHtml('mini_login'?>

Display total weight of cart in the magento

$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();

$weight = 0;
foreach($items as $item) {
    $weight += ($item->getWeight() * $item->getQty()) ;
}

echo $weight;

How to Set Registration Block on Home Page ?

{{block type="Mage_Customer_Block_Form_Register" template="customer/form/register.phtml"}}