Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Is It Safe To Add A New Field To Fn_Get_Shipments_Info Rate Topic   - - - - -

  • yong2014
  • Member
  • Members
  • Join Date: 26-Feb 14
  • 36 posts

Posted 17 April 2014 - 02:17 AM #1


I want to see the tracking number in the shipments summary screen in the back-end (Orders-->Shipments) (./design/backend/templates/views/shipments/manage.tpl),

I found that the field shipments.tracking_number is not in the list, so I made a simple change in fn_get_shipments_info() function in ./app/functions/fn.cart.php as below:

I added a line '?:shipments.tracking_number as my_tracking_number', in the php code, now I can show the tracking number within manage.tpl.

My question is: Is this change safe without changing other part of cs-cart? Will it break something else?

I noticed that now the shipments API shows my new field as well, that's fine for me.

I am using cs-cart 4.1.2.

function fn_get_shipments_info($params, $items_per_page = 0)
// Init view params
$params = LastView::instance()->update('shipments', $params);

// Set default values to input params
$default_params = array (
'page' => 1,
'items_per_page' => $items_per_page

$params = array_merge($default_params, $params);

$fields_list = array(
'?:shipments.tracking_number as my_tracking_number',
'?:shipments.timestamp AS shipment_timestamp',
'?:orders.timestamp AS order_timestamp',

  • mink
  • Developer
  • Authorized Reseller
  • Join Date: 03-Oct 12
  • 27 posts

Posted 17 April 2014 - 06:10 AM #2

Hello yong2014,

Your change is completely safe and will not break other parts of CS-Cart, especially because you get the tracking number using the "my_tracking_number" alias and such a field is not used anywhere on shipments or order templates.

Best regards, Sergei
Simtech Development | sales@simtechdev.com | www.simtechdev.com

  • yong2014
  • Member
  • Members
  • Join Date: 26-Feb 14
  • 36 posts

Posted 18 April 2014 - 10:45 AM #3

Thanks a lot Sergei !

  • nive7s
  • Newbie
  • Trial users
  • Join Date: 23-Mar 18
  • 1 posts

Posted 23 March 2018 - 10:04 PM #4

I know that is not the best move to reply to a 4 year old post but first this is the only reference to my current problem and second I honestly cannot understand why I cannot make a new post into the forum (maybe because I've just register as a new user).

However, I'd like to retrieve a new column from the shipments table (the new column is created and populated in a different part of the code).

I don't think is a good idea to directly modify the core function fn_get_shipments_info but instead I'd like to use the hook "get_shipments", defined into the function.

Into my hook I add a new element into $fields_list but once the control goes back to the fn_get_shipments_info function, the variable $fields_list does not contain the added element.


my hook looks something like this:


function fn_myaddon_get_shipments($params, $fields_list, $joins, $condition, $group) {
    $fields_list[] = '?:shipments.newcolumn';
am I missing something?
Thank you very much

  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20955 posts

Posted 26 March 2018 - 06:07 AM #5

Please add ampersand before $fields_list variable

function fn_myaddon_get_shipments($params, &$fields_list, $joins, $condition, $group) {
    $fields_list[] = '?:shipments.newcolumn';

It should help

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)