void clicked()
{
EcoResProductTranslation ecoResProductTranslation;
EcoResDistinctProduct ecoResDistinctProduct;
EcoResProductIdentifier ecoResProductIdentifier;
EcoResProductMaster ecoResProductMaster;
EcoResProductDimensionGroupProduct ecoResProductDimensionGroupProduct;
//product creation
if(ecoResProductSubtype == EcoResProductSubtype::Product)
{
ecoResDistinctProduct.initValue();
ecoResDistinctProduct.DisplayProductNumber ="Dax123";
ecoResDistinctProduct.ProductType =EcoResProductType::Item;
ecoResDistinctProduct.SearchName ="Dax123";
ecoResDistinctProduct.doInsert();
ecoResProductTranslation.initValue();
ecoResProductTranslation.LanguageId =currentUserLanguage();
ecoResProductTranslation.Description ="Dax123";
ecoResProductTranslation.Name="Dax123";
ecoResProductTranslation.Product = ecoResDistinctProduct.RecId;
ecoResProductTranslation.doinsert();
if(ecoresdistinctproduct.recid)
{
ecoresproductidentifier.initValue();
ecoresproductidentifier.product=ecoresdistinctproduct.recid;
ecoresproductidentifier.productnumber=ecoResDistinctProduct.DisplayProductNumber;
ecoresproductidentifier.insert();
}
}
//product master creation
else
{
ecoResProductMaster.clear();
ecoResProductMaster.initValue();
ecoResProductMaster.ProductType = EcoResProductType::Item;
ecoResProductMaster.DisplayProductNumber = "Dax123";//ProductNumber.valueStr();
ecoResProductMaster.SearchName ="Dax123";// SearchName.valueStr();
ecoResProductMaster.VariantConfigurationTechnology = EcoResVariantConfigurationTechnologyType::PredefinedVariants;
if(ecoResProductMaster.validateWrite())
{
ecoResProductMaster.insert();
}
ecoResProductIdentifier.clear();
ecoResProductIdentifier.initValue();
ecoResProductIdentifier.ProductNumber = "Dax123";
ecoResProductIdentifier.Product = ecoResProductMaster.RecId;
ecoResProductIdentifier.insert();
ecoResProductDimensionGroupProduct.clear();
ecoResProductDimensionGroupProduct.initValue();
ecoResProductDimensionGroupProduct.initFromProduct(ecoResProductMaster);
ecoResProductDimensionGroupProduct.ProductDimensionGroup = EcoResProductDimensionGroup::findByDimensionGroupName('SizeColCon').RecId;
if(ecoResProductDimensionGroupProduct.validateWrite())
{
ecoResProductDimensionGroupProduct.insert();
}
EcoResProductTranslation::createOrUpdateTranslation(ecoResProductMaster.RecId, "Dax123";/*ProductNumber.valueStr()*\,"Dax123"; //SearchName.valueStr());
}
info('product created');
super();
}
No comments:
Post a Comment