Venue Search seems to be ignoring CategoryId parameter - api

I'm trying to do some resolution between restaurants in my DB to their respective Foursquare id. For example, there's a Steakhouse (a subcategory of the Food category) in Penang, MY called 'Suffolk House', but when I specify the categoryId non-Food related venues still show up in the result group.
https://api.foursquare.com/v2/venues/search?categoryId=4d4b7105d754a06374d81259&intent=match&ll=5.4112879000000,100.305271200000&query=Suffolk&client_id=XXXXXXX&client_secret=XXXX
You'd expect only results belonging withing a category (or subcategory) would come back. What gives? Is categoryId really a no-op parameter?

The categoryId parameter is not currently supported for intent=match. You can either filter the results by category afterwards, or use a different intent if you need category matches.

Related

Shopware API search products endpoint total from a stream inconsistent

I have two dynamic product groups
First: Test Product with variants
Conditions: Product Is equal to Variant product
Result total 7 like I expect this
Second: Active Products
Conditions: Active yes
we allready see that the stream ids are just set to 5 products
Now we get a total of 5 instead of 15 products like expected?
Why is it inconsistent, and how can I modify my request to consider also the variants?
You shouldn't rely on the stream_ids column as an indicator which product is shown in a dynamic product group at any given moment. This is because there are multiple more things that factor into whether a product is shown to a user in a dynamic product group.
The filters you define for the group resolve to an SQL query, which in simplified terms would yield something like WHERE active = 1 AND id IN ('...', '...'). So the stream_ids column isn't used to select the contents of a group, but the entire query including all filters is executed in the storefront request. The result of that query is what you see in the preview of the dynamic product group.
Why doesn't it correlate completely with the content of stream_ids?
Shopware features inheritance of fields. If fields of a variant haven't been assigned a value, they may inherit that value from their parents. This may not be reflected in the contents of stream_ids. In fact the children/variants may even inherit the contents of stream_ids.
Then there's the fact that contents of the product group may vary, depending on the current sales channel. That may be because the sales channel features a different language, hence the content of a translatable field used in a filter may vary. Also if you use price filters, there is the possibility of products with multiple prices, which might only be shown if certain conditions are met, defined by the rule builder.
In short, don't count on the stream_ids, which can't reflect all these variables but are used in some capacity internally, for invalidating caches and such. Instead use the preview to judge what the average user might find when they see a product group. There's also the possibility to choose which sales channel the preview should apply to, for the exact reason, that contents may differ depending on the sales channel.

Most appropriate way to store/retrieve User Input in a eCommerce iOS application?

I'm a bit confused with Sqlite, Core Data, NSUserDefaultsand PropertyList. I know what is what, but not a very clear idea of about where to appropriately use them.
I know that there are lots of tutorials, but I'm good at learning through situation based understanding. So kindly do help me to understand this in the situation that I'm facing right now and to make use of the available options wisely.
I'm working on an ECommerce iOS (native) application, where I'm highly dependent on API's for data display. Now I'm in need of recording user's review for a product and send it over through an API.
ie. I have three components, rating title, rating value(for that title) and another rating title ID. I'm defining with an example, I need to store multiple rows with details,
Components Data to be stored
**Title** - Quality | Value | Price
| |
**Rating** - 2 | 3 | 1
| |
**TitleID** - 10 | 11 | 12
Like this, there will be so many entries, i.e, the number of components differs for various users, for some users, there might be more than three components, which must be saved & send through an API. So how should I save these data? which is the RIGHT way to save these data temporarily?
If I understand you correctly, as vaibhav implied your question seems pretty general and probably relates more to structuring your data to fit your requirements than to technical aspects of the iOS / CoreData environment. In that vein, I’ll offer a few thoughts I’d have in structuring a data structure for quality ratings per your description.
If your ratings will always be for the three categories you show, i.e. Quality, Value and Price, I wouldn’t over-complicate things; I’d just use three properties in a rating record to hold the values that a user assigns in his/her rating of a product (just showing selected attributes and relationships in all following lists):
Product
name
Rating
ratedProduct (many to one)
qualityRating Int
valueRating Int
priceRating Int
Done this way you’d need to associate the values with their types in code for the APIs, such as (where item is a retrieved rating record):
display(product: item.ratedProduct.name, quality: item.qualityRating, value: item.valueRating, price: item.priceRating).
On the other hand, you may be describing a more generic approach that would allow for ratings categories that vary more frequently, or perhaps vary among products. This could apply where, for example, ratings include how well things fit for clothing but not for other products like books. In that case, you’d need a more complicated structure where a product could have a variable number of ratings of different types, so you’d need another layer of entities that let you create an arbitrary number of rating records that applied to a product.
Here you'd create a separate rating record for each rating that a user assigned to a product.
The simplest form of that structure would be like the following:
Product
name String
UserEvaluation
ratedProduct (many to one)
productRating (one to many)
ProductRating
ratingType (many to one)
value Int
RatingType
ratingTitle String
ratingID String or Int
Then you’d have to have a bit more structure where you'd list the product and then access the ratings with a loop that cycled through the set of all of the ratings linked to the product record somewhat like this (where item is a retrieved UserEvaluation):
displayTitle(product: item.ratedProduct.name)
for rating in item.productRating {
displayRating(ratingTitle: item.productRating.ratingType.title, ratingValue: item.productRating.value)
}
You'd probably want to combine these into a method that takes the name and an array of ratings.
To keep track of things, you’d also probably want to create another entity that defined product classes and specified what specialized ratings applied to each class (like fit for clothing and mileage for cars). By default, you also may want to allow for a few generic rating types that apply to all products (like the quality and price ratings you show). For this approach, the full structure would look like this:
Product Category
title
ratingType (many to many)
Product
productType (many to one)
UserEvaluation
ratedProduct (many to one)
productRating (one to many)
ProductRating
ratingType (many to one)
value Int
RatingType
ratingTitle String
ratingID String or Int
With this structure, once a product is assigned a productType, the application would know what ratings to ask for in the UI.
You could try building more complicated rating records with all of the types that apply to a product category, but that would get very messy if the applicable categories vary over time. You could also create a "custom" rating type that let a user specify a title and input a rating, in which case you'd need a text field in the rating record that only applies if the ratingType is "custom".
I hope this helps…

