Jump to content


Matching categories of imported products

category matches import product feeds

  • Please log in to reply
1 reply to this topic

#1 ayoksus

  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 25 July 2013 - 04:52 PM

Hi there,


I am busy to create an e-commerce site where I need to import products from product feeds (in XML/CSV). I import the data to mysql and display those on my website. However, I am stuck where I need to match their categories with my site's categories. 


For example, I have category laptops which is under computer, but the data has no category laptops, instead they put most laptops under category notebooks. Or sometimes the feeds give you a laptop bags under category laptop. 


How could I possibly grab the right products under categories in the productfeed and put those into the right categories in my site? What could be the best logic to accomplish this?


I have tried making keywords, however, I can't get it really neat. Could someone give me an advice here?


Thank you

#2 Psycho

  • Moderators
  • Move along, nothing to see here
  • 11,846 posts
  • LocationCanada

Posted 25 July 2013 - 05:32 PM

There is no right answer here. No solution will be perfect because no matter what you do now you have no control over how those feeds may change over time. I think you should go into this with the expectation of getting a "good enough" solution. Getting 90% of the products into the right category will probably take little effort. Getting the remaining 10% would be a lot of work.


Start by analyzing the input data to determine what attributes you can use to make a determination about the category. And, as you've pointed out this is probably different for each source of the data. I don't know how many different sources you are using. If you are using a relatively small number of sources I would look at each source individually and maybe create different logic for each one. But, if there are hundreds, then it probably isn't worth the effort. Bottom line is I can't really suggest how to go about this without doing the analysis.


But, let;s take the one example you provided where they put laptops under the category notebook. Do, an analysis of the incoming data to see if all "notebooks" are in fact laptops. If so, you can create a rule that anything indicated as a "notebook" will go into the "laptop" category. As for laptop bags being in the laptop category, you can analyze those to see if there is something in common that you can use. For example, do they all have "bag" in the name or some other piece of data that distinguishes them from laptops? If all else fails, you could use the price (although I wouldn't want to resort to it) since laptops bags "should"generally cost a lot less than an actual laptop.

The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users