Jump to content

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

Backend Customer List Add & Sort By Company Rate Topic   - - - - -

 
  • tjordan
  • Junior Member
  • Members
  • Join Date: 06-Oct 08
  • 117 posts

Posted 02 June 2017 - 04:42 PM #1

CS Cart v.4.3.4 - 
Looking to add new column to profile customer table and as hook instructions in the
/design/backend/templates/views/profiles/manage.tpl at line code 33/67, but common field 'company' is unable to sort by company.

Hooks:
1)  my_changes/hooks/profiles/manage_data.override.tpl
<td class="row-status hooks-profiles manage-data user-company">{$user.company}</td>

 

2) my_changes/hooks/profiles/manage_header.overide.tpl

<th width="10%" class="hooks-profiles manage-header user-company"><a class="cm-ajax" href="{"`$c_url`&sort_by=company&sort_order=`$search.sort_order_rev`"|fn_url}" data-ca-target-id={$rev}>{__("company")}{if $search.sort_by == "company"}{$c_icon nofilter}{else}{$c_dummy nofilter}{/if}</a></th>

Link shows as follow:
admin.php?dispatch=profiles.manage&user_type=C&sort_by=company&sort_order=desc

Attached File  Customers-Profile-Administration.png   90.48KB   5 downloads

 

Any idea of what file(s) I'm missing to get it sorted by Company?



 
  • beencart
  • Senior Member
  • Authorized Reseller
  • Join Date: 27-Feb 17
  • 189 posts

Posted 02 June 2017 - 05:25 PM #2

CS Cart v.4.3.4 - 
Looking to add new column to profile customer table and as hook instructions in the
/design/backend/templates/views/profiles/manage.tpl at line code 33/67, but common field 'company' is unable to sort by company.

Hooks:
1)  my_changes/hooks/profiles/manage_data.override.tpl
<td class="row-status hooks-profiles manage-data user-company">{$user.company}</td>

 

2) my_changes/hooks/profiles/manage_header.overide.tpl

<th width="10%" class="hooks-profiles manage-header user-company"><a class="cm-ajax" href="{"`$c_url`&sort_by=company&sort_order=`$search.sort_order_rev`"|fn_url}" data-ca-target-id={$rev}>{__("company")}{if $search.sort_by == "company"}{$c_icon nofilter}{else}{$c_dummy nofilter}{/if}</a></th>

Link shows as follow:
admin.php?dispatch=profiles.manage&user_type=C&sort_by=company&sort_order=desc

attachicon.gifCustomers-Profile-Administration.png

 

Any idea of what file(s) I'm missing to get it sorted by Company?

 

Hello! It's working correctly on default CS-Cart. Perhaps you have any custom modifications.


Custom development for CS-Cart | Add-ons | Integrations

https://beencart.com  |  https://beencart.ru


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

Posted 05 June 2017 - 05:04 AM #3

CS Cart v.4.3.4 - 
Looking to add new column to profile customer table and as hook instructions in the
/design/backend/templates/views/profiles/manage.tpl at line code 33/67, but common field 'company' is unable to sort by company.

Hooks:
1)  my_changes/hooks/profiles/manage_data.override.tpl
<td class="row-status hooks-profiles manage-data user-company">{$user.company}</td>

 

2) my_changes/hooks/profiles/manage_header.overide.tpl

<th width="10%" class="hooks-profiles manage-header user-company"><a class="cm-ajax" href="{"`$c_url`&sort_by=company&sort_order=`$search.sort_order_rev`"|fn_url}" data-ca-target-id={$rev}>{__("company")}{if $search.sort_by == "company"}{$c_icon nofilter}{else}{$c_dummy nofilter}{/if}</a></th>

Link shows as follow:
admin.php?dispatch=profiles.manage&user_type=C&sort_by=company&sort_order=desc

attachicon.gifCustomers-Profile-Administration.png

 

Any idea of what file(s) I'm missing to get it sorted by Company?

 

PM me temporary FTP access, our specialists will check the issue


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    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tjordan
  • Junior Member
  • Members
  • Join Date: 06-Oct 08
  • 117 posts

Posted 06 June 2017 - 01:46 PM #4

We used debug mode and found that the query changes the ORDER BY to company_name instead of company. This variable is really the store company name. It should be ordering by the cscart_users.company field. Any idea which script maps the URL parameters to the actual SQL query?

 

 

SELECT cscart_users.user_id, cscart_users.user_login, cscart_users.is_root, cscart_users.timestamp, cscart_users.user_type, cscart_users.status, cscart_users.firstname, cscart_users.lastname, cscart_users.email, cscart_users.company, cscart_users.company_id, cscart_companies.company as company_name FROM cscart_users  LEFT JOIN cscart_user_profiles ON cscart_user_profiles.user_id = cscart_users.user_id LEFT JOIN cscart_companies ON cscart_companies.company_id = cscart_users.company_id WHERE 1 AND cscart_users.user_type = 'C'  GROUP BY cscart_users.user_id  ORDER BY company_name asc  LIMIT 0, 110



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

Posted 06 June 2017 - 02:33 PM #5

We used debug mode and found that the query changes the ORDER BY to company_name instead of company. This variable is really the store company name. It should be ordering by the cscart_users.company field. Any idea which script maps the URL parameters to the actual SQL query?

 

 

