Question: List Sales Search In Product Name And Details

List Sales Search In Product Name And Details

I'm looking at controllers/Reports.php and as I'm not familiar with datatables, I have to ask: How can change the query so it searches in both sale_items.product_name AND sale_items.details?

SS

Scott Smith

Asked
I'm looking at controllers/Reports.php and as I'm not familiar with datatables, I have to ask: How can change the query so it searches in both sale_items.product_name AND sale_items.details?
  • MS

    Mian Saleem

    Answered
    Hello,

    You can check the `getsales` method. The product is search with

    ```php
    if($product) { $this->datatables->like('sale_items.product_name', $product, 'both'); }
    ```
    You can add `or_like()` to search other columns on the table.

    Thank you
  • SS

    Scott Smith

    Answered
    Well, I thought I tried that, but I must have typo'd something. Works now. Thanks!
  • MS

    Mian Saleem

    Answered
    I am glad to know that you have manage to modify it as you need. Thanks for updating
  • Login to Reply