Method

/**
 * W3NextApps
 * @category   Modification
 * @package    ItemCode Barcode Generator EAN8
 * @copyright  Copyright 2013 W3NextApps
 * @license    http://w3nextapps.com/terms
 * @author     Jomar
 */

HOW TO :

1. FILE TO EDIT : inventory/manage/items.php

2 LOOK FOR THIS LINE :

  
   text_row(_("Item Code:"), 'NewStockID', null, 21, 20);
   REPLACE WITH :
   $tmpBarcodeID="";
	 if ( $_POST['generateBarcode'] )
	      {
	      $tmpBarcodeID=generateBarcode();
        }
	 text_row(_("Item Code:"), 'NewStockID', $tmpBarcodeID, 21, 20);
	 echo '<td /><td >';
         echo '<button class="ajaxsubmit" type="submit"aspect=\'default\'  name="generateBarcode"  id="generateBarcode" value="Generate Barcode EAN8"> Generate EAN-8 Barcode </button>';
         echo '</td >';

3. LOOK FOR THIS LINE :

   end_page(@$_REQUEST['popup']);
   AFTER THE ABOVE LINE, INSERT THIS :
   
   function generateBarcode() {
   		$tmpBarcodeID = "";
   		$tmpCountTrys = 0;
		  while ($tmpBarcodeID == "")	{
  			srand ((double) microtime( )*1000000);
  			$random_1  = rand(1,9);
  			$random_2  = rand(0,9);
  			$random_3  = rand(0,9);
  			$random_4  = rand(0,9);
  			$random_5  = rand(0,9);
  			$random_6  = rand(0,9);
  			$random_7  = rand(0,9);
  			$random_8  = rand(0,9);

  			$tmpBarcodeID = $random_1 . $random_2 . $random_3 . $random_4 . $random_5 . $random_6 . $random_7 . $random_8;

  			// LETS CHECK TO SEE IF THIS NUMBER HAS EVER BEEN USED
        $query = "SELECT stock_id FROM ".TB_PREF."stock_master WHERE stock_id='" . $tmpBarcodeID . "'";
        $arr_stock = db_fetch(db_query($query));

	      if (  !$arr_stock['stock_id'] ) {
	            return $tmpBarcodeID;
	          }
	        $tmpBarcodeID = "";	 
      	}  		
    }