SELECT cscart_users.user_id, cscart_users.user_login, cscart_users.is_root, cscart_users.timestamp, cscart_users.user_type, cscart_users.status, cscart_users.firstname, cscart_users.lastname, cscart_users.email, cscart_users.company, cscart_users.company_id, cscart_companies.company as company_name FROM cscart_users  LEFT JOIN cscart_user_profiles ON cscart_user_profiles.user_id = cscart_users.user_id LEFT JOIN cscart_companies ON cscart_companies.company_id = cscart_users.company_id WHERE 1 AND cscart_users.user_type = 'C'  GROUP BY cscart_users.user_id  ORDER BY company_name asc  LIMIT 0, 110

 

The query is correct due to the following part:

... cscart_companies.company as company_name ...

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    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tjordan
  • Junior Member
  • Members
  • Join Date: 06-Oct 08
  • 117 posts

Posted 06 June 2017 - 02:51 PM #6

No, this causes is to sort on the STORE company name when it should be the CUSTOMER company name.

 

If we compare it to a sort on Name or sort on email the ORDER BY is cscart_users.lastname, cscart_users.firstname and cscart_users.email which are correct. What we expect is for the query to be ORDER BY cscart_users.company. What we are getting is ORDER BY company_name.

 

In the first part of the query it selects cscart_users.company, but there are multiple JOINS and I wonder if they are messing with the query.

 

SELECT cscart_users.user_id, cscart_users.user_login, cscart_users.is_root, cscart_users.timestamp, cscart_users.user_type, cscart_users.status, cscart_users.firstname, cscart_users.lastname, cscart_users.email, cscart_users.company, cscart_users.company_id, cscart_companies.company as company_name FROM cscart_users  LEFT JOIN cscart_user_profiles ON cscart_user_profiles.user_id = cscart_users.user_id LEFT JOIN cscart_companies ON cscart_companies.company_id = cscart_users.company_id WHERE 1 AND cscart_users.user_type = 'C'  GROUP BY cscart_users.user_id  ORDER BY cscart_users.lastname asc, cscart_users.firstname asc  LIMIT 0, 10

 

SELECT cscart_users.user_id, cscart_users.user_login, cscart_users.is_root, cscart_users.timestamp, cscart_users.user_type, cscart_users.status, cscart_users.firstname, cscart_users.lastname, cscart_users.email, cscart_users.company, cscart_users.company_id, cscart_companies.company as company_name FROM cscart_users  LEFT JOIN cscart_user_profiles ON cscart_user_profiles.user_id = cscart_users.user_id LEFT JOIN cscart_companies ON cscart_companies.company_id = cscart_users.company_id WHERE 1 AND cscart_users.user_type = 'C'  GROUP BY cscart_users.user_id  ORDER BY cscart_users.email asc  LIMIT 0, 10

 



 
  • tjordan
  • Junior Member
  • Members
  • Join Date: 06-Oct 08
  • 117 posts

Posted 06 June 2017 - 06:35 PM #7

Think we found a solution which works. app\functions\fn.users.php

 

Lines 918 - 926 is the $sortings array. Last line is 'company' => "company_name",

 

We changed this to 'company' => "?:users.company",

 

Now it is sorting on the customer company name.



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

Posted 07 June 2017 - 07:42 AM #8

No, this causes is to sort on the STORE company name when it should be the CUSTOMER company name.

 

In this case you are right. Thank you for sharing the solution


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    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • cmyers
  • Newbie
  • Members
  • Join Date: 18-May 18
  • 3 posts

Posted 30 May 2018 - 01:37 PM #9

Sorry for jumping on this thread, but it is the closest one I could find for what I need.

 

I added a custom profile field and I would like it to show up on the Customers view list and also be able to sort by it on this page. I have not tried using hooks and the my_changes add-on yet, but I have tried directly editing the /design/backend/templates/views/profiles/manage.tpl file. Nothing changes when I edit this file, even after I clear the cache in CS-cart and my server. This is the file that controls the Customers view correct?

 

Thank you in advance for any help you can provide.



 
  • oleg.gorshkov
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 06-Dec 13
  • 2786 posts

Posted 31 May 2018 - 05:28 AM #10

Sorry for jumping on this thread, but it is the closest one I could find for what I need.

 

I added a custom profile field and I would like it to show up on the Customers view list and also be able to sort by it on this page. I have not tried using hooks and the my_changes add-on yet, but I have tried directly editing the /design/backend/templates/views/profiles/manage.tpl file. Nothing changes when I edit this file, even after I clear the cache in CS-cart and my server. This is the file that controls the Customers view correct?

 

Thank you in advance for any help you can provide.

 

Hello!

 

The file is correct. What did you change there? Do you have any add-ons related to users?


Simtech Development | sales@simtechdev.com | www.simtechdev.com
CERTIFIED CS-CART PARTNER | LICENSES | DEVELOPMENT | ADD-ONS | DESIGN | UPGRADE

Mega SEO Package - All you need for your SEO


 
  • cmyers
  • Newbie
  • Members
  • Join Date: 18-May 18
  • 3 posts

Posted 31 May 2018 - 01:23 PM #11

Hello!

 

The file is correct. What did you change there? Do you have any add-ons related to users?

 

I had the beta Responsive Backend add-on running. When I deactivated that, the changes were displayed.

 

Thanks!



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

Posted Today, 05:28 AM #12

Try to download and install latest version of the module here

 

https://marketplace....dmin-panel.html


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    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.