adrianharabula / condr

ConDr (Consumer Decision Maker) - Project carried out within the Web Technologies course, academic year 2016-2017, Faculty of Computer Science, Iași.
https://adrianharabula.github.io/condr/
MIT License
1 stars 0 forks source link

Is there a way to automatically import new products with characteristics? #149

Open adrianharabula opened 7 years ago

adrianharabula commented 7 years ago

When a product is not found, can we search it and import it automatically?

API-uri disponibile am avea:

Exemplu răspuns upcitemdb: Request url: https://api.upcitemdb.com/prod/trial/lookup?upc=885909918188 Response body:

{
  "code": "OK",
  "total": 1,
  "offset": 0,
  "items": [
    {
      "ean": "0885909918188",
      "title": "Apple MacBook Pro 13.3" Retina Display Notebook Computer 2.7GHz Dual-core Intel Core i5 (Broadwell) 8GB DDR3 RAM 256GB PCIe Flash Storage (Early 2015)",
      "description": "A Spectacular display is just the beginning   A groundbreaking Retina display. A new force-sensing trackpad. All-flash architecture. Powerful dual-core and quad-core Intel processors. Together, these features take the notebook to a new level of performanc",
      "upc": "885909918188",
      "brand": "Apple",
      "model": "MF840LL/A",
      "color": "Silver",
      "size": "13.3in. Retin A Display",
      "dimension": "",
      "weight": "",
      "currency": "",
      "lowest_recorded_price": 250,
      "images": [
        "http://images.highspeedbackbone.net/SKUimages/large/40300998_vmain01_at_mn_4719591.jpg",
        "https://i5.walmartimages.com/asr/19d6cafd-e520-4a6f-b6c3-3ddcbc2cbfe5_1.b191d88d51a33125c7334c23ccafd17c.jpeg?odnHeight=450&odnWidth=450&odnBg=ffffff",
        "http://img.bbystatic.com/BestBuy_US/images/products/8532/8532029_sc.jpg",
        "http://img1.r10.io/PIC/100026633/0/1/250/100026633.jpg",
        "http://images.frys.com/art/product/300x300/8408658.01.prod.jpg",
        "http://image1.cc-inc.com/prod/13446000/13446712_xlg.jpg",
        "http://images.qvc.com/is/image/e/03/e282303.001?$uslarge$",
        "http://images10.newegg.com/ProductImageCompressAll200/A5E6_1_20150416344022063.jpg",
        "http://www.adorama.com/images/large/ACMF840LLA.JPG",
        "http://images.prosperentcdn.com/images/250x250/content.abt.com/media/images/products/l_MF841LLA.jpg"
      ],
      "offers": [
        {
          "merchant": "Abt",
          "domain": "abt.com",
          "title": "Apple MacBook Pro 13.3\"\" With Retina Display 2.7GHz Intel Core i5 Laptop Computer",
          "currency": "",
          "list_price": "",
          "price": 1463.7,
          "shipping": "",
          "condition": "New",
          "availability": "",
          "link": "http://www.upcitemdb.com/norob/alink/?id=u2s233230363b4d4y2&tid=1&seq=1495966973&plt=a91fdcbd73c8bd4e60a9714aeee31a9d",
          "updated_t": 1465780889
        },
        {
          "merchant": "Adorama",
          "domain": "adorama.com",
          "title": "Apple MacBook Pro 13.3" Retina Display Notebook Computer 2.7GHz Dual-core Intel Core i5 (Broadwell) 8GB DDR3 RAM 256GB PCIe Flash Storage (Early 2015)",
          "currency": "",
          "list_price": "",
          "price": 1399,
          "shipping": "Free Shipping",
          "condition": "New",
          "availability": "",
          "link": "http://www.upcitemdb.com/norob/alink/?id=u2q2y2t20333f4d4v2&tid=1&seq=1495966973&plt=3a991c30da14501f7312723dad5d133c",
          "updated_t": 1474863552
        },
        {
          "merchant": "Newegg.com",
          "domain": "newegg.com",
          "title": "Apple MacBook Pro Core i5 2.7GHz (Broadwell) 256GB SSD 8GB 13.3\" Retina (2560x1600) BT Mac OS X 10.10 Yosemite FaceTime Camera (Early 2015)",
          "currency": "",
          "list_price": "",
          "price": 1400,
          "shipping": "19.99",
          "condition": "New",
          "availability": "",
          "link": "http://www.upcitemdb.com/norob/alink/?id=v2p213x2z213e4d4v2&tid=1&seq=1495966973&plt=deb4f6650100517f14a271418d220b45",
          "updated_t": 1479210487
        },
        {
          "merchant": "QVC.com",
          "domain": "qvc.com",
          "title": "Apple 13\" MacBook Pro - Core i5, 8GB RAM, 256GB SSD & Software",
          "currency": "",
          "list_price": 2449.96,
          "price": 2229.96,
          "shipping": "26.22",
          "condition": "New",
          "availability": "",
          "link": "http://www.upcitemdb.com/norob/alink/?id=u2q213u2w21394c4z2&tid=1&seq=1495966973&plt=40ad7a815d023aff6248c1274a3e0047",
          "updated_t": 1495194894
        },
        {
          "merchant": "MacMall",
          "domain": "macmall.com",
          "title": "Apple MF840LL/A 13.3 MacBook Pro with Retina display  Dual-core Intel Core i5 2.7GHz (5th generation processor)  8GB RAM  256GB PCIe-based flash storage  Intel",
          "currency": "",
          "list_price": 1499,
          "price": 1449,
          "shipping": "0",
          "condition": "New",
          "availability": "",
          "link": "http://www.upcitemdb.com/norob/alink/?id=u2q2y2u203y2a484s2&tid=1&seq=1495966973&plt=05ee68a4c8840f1d1d98683c2b4fd5ea",
          "updated_t": 1493828651
        },
        {
          "merchant": "Frys Electronics",
          "domain": "frys.com",
          "title": "NEW! Apple 13.3\" MacBook Pro with Retina display, Dual-core Intel Core i5 2.7GHz (5th generation processor), 8GB RAM, 256GB PCIe-based flash storage, Intel Iris Graphics 6100, Two Thunderbolt 2 ports, 802.11ac Wi-Fi, 10 hours of battery life, OS X Yosemit",
          "currency": "",
          "list_price": "",
          "price": 826.2,
          "shipping": "",
          "condition": "New",
          "availability": "",
          "link": "http://www.upcitemdb.com/norob/alink/?id=u2r2y2u2w2z29454u2&tid=1&seq=1495966973&plt=71b0016c76923334976e1e1276fcb654",
          "updated_t": 1488643982
        },
        {
          "merchant": "Rakuten(Buy.com)",
          "domain": "rakuten.com",
          "title": "Apple MacBook Pro 13-inch - Retina 2.7Ghz 8GB 256GB - Mar 2015 / MF840LL/A Apple MacBook Pro MF840LL/A 13.3-Inch Laptop with Retina Display (256 GB) NEWEST VERSION",
          "currency": "",
          "list_price": "",
          "price": 1456.39,
          "shipping": "Free Shipping",
          "condition": "New",
          "availability": "Out of Stock",
          "link": "http://www.upcitemdb.com/norob/alink/?id=u2q2z2x233z2d454r2&tid=1&seq=1495966973&plt=99f13618f01e1dff11e4be71651ba804",
          "updated_t": 1495830797
        },
        {
          "merchant": "Best Buy",
          "domain": "bestbuy.com",
          "title": "Apple - Macbook Pro With Retina Display (latest Model) - 13.3\" Display - 8gb Memory - 256gb Flash Storage - Silver",
          "currency": "",
          "list_price": "",
          "price": 1499.99,
          "shipping": "",
          "condition": "New",
          "availability": "",
          "link": "http://www.upcitemdb.com/norob/alink/?id=u2q2y2y243z2a494t2&tid=1&seq=1495966973&plt=675f0e0e62217e008130da95bf5559c4",
          "updated_t": 1486163626
        },
        {
          "merchant": "Wal-Mart.com",
          "domain": "walmart.com",
          "title": "Apple MacBook Pro 13\" Retina Display MF840LLA Intel Core i5 2.7GHz 8GB 256GB SSD",
          "currency": "",
          "list_price": "",
          "price": 2499.99,
          "shipping": "Free Shipping",
          "condition": "New",
          "availability": "Out of Stock",
          "link": "http://www.upcitemdb.com/norob/alink/?id=u2r2x2v223z264d4u2&tid=1&seq=1495966973&plt=68d38043ead4b8c58b21e94c52f8bf48",
          "updated_t": 1495839438
        },
        {
          "merchant": "TigerDirect",
          "domain": "tigerdirect.com",
          "title": "Apple MacBook Pro - MF840LL/A",
          "currency": "",
          "list_price": "",
          "price": 1494,
          "shipping": "",
          "condition": "New",
          "availability": "",
          "link": "http://www.upcitemdb.com/norob/alink/?id=v2p24323y2637464s2&tid=1&seq=1495966973&plt=66b097fc123d469aeb62b2848a4808f0",
          "updated_t": 1495919811
        },
        {
          "merchant": "Blinq.com",
          "domain": "blinq.com",
          "title": "Apple MacBook Pro 13.3in Laptop i5 3.1GHz 8GB 512GB Mac OS X (MF843LL/A)",
          "currency": "",
          "list_price": "",
          "price": 1510.39,
          "shipping": "",
          "condition": "New",
          "availability": "",
          "link": "http://www.upcitemdb.com/norob/alink/?id=u2x2531323y2c464x2&tid=1&seq=1495966973&plt=0124fecae18fb0c7ba7597c53ba0280c",
          "updated_t": 1478056130
        },
        {
          "merchant": "Newegg Business",
          "domain": "neweggbusiness.com",
          "title": "Apple MacBook Pro Core i5 2.7GHz (Broadwell) 256GB SSD 8GB 13.3\" Retina (2560x1600) BT Mac OS X 10.10 Yosemite FaceTime Camera (Early 2015)",
          "currency": "",
          "list_price": "",
          "price": 1527.69,
          "shipping": "Free Shipping",
          "condition": "New",
          "availability": "Out of Stock",
          "link": "http://www.upcitemdb.com/norob/alink/?id=v2o263v2y2337464z2&tid=1&seq=1495966973&plt=4a640983f6c43696ba10ec5c19027b3b",
          "updated_t": 1495894981
        }
      ],
      "elid": "152538538811"
    }
  ]
}
adrianharabula commented 7 years ago

