In BigCommerce, can I access the current customer's record using JavaScript?
I want to change something on the product page based on the customer group that the current customer is in.
there is no JS SDK yet for Bigcommerce. However, because the APIs are restful, you should be able to execute a simple GET request to get a customer's record. The only challenge is that you need to get the customer ID/info when they login to the store and then get their record.
There is an example on Bigcommerce forums on using Javascript to hide pricing for customers who are not logged in.
http://forum.bigcommerce.com/f4/global-variable-for-current-user-s-group-1815/index2.html
This combined with GET request on the customer endpoint (http://developer.bigcommerce.com/api/customers) should get you moving in that direction.
Does this help? Are you looking for a code sample?
Use Javascript or jQuery to do the IF statement.
Then use Ajax to request the data that you want to display to the user.
So to answer your question, directly with Javascript you can't, but combine it with some PHP and then you use the API to do what you would like.
Hope this helps :)
Related
I am building a shopify app by using the Shopify API, and run into trouble.
When I make a GET request with '/admin/customers.json'
Shopify API response with results sort incorrectly unlike other resources(Product, Order, etc)
I make some screenshots to get thething clear.
Both Order and Product reponse with the correct collection result("updated_at desc") but Customer didn't.
Is it bug or did I miss anything?
I think you need to encode your parameters. Shopify docs don't show encoded params for clarity but you need:
'?fields='+encodeURIComponent('id,updated_at')+
'&updated_at_min='+encodeURIComponent('2015-11-25 20:01:00')+
'&order='+ encodeURIComponent('updated_at DESC');
You could use the search endpoint on customer.
/admin/customers/search.json
/admin/customers/search.json?order=updated_at DESC&fields=id
See the doc on the same API page as customer, just a bit further down the page
https://docs.shopify.com/api/customer
Use the 'sorty_by' attribute when doing your search: https://shopify.github.io/js-buy-sdk/api/classes/ShopClient.html#method-fetchQueryCollections
QuickBooks Online (QBO) uses a URL format like qbo.intuit.com/app/timeactivity?txnId=123 to point to, in this example, a TimeActivity.
However, in the API, resources are referenced by entityId (returned as just Id when querying via the TimeActivity API), which is different from txnId.
In my time tracking web app, I have a feature that exports time to QBO as TimeActivities. I'd like to provide users with direct links from the time entered in my app to the corresponding TimeActivity in QBO—is there any way to do so?
The answer to this is that it's not currently possible because there's multiple base URLs (I think they call them "realms") in use for QuickBooks Online (qbo.intuit.com is only one of them). Because you do not receive this information as part of linking to QBO via OAuth, there's unfortunately no way to construct proper links.
Yes, when creating a successful TimeActivity you will receive back an Id, which I assume you are persisting.
That Id can be used to query QBO in a simple GET request.
<baseURL>/company/{companyID}/timeactivity/{timeactivityId}
I need to retrieve custom field values for customers and addresses using the Big Commerce API.
There appears to be a facility for this for custom product fields;
https://developer.bigcommerce.com/api/stores/v2/products/custom_fields
However no documentation exists for customers and addresses. I tried to access with a similar URL to the products custom fields URL (ie. GET /stores/{store_hash}/v2/customers/{customer_id}/custom_fields) with no success
I realise a similair question has been asked on here already, however BigCommerce support asked me to ask the question on here and that a developer will respond. Here's hoping.
Unfortunately there is no endpoint for custom fields on customers/addresses through the BC API. Hopefully that will be something they'll add when they come out with the next version of their API
I have a question regarding ScriptTag API - http://api.shopify.com/scripttag.html, is there a way to add couple variables if code is being added into the Thank You page? I would like to collect order_id and order_amount so client can track performance etc. but looking at the API it seems that I can only specify event and source or am I missing somthing?
cheers,
/Marcin
You can only specify event and source when creating a script tag.
However, since the structure of the Thank You page is known, you can grab the order number and total from the DOM using js.
Alternatively, You can couple your js tracking on the front end with data from the Orders API to get the data you need.
I was able to make an offer using PlaceOfferRequest (XML). What should I do in order to complete the purchase and update the shipping address to where he/she should ship the Item?
I'm using XML in order to post the request.
While I can't find any official resource stating that completing purchases isn't possible, I'm 99% sure that its simply not possible. All you can do is redirect the user to the payments page, using this template for the URL:
http://payments.${DOMAIN}/ws/eBayISAPI.dll?CheckoutProcessor&item=${Item.ItemID}&transactionId=${TransactionID}
Where DOMAIN could be, for example, "sandbox.ebay.de" or just "ebay.com".