All posts by Sivakumar

Change Background Image Url Using Jquey

<script type="text/javascript">
    $('li.swatch').each( function() {
    var thumbnail_url = $(this).find('.thumbnail').css("background-image");  
    var src = thumbnail_url.split('thumbnail');
    var split_url = src[0].split('"');
    var split_url_link = split_url[1];
    var split_img = src[1].split('"');
    var split_img_link = split_img[0];
    var preview ="preview";
    var img_url = split_url_link+preview+split_img_link;
    $(this).find('.thumbnail').css("background-image", 'url('+ img_url+ ')')
    });
 
</script>

REMOVE INDEX.PHP FORM URL IN MAGENTO

 

Step1: Open the  .htaccess file in Magento Root folder:

 

Step2: find the code in .htaccess file

#Rewrite Base /magento/ . 
    Just replace it with
Rewrite Base /

 

Step3: Put this Code to below this lines:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>

Get url parameter jquery Or Get Query String Values In js

Step1:Get url parameter jquery Or Get Query String :

// Read a page's GET URL variables and return them as an associative array.
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

 

Step2: Get url parameter Or Get Query String Values :

//example site url
 
http://www.knowledgebags.com/get-url-parameter-jquery-or-get-query-string-values-in-js/?page_count=2
 
//get the parameter
var page_count = getUrlVars()["page_count"];

 

Display the Rating Star in Magento Pages

step1: Display the Rating Star in Magento Pages:

<?php
 
    $storeId = Mage::app()->getStore()->getId();
 
    $summaryData = Mage::getModel('review/review_summary')->setStoreId($storeId)  ->load($_product->getId());
 
?> 
 
<div class="ratings">
 
        <div class="rating-box">
 
            <div class="rating" style="width:<?php echo $summaryData['rating_summary']; ?>%"></div>            
 
         </div>
 
</div>

Get the Product Differnt Price in Magento

 

Step1: Get the Product Actual Price:

<?php 
   // without currency sign
   $_actualPrice = $_product->getPrice();
   echo $_actualPrice;
 
   // with currency sign
   $_formattedActualPrice = Mage::helper('core')->currency($_product->getPrice(),true,false); 
   echo $_formattedActualPrice;
?>

 

Step2: Get the Product Special Prices:

<?php
    // without currency sign
    $_specialPrice = $_product->getFinalPrice();
    echo $_specialPrice;
 
   // with currency sign
   $_formattedSpecialPrice = Mage::helper('core')->currency($_product->getFinalPrice(),true,false);
   echo $_formattedSpecialPrice;
?>

 

Step13 Get the Particular Product  Price:

<?php
   // particular product
    $_productId = 52;
    $_product = Mage::getModel('catalog/product')->load($_productId);
?>