Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Add columns to order list

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 09-09-2015, 03:35 AM
 
Romas Romas is offline
 

Member
  
Join Date: Feb 2015
Posts: 16
 

Default Add columns to order list

I need to create module which adds columns to order list in admin area.
As I see with webmaster kit template for order list is
admin/en/items_list/model/table/body.tpl
This template uses function getColumns() but my problem is there is no getColumns() function in templates viewer class XLite\View\ItemsList\Model\Order\Admin\Search. Tell me please how can I override this function in my Module, do I need to create new viewer in my module class which extends XLite\View\ItemsList\Model\Order\Admin\Search or whatever and where is getColumns() method is coded?
__________________
Version 4.4.4
Reply With Quote
  #2  
Old 09-09-2015, 08:52 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Add columns to order list

getColumns() method comes from the \XLite\View\ItemsList\Model\Table class through inheritance (check what classes "extend" to understand methods they inherit).

You should look into the defineColumns() method as this is the method that... err... defines columns

You can override this method from your module and change what columns the page displays.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 09-10-2015, 03:57 AM
 
Romas Romas is offline
 

Member
  
Join Date: Feb 2015
Posts: 16
 

Default Re: Add columns to order list

Now I see that I must change defineColumns() method in XLite\View\ItemsList\Model\Order\Admin\Search class. Here is its code
PHP Code:
protected function defineColumns()
    {
        return array(
            
'orderNumber' => array(
                static::
COLUMN_NAME     => static::t('Order #'),
                static::
COLUMN_LINK     => 'order',
                static::
COLUMN_SORT     => static::SORT_BY_MODE_ID,
                static::
COLUMN_ORDERBY  => 100,
            ),
            
'date' => array(
                static::
COLUMN_NAME     => static::t('Date'),
                static::
COLUMN_TEMPLATE => $this->getDir() . '/' $this->getPageBodyDir() . '/order/cell.date.tpl',
                static::
COLUMN_SORT     => static::SORT_BY_MODE_DATE,
                static::
COLUMN_ORDERBY  => 200,
            ),
            
'profile' => array(
                static::
COLUMN_NAME     => static::t('Customer'),
                static::
COLUMN_TEMPLATE => $this->getDir() . '/' $this->getPageBodyDir() . '/order/cell.profile.tpl',
                static::
COLUMN_NO_WRAP  => true,
                static::
COLUMN_MAIN     => true,
                static::
COLUMN_SORT     => static::SORT_BY_MODE_CUSTOMER,
                static::
COLUMN_ORDERBY  => 300,
            ),
            
'paymentStatus' => array(
                static::
COLUMN_NAME     => static::t('Payment status'),
                static::
COLUMN_CLASS    => 'XLite\View\FormField\Inline\Select\OrderStatus\Payment',
                static::
COLUMN_SORT     => static::SORT_BY_MODE_PAYMENT_STATUS,
                static::
COLUMN_ORDERBY  => 400,
            ),
            
'shippingStatus' => array(
                static::
COLUMN_NAME     => static::t('Shipping status'),
                static::
COLUMN_CLASS    => 'XLite\View\FormField\Inline\Select\OrderStatus\Shipping',
                static::
COLUMN_SORT     => static::SORT_BY_MODE_SHIPPING_STATUS,
                static::
COLUMN_ORDERBY  => 500,
            ),
            
'Delivery type' => array(
                static::
COLUMN_NAME     => 'Delivery type',
                static::
COLUMN_TEMPLATE => 'admin/en/modules/Romas/NewOrder/delivery_type.tpl',
                static::
COLUMN_ORDERBY  => 550,
            ),
            
'total' => array(
                static::
COLUMN_NAME     => static::t('Amount'),
                static::
COLUMN_TEMPLATE => $this->getDir() . '/' $this->getPageBodyDir() . '/order/cell.total.tpl',
                static::
COLUMN_SORT     => static::SORT_BY_MODE_TOTAL,
                static::
COLUMN_ORDERBY  => 600,
            ),
        );
    } 

As u see I added delivery_type column, it adds a column to order list. But why it does not add a content to column which is located in admin/en/modules/Romas/NewOrder/delivery_type.tpl?
__________________
Version 4.4.4
Reply With Quote
  #4  
Old 09-13-2015, 03:01 AM
 
sayanhealth sayanhealth is offline
 

Newbie
  
Join Date: Mar 2013
Posts: 2
 

Default Re: Add columns to order list

I found a solution:
I need to add to delibery type field
static::COLUMN_TEMPLATE => '/modules/Romas/NewOrder/delivery_type.tpl',
not

static::COLUMN_TEMPLATE => 'admin/en/modules/Romas/NewOrder/delivery_type.tpl',
__________________
X-Cart Gold Plus 4.5.4
Reply With Quote

The following user thanks sayanhealth for this useful post:
qualiteam (09-14-2015)
  #5  
Old 09-14-2015, 12:30 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Add columns to order list

Quote:
PHP Code:
...
            
'Delivery type' => array(
                static::
COLUMN_NAME     => 'Delivery type',
                static::
COLUMN_TEMPLATE => 'admin/en/modules/Romas/NewOrder/delivery_type.tpl',
                static::
COLUMN_ORDERBY  => 550,
            ),
... 

You should not use 'Delivery type' as the key for the array. Please use 'deliveryType' instead.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:07 PM.

   

 
X-Cart forums © 2001-2020