1

I am trying to retrieve user information through api in CS-cart. But it returns only limited information. How can we modify the code to get all the user info for ex- user profiles, address, gst and all.

2 Answers2

0

you can create your own API.

/var/www/html/app/addons/addon_name/Tygh/Api/Entities/Egg.php

    <?php 
namespace Tygh\Api\Entities;

use Tygh\Api\AEntity;
use Tygh\Api\Response;

class Egg extends AEntity
{
    public function index($id = '', $params = array())
    {
        if(empty($id))
        {
            $dd=db_get_array("SELECT * FROM ?:table_name");
            //result all rows
        }
        else
        {
            // for filtering purpose
            $where=array("id"=>$id);
            $dd=db_get_array("SELECT * FROM ?:table_name where ?w",$where);
            //result-> specific one row
        }
        return array(
            'status' => Response::STATUS_OK,
            'data' => $dd
        );
    }

    public function create($params)
    {
        return array(
            'status' => Response::STATUS_OK,
            'data' => array()
        );
    }

    public function update($id, $params)
    {
        return array(
            'status' => Response::STATUS_OK,
            'data' => array()
        );
    }

    public function delete($id)
    {
        return array(
            'status' => Response::STATUS_NO_CONTENT,
        );
    }

    public function privileges()
    {
        return array(
            'index' => true,
            'create' => 'create_things',
            'update' => 'edit_things',
            'delete' => 'delete_things',
            'index'  => 'view_things'
        );
    }
    public function privilegesCustomer()
    {
        return array(
            'index' => true
        );
    }
}
?>

Remarks: file name, class name, file path

sreechith srk
  • 146
  • 12
0

Or you can edit the user API entity from this location.

app/Tygh/Api/Entities/Users.php

Any doubts , then kick me in...

sreechith srk
  • 146
  • 12