Jump to content

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

Extend Product Search In Admin Via Addon Rate Topic   - - - - -

 
  • ubrium
  • Newbie
  • Trial users
  • Join Date: 09-Apr 18
  • 1 posts

Posted 09 April 2018 - 09:31 PM #1

Hello everyone.

 

I have developed an addon for a client to add a new field to the product. The addon adds an EAN code to the product.

The client also requires that the products can be searched by that code in product search in the right sidebar in admin (dispatch=products.manage). 

 

I have managed to add a new search field, using a hook, but I don't know how to pass that fields value to the search query. Requirement is that I don't alter core files, and to do all of that in addon. Since this is the first addon that i developed for cs-cart and to be honest, I don't quite understand their documentation, and couldn't find much resources on this topic Any guidance would be helpful.

 

Just to be clear, here is the printscreen of the feature I am talking about

 

https://prnt.sc/j31z8c



 
  • galtinbaeva
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 06-Dec 13
  • 3382 posts

Posted 12 April 2018 - 03:43 PM #2

Hello everyone.

 

I have developed an addon for a client to add a new field to the product. The addon adds an EAN code to the product.

The client also requires that the products can be searched by that code in product search in the right sidebar in admin (dispatch=products.manage). 

 

I have managed to add a new search field, using a hook, but I don't know how to pass that fields value to the search query. Requirement is that I don't alter core files, and to do all of that in addon. Since this is the first addon that i developed for cs-cart and to be honest, I don't quite understand their documentation, and couldn't find much resources on this topic Any guidance would be helpful.

 

Just to be clear, here is the printscreen of the feature I am talking about

 

https://prnt.sc/j31z8c

 

Hello!

 

If you add name attribute to your search input field, in the fn_get_products you will see your variable in $params array. Then you just need to add the condition like:

if (!empty($params['ean'])) {
    $condition .= db_quote(' AND products.ean LIKE ?l', "%" . trim($params['ean']) . "%");
}

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

Google Analytics Enhanced Ecommerce - get advanced ecommerce analytics


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

Posted 13 April 2018 - 05:31 AM #3

I suggest you to use the get_products hook in the mentioned function (app/functions/fn.catalog.php) to alter $condition variable


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    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)