-
Notifications
You must be signed in to change notification settings - Fork 186
Allow creating/updating/deleting custom fields #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
You can now work with Custom Fields. ` use Bigcommerce\Api\Client as Bigcommerce; $Product = Bigcommerce::getProduct(1); // Get a collection of Custom Fields for the product ID Bigcommerce::getProductCustomFields($Product->id); // Get the Custom Field with the ID bigcommerce#5 for the product ID Bigcommerce::getProductCustomField($Product->id, 5); // Create a Custom Field for the product ID $id = Bigcommerce::createProductCustomField($Product->id, array( 'name' => 'Name of Custom Field', 'text' => 'Value of Custom Field' )); // Delete the Custom Field with the ID bigcommerce#5 for the product ID Bigcommerce::deleteProductCustomField($Product->id, 5); // Or you can do it like other resources as well. $CustomField = new Bigcommerce\Api\Resources\ProductCustomField(array( 'name' => 'Name of Custom Field', 'text' => 'Value of Custom Field', 'product_id' => 1 // The ID of the attached product )); $CustomField->create(); `
|
👍 |
Allow creating/updating/deleting custom fields
|
What error do you get? |
|
You need to print or echo it. It doesn't necessarily mean that there's an error. Use the new public function display()
{
echo Client::getProductCustomField($this->product_id, $this->id);
}
|
|
Well your product may have no custom fields…try:
|
|
Sorry, I can't help you there. |
|
No luck I created a new php page just to display custom field using u code and added a custom field to a product. Display product name, sku but not custom field thanks
|
|
In the example, 5 is the ID of the custom field. I'm not sure why it wouldn't work for you in your example. |
|
I'm using the API to update custom fields for a product and I'm getting this error:
Here's my code: It is updating the product. I'm just trying to figure out where that error is coming from. Thanks! |
|
Hi i would like to get some products in my Bigcommerce store based on date using api. So i have followed the following api code like this. But no luck $filter = array('date_created' => 'Sat, 25 Jan 2014 16:43:15 +0000');//query filter $products = Bigcommerce::getProducts($filter); But in the same way following one is working good. $filter = array('sku' => 'CST-120');//query filter $products = Bigcommerce::getProducts($filter); So please any help me how can i change the date variable would be better |
You can now work with Custom Fields.
use Bigcommerce\Api\Client as Bigcommerce; $Product = Bigcommerce::getProduct(1); // Get a collection of Custom Fields for the product ID Bigcommerce::getProductCustomFields($Product->id); // Get the Custom Field with the ID #5 for the product ID Bigcommerce::getProductCustomField($Product->id, 5); // Create a Custom Field for the product ID $id = Bigcommerce::createProductCustomField($Product->id, array( 'name' => 'Name of Custom Field', 'text' => 'Value of Custom Field' )); // Delete the Custom Field with the ID #5 for the product ID Bigcommerce::deleteProductCustomField($Product->id, 5); // Or you can do it like other resources as well. $CustomField = new Bigcommerce\Api\Resources\ProductCustomField(array( 'name' => 'Name of Custom Field', 'text' => 'Value of Custom Field', 'product_id' => 1 // The ID of the attached product )); $CustomField->create();