michal.siman 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 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 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 = file ( DB_ORDERS ); $rFile = fopen ( DB_ORDERS , 'w' ); flock ( $rFile , LOCK_EX ); $iCount = count ( $aFile ); for( $i = 0 ; $i < $iCount ; $i ++ ){ if( $i > 0 ){ $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 ( $rFile , LOCK_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?
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 -> deleteInFile ( DB_ORDERS_INVOICE , $iOrder , 0 ); $oFF -> setRow ( $iOrder , $iInvoice ); $oFF -> addToFile ( DB_ORDERS_INVOICE );
After in order details to get Invoice use something like this:
$aInvoice = $oFF -> throwData ( DB_ORDERS_INVOICE , $iOrder , 0 ); if( isset( $aInvoice ) ){ $iInvoice = $aInvoice [ 1 ]; }