Payment ID or NAME in Orders List

Deivids

Avatar: Deivids

2014-12-17 16:57

Hello. I would like to have payment id or name in my orders list in every line. When I insert something like

$aData['iPayment']

, nothing happens. What should I do more? Please give me a complete solution. Thank you.

» Quick.Cart v6.x

boboo

Avatar: boboo

2014-12-17 19:43

First look into the _fields.php in /database/
In the $aOrdersFields there is neither field "iPayment" nor "sPayment".
No field for Payment nor Shipment.
They are in $aOrdersExtFields.

Then, when you look into the listOrdersAdmin function in /core/orders-admin.php, you will see, that the array $this-aOrders is created with "generateCache" function.
Looking at this function you see, that only one database will be read: DB_ORDERS.
The DB_ORDERS_EXT with the needed informations will not be loaded.

You have 2 ways to solve it (without changing database structure):
Extend the generateCache function with loading the data from DB_ORDERS_EXT (fast)
or
in the listOrdersAdmin add the query to DB_ORDERS_EXT (slowly)

That's all.

boboo :-)

Deivids

Avatar: Deivids

2014-12-18 08:56

There is the code:

/**
  * Generate cache variables
  * @return void
  */
  
public function generateCache( ){

    if( !
is_fileDB_ORDERS ) )
      return 
null;

    
$this->aOrdersFields $GLOBALS['aOrdersFields'];
    
$this->aOrdersExtFields $GLOBALS['aOrdersExtFields'];
    
$this->aOrdersProductsFields $GLOBALS['aOrdersProductsFields'];

    
$rFile fopenDB_ORDERS'r' );
    
$i 0;
    while( !
feof$rFile ) ){
      
$sContent fgets$rFile );
      if( 
$i && !empty( $sContent ) ){
        
$aData unserializetrim$sContent ) );
        
$this->aOrders[$aData['iOrder']] = $aData;
        
$this->aOrders[$aData['iOrder']]['sDate'] = displayDate$aData['iTime'] );
        
$this->aOrders[$aData['iOrder']]['sStatus'] = $this->throwStatus$aData['iStatus'] );        
      }
      
$i++;
    } 
// end while
    
fclose$rFile );
  } 
// end function generateCache



Should I write something like

$rFile fopenDB_ORDERS'r'DB_ORDERS_EXT'r' );



Please give me a coplete solution. Thank you.

boboo

Avatar: boboo

2014-12-18 09:47

Add a:

$lang['Payment'] = "Payment";


in /database/translations/xx.php

Then in /core/orders-admin.php in function generateCache under:

fclose$rFile );


add:

$rFile=fopen(DB_ORDERS_EXT,'r');
 
$i=0;
 while(!
feof($rFile)){
  
$sContent=fgets($rFile);
  if(
$i>0&&!empty($sContent)){
   
$aData=unserialize(trim($sContent));
   
$this->aOrders[$aData['iOrder']]['mPayment']=$aData['mPayment'];
  }
  
$i++;
 }
fclose($rFile);


then in the same file in function listOrdersAdmin under:

<td class="email"><a href="mailto:'.$aData['sEmail'].'">'.$aData['sEmail'].'</a></td>


add:

<td class="phone">'.(isset($aData['mPayment'])?$aData['mPayment']:'&nbsp;').'</td>


then in /templates/admin/orders.php under:

<td class="email"><?php echo $lang['Email']; ?></td>


add:

<td class="phone"><?php echo $lang['Payment']; ?></td>


Then in this file find all colspan="x" and add 1 to every "x"

Fertig.

boboo :-)

Deivids

Avatar: Deivids

2014-12-18 10:35

I have some HTML skills. All I needed is the updated php function. You done it well. Works properly. I have just changed mPayment to iPayment, to have an ID instead of the name. Thank you :)

Back to top
about us | contact