Add customer’s order number on Cs-cart admin’s order detail page

This minor addon code will add customer’s order number (as in nth order) in admin’s order detail page.  See the image below for better understanding.

Cs-cart customer order no

I personally find it helpful when reviewing orders for fraud.  Typically a user’s first order should attract rigorous checking.  If not for this modification I would have to click on customer profile and then see all orders.

This is a minor modification so you can edit any of your existing addon.  If you don’t have an existing addon, do the changes in my_changes addon just make sure you have it installed.  To illustrate I will do the changes in my_changes addon.

  1. Make sure you have the addon installed.  Verify from Administration->addons page.
  2. Write a function to get customer’s nth order in func.php, create file if not present.
    if (!defined('AREA')) { die('Access denied'); }
    function fn_my_changes_customer_order_no($order_id, $customer_id)
     $sql = "SELECT count(*) as count FROM ?:orders WHERE user_id = ?i AND order_id <= ?i AND is_parent_order != 'Y' AND STATUS != 'I' " ;
     $count = db_get_field($sql,$customer_id,$order_id) ;
     return $count ;
  3. Add template code, create folder and files if not present.
    <div>&nbsp;Customer's order #{$order_info.order_id|fn_my_changes_customer_order_no:$order_info.user_id}</div>
  4. That’s it, just clear cache with admin.php?cc and check order details page.
Posted in CS-Cart, CS-Cart Addons, PHP
6 comments on “Add customer’s order number on Cs-cart admin’s order detail page
  1. Warren says:

    I get

    Parse error: syntax error, unexpected ‘<' in /home/ikonicit/public_html/addons/my_changes/func.php on line 12

  2. thanks for this trick tutorial. awesome

    how to create “popularity product count” for frontend (customer’s side product view)?
    for example: “popularity: 1500” or “Score: 1500”

  3. Mehmet says:

    I need this adon but version 4.2.3
    pls help me how make do it for V 4.2.3

Leave a Reply

Your email address will not be published. Required fields are marked *