Jump to content

Phonegap app for Prestashop


razorranjan

Recommended Posts

Hello guys,

 

I recently developed an app using cordova, angularjs, ionic framework, angular material for wordpress site.

 

Wordpress returned json data via their api plugin and angular works on json data so there were no problems while building the app.

 

Now i want to build an e-commerce app using cordova,angularjs,ionic framework,angular material for prestashop.

The main concern for me is that prestashop returns xml response for the api calls made.

Is there any way i can reterive json data using the webservice that prestashop provides.

 

Please guide me through this so that i can contribute my app for free after the development.

 

Prestashop version: 1.6.0.9

 

Thanks.

Link to comment
Share on other sites

Note: website i am using here is on local machine.

okay i figured it out for getting response in json format using the below link

key@domainname/api/products/?output_format=JSON

 

its gives me json data but when i try to access the same using angularjs i get error.

I tried it in two ways.

1.using

var get_products = 'http://[email protected]/api/products/';
    $http.get(get_products).success(function(response){
        console.dir(response);
    });

 

Error: Access to restricted URI denied.

 

2. using

    var ws_url = 'http://prestashop.net' ;
    var ws_key = 'key' ;
    $http({
        method: 'get',
        url: ws_url + '/api/products/',
        params:
        {
            ws_key: ws_key
        }
    });

 

XML Parsing Error: no element found Location: moz-nullprincipal:{05e14370-efc4-4149-8c65-33d77604d6b2} Line Number 1, Column 1:

 

 

Can anybody tell me where i am getting it wrong.

I tried the 2nd method from the link : http://stackoverflow.com/questions/24798902/acces-prestashop-webservice-from-javascript

as the guy had the same situation like i have.

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

I was playing with some other js framework but had similar issue, but this worked for me.

 

Also used http.get but try with this as url

 var get_products = 'http://your-store-name.com/api/products?ws_key=YOUR_KEY&output_format=JSON';

For some reason that worked for me.

 

Hope it helps and you have success in making an app.

Link to comment
Share on other sites

  • 5 weeks later...
  • 1 month later...

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...