Okay
  Public Ticket #3532742
Sales Agent dashboard visibility on mobile
Closed

Comments

  •  3
    Alex started the conversation

    Hello,

    I'm interested in modifying the functionality of the Sales Agent dashboard, specifically regarding its behavior when accessed via a mobile phone. The primary focus is on the Customers tab.

    Firstly, the filter seems to be malfunctioning when attempting to display additional parameters like company name, total spend, etc.

    Secondly, I aim to have it display the company name rather than the user name or customer name.

    The attached photo should provide clarification on my points.


    Thanks in advance for your time and help :) 

    Attached files:  Skärmbild 2023-11-29 133515.png

  •  1,906
    WebWizards replied

    Hello Alex,

    I'd be happy to assist,


    (1) To show the billing company instead of the username / customer name, you can add this code snippet to your site:

    add_filter('salesking_customers_page_name_display', function($name, $customer_id){
        $customerobj = new WC_Customer($customer_id);
        $user_info = get_userdata($customer_id);
        $company_name = get_user_meta($customer_id,'billing_company', true);
        if (empty($company_name)){
            $company_name = '';
        }
        return $company_name;
    }, 10, 2);
    add_filter('b2bking_show_customers_page_company_column','__return_false');
    add_filter('salesking_dashboard_show_customer_column','__return_false');
    

    This snippet should replace the name in most places.

    If you see any issues after adding it or need any adjustments, please let me know where.



    (2) Regarding the columns filter there, this uses a script which unfortunately cannot work perfectly together with the responsiveness of columns which is based on CSS to hide columns on smaller screens. This script is based on the datatables library and we don't really have a way of editing its functionality.

    As a workaround, I can suggest that we hide the Edit Columns button on smaller screens if you'd like. That way, there would be no confusion for mobile users.

    To do that, you can add this snippet to the site:

    add_action('salesking_dashboard_head', function(){
        ?>
        <style type="text/css">
            @media (max-width: 999px) { 
                .buttons-colvis{
                    display: none;
                }
            }
        </style>
        <?php
    });
    


    Kind regards,

    Stefan

  •  3
    Alex replied

    Thank you Stefan,

    The solution seam to work for now, will keep going with the work around and see if i will hit some new walls, and if so i will reach out again.

    Thanks again for the help!