Skip to main content

Posts

indian Pin code Validation

<html> <head> <title>Sample Code</title> <script type="text/javascript"> function CheckIndianZipCode(MyZipCode) {        var CheckZipCode = /(^\d{6}$)/;        if(CheckZipCode.test(MyZipCode))        {              document.getElementById('p1').innerHTML ="valid";        }        else        {              document.getElementById('p1').innerHTML ="Your Entered Zip Code Is Not Valid.";        } } </script> </head>       Enter String : <input type="text" name="txtOriginal" onKeyup="CheckIndianZipCode(this.value);" /><br> <p id="p1">Hello Ankur</p>

Get all product attributes for a magento object using SQL

Sometimes you may want to quickly compare all of the attributes that object (category / product) has in magento. The EAV structure of the database makes this difficult to do this simply, so this is a query that will do it for you SELECT * FROM ( SELECT ce . sku , ea . attribute_id , ea . attribute_code , CASE ea . backend_type WHEN 'varchar' THEN ce_varchar . value WHEN 'int' THEN ce_int . value WHEN 'text' THEN ce_text . value WHEN 'decimal' THEN ce_decimal . value WHEN 'datetime' THEN ce_datetime . value ELSE ea . backend_type END AS value , ea . is_required AS required FROM catalog_product_entity AS ce LEFT JOIN eav_attribute AS ea ON ce . entity_type_id = ea . entity_type_id LEFT JOIN catalog_product_entity_varchar AS ce_varchar ON ce

Add multiple file/images in magento custom module

For upload multiple files, first we have to change input type in Abstract.php  go to lib/Varien/Data/Form/Element/Abstract.php look for function and replace  public function getElementHtml()     { if($this->getType()=='file' && $this->getMultiple())         $_multiple = ' multiple'; $html = '<input id="'.$this->getHtmlId().'" name="'.$this->getName()          .'" value="'.$this->getEscapedValue().'" '.$this->serialize($this->getHtmlAttributes()).$_multiple.'/>'."\n"; $html.= $this->getAfterElementHtml(); return $html;     } now open form.php in your module say: app/code/community/module name/namespace/Block/Adminhtml/Libraryfile/Edit/Tab/Form.php add field: $fieldset->addField('file_path', 'file', array( 'label' => Mage::helper('libraryfile')->__('File'), '

connect20.magentocommerce.com:443 Error while installing any extension

 use this code   in   downloader/lib/Mage/HTTP/Client/Curl.php <?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage * @package Mage_HTTP * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Op