zanox Web Services contextual Product Search


/ Published in: JavaScript
Save to your folder(s)

Wraps Contextual Product Search of zanox Web Services


Copy this code and paste it in your HTML
  1. function addScript(url) {
  2. var script = document.createElement("script");
  3. script.src = url + '&t='+new Date().getMinutes();
  4. script.type = "text/javascript";
  5. document.getElementsByTagName("head")[0].appendChild(script);
  6. }
  7.  
  8.  
  9. function productSearch(version, applicationid, adspace, region, programs, minPrice, maxPrice, category, page, items, q, callback) {
  10. var url = 'http://api.zanox.com/json/' + version + '/products?applicationid=' + applicationid;
  11. if (adspace) url += '&adspace=' + adspace;
  12. if (region) url += '&region=' + region;
  13. if (programs) url += '&programs=' + programs;
  14. if (category) url += '&category=' + category;
  15. if (page) url += '&page=' + page;
  16. if (items) url += '&items=' + items;
  17. if (minPrice) url += '&minPrice=' + minPrice;
  18. if (maxPrice) url += '&maxPrice=' + maxPrice;
  19. if (callback) url += '&callback=' + callback;
  20. if (q) url += '&q=' + q;
  21. addScript(url);
  22. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.