Okay
  Public Ticket #3509137
Can i create a database of products to add to basket
Closed

Comments

  • Craig Simpson started the conversation

    Hi there, 

    We are an automotive business with 100,000+ lines in a CSV that we provide to customers. Currently the customers return by email what they want to order.

    We want to build a very easy option online that allows customers to visit a page and search ONLY for the product ID numbers that they want to "add to an order" which somehow is sent to us (email/form etc) - like building a basket but we don't want to explore ecommerce plugins because we don't require "online ordering" with commerce. Just search what you want and get that list of wanted Product ID numbers over to our sales teams.

    We do however, want speed on searching and if possible, like an AJAX search facility.

    I have included a screenshot of something like what I am trying to acheive but ignore the Barn reference. It shows a page, with a search box and I want your plugin to return search results from a new database.

    I wonder if your plugin can help here? I look forward to hearing from you.

    Best wishes Craig

    Attached files:  screen1.jpg

  •  1,819
    Miloš replied


    Hi Craig,

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    1. In terms of having a search for users which will initially hide the Table and just reveal their 'filtered results', you can achieve that with our Powerful Filters Add-on.

    It has the feature "Hide table before filtering" and you can include the "search" button.

    This allows you to set one or more Column filters for the user to pick, and when they hit "search" ( you can change the label of that button if needed),  and only then they get the matching rows returned.

    Please check more on this Add-on here;

    Before purchase, you can test all plugin and Add-on features on our sandbox site.


    2.In regards to choosing Product ID's in that way and then having a Table only return the rows that match the Product ID's.

    You can also use perhaps the Product Name in a field, if that might be easier, but it depends on your use-case, of course and how you structure the Columns.


    We have various filtering options for Columns, such as selectbox ( in this case it is probably not useful as a single value), more useful for you will be a multiSelectBox filter, or a CheckBox filter, where users can simply choose from multiple Product ID's and/or Product Names,  and then only those rows would load in the Table.

    -


    3. After the Products rows load - you can enable the front end users to have our Export Table Tools to export it as Excel or CSV file.

    Just note the limitations we pointed out in that Documentation hyperlink, 

    These export Tools are based on a 3rd Party HTML library which have certain limitations.


    4. Speed on the search using AJAX:

    If you already got all your data in a CSV, you will most probably import that data in an SQL Database in order to use our SQL Table with server-side processing feature.

    This dramatically helps with performance because it only loads one Table Page at one time, while all the other table rows are not loaded on the page.

    Please check more on our server-side processing here.

    -

    And here you can see how you can import CSV data to make Manual Tables.

    Since you have 100 thousand or more rows, you won't be able to import it via our Plugin/via WordPress in general.

    Data that has more than few thousand rows can  sometimes not be imported in this way directly via the plugin ( depending on the server) - this is a limitation that is coming from WordPress itself combined with server performance.

    But there is a solution.

    What you can do is, if you get errors, and it does not work importing directly through our plugin,

     you can then import the file, in form of Excel, CSV, or spreadsheet directly in your database via your database management tool, such as PhPMyAdmin.

    And then you will be able to create a simple SQL query based table from this database table, by using this query (for example):

    SELECT * FROM table_1

    -



    One drawback for server-side Tables is with our Export Tools.

    As pointed out in the said limitations, for the number of rows which will be exported.

    • For tables with server-side processing, only the visible rows will be exported to any format. If you want the entire table to be exported (or copied to a clipboard), you need to choose the “Show All” feature in the “show … entries” block, and then do the export:
    1550886529.png


    But we don't recommend allowing users to have the option to change the Number of rows like that on front-end, if you got a table of 100 Thousand rows, and hit "Show all rows" it will most probably crash the browser.


    So, that is something to be aware of.


    Since you will have more than 100 thousand rows of Data, in that case, you must use our server-side processing feature.

    Depending on how many Products a user chooses, let's say in a CheckBox or multiSelectBox filter, if they do not choose a huge number of Producst, for example if they choose 100 products, then you can set the default number of rows in the Display Settings of this Table to be "100 rows".

    4537966900.png

    In this use-case, if the user does not choose more than 100 Products, then 100 rows will all be loaded in the first Table Page of the result, and a User can easily Export that as CSV/Excel file to see all rows.

    But if you have 100 default rows per page, and they choose 105 , then 5 rows will remain not exported, that can be an issue.

    -


    There could be a workaround, if you wish to customize how many rows can be presented per Table Page on back and front-end of Tables, to remove "ALL" for example and add custom number of Rows options, like "1000",  "2000" and so on.

    ( I don't recommend setting a possible number of rows to more than around 6 thousand, it can slow down the page or crash it, depending on your Hosting Server performance);


    -We don't have a built-in solution for this yet, but there is a workaround

    by adding a hook to your active Theme or child Theme's functions.php file.

    With this solution, it will not be affected by plugin updates

     since it would pull the function from the Theme itself.

    -

    For example, if you need the same options for all tables,

    add this hook: "wpdatatables_filter_table_description" to the active Theme's or child Theme's functions.php :

    add_filter( 'wpdatatables_filter_table_description', 'verse_show_entries', 10, 3 );
    function verse_show_entries( $object, $table_id, $wpDataTableOBJ ){  
      $object->dataTableParams->aLengthMenu = array(    
        array(             
                   10,     
                       25,    
                        50,     
                       75,       
                     100    
        ),      
      array(     
                   10,    
                    25,     
                   50,      
                  75,    
                    100  
          )  
      );  
      return $object;
    }
    

    ( This example removes the "ALL" option from the number of rows selection dropdown, but you can modify it to change/add options you need)

    Or, if you just need it for one specific table, you can pass table ID, as a parameter of the function, like this :

    add_filter( 'wpdatatables_filter_table_description', 'verse_show_entries', 10, 3 );
    function verse_show_entries( $object, $table_id, $wpDataTableOBJ ){
        if ($table_id == 1){
           $object->dataTableParams->aLengthMenu = array(
               array(
                   10,
                   25,
                   50,
                   75,
                   100
               ),
               array(
                   10,
                   25,
                   50,
                   75,
                   100
               )
           );
        }
        return $object;
    }

    ( On that example, the table ID is 1,  but you can set your table's ID)

    -

    Alternatively, if you wish to select multiple specific tables that should have this, you can add multiple table ID's, for example :

    add_filter( 'wpdatatables_filter_table_description', 'verse_show_entries', 10, 3 );
    function verse_show_entries( $object, $table_id, $wpDataTableOBJ ){
        if (in_array($table_id,[1,2,3,4,5,6]){
           $object->dataTableParams->aLengthMenu = array(
               array(
                   10,
                   25,
                   50,
                   75,
                   100
               ),
               array(
                   10,
                   25,
                   50,
                   75,
                   100
               )
           );
        }
        return $object;
    }
    

    Important to note :

    This hook is not going to change the options in the back-end table settings/Display settings, here the options will look the same :

    2730158179.png

    But it will directly override the settings on the table itself,  ( in both back and front-end),

    so if we check on the table's available options for number of rows,  it will then activate the hook's settings in the "Show Number of Entries" dropdown :

    9611596294.png

    Of course, that was an example where we removed the "ALL" rows option,

    but you can modify the hook, to change/add options you need.

    -

    Now, this other workaround is if you wish to change the available row options on the back-end of the table settings.

    You also can't use this option out-of-the-box, but there's a way to do it.

    You need to open this file:

     ../wp-content/plugins/wpdatatables/templates/admin/table-settings/table_settings_block.inc.php 

    and around line 367 you'll see this:

    <select class="form-control selectpicker" id="wdt-rows-per-page"> 
      <option value="1">1</option> 
      <option value="5">5</option> 
      <option value="10">10</option>  
     <option value="25">25</option> 
      <option value="50">50</option> 
      <option value="100">100</option>  
     <option value="-1"><?php _e('All', 'wpdatatables'); ?></option>
    </select>

    * When searching the code, it is best to search for a phrase using CTR+F,  since our devs might add new lines of code during Updates, then the exact line number changes,

    so i advise to search for "Rows per page selection" , and you will find the comment right above this code : 

    Then you can change the options as you need them,

     for this example, i reorder some values, i added option "15", and changed "All" to "1000".

                                       <option value="1">1</option>    
                                         <option value="5">5</option>   
                                            <option value="10">10</option> 
                                            <option value="15">15</option> 
                                             <option value="25">25</option>  
                                         <option value="50">50</option>    
                                             <option value="100">100</option> 
                                          <option value="1000">1000</option>
    
    6314974469.png

            Then you will see the options look like that, in the plugin, on table's Display tab :

    9398908774.png

    -

    Then, open ../wp-content/plugins/wpdatatables/source/class.wpdatatable.php 

    and around line 3737 ( or search for "aLengthMenu"), and replace the values as needed, in my example like this:

    $obj->dataTableParams->aLengthMenu = json_decode('[[1,5,10,15,25,50,100,1000],[1,5,10,15,25,50,100,1000]]');
    

    And the last thing to do is to go to line 544 of the same file ( or search for "setDisplayLength", and modify it so it looks like this:

    public function setDisplayLength($length) {   
         if (!in_array($length, array(1, 5, 10, 12, 15, 25, 30, 50, 100, 1000))) {  
              return false;
    

    So, again, change the values as needed.

    You may also want to add the value in

     ../wp-content/plugins/wpdatatables/templates/admin/table-settings/column_settings_panel.inc.php

     around line 570, 

    if you wish to add that value to possible column options (if you have a select-box filter, or selectbox editor input type, this would be the number of values displayed in those drop-downs).

    Please make sure to delete cache in your browser after you apply the changes.

     It works on my Test table, and Test site;   let me know if it works for yousmile.png

    7110967922.png

    Important to note : During updates, this code will be overwritten, it will change to default code, so if you update the plugin, you have to repeat this process.

    We will work on adding a better solution as soon as possible, for the time being, it is like that.

    If you wish to affect the speed of development for these options,

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.


    I apologise if that was too many details, I just wanted to clarify all the points and what you can try to mitigate that limitation of our server-side Table only being able to Export one Table Page at a time.

    To work around it, a User can either Export multiple table Pages 1 by 1,  or you can add Custom "Number of rows per page" options to allow users to load more rows in the Table Page and simply export all rows with one click.

    -



    5. In regards to the User sending an Email with their desired Products/order;

    If you plan to make perhaps an automated solution to have the User automatically send you an Email when they click "Export" Button - we currently don't have any built-in solution for that.

    You can also suggest that as a future development option if you wish, on the same page as sent before;

    -

    If you have coding skills and wish to try to make a custom solution now,

    you can check out our available hooks for Developers on this documentation and see if you can find any hook that might help.

    Please be advised that custom solutions with hooks are not included in our support.

    You can also research resources such as Stack Overflow to see if any other user perhaps found a workaround.

    ( We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet)

    -

    For sending emails though, you can use this:

    https://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/sending-e-mail-in-wordpress#:~:text=To%20send%20an%20e%2Dmail,authentication%20settings%20you%20defined%20above



    I hope that helps.smile.png


    And i just wanted to point out that you can try wpDataTables before purchasing

     on our sandbox Demo sites ( you can find links for the main plugin Demo,  

    as well as add-on Demos, in my signature),

    and there is a 15-day money-back guarantee period, 

    so if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)

    Let me know if you have any additional questions. 



    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables