Image resize script – PHP

<?php
 class SimpleImage {
 function resizeImage($max_width,$max_height,$url,$destination){
  $quality = 95; $source_pic = ''.$url.'';
  $src = imagecreatefromjpeg($source_pic);
  list($width,$height)=getimagesize($source_pic);
  $x_ratio = $max_width / $width; $y_ratio = $max_height / $height;
  if( ($width <= $max_width) && ($height <= $max_height) ){
   $tn_width = $width; $tn_height = $height; }
  elseif (($x_ratio * $height) < $max_height){
   $tn_height = ceil($x_ratio * $height); $tn_width = $max_width; }
  else {
   $tn_width = ceil($y_ratio * $width); $tn_height = $max_height; } $tmp=imagecreatetruecolor($tn_width,$tn_height);
  imagecopyresampled($tmp,$src,0,0,0,0,$tn_width, $tn_height,$width,$height);
  imagejpeg($tmp,$destination,$quality); imagedestroy($tmp);
 }
}
 $image = (object) new resizeImage();
 $image->resizeImage(100,80,$source,$destination);
?>

Use a Coupon Code for Specific Products – Magento

In our Magento ACP, simply click on Shopping Cart Price Rules (Which is under the top menu “Promotions”) – and then click Add New Rule.
On the left you can see three tabs, in the uppermost one you’ll have to name your Price Rule, choose which website it will be activated on and what customers will see it, and also name the actual coupon code itself.

Then click on the next tab entitled “conditions” which is the important one, as this area specifies which products/categories will be available for the promotion. So, click the little green plus, and then select “Product Attribute Combination” .

After that again click on the next green button and select the option “SKU”(A unique name given to each products) from the dropdown .
Then modify the value of “IS” to “IS ONE OF” and the click on the small rectangular box (which is white in color ) .

You can all the products added . please sleect the products for which you want to add promotion .

Further click on the next tab “Action” where you have to mentoned discount amounnt and all .

Save all these details and inform the users about this promotion by sending newsletter

Latest tweets in your site – PHP

<?php

$username=”tppramod”; // Your Twitter username

$limit=10;//Number of tweets

if(!is_numeric($limit)){$limit = 10;}

$xml = simplexml_load_file(‘http://search.twitter.com/search.atom?q=from%3A’.urlencode($username));?>

<table>

<?php for($i=0;$i<$limit;$i++){

if(empty($xml->entry[$i]->content)) break;

$attr = $xml->entry->link[1]->attributes();

?>

<tr> <td> <img src=”<?php echo $attr[‘href’]; ?>” /> </td> <td style=” font-size:12px;”> <?php echo  $xml->entry[$i]->content; ?> </td> </tr>

<?php } ?>

</table>

Add the block “Based on your selection, you may be interested in the following items ” – Magento

1) In the Admin Panel, select Catalog > Manage Products.
2) Select the product you wish to configure cross-sell products for by clicking its respective row.
3) Click on  the Cross-sells tab from the left side panel.
4) Click on the button “Reset Filter” and select the products to be listed
5)Once cross-sell products are selected, click Save at the top right of the page.
6) Clear your cache and refresh the product information page to assure that it’s working to your satisfaction.

How to add cross-sell to a product – Magento

1) In the Admin Panel, select Catalog > Manage Products.
2) Select the product you wish to configure cross-sell products for by clicking its respective row.
3) Click on  the Cross-sells tab from the left side panel.
4) Click on the button “Reset Filter” and select the products to be listed
5)Once cross-sell products are selected, click Save at the top right of the page.
6) Clear your cache and refresh the product information page to assure that it’s working to your satisfaction.