Always give you support successfully

Jul

22

2012

Get Product Image With Aspect Ratio In Magento

Uncategorized

Comments Off on Get Product Image With Aspect Ratio In Magento

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...

Jul

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:

&lt;pre&gt;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 != "") &amp;&amp; (typeof name != 'undefined')){
<%%KEEPWHITESPACE%%> alert(decodeURI(name)); // Alert jon
}

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

FacebookTwitterDiggMore...

Jul

15

2012

Internal Server Error 500 solved in Magento

Uncategorized

Comments Off on Internal Server Error 500 solved in Magento

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...

Jul

4

2012

How to add line break in long srting by Jquery?

Uncategorized

Comments Off on How to add line break in long srting by Jquery?

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.

</pre>
<ul id="nav">
 	<li>First Menu Item</li>
 	<li>Second Menu Item</li>
 	<li>Menu3</li>
 	<li>Fourth Menu Item</li>
</ul>
<pre>

Above menu item multiple words dynamically add line break(
) 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:

</pre>
<ul id="nav">
 	<li>First
Menu Item</li>
 	<li>Second
Menu Item</li>
 	<li>Menu3</li>
 	<li>Fourth
Menu Item</li>
</ul>
<pre>

Home this will help you…:)

Thanks

 

FacebookTwitterDiggMore...