Add Invoice number field to order in admin section

michal.siman

No avatar

2007-03-13 20:29

I need add one field to order details in admin section for number of invoice. Now i add:


  
<tr>
    <
th>
      
$lang[Invoice_number]
    </
th>
    <
td>
      <
form action="" method="get" class="form">
        <
input type="hidden" name="p" value="$p" />
        <
input type="hidden" name="iOrder" value="$iOrder" />
        <
input type="hidden" name="sOption" value="save" />
        <
input type="text" name="iInvoice" class="input" maxlength="100" />
        <
input type="submit" value="$lang[save]" />
      </
form>        
    </
td>
  </
tr>



But what next? Can you give me a right way?

» Quick.Cart v2.x

treewood (OpenSolution)

Avatar: treewood

2007-03-14 07:52

michal.siman - oh ... it is little hard to do :( Go steps with saving status. You must save status, read status. It is big work

michal.siman

No avatar

2007-03-14 08:28

yes, i know.

i tried add this option to "dbSaveOrderStatus" function and add another one field to Change status form:


..
      <
form action="" method="get" class="form">
        <
input type="hidden" name="p" value="$p" />
        <
input type="hidden" name="iOrder" value="$iOrder" />
        <
input type="hidden" name="sOption" value="save" />
        <
select name="iStatus" class="input" >
          
$sStatusSelect
        
</select>
        <
input type="text" name="iInvoice" class="input" maxlength="100"/>
        <
input type="submit" value="$lang[save]" />
      </
form>        
..




if( !function_exists'dbSaveOrderStatus' ) ){
  
/**
  * Save order status to file
  * @return void
  * @param int    $iOrder
  * @param int    $iStatus
  */
  
function dbSaveOrderStatus$iOrder$iStatus$iInvoice ){
    
$aFile  fileDB_ORDERS );
    
$rFile  fopenDB_ORDERS'w' );
    
flock$rFileLOCK_EX );
    
$iCount count$aFile );

    for( 
$i 0$i $iCount$i++ ){
      if( 
$i ){
        
$aFile[$i]  = ereg_replace"\r"''$aFile[$i] );
        
$aExp       explode'$'$aFile[$i] );
        if( 
$aExp[0] == $iOrder )
          
$aFile[$i] = $aExp[0].'$'.$aExp[1].'$'.$iStatus.'$$'.$iInvoice.'$'."\n";
      }

      
fwrite$rFile$aFile[$i] );
    } 
// end for
    
flock$rFileLOCK_UN );
    
fclose$rFile );
  } 
// end function dbSaveOrderStatus



Now, i see one more field in order db, but is empty. Can you help me with next step please treewood?

treewood (OpenSolution)

Avatar: treewood

2007-03-14 13:17

michal.siman - better idea is to save it to DB_ORDERS_EXT or maybe will be easier save to another file for example db/orders_invoices.php and save to this for example:

$oFF->deleteInFileDB_ORDERS_INVOICE$iOrder);
$oFF->setRow$iOrder$iInvoice );
$oFF->addToFileDB_ORDERS_INVOICE ); 


After in order details to get Invoice use something like this:

$aInvoice $oFF->throwData(  DB_ORDERS_INVOICE$iOrder);
if( isset( 
$aInvoice ) ){
  
$iInvoice $aInvoice[1];
}

Back to top
about us | contact