Pentru a căuta upc code pentru un produs putem folosi

adrianharabula commented 7 years ago

Am găsit şi documentaţia pentru apiul de mai sus. http://www.upcitemdb.com/wp/docs/main/development/responses/

elis47 commented 7 years ago

Api pentru scanarea codului de bare https://www.microsoft.com/en-us/store/p/scandit-barcode-scanner/9nblggh4sskh

adrianharabula commented 7 years ago

hmm... interesant... eu n-am windows şi nu îmi merge, dar nu m-am gândit să caut librărie de scanat barcode pe pc.

Am găsit zbar-tools utilitar cross platform care scanează codul de bare. Nu ştiu cum să îl implementăm la noi pe site, dar am reuşit să scanez cu el coduri de bare cu pc-ul :))

image

adrianharabula commented 7 years ago

Paşii ca să scanăm cod de bare ar fi

  1. să găsim un cititor de carduri pe telefon/pc(pe telefon avem ionic) (de partea asta mă pot ocupa eu)
  2. trimitem codul de bare într-un request la aplicaţia noastră laravel: ex: condr.me/lookup/885909918188
  3. din laravel facem un request către unul sau mai multe apiuri care pot procesa acest cod, de exemplu https://api.upcitemdb.com/prod/trial/lookup?upc=885909918188 Folosim guzzle http pentru asta. Mai multe info aici
  4. datele obţinute de aici, sunt în format json, le putem folosi cum vrem noi
  5. end of story
elis47 commented 7 years ago

3,4,5 done; 1,2 to go 👍