Skip to content

Add sorting to Customer Quote Listing  #124

@Pauldro

Description

@Pauldro

Make a new branch from master call it quote-listing

The files you'll need to change are

site/templates/content/customer/cust-page/quotes/quotes-panel.php
site/templates/content/customer/cust-page/quotes/quotes-table.php
site/templates/content/customer/cust-page/quotes/quotes-thead-rows.php
vendor/cptechinc/dpluso-processwire-classes/src/QuotePanelCustomer.class.php
site/templates/_dbfunc.php

You'll need this as a reference

vendor/cptechinc/dpluso-processwire-classes/src/Model/Quote.class.php
vendor/cptechinc/dpluso-processwire-classes/src/SalesOrderPanelCustomer.class.php

  1. Add the column Quote Total to site/templates/content/customer/cust-page/quotes/quotes-thead-rows.php . Place it before Notes

  2. Add this new column to site/templates/content/customer/cust-page/quotes/quotes-table.php before the notes link. The field we will be using will be called subtotal ($quote->subtotal).

  3. Look at site/templates/content/customer/cust-page/orders/orders-thead-rows.php
    We will be modeling site/templates/content/customer/cust-page/quotes/quotes-thead-rows.php after this file

  4. Quotepanel has all of these functions so take one of the a links and copy it to site/templates/content/customer/cust-page/quotes/quotes-thead-rows.php

  5. The every heading will be can be sorted except for Detail, Notes, and Edit. So Paste the link for each heading but remember to keep the heading and to have the function sort by the column name which you can find in vendor/cptechinc/dpluso-processwire-classes/src/Model/Quote.class.php

  6. Open vendor/cptechinc/dpluso-processwire-classes/src/QuotePanelCustomer.class.php
    the function we are going to edit is get_quotes(), Notice that it already has the ability to do the orderby
    it just needs the queries and the custom queries for dates. You can look at vendor/cptechinc/dpluso-processwire-classes/src/SalesOrderPanelCustomer.class.php for reference in its get_orders() function

  7. First Let's do the most simple one. Go to _dbfunc.php and find the function get_customerquotes()
    Copy the function and paste it underneath renaming the function change the parameters to match
    get_customerquotesorderby($sessionID, $custID, $limit = 10, $page = 1, $useclass = false, $sortrule, $orderby, $debug = false).

  8. Edit the query to do the sorting, I'll let you handle this one by yourself, if you need to debug the query you can always go to site/templates/content/customer/cust-page/quotes/quotes-panel.php and echo $quotepanel->get_quotes(true)

  9. Now go to _dbfunc.php copy the function get_customerordersorderdate()
    paste it under get_customerquotesorderby(), again I'll let you handle the query on this one you'll have to make sure it's pointing to the right column and remove the type = 'O' from that query. You'll have to do this for both Review Date and Expire Date so rename your functions accordingly and have them point to the right columns.

  10. Update vendor/cptechinc/dpluso-processwire-classes/src/QuotePanelCustomer.class.php get_quotes() to have the if statements look for the column names for the expire date and review date sorting.

  11. Remove all the $ajax->* from site/templates/content/customer/cust-page/quotes/quotes-panel.php

Test, and have me review it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions