xvoyance Posted April 17, 2012 Share Posted April 17, 2012 I modified categories.php so that it can automatically acquire products information from other websites. However, I do not know how to insert the information back. Here is my program: http://pastebin.com/a5GjTqWy on line 928 onchange() first check the validity of the products number by calling chk_ISBN. After successfully checked, it called send_findbooks on line 908, which evoke ajax.request to acquire information from send_one_isbn.php, which is shown http://pastebin.com/sBMXtd5v The information is obtained and parsed. But I do not know how to pass the results back. I cannot display the results in FilltheForm in line 918. Perhaps, should I insert the results directly into the database, instead of passing back? Any suggestion? Link to comment Share on other sites More sharing options...
MrPhil Posted April 18, 2012 Share Posted April 18, 2012 Are you looking to automatically update your product database (and osC continues to be driven by your database), or are you trying to somehow grab product information "on the fly" for a product display (without putting anything in your own database)? In the first case, it might be easier to grab the data with an external utility, massage it into a CSV file, and use Easy Populate to bulk read in product data. I don't know if there's a way to automatically run Easy Populate, or if it has to be kicked off manually. In the second case, what is the purpose of not keeping it in your database? Once you have a second or third request for this data, haven't you blown any savings in system load by not keeping it around? I'm assuming that you have permission to use this external data in some way, although I wouldn't see any effective difference between storing it in your database and just republishing it on the fly. Anyway, perhaps you could get a better answer by clarifying what you're trying to accomplish here. Link to comment Share on other sites More sharing options...
xvoyance Posted April 18, 2012 Author Share Posted April 18, 2012 I am trying the first case you mentioned, i.e. automatically update database (although I do not describe in that way) and keep the information in my database. I have tried Easy Populate, but it does not meet my needs. For EP I still need to key in all products information, and download images from other website...etc. What I am doing is building a book store, which have at least 100000 books. The data is available in any library (for instance ISBNDB or google books which are most popular). You cannot key in yourself, not only because of the amount of work required, but also because of the accuracy. Similar works can be done and have been done for CD/DVD catalog. Many similar programs for simply look up information from such libraries are available on the internet. However, the problem is how to integrate it with OSC elegantly. Link to comment Share on other sites More sharing options...
burt Posted April 18, 2012 Share Posted April 18, 2012 This would definitely not be easy or straightforward, even for a developer. I suggest that this would need to be custom coded, as I think not too many people would be able to help with this. In general the idea is; insert the isbn into the model_number field onblur, curl to the site to grab the data. use json or such to insert the grabbed data into the correct fields in the db Link to comment Share on other sites More sharing options...
MrPhil Posted April 18, 2012 Share Posted April 18, 2012 I don't see why an external utility couldn't be written for your site or PC that grabs foreign data in a predictable format and outputs a CSV file suitable for EP. That would certainly beat keying it in all by hand! Going directly into your database is certainly possible, but if something goes wrong, it could really mess up things. With an intermediate CSV file, you have a chance to eyeball the data and give it a quick sanity test. It can be done either way, but I would suggest that a CSV into EP would be safer and less work. It also depends on whether this volume of work will be a repeated occurence, or is just a one-time setup job (with smaller updates on a regular basis). Link to comment Share on other sites More sharing options...
xvoyance Posted April 19, 2012 Author Share Posted April 19, 2012 This would definitely not be easy or straightforward, even for a developer. I suggest that this would need to be custom coded, as I think not too many people would be able to help with this. In general the idea is; insert the isbn into the model_number field onblur, curl to the site to grab the data. use json or such to insert the grabbed data into the correct fields in the db I have almost done the job you mentioned. 1. inser the ISBN is done by hand as products_model in the original osc code 2. I did not use onblur instead I use onchange to jump to a javascript to check the ISBN and grab the data (Please refer to the code I provided in the first post.) 3. Yes, the data is grab using json and the transfer between javascript and PHP is done by AJAX.request The only thing remain is, perhaps, I should update the database directly, instead of sending the data back. Link to comment Share on other sites More sharing options...
xvoyance Posted April 19, 2012 Author Share Posted April 19, 2012 I don't see why an external utility couldn't be written for your site or PC that grabs foreign data in a predictable format and outputs a CSV file suitable for EP. That would certainly beat keying it in all by hand! Going directly into your database is certainly possible, but if something goes wrong, it could really mess up things. With an intermediate CSV file, you have a chance to eyeball the data and give it a quick sanity test. It can be done either way, but I would suggest that a CSV into EP would be safer and less work. It also depends on whether this volume of work will be a repeated occurence, or is just a one-time setup job (with smaller updates on a regular basis). I indeed tried this way. The EP way is to insear the URL instead of grabing the external image. The URL does not fit into osc well....so I gave up. I know an auction site in our country (www.ruten.com.tw) use the idea I am trying to do. Their result is satisfactory. p.s. there are other osc add-on similar to EP I have seem, but for old version 2.2 or so...presumably. I did not got the result anyway. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.