Always give you support successfully

Jun

22

2012

Recently we face an issue to show magento product images maintain aspect ratio.  Finally we found the exact solutions that we needed. I think this articles will help you for solve your problem.

Following code for magento product image with aspect ratio:

$this->helper('catalog/image')->init($_product, 'image')->constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(204, NULL);

Please share your comments & let us know if you have any suggestion.

Thanks

FacebookTwitterDiggMore...

Jun

20

2012

First you need to create a javascript function for get all variables.

http://www.example.com/index.php?name=jon&gender=male // Sample Valid URL for this example

function getcurrenturlparams()
{
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(‘=’);
params.push(hash[0]);
params[hash[0]] = hash[1];
}
return params;
}

Explain above Code: In getcurrenturlparams() functions hashes return all variables array with variable name= variable value start from “?” & it is divided by “&”. It will returns like:

<pre>name=jon
gender=male

In for loop it will get variable name & vlaue in params array.Like: params[name];
Now if you want to get single variable value Please call your vaiables likes below:

var name = getcurrenturlparams()["name"];
if((name != "") && (typeof name != 'undefined')){
 alert(decodeURI(name)); // Alert jon
}

Hope this will help you.
N.B: Only possible this example like above sample URL

FacebookTwitterDiggMore...

Jun

15

2012

I faced few time Internal Server Error 500 to install new Magento & upload complete Magento Store in server. I got the few solutions. I’m sharing with you. I hope it will help if you face this error.
See Below Solutions:
First: You can change magento root index.php file permission 755

If show same error please try below.
Second: Change all file permission 644 & all folders permission 755/ You can change all folders& file permission 777

If not fix you can change in .htaccess file. Please try below.
Third: Comment out hash
From

#RewriteBase /

To

RewriteBase /

You may also change your magento root .htaccess file.
Change
From

Options +FollowSymLinks

To

Options +SymLinksIfOwnerMatch

Thanks

FacebookTwitterDiggMore...

Jun

4

2012

One of my client project needed create 2 lines menu from single line long menu text.  I was little bit worry because all menu are coming dynamically from system. Finally I solve my problem using Jquery. Now I want to share my experience with all of you.

<ul id="nav">
<li> <a href="#"><span>First Menu Item</span></a></li>
<li> <a href="#"><span>Second Menu Item</span></a></li>
<li> <a href="#"><span>Menu3</span></a></li>
<li> <a href="#"><span>Fourth Menu Item</span></a></li>
</ul>

Above menu item multiple words dynamically add line break(<br/>) after first word by separate space. Single word menu item will not add line break above codes. Jquery codes are below:

<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(function() {
jQuery('#nav > li > a > span').each(function () {
var str = jQuery.trim(jQuery(this).text());// Get Menu Item Text
var sid = str.split(" ");// Separate menu text by space
var i;
var menuval="";

if(sid.length>1){
for(i=0;i<sid.length;i++){ // Loop for menu item parts
if(i==0){
menuval+=sid[i]+"<br/>"; //Here add <br/> after first words
}else{
menuval+=" "+sid[i];
}
}
jQuery(this).html(menuval);
}
});
});
// ]]>
</script>

Output shown below:

<ul id="nav">
<li> <a href="#"><span>First<br/> Menu Item</span></a></li>
<li> <a href="#"><span>Second<br/> Menu Item</span></a></li>
<li> <a href="#"><span>Menu3</span></a></li>
<li> <a href="#"><span>Fourth<br> Menu Item</span></a></li>
</ul>

Home this will help you…:)

Thanks

FacebookTwitterDiggMore...