Want to im开发者_运维技巧prove this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this questionDoes anyone know how to update magento's catalog of products automatically by having Magento do a read from an XML file? The scenario would be that a cron job would periodically check for the presence of a feed file on a remote server, do an FTP transfer to pull it over to the local machine and then, depending on whether the feed file is a complete listing or whether it just contains new products, Magento would either completely refresh its catalog on each update, or it might just do an append. It doesn’t really matter at this stage; all i would like to know is whether Magento is capable of doing such a task? Thanks.
Mark.
There are many approaches to this problem. Personally I would put together a module that runs on a 'cron' schedule to check the (remote) location for new files to parse.
In that module there are two approaches to parsing the XML file: some Magento/Zend method that magically does it all for you or normal PHP XML parsing techniques where you read in the file as a series of objects. Due to where I am with XML skills I would take the latter approach.
The next step depends on the nature of your products. There are simple products that have just the one SKU and no options, then there are configurable products. Configurable products, e.g. a T-shirt has sizes and colours, imagine five sizes and five colours then you need 25 SKU codes for the 'simple' variants plus another for the configurable 'master' product.
If you are primarily selling 'simple' products then all well and good. Configurables require a bit more effort to get right, whether creating them in the backend or by program code.
Given these difficulties I would update a catalog that has been part-hand-crafted rather than expect Magento + your code to magically create it for you.
To answer your question, Magento certainly has the functionality, however there is always a lot of effort in building a catalog and automating that process requires work.
精彩评论