Posts

How to add a text counter in textarea or Setting a maxlength on a textarea?

if you want to add text counter your textarea and set the Setting a maxlength on a textarea. so simply add this code in file and run the file in your browser <form name="textcount" id="textcount"> <textarea cols="60"  rows="12" class="input_compose_textarea" id="description" name="description" onkeypress="textCounter(this,this.form.counter,500);" onblur="textCounter(this,this.form.counter,500);"></textarea> <br/> Max length - <input    type="text" readonly="readonly"    name="counter"    maxlength="3"    size="3"    value="500"    onblur="textCounter(this.form.counter,this,500);"> char remaining. </form> <script type="application/javascript"> function textCounter( field, countfield, maxlimit ) { if ( field.value.length > maxlimit ) { field.value = field.va

How to Check if current page is Homepage or not in magento?

Simply add this code in your page this code will check if current page is Homepage or not in magento. <?php if($this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true))): echo "yes homepage of magento"; else: echo "this is not Homepage"; endif; ?>

How to remove right column from product details page in magento?

go to this directory app/design/frontend/base/default/layout/ open catalog.xml and search  <label>Catalog Product View (Any)</label> you can find this line around 180 line of this page code will be like this <catalog_product_view translate="label">         <label>Catalog Product View (Any)</label>         <!-- Mage_Catalog -->         <reference name="root">             <action method="setTemplate"><template>page/2columns-right.phtml</template></action>         </reference> change 2columns-right.phtml to 1column.phtml  <catalog_product_view translate="label">         <label>Catalog Product View (Any)</label>         <!-- Mage_Catalog -->         <reference name="root">             <action method="setTemplate"><template>page/1column.phtml</template></action>         </reference&

How to get the path of downloadable product's file of associated product or group product which was upload during add downloadable product?

How to get the path of  downloadable product's file of associated product or group product which was upload during add downloadable product? This will return you full path of downloadable product  $file =''; $home_url = Mage::helper('core/url')->getHomeUrl(); $static_path = $home_url."media/downloadable/files/links"; $productLinks = $ $product ->getTypeInstance(true)->getLinks($product); foreach($productLinks as $key=>$val) {       $val = trim($productLinks[$key]->link_file);         if($val!='')         {         $file = $val;         }         else         {         $file = '';         } } echo $file_path = $static_path.$file;

HOW TO GET GET BASE URL, SKIN URL, GET MEDIA URL, GET STORE URL AND OTHER URLS IN MAGENTO?

HOW TO GET  GET BASE URL, SKIN URL, GET MEDIA URL, GET STORE URL AND OTHER URLS IN MAGENTO? HERE IS SOME USEFULL URL FOR YOU WHICH CAN HELP YOU TO USE THE DEFINE URL IN MAGENTO HOPE THIS WILL HELP YOU. To get Media URL {{media url='/sampleimage.jpg'}} To get Store URL {{store url='mypage.html'}} To get Base URL {{base url='yourstore/mypage.html'}} TO Retrieve URL path in PHTML Note: In editing PHTML don't forget to enclode the following code with PHP tag Not secure Skin URL: <?php echo $this->getSkinUrl('images/sampleimage.jpg') ?> Secure Skin URL <?php echo $this->getSkinUrl('images/ sampleimage.gif', array('_secure'=>true)) ?> Get  Current URL $current_url = Mage::helper('core/url')->getCurrentUrl(); Get Home URL $home_url = Mage::helper('core/url')->getHomeUrl(); Get Magento Media Url Mage::getBaseUrl(

How to know product type in magento?

How to know product type in magento that product is group or simple or downloadable. echo $product->getTypeId();

How to get the id of associated products in magento from the array of associated products?

Get the id of associated products in magento from the array of associated products. i was getting rid that i have array of associated product but unable to get the id of associated product. after so much search i found this solution check this it will works for you .... $associatedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product); foreach($associatedProducts as $assoc_id) { $aid = $assoc_id->getId(); echo "id of associated products is = ".$aid; echo "<br/>"; }