public function testAddProductCategoryAndProduct(Connection $connection) { $productCategory = new ProductCategory(); $productCategory->setName("name")->setDescription("description")->setImage("image")->setUrl("url"); $productCategoryResource = new ProductCategories($connection); $categoryResponse = $productCategoryResource->post($productCategory); $categoryId = $categoryResponse['CategoryID']; $product = new Product(); $product->addCategory($categoryId); $product->setCost("2")->setLongDescription("long description")->setPrice("3")->setProductImage("image")->setProductName("NEWWW")->setProductURL("url")->setShortDescription("short description")->setSku("sku")->setWeight("2"); $productResource = new Products($connection); return $productResource->post($product); }
private function formProduct($body) { $product = new Product(); $product->setProductId($body['ProductID'])->setSku($body['SKU'])->setProductName($body['ProductName'])->setLongDescription($body['LongDescription'])->setShortDescription($body['ShortDescription'])->setProductURL($body['ProductURL'])->setProductImage($body['ProductImage'])->setWeight($body['Weight'])->setCost($body['Cost'])->setPrice($body['Price'])->setActive($body['Active'])->setCreated($body['Created'])->setLastUpdated($body['LastUpdated']); return $product; }