Closed pc4service closed 5 years ago
using Bukimedia.PrestaSharp.Factories;
using Bukimedia.PrestaSharp.Entities;
namespace Prestashop
{
public partial class CategoryPost
{
public CategoryPost()
{
category category = new category();
category.AddName(new Bukimedia.PrestaSharp.Entities.AuxEntities.language { id = 1, Value = "Lang 1" });
category.AddName(new Bukimedia.PrestaSharp.Entities.AuxEntities.language { id = 2, Value = "Lang 2" });
category.id_parent = 2; // This is the beginning category
category.AddLinkRewrite(new Bukimedia.PrestaSharp.Entities.AuxEntities.language { id = 1, Value = "test_lang1" });
category.AddLinkRewrite(new Bukimedia.PrestaSharp.Entities.AuxEntities.language { id = 2, Value = "test_lang2" });
category.active = 1;
category.is_root_category = 0;
category.id_shop_default = 1;
CategoryFactory Category = new CategoryFactory(PrestashopForm.BaseUrl, PrestashopForm.Account, PrestashopForm.Password);
Category.Add(category);
}
}
}
However in this case I can insert the category but it is not enable under the frontstore. Needs to add it to the top menu in modules configuration in backoffice.
Hello @pc4service, the example provided by @LuisFReis should work.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Have you example in C# , who to add new category using PrestaSharp ?