Retrieve ISBN from eBay listing via Shopping API

I'm trying to use the eBay shopping API to try and retrieve the ISBNs from listings for books. I already have the eBay IDs for the listings which I'm interested in. Likely that most will have the ISBNs included in the Item Specifics for the listing (some won't, these can be disregarded).
One would therefore assume that retrieving the Item Specifics from the API would give the ISBN as a value, but it appears that the output gives pretty much everything apart from the ISBN. For example, the following API request gives lots of interesting detail about the listing, apart from the ISBN itself:
http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=MYAPPID&siteid=1&version=897&ItemID=EBAYID&IncludeSelector=ItemSpecifics
I haven't had much joy searching the API docs for a solution to getting this particular element from the listing - does anybody have a solution for this? Or if it simply isn't possible to get the ISBN via the API cleanly, is there an alternative method? (This is for very small scale personal use.)
ISBN, UPC, EAN and suchlike come under the productID field.
This field is returned by using the Details value of IncludeSelector. So the url you would want is:
http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=MYAPPID&siteid=1&version=897&ItemID=EBAYID&IncludeSelector=Details
http://developer.ebay.com/devzone/shopping/docs/CallRef/GetSingleItem.html#Response.Item.ProductID
EDIT:
To get the ISBN form a catalogue product you need to use the productID value to make a request to the Product API.
You need to call getProductDetails with the input:
<productDetailsRequest>
<productIdentifier>
<ePID>91515717</ePID>
</productIdentifier>
<datasetPropertyName>ISBN</datasetPropertyName>
</productDetailsRequest>
You can use ISBN10 or ISBN13 as the value of datasetPropertyName depending on which one you want.
http://svcs.ebay.com/services/marketplacecatalog/ProductService/v1?OPERATION-NAME=getProductDetails&SECURITY-APPNAME=APPID&SERVICE-VERSION=1.3.0&productDetailsRequest.productIdentifier.ePID=REFERENCE&productDetailsRequest.datasetPropertyName=ISBN
http://developer.ebay.com/DevZone/product/CallRef/getProductDetails.html

Foursquare venues exclusions

In 4square venues API reference I've found parameter categoryId for inclusion some category venues. But I want to exclude some categories from my venues list (e.g. trains and airplane check-ins).
Is this feature available?
No it isn't, you'll need to retrieve the venues in the top-level category that you do want and then filter out those belonging to the categories that you don't want.

NHibernate update reference

Entities
We have an entity called Product which is loaded using NHibernate.
Product has a category which NHibernate happily populates for me.
Database
In the database, Product has a foreign key for category.
Scenario
User edits this Product (via a web interface) and chooses a different category (say instead of "Fish" we select "Veg").
This is probably a dropdown list, with each category shown. When they choose a different category we get an int key.
Problem
Obviously we now want to save the changes to Product but in effect the only change is to save a new int (say 2, instead of 1).
So we retrieve the existing Product, and now comes the problem.
We don't have a "CategoryID" field on Product, we only have a Category property.
But we don't really want to retrieve the category (by id) just to assign it to the Product.
So I guess what I want to know is should we...
a) Add a CategoryID property to Product
b) Create a new category, assign it the relevant id and attach that to Product (but surely that will cause errors, or overwrite the existing category)
c) Retrieve (lookup) the category from the system (by id) and attach that to the Product
d) Do something else entirely!
It looks like you might be able to using the Session.Load(id) functionality.
Session.Load is a special method that returns a proxy with the ID until you request another property at which point it loads. It throws an error if there is no item matching the ID. Try something like:
product.Category = Session.Load<Category>(2); //2 being the new category ID
Session.SaveOrUpdate(product);
I just did a little testing and it did not seem to pull back the entire Category.
Updated: Session.Load is the correct answer
product.Category = session.Load<Category>(2);
session.Save(product);
Use NH's EnumStringType<T> to map your Category as an enum to the respective database value (which can be a string or a number). You'll find quite a few usage examples, if you google for it.
HTH!