Change The Pasteboard Color In Photoshop

First  select Photoshop’s Paint Bucket Tool from the Tools palette. By default, it’s hiding behind the Gradient Tool  so you’ll need to click and hold on the Gradient Tool for a moment until a fly-out menu appears  then select the Paint Bucket Tool from the fly-out menu

Next, click on the Foreground color swatch in the Tools palette.

This brings up Photoshop’s Color Picker. Select whaterver color you want to use for the pasteboard. I’ll choose a shade of red.

Click OK once you’ve chosen a color to exit out of the Color Picker. Move your mouse cursor into the pasteboard area  hold down your Shift key  and click on the pasteboard. Instantly  the pasteboard changes to the new color.

Solve The % Calculation mistake in coupon code module

In Cre loaded when you set a % in coupon code at that time it will not count its properly the only mistake is
there is a no proper Operator Precedence in the coupon code module

in the includes/modules/order_total/ot_copuon.php

in the function credit_calculate()

find the code

$pod_amount = tep_round($pr_c*10,2)/10*c_deduct/100;

replace with this

$pod_amount = (((tep_round($pr_c*10,2)/10)*c_deduct)/100);

How to get Newsletter Subscribers in Magento using Script?

Step: – 1
Using the Magento Admin panel we can download/export the CSV file but it can’t satisfy the client requirement means that Sometimes, our clients want only following Fields in Newsletter Subscriber CSV file.

Subscriber id, First name, Last name and Email Address

For those requirements we have to customize Newsletter Module but It is very risky for our Store because any small mistake will block the site. So that following is the simplest method for Download/Export the CSV file.

Step: – 2


ini_set('max_execution_time', 600);
ini_set('memory_limit', '1024M');

require 'app/Mage.php';
$app = Mage::app('');

$myFile = "var/export/subscribers.csv";
$fp = fopen($myFile, 'w');

$columns = array('customers_firstname','customers_lastname','customers_email_address');

/* get Newsletter Subscriber whose status is equal to "Subscribed"    */

$sql = "SELECT * FROM newsletter_subscriber WHERE subscriber_status = 1";
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
foreach ($connection->fetchAll($sql) as $arr_row) {

$loademail = $arr_row['subscriber_email'];

$customer = Mage::getModel('customer/customer');

$fname = explode(',', $customer->getData('firstname'));
$lname = explode(',', $customer->getData('lastname'));
$email = explode(',', $customer->getData('email'));
$fname = $fname[0];
$lname = $lname[0];
$email = $email[0];
if ($fname=="" && $lname=="")
$subscribers = array('firstname'=>$fname,'lastname'=>$lname,'email'=>$email);

header('Content-disposition: attachment; filename=' . $myFile);
header('Content-type: application/text');

Step: – 3 Just Copy above code and paste it into you PHP file and put that file into Root Directory of your Magento Store.

Step: – 4 After completion of above all the steps run your PHP file Manually.

For ex:-
Assume that you php file name is “Newsletter.php” and domain name of your magento store is “; then write following URL.

Step: – 5 Save the generated file.

Posted in Magento. 1 Comment »

How to upload file using php?

Once I had a requirement to upload a file using php.
For that I used following sample code.

 <form name="newad" method="post" enctype="multipart/form-data">
 	<tr><td><input type="file" name="txtUploadFile" id="txtUploadFile"></td></tr>
 	<tr><td><input name="btnSubmit" id="btnSubmit" type="submit" value="Upload image"></td></tr>

  if (isset($_POST['btnSubmit']))
    if ($_FILES["txtUploadFile"]["error"] > 0)
      echo "Error: " . $_FILES["txtUploadFile"]["error"] . "<br />";
	  move_uploaded_file($_FILES["txtUploadFile"]["tmp_name"], "images/" . $_FILES["txtUploadFile"]["name"]);
	  echo "<h1>File Uploaded Successfully.</h1>";

Transfer a file over a secure FTP connection with Curl

curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP).
With help of php curl we can transfer a data from one connection to another connection there for we need to create code snippet like this.

     $username = your_ftp_username; 
     $password = 'your_ftp_password'; 
     $url = '’; 
     $ftp_server = "ftp://" . $username . ":" . $password . "@" . $url; 
     echo "initializing CURL.\n"; 
     $ch = curl_init(); 
     echo "Set CURL URL.\n"; 
     //curl FTP 
     curl_setopt($ch, CURLOPT_URL, $ftp_server); 
     //Remove slashes for  Debugging 
     //curl_setopt($ch, CURLOPT_VERBOSE, TRUE);    
     // Set SSL Settings 
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
     curl_setopt($ch, CURLOPT_FTP_SSL, CURLFTPSSL_TRY); 
     //List FTP files and directories (with only display list) 
     curl_setopt($ch, CURLOPT_FTPLISTONLY, TRUE); 
     //Output to curl_exec 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

     echo "Executing CURL.\n"; 
     $output = curl_exec($ch); 
     echo "Closing CURL.\n"; 
     echo  $output . "\n"; 
   // List output result
    $files = explode("\n", $output); 

Solve the The blank page of process_checkout problem in cre because of

some time there is a pull of buffer in php while doing the payment in
so checkout_process.php is not redirect the page to the checkout_success.php

so solve this problem at the end you find

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'order_id='. $insert_id.'&customer_id='.$_SESSION['customer_id'], 'SSL'));

To get the solution of this problem you have declare one variable before all the sessiojn unset in the file

$payment_type_authorize = $_SESSION['payment'];

and then redirect the page with javascript by applying the condition of if(

  if($payment_type_authorize == 'authorizenet') { ?>
<script language="javascript">
  window.location  = " <?php echo tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'order_id='. $insert_id.'&customer_id='.$_SESSION['customer_id'], 'SSL'); ?>";
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'order_id='. $insert_id.'&customer_id='.$_SESSION['customer_id'], 'SSL'));


How to crop/resize image using php with jquery?

Step 1: Your root folder is uploadcrop

Step 2: create uploadcrop ->upload_crop.php file with upload_crop.docx file code
Download upload_crop.php file from here

Step 3: Download and put below js files into uploadcrop ->js folder with jquery-pack.js and jquery.imgareaselect-0.3.min.js filenames.
Download jquery-pack.js file from here
Download jquery.imgareaselect-0.3.min.js file from here

Step 4: Create uploadcrop ->upload_pic folder and put iamge with resized_pic.jpg name.

Step 5: Run http://localhost/uploadcrop/upload_crop.php file and select your file from click on browse button.

Step 6: By default you can crop 100*100 resized image from the large image.

Step 7: You can also change cropped image size from upload_crop.php file line no. 10 and 11.

 $thumb_width = "100";					// Width of thumbnail image
$thumb_height = "100";					// Height of thumbnail image 

Step 7: When you click on Save thumbnail button your cropped image saved.

Posted in PHP. 1 Comment »