static void UpdatingProductCategoryHierarchy(Args
_args)
{
EcoResProduct _EcoResProduct;
EcoResProductCategory _EcoResProductCategory;
EcoResCategoryHierarchy EcoResCategoryHierarchy;
;
select forUpdate _EcoResProduct
EcoResProduct _EcoResProduct;
EcoResProductCategory _EcoResProductCategory;
EcoResCategoryHierarchy EcoResCategoryHierarchy;
;
select forUpdate _EcoResProduct
where _EcoResProduct.DisplayProductNumber == "itemid"; // Item Number
select forUpdate _EcoResProductCategory
where _EcoResProductCategory.Product
==
EcoResProduct::findByDisplayProductNumber(_EcoResProduct.DisplayProductNumber).RecId;
if(_EcoResProductCategory)
{
ttsBegin;
ttsBegin;
_EcoResProductCategory.Product
= EcoResProduct::findByDisplayProductNumber(_EcoResProduct.DisplayProductNumber).RecId;
//Category
Hierarchy Name
EcoResCategoryHierarchy = EcoResCategoryHierarchy::findByName("HierarchyName");
_EcoResProductCategory.CategoryHierarchy = EcoResCategoryHierarchy.RecId;
//Category Name
_EcoResProductCategory.Category = EcoResCategory::findByName('category',EcoResCategoryHierarchy.RecId).RecId;
_EcoResProductCategory.update();
ttsCommit;
ttsCommit;
}
if(!_EcoResProductCategory)
if(!_EcoResProductCategory)
{
ttsBegin;
ttsBegin;
_EcoResProductCategory.Product
=
EcoResProduct::findByDisplayProductNumber(_EcoResProduct.DisplayProductNumber).RecId;
EcoResCategoryHierarchy = EcoResCategoryHierarchy::findByName("HierarchyName");//Category Hierarchy Name
EcoResCategoryHierarchy = EcoResCategoryHierarchy::findByName("HierarchyName");//Category Hierarchy Name
_EcoResProductCategory.CategoryHierarchy = EcoResCategoryHierarchy.RecId;
// Category Nam
_EcoResProductCategory.Category = EcoResCategory::findByName('category',EcoResCategoryHierarchy.RecId).RecId; e
_EcoResProductCategory.Category = EcoResCategory::findByName('category',EcoResCategoryHierarchy.RecId).RecId; e
_EcoResProductCategory.insert();
ttsCommit;
ttsCommit;
}
}
No comments:
Post a Comment