Hi
I'm trying to use the Feeds module to pull in Booking.com XML webservices data to use on my site. http://xml.booking.com/affiliates/documentation/
They provide different feeds depending on the type of hotel assets you are trying to retrieve to cache locally. One of the feeds for example is basic hotel information (getHotel) and is formatted like this in XML:
<result>
<address>Den Texstraat 16</address>
<checkin>
<from>14:00</from>
<to>00:00</to>
</checkin>
<checkout>
<from/>
<to>11:00</to>
</checkout>
<city>Amsterdam</city>
<city_id>-2140479</city_id>
<class>2</class>
<class_is_estimated>0</class_is_estimated>
<commission>0</commission>
<countrycode>nl</countrycode>
<currencycode>EUR</currencycode>
<district/>
<hotel_id>10003</hotel_id>
<hoteltype_id>14</hoteltype_id>
<is_closed>0</is_closed>
<location>
<latitude>52.3586189174691</latitude>
<longitude>4.89389419555664</longitude>
</location>
<max_persons_in_reservation>0</max_persons_in_reservation>
<max_rooms_in_reservation>0</max_rooms_in_reservation>
<maxrate>720</maxrate>
<minrate>45</minrate>
<name>Asterisk Hotel</name>
<nr_rooms>42</nr_rooms>
<preferred>0</preferred>
<ranking/>
<review_nr/>
<review_score/>
<url>http://www.booking.com/hotel/nl/asterisk.html</url>
<zip>1017 ZA</zip>
</result>I have successfully imported individual hotels into their own nodes using the above getHotels XML and the Feeds Module. Now the bit i am struggling with is to update those existing hotel nodes with other information provided by Booking.com such as photos which come in on a different feed getHotelPhotos which is formatted like this:
<result>
<hotel_id>10156</hotel_id>
<photo_id>100127</photo_id>
<url_max300>
http://www.animage.com/100127.jpg
</url_max300>
<url_original>
http://www.animage.com/100127.jpg
</url_original>
<url_square60>
http://www.animage.com/100127.jpg
</url_square60>
</result>The common variable running throughout the Booking.com Webservices sysem is hotel_id which allows you to pull the information together
I am convinced Feeds is capable of doing what i want it to do but have stumbled when it comes to adding additional information to the individual hotel nodes. So i tried to create two Feed Importers. One for getHotel which is putting data into Content Type hotels with all the hotel fields listed above and then another Feed Importer for getHotelPhotos which also pushes data into the hotels Content Type but usesspecific image fields inside that hotels content type but it simply creates new nodes instead of appending the extra information to the existing hotel nodes. I have also tried all of the Update Existing Node options:
- Do not update existing nodes
- Replace existing nodes
- Update existing nodes (slower than replacing them)
I have also tried setting the GUID as hotel_id because that in theory should trigger the unique check so instead of creating new nodes it updates but still my second Feed Importer simply created new nodes of the photos.
Any help greatly appreciated!
thanks
Lee
| Comment | File | Size | Author |
|---|---|---|---|
| content.jpg | 36.76 KB | leewoodman |
Comments
Comment #1
johnbarclay commentedYour approach seems right on. hotel id should be the guid or a field that is has "unique target" checked. Update existing nodes should be selected. I'm changing this to a feature request as my understanding is this doesn't currently work in feeds 7.x-2.x
I believe this is a duplicate of #1127696: Attach multiple importers to one content type (in D7) which is basically a feature request and patch to make this work. Please reset the status if this is not the case.
Can you try some of the patches in #1127696: Attach multiple importers to one content type (in D7) and see if they work and comment on them in that thread.
Comment #2
johnvThe problem is that a feed/importer always imports a complete node. partially completing a node is possible with this patch #1047894: Behavior when fields/columns are not in import file: do not clear field, but leave field untouched.
Comment #3
romanciuc commentedi have the same problem like alwoodman and for me worked this solution:
i'd applied this patch #1047894: Fields not present in import files are cleared.
and after i changed like this
->condition('entity_type', $this->entityType());
//->condition('id', $source->id);
on FeedsProcessor.inc line 550
and i have things work