Saturday, 6 June 2015
jQuery : Check radio button is checked or not
jQuery
/*Check Radio button is checked or not*/
<script type="text/javascript">
if(jQuery('#id1').is(':checked')==true)
{
/*Something Code*/
}
else
{
/*Something Code*/
}
</script>
<script type="text/javascript">
if(jQuery('#id1').is(':checked')==true)
{
/*Something Code*/
}
else
{
/*Something Code*/
}
</script>
jQuery : Remove or Delete value from the array
Hello Friends,
Here, Using jQuery remove the Value and index from the array !
/*Remove Values and index from Array*/
/*Array['Apple','Banana','Lemon']*/
I hope this will helpful to you !
Thanks
Here, Using jQuery remove the Value and index from the array !
/*Remove Values and index from Array*/
jQuery
var sample_array = new Array('Apple','Banana','Mango','Lemon');
var val = "Mango";
remove_item(sample_array,val);
var remove_item = function (arr, value) {
var b = '';
for (b in arr) {
if (arr[b] === value) {
arr.splice(b, 1);
break;
}
}
return arr;
}
/*Result will be*/var val = "Mango";
remove_item(sample_array,val);
var remove_item = function (arr, value) {
var b = '';
for (b in arr) {
if (arr[b] === value) {
arr.splice(b, 1);
break;
}
}
return arr;
}
/*Array['Apple','Banana','Lemon']*/
I hope this will helpful to you !
Thanks
jQuery : Check image exist or not on location
Hello Friends,
Sometimes we need to check, Is file is exist or not on particular location?
So, for this using below method we can check the file is exist or not !
Sometimes we need to check, Is file is exist or not on particular location?
So, for this using below method we can check the file is exist or not !
jQuery
<script type="text/javascript">
function imageExists(url, callback) {
var img = new Image();
img.onload = function() { callback(true); };
img.onerror = function() { callback(false); };
img.src = url;
}
function onload(id) /*This function will use while Mouseover event */
{
var imageUrl = "Image File URL";
imageExists(imageUrl, function(exists) {
if(exists==true){
/*Something Code here*/
}else{
/*Something Code here*/
}
});
}
</script>
function imageExists(url, callback) {
var img = new Image();
img.onload = function() { callback(true); };
img.onerror = function() { callback(false); };
img.src = url;
}
function onload(id) /*This function will use while Mouseover event */
{
var imageUrl = "Image File URL";
imageExists(imageUrl, function(exists) {
if(exists==true){
/*Something Code here*/
}else{
/*Something Code here*/
}
});
}
</script>
PHP : Get Array of CSV file in PHP
Hello Friends,
Method 2::
Here, second method for read the CSV file, its returns Array of the CSV data !
If you want to read CSV line by line you can use Method 1 also,
Also, need to get PHP array to jQuery refer this Link,
May this help you !
Method 2::
Here, second method for read the CSV file, its returns Array of the CSV data !
PHP
<?php
$file = "Path of File Name";
$csv = new Varien_File_Csv();
$data = $csv->getData($file);
Print_r($data); /*This will give Array of CSV file data*/
?>
$file = "Path of File Name";
$csv = new Varien_File_Csv();
$data = $csv->getData($file);
Print_r($data); /*This will give Array of CSV file data*/
?>
If you want to read CSV line by line you can use Method 1 also,
Also, need to get PHP array to jQuery refer this Link,
May this help you !
PHP : Read PHP array using jQuery JSON
Hello Friends,
I got this method after so many surfing, I hope this will help you for read PHP array to the jQuery.
Using this can get the PHP array in JavaScript array!
Hope, this will useful to you !
I got this method after so many surfing, I hope this will help you for read PHP array to the jQuery.
Using this can get the PHP array in JavaScript array!
PHP
<?php
$file = "Path of File Name";
$csv = new Varien_File_Csv();
$data = $csv->getData($file);
Print_r($data); /*This will give Array of CSV file data*/
?>
<script type="text/javascript">
var sample = new Array();
var vals = 'sample ';
sample [vals] = '<?php echo json_encode($data) ?>';
var sample_data = JSON.parse(sample ["sample"]);
</script>
$file = "Path of File Name";
$csv = new Varien_File_Csv();
$data = $csv->getData($file);
Print_r($data); /*This will give Array of CSV file data*/
?>
<script type="text/javascript">
var sample = new Array();
var vals = 'sample ';
sample [vals] = '<?php echo json_encode($data) ?>';
var sample_data = JSON.parse(sample ["sample"]);
</script>
Hope, this will useful to you !
Thursday, 16 April 2015
Magento : Display product image in order transaction mail
Hi, Some Time client want some extra, just like here,
For set Product image with the mails in Magento you need to follow just 2 change for that
1) File for Edit : app/design/frontend/base/default/template/email/order/items.phtml
After the below mentioned line
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>
Add this,
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Image') ?></th>
2) File for Edit :
app/design/frontend/base/default/template/email/order/items/order/default.phtml
After the below mentioned line
<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->escapeHtml($this->getSku($_item)) ?></td>
Add this,
<td align="center" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
<img src="<?php echo $this->helper('catalog/image')->init(Mage::getModel('catalog/product')->load($_item->getProductId()), 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" />
</td>
Now, Go to admin and Clear Cache, Make Order you got the Product image also with order !
Subscribe to:
Posts (Atom)