Jump to content

How to use filter and display parameters with URL in web service ?


hardyahir

Recommended Posts

i read the official documentation parts this http://doc.prestashop.com/display/PS14/Chapter+8+-+Advanced+Use and trying to get the employees using filter here is my code
 

$opt = array(
    'resource' =>'employees',
    'display' =>'[full]',

$url = $this->url.'/api/'.$options['resource'];
			$url_params = array();

			if (isset($options['id'])) {
				$url .= '/'.$options['id'];
			} 
			$params = array('display', 'filter', 'sort', 'limit', 'id_shop', 'id_group_shop');
			foreach ($params as $p) {
				foreach ($options as $k => $o)  {
					if (strpos($k, $p) !== false) {
						$url_params[$k] = $options[$k];
					}
				}
			}

			if (count($url_params) > 0)
				$url .= '/?'.utf8_decode(urldecode(http_build_query($url_params) ) );

but still no data found when the url is called.

Edited by hardyahir (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...