Search code examples
cs-cart

how to implement core product API in cs-cart addon controller ?


I am creating an cs-cart Addon for pulling all inventory data via addon.

I tried to implement for product API implementation in custom Addon controller to show list of all products with its all product information , but unfortunately i am unable to implement API in my custom Addon controller in cs cart ?

Please can you provide help on how to implement core API of cs-cart in addon controller.

Thanks in advance.


Solution

  • In a CS-Cart add-on you have access to all core functions. For product search, you can use fn_get_products($params, $items_per_page, $lang_code) function. For more information, you should check the function itself in /app/functions/fn_catalog.php around line 6000 (the line depends on your actual version of CS-Cart).

    You can use these parameters in the $params array to fine-tune your results:

    $default_params = array (
            'area' => AREA,
            'use_caching' => true,
            'extend' => array('product_name', 'prices', 'categories'),
            'custom_extend' => array(),
            'pname' => '',
            'pshort' => '',
            'pfull' => '',
            'pkeywords' => '',
            'feature' => array(),
            'type' => 'simple',
            'page' => 1,
            'action' => '',
            'filter_variants' => array(),
            'features_hash' => '',
            'limit' => 0,
            'bid' => 0,
            'match' => '',
            'tracking' => array(),
            'get_frontend_urls' => false,
            'items_per_page' => $items_per_page,
            'apply_disabled_filters' => ''
        );