Skip to content
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

layout_file when updating / creating products #207

Open
osinho opened this issue Aug 15, 2017 · 0 comments
Open

layout_file when updating / creating products #207

osinho opened this issue Aug 15, 2017 · 0 comments

Comments

@osinho
Copy link

osinho commented Aug 15, 2017

Hi,

I have an issue with custom layout_files when updating / creating products via the API.

My entire API call works nice and smoothly except for assigning a specific layout_file to my products.

I expect the layout_file to chance from default to "_product-sets.html". I assign the file in the options array like so:

$options = array(
                                "name"=>$product_name,
				 "availability"=>"available",
				 "sku"=>$line["code"],
				 "type"=>"physical",
				 "description"=>$description,
				 "search_keywords"=>$keywords,
				 "sale_price"=>$line["price"],
				 "price"=>$totalprice,
				 "retail_price"=>$totalprice,
				 "sort_order"=>$sort_order,
				 "is_visible"=>true,
				 "related_products"=>"'".$related_IDs_string."'",
				 "inventory_level"=>0,
				 "inventory_warning_level"=>1,
				 "warranty"=>$special_set_info,
				 "weight"=>$totalweight,
				 "inventory_tracking"=>"simple",
				 "brand_id"=>$brandID,
				 "page_title"=>$page_title,
				 "meta_keywords"=>$keywords,
				 "meta_description"=>$meta_description,
				 "layout_file"=> "_product-sets.html",
				 "categories"=>$categories,
				 "condition"=>"New",
				 "open_graph_type"=>"product",
				 "option_set_display"=>"right",
				 "upc"=>$upc
				 );

and call the API like so

try {
            $product_update = Bigcommerce::updateProduct($bc_productID,$options);

        } catch(Bigcommerce\Api\Error $error) {
            echo $error->getCode();
            echo $error->getMessage();
        }

The product is updated properly (every single value of the options array is being populated) except for the layout_file.

I can go and login to my dashboard and change the layout file for the item in question to _product-sets (in the back-end there is actually no .html shown) - but the API would not do it automatically.

Since I am planning to update a rather large number of products, going in and changing the template file manually for every single one is not really an option...

Any idea what I am doing wrong here?

Thanks for your help folks..

Steps to reproduce behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant