Skip to main content

When you sync Template Items to BigCommerce, the Matrix Items in TemplateItem will be mapped to product variant in BC side. If you don’t want to use the default price mapping, and want to use the specified price in Matrix item attribute instead, the following customization project can help you.

public class BCTemplateItemProcessor_Extension : PXGraphExtension<BCTemplateItemProcessor>
{
//The code is active only if BigCommerce connector feature is enabled.
public static bool IsActive() => CommerceFeaturesHelper.BigCommerceConnector;

//Specify the attribut ID to get the price.
protected const string AttributeId = "RTLWEBPRC";

#region Event Handlers
public delegate void MapBucketExportDelegate(BCProductWithVariantEntityBucket bucket, IMappedEntity existing);

PXOverride]
public void MapBucketExport(BCProductWithVariantEntityBucket bucket, IMappedEntity existing, MapBucketExportDelegate baseMethod)
{
baseMethod(bucket, existing);
TemplateItems impl = bucket.Product?.Local;
//All attributes in Matrix item have been saved in AttributesValues.
if (impl != null && impl.Matrix?.Any() == true && impl.AttributesValues?.Any() == true)
{
//Find the attribute that you want to use, you can only use AttributeID here, AttributeDescription doesn't work here.
var priceAttributes = impl.AttributesValues.Where(a => string.Equals(a.AttributeID.Value, AttributeId, StringComparison.OrdinalIgnoreCase));
impl.Matrix.ForEach(x => {
//Loop all matrix items, find the associated attribute with NoteID
var matchedPriceAttribute = priceAttributes.FirstOrDefault(p => p.NoteID.Value == x.Id);
if (matchedPriceAttribute != null && !string.IsNullOrEmpty(matchedPriceAttribute.Value?.Value))
{
if (Decimal.TryParse(matchedPriceAttribute.Value?.Value, out var result))
{
x.DefaultPrice = result.ValueField();
}
}
//This is the list that you can change the mapping value in this customization:
//Example: x.DefaultPrice = 10, the price in variant will be assigned to 10.
//price : DefaultPrice
//retail_price : MSRP
//weight : BaseItemWeight
});
}
}

#endregion
}

 

 

Note: you cannot use the entity mapping to change the mapping for product variant level in current version.

Hi @simonliang91 , thanks for the update on this. I’m currently dealing with an issue in Build 21.216.0034 (using BigCommerce) where if I sync a Template Item with multiple Matrix Items associated that have different default prices, the system will insert the first/lowest price variant and skip the others. 

 

Example: Template Item A has Matrix 1 at $100, Matrix 2 at $105, and Matrix 3 at $110. If you prepare/process Template Item A to update an existing product with variants, it inserts Matrix 1 at $100 but then skips Matrix 2 and Matrix 3 (deleting 2 and 3 if they had been active on BigCommerce as variants previously).


Does this customization project suggested here solve for the above issue? Related, is there any plan to make this default functionality in a future build or make it an available customization packet? 


Hello @simonliang91 ,

 

Thanks for sharing this. Is there a way to modify the BC connector so that a new customer record is not created each time. We would like the BC customers to be imported and only have the billing and shipping info updated under the BC customer we have set.

 

 


Hi @simonliang91 , thanks for the update on this. I’m currently dealing with an issue in Build 21.216.0034 (using BigCommerce) where if I sync a Template Item with multiple Matrix Items associated that have different default prices, the system will insert the first/lowest price variant and skip the others. 

 

Example: Template Item A has Matrix 1 at $100, Matrix 2 at $105, and Matrix 3 at $110. If you prepare/process Template Item A to update an existing product with variants, it inserts Matrix 1 at $100 but then skips Matrix 2 and Matrix 3 (deleting 2 and 3 if they had been active on BigCommerce as variants previously).


Does this customization project suggested here solve for the above issue? Related, is there any plan to make this default functionality in a future build or make it an available customization packet? 

Hi Phil,

We are planning to improve the mapping for matrix item in 2023r2. 

For your issue, if you are using the default entity mapping and the Template Item in BC side is exported from Acumatica, it should not have this issue. But if there is an existing Template Item in BC, and you exported the same Template Item from Acumatica again, our connector will detect the key info between both of them to identify they are the same item or not, if the BC side matrix item is different with Acumatica side matrix item, system may skip them(we are using the sku(BC side) and InventoryCD(Acumatica side) to identify whether they are the same item). 

If you want to control the mapping by yourself, you can do it in the customization code, it will be the similar code with this customization


@AndrewBGL could you please elaborate your question? You dont want the new customers to be imported? What would you like to do with the Orders created by those new customers? Why dont you wanna create the new customers? Could you please provide the user scenarios? Thanks.


Reply