Define parent node category id in Magento Plugin  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Define parent node category id in Magento Plugin

Postby jak » Mon Jan 16, 2017 9:55 pm

Hi!

I'm customizing Magento Integration Plugin in jiwa,
in this we need to add category 4 as sub-category of Magento main category, we change it's code, it works properly, but the problem when we create/update product into that category it will create one more sub-category of same name in Main category,
we find out the problem for this, and

// Find the category which matches the Jiwa category 4

MagentoServiceReference.catalogCategoryEntity category4_Catalog = MagentoIntegration.GetMagentoCategoryFromDescription(category1_Catalog, inventory.Category4.Description);
if (category4_Catalog == null)
{


here in the above code,
we need to define parent node id means we need to define category1_Catalog id,

can you please tell us how we can define it's id, or is their is any other way to do that.

Thank you in Advance!
jak
Occasional Contributor
Occasional Contributor
 
Posts: 22
Joined: Mon Oct 10, 2016 10:00 pm
Topics Solved: 0

Re: Define parent node category id in Magento Plugin  Topic is solved

Postby Mike.Sheen » Tue Jan 17, 2017 3:11 pm

We already determine what we think must be the root category when we do the following in the CreateOrUpdateMagentoProductsFromJiwa method:

Code: Select all
// find the first active level 1 category in Magento and use that as the root category
List<MagentoServiceReference.catalogCategoryEntity> topLevelMagentoCategories = MagentoIntegration.GetMagentoCategoriesForLevel(magentoCatalogCategoryTree, 1);
if (topLevelMagentoCategories.Count == 0)
{
   throw new Exception("No top-level Magento Category found.");
}


so if you want the Jiwa category 4 to appear under the root, just change the code you posted to be:

Code: Select all
// Find the first sub category of root category category which matches the Jiwa category 4 description
MagentoServiceReference.catalogCategoryEntity category4_Catalog = MagentoIntegration.GetMagentoCategoryFromDescription(root_Category, inventory.Category4.Description);
if (category4_Catalog == null)
{
   // no category was found with that description, create one
...
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807


Return to Technical and or Programming

Who is online

Users browsing this forum: Google [Bot] and 0 guests