I am trying to get cart options to be included in the line item response
My Attempt (nodejs)
return bc_acc.get(`/carts/${cartId}?include=options`, {include:'options'}).then(data => {..
The response is fine but i expected to see options per line item. But its not there. The API Docs show it in the response.
The Response
Specify the full path of the include object like:
/carts/${cartId}?include=line_items.physical_items.options
Related
I am read the office doc https://developer.bigcommerce.com/api-reference/89019d490c6f8-carts
but i can find the cart data end point.
get the singe cart data need cartid Get a Cart GET https://api.bigcommerce.com /stores/{store_hash}/v3/carts/{cartId}
but where to get the CartId
I am using this boilerplate https://github.com/bigcommerce/sample-app-nodejs
my code look like for call api.
const { data } = await bigcommerce.get('/carts'); console.log("this is store cart api call ",data) res.status(200).json(data);
I mention the code block above
expecting output was get the real time store front cart data.
show to the admin where app dashbord show the list of cart activity on going.
I have a shop running on Shopware 6. The data is being migrated into that shop from Magento 1.8. In magento shop one can assign multiple url's to a product. So that a productA can be accessed via shop.domain/productA, shop.domain/categoryA/productA, shop.domain/categoryA/bategoryB/productA.
In shopware after the product got imported it only has one link to it - shop.domain/product-a (shopware parses the names into url keys differently than magento in case of some more crazy product names that I have).
I need help in having the product have the same links it had in magento - shop.domain/productA, shop.domain/categoryA/productA, shop.domain/categoryA/bategoryB/productA. How can I do that?
If this is not possible then how at least can I assign to the product a custom url-key so that it it the same as in magento?
I have found that the product entity in Shopware has a relation to seo_url entity and I have been trying to push different combinations to that endpoint via API, for example:
'foreignKey' => $shopwareProducts[0]->id,
'salesChannelId' => $germanySalesChannelId,
'routeName' => 'frontend.navigation.page',
'pathInfo' => 'productA',
'seoPathInfo' => 'seoPathInfoTest'.$shopwareProducts[0]->id
and it seems to go in without errors, but I have no idea how to make it work on the storefront side (meaning th elink gives me 404). There is a Settings->SEO page where URL seems to be configured but I do not know exactly how to built the snippet to work (tried variations of {% for part in product.seoUrls %}{{ part.seoPathInfo|lower }}/{% endfor %}).
The other thing I tried to use is product's Canonical URL settings and enter some paths in SEO path field but it always gets me this error:
errors [ {…} ]
0 Object { status: "404", code: "FRAMEWORK__SEO_URL_ROUTE_NOT_FOUND", title: "Not Found", … }
status "404"
code "FRAMEWORK__SEO_URL_ROUTE_NOT_FOUND"
title "Not Found"
detail "seo url route\"\" not found."
meta Object { parameters: {…} }
parameters Object { routeName: "" }
routeName ""
I am quite new to shopware and all this is very confusing to me :/ Can anyone help please? Shopware documentation is completely unhelpful in this regard. Oh and I need to use the API because I have about 1600 products to import, so cannot do it by hand. I can easily extract all url keys from magento and if I will knoe how to push them into shopware (seo_url?) then I will be saved.
Same for categories - is there a way to have them use a different url key?
Also is it possible to assign many url's to a product, or can there be only one?
I do not have the cache enabled yet.
All you have to do after all that is to go and refresh your indexes. After that clear the cache.
Settings -> System -> Caches & Indexes
After that the seo urls will be generated. You will have to wait a bit though
What endpoints are used to fetch from Acumatica product data. Theoretically it should be /entity/Default/18.200.001/StockItem, however there no info about assigned categories, attributes, complex product information
The Default endpoint provides the ability to get the following information from the Stock Items page
The main problem with this page is that Acumatica doesn't allow to request more than one array type detail at a time and as you can see on the screenshot almost all details are arrays. So you will have to request each one separately.
For example, you can get items with their Categories by sending the following GET request:
entity/Default/18.200.001/StockItem?$expand=Categories
but at the same time, it is a little tricky to get Attributes, because you will need to send a PUT request with InventoryID for getting Attributes of the Item:
Request: entity/Default/18.200.001/StockItem?$expand=Attributes
Body:
{
"InventoryID" : {
"value" : "AACOMPUT01"
}
}
If you need to be able to get other information from this page you will need to extend endpoint, entity and add additional Views and Fields.
6.30.15 - HOW CAN I MAKE THIS QUESTION BETTER AND MORE HELPFUL TO OTHERS? FEEDBACK WOULD BE HELPFUL. THANKS!
I need to send a content-range header to a dojo/dgrid request:
I cannot find any examples of HOW to do this. I'm not exactly sure where this setting goes (Content-Range: items 0-9/*). I have been given a great linkheaderpagination example on this question: Django Rest Framework Pagination Settings - Content-Range But I don't know how to make this work to produce a Content-Range response. Any takers or does anyone know of any good resources or examples??
UPDATE: I am trying to create pagination in Dojo/grid. I have am using a server-side api (Django Rest Framework) to supply to data to the Dojo/Dgrid. Django Rest Framework does not automatically sent content-range headers when it gets a response from Dojo. Dojo sends a range request when formatted to have pagination. I don't know now to configure the Django Rest Framework API to send a content-range header when it gets a request from Dojo. Unfortunately, I'm trying to do something very specific and just general settings on either side doesn't work.
Including Content-Range Header in response:
You just need to create a headers dictionary with Content-Range as the key and value as how many items are being returned and how many total items exist.
For example:
class ContentRangeHeaderPagination(pagination.PageNumberPagination):
"""
A custom Pagination class to include Content-Range header in the
response.
"""
def get_paginated_response(self, data):
"""
Override this method to include Content-Range header in the response.
For eg.:
Sample Content-Range header value received in the response for
items 11-20 out of total 50:
Content-Range: items 10-19/50
"""
total_items = self.page.paginator.count # total no of items in queryset
item_starting_index = self.page.start_index() - 1 # In a page, indexing starts from 1
item_ending_index = self.page.end_index() - 1
content_range = 'items {0}-{1}/{2}'.format(item_starting_index, item_ending_index, total_items)
headers = {'Content-Range': content_range}
return Response(data, headers=headers)
Suppose this is the header received:
Content-Range: items 0-9/50
This indicates that first 10 items are returned out of total 50.
Note: You can also use * instead of total_items if calculating total is expensive.
Content-Range: items 0-9/* # Use this if total is expensive to calculate
If you are talking about providing Content-Range in the response, I mentioned in an answer to another SO question (which I believe may also have originated from your team?) that there is one alternative to this header: if your response format is an object (not just an array of items), it can specify a total property indicating the total number of items instead.
Again looking for a few minutes at the DRF documentation, it appears it should be possible to customize the format of the response.
Based on the docs and reading the source of LimitOffsetPagination (which you want to be using to work with dstore, as already discussed in a previous question), if I had to take a wild guess, you should be able to do the following server-side:
class CustomPagination(pagination.LimitOffsetPagination):
def get_paginated_response(self, data):
return Response(OrderedDict([
('total', self.count),
('next', self.get_next_link()),
('previous', self.get_previous_link()),
('items', data)
]))
This purposely assigns the count to total and the data to items to align with the expectations of dstore/Request. (next and previous are entirely unnecessary as far as dstore is concerned, so you could take or leave them, depending if you have any use for them elsewhere.)
Using the legacy API in bigcommerce, trying to add a product image without success. I have done this before but it seems to not work now.
The API documentation says that there is a function to 'create a product image', however it says that the field 'product_id' is read only and any request will be rejected if it is included. If that is true and not a typo, how are you supposed to create a product image against a product?
Don't add product ID to the parameters, add it to the url. So if you want to add images to product 12345, make a post to
'/products/12345/images'
of the image data
{ 'sort_order': 1, 'image_file': 'http://blah.jpg' }