Skip to content

layout_file when updating / creating products #207

@osinho

Description

@osinho

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions