You have already read my last posts of Shopware Section. If not, Please read following posts first.
1. Rest API in Shopware PHP
2. Create REST Api for Shopware using php and curl
3. Retrieve Articles and Category using REST Api in Shopware
4. Post Article, Category and Image using REST Api in Shopware
Follow these steps:
1. Create a page "postcategory.php" and put following code.
Note:
1. Please replace values of those fields, you don't want, to NULL.
2. You can remove "id". If you want to generate category automatically.
3. Don't remove parent. It is a required field. If you remove this field. You will get following error message:
parent id is missing
Warning:
Don't delete a default row from category table. It has category id = 3 and parent id = 1
If you delete it. You will get above error message.
1. Rest API in Shopware PHP
2. Create REST Api for Shopware using php and curl
3. Retrieve Articles and Category using REST Api in Shopware
4. Post Article, Category and Image using REST Api in Shopware
Post Category:
Follow these steps:
1. Create a page "postcategory.php" and put following code.
<?php2. Run this code.
include 'config.php'; // Know more about config.php in last post. Must Read
$s2parray = Array (
"id" => "A NEW CATEGORY ID",
"parent" => "PARENT ID",
"name" => "NAME",
"path" => "PATH",
"position" => "POSITION",
"metakeywords" => "META KEYWORDS",
"metadescription" =>"META DESCRIPTION",
"cmsheadline" => "CMS HEADLINE",
"cmstext" => "CMS TEXT",
"template" => "TEMPLATE",
"active" => TRUE OR FALSE,
"blog" => "BLOG",
"showfiltergroups" => "SHOW FILTER GROUPS",
"external" => "EXTERNAL",
"hidefilter" => "HIDE FILTER"
);
$client->post('categories', $s2parray);
?>
Note:
1. Please replace values of those fields, you don't want, to NULL.
2. You can remove "id". If you want to generate category automatically.
3. Don't remove parent. It is a required field. If you remove this field. You will get following error message:
parent id is missing
Warning:
Don't delete a default row from category table. It has category id = 3 and parent id = 1
If you delete it. You will get above error message.
Lovvely blog you have here
ReplyDelete