I am trying to get to the store resource (name, domain, etc) of the Bigcommerce API using PHP.
I can get to product, category, time, and other resources, I just cannot figure out how to get to these with PHP.
I have tried using Bigcommerce::getStore() and several variations with no luck.
It has not been implemented in the PHP SDK yet, from the looks of it.
Use this branch https://github.com/bigcommerce/bigcommerce-api-php/pull/62
The code is
$store = Bigcommerce::getStore();
print_r($store);
Related
I have created metafield using API. Currently accessing those Metafield in shopify cart.liquid like given below -
{{shop.metafields.AnnexCloud.access_token}}
Getting correct value using above syntax.
But when I try to access Metafield through above syntax in APP files facing issue.
I am creating new shopify public APP using python. In that want access metafield using
{{shop.metafields.AnnexCloud.access_token}}
So, please help me out.
Thanks
I'm not 100% sure what you mean about accessing that metafield through your app - there are lots of places where you might be trying to use that value, so I'll try to cover a few of the bases here.
If you're trying to access the metafield in your Python code
Your app is not running on Shopify's servers and doesn't have any native concept of Liquid code. However, since your app is running on your servers with access to whatever database you've used to store the data you need, you shouldn't need to access this metafield - you should have all the information you need already saved.
That said, if your app's requirements have put you in a position where you need to read that live from the store, you can use your app's credentials to access [the-store-domain.myshopify.com]/admin/metafields.json to get metafield information into your app. You can refine your request as well - for example, [the-store-domain.myshopify.com]/admin/metafields.json?namespace=atuls-app would only return metafields where the namespace was atuls-app.
If you're trying to access the metafield in your app's front-end code
You unfortunately won't be able to put the liquid drop into any file inside of the store's /assets folder (if you're writing any files there), nor will you be able to put any Liquid inside of any assets your app loads through the content_for_header.
For the latter case, though, the scripts loaded through content_for_header would be coming from your server, so you could use any of the methods listed above to get that value injected into the script file through your server's code/logic.
For the former case, where you are adding a file to the /assets folder of a Shopify theme, you would only have access to a very limited number of Liquid variables (and unfortunately shop isn't one of them). To get around this, you would need your app's install to add a script tag to the layouts/theme.liquid file to save a global variable with the contents of your metafield. Any other scripts would then be able to access that global variable. (Note: this method comes with all the normal caveats/considerations about using global variables for things)
Hope this helps!
I'm looking for a way in Liquid to retrieve all Customers, or all Orders. I know it's targeted from a Client POV so probably not, but I just wanted to double check if there are any undocumented handles anyone has come across? Its for a protected page for staff user only access.
If the only solution to fetch this data is to use the App Proxy (for API access), is there a tidy way of including the output in a template? I gather there is no way to simply include an App Proxy liquid file into a Page as you can with Snippets, so does that purely leave either having the webpage at a proxy url or to pull in the contents with a jQuery call?
Your question is confusing. If you're on the front-end of a store, using Liquid, it seems pretty obvious you cannot easily access all customers. That would not be a front-end store thing. If you were logged in as a customer, with Liquid you'd have all that customer's order data.
With a clearer question, maybe you might get more help. What are you trying to do, and why?
Each category page on the Bigcommerce store has a unique id: %%GLOBAL_CatId%%
I need to pass this variable, which I cannot possibly know before hand, to my API script. I'm using an include for my script so I've tried several variations of the following but I can't get anything to work:
%%Include.http://example.com/api.php?catid=%%GLOBAL_CatId%%%%
Is this possible and how can I accomplish this?
I was informed by API support that this is NOT possible.
I'm using magento 1.7 and my problem is how to get configurable product and their options through a default api without creating a custom api. because my client wants to get the api's without modifying the actual source code on the server.
Now i can able to get the options like warranty & the screen protector but can't able to get a color and then a size. Please refer the attached screenshot below:
I have googled a lot more to find my solution without writing a custom api to get a configurable product. But so far no luck!
Is there any other way to get so? please let me know.
And please note, i'm a pure front end developer role. By referring the API reference documentation we are developing this application.
Referring the API document - http://www.magentocommerce.com/api/soap/introduction.html
Try to use $product->getOptions(), But make sure you load the product object $product = $observer->getEvent()->getProduct();
I am trying to build an API service for my Yii based website,
I have create an API controller with all the functions that returns objects in JSON format.
I also created a system to generate API keys for a specific URL... but I cant seem to understand how to detect the url from where the call is being made to my api so I can compare and validate.
I have tryed with HTTP_REFERER ...not working...
Any idea how is this possible ?
Thanks
try this:
Yii::app()->request->urlReferrer
or
Yii::app()->request->host
or
Yii::app()->request->hostAddress
for more details see http://www.yiiframework.com/doc/api/1.1/CHttpRequest