Try our conversational search powered by Generative AI!

CartHelper - Accept changes crashes (Commerce 8.15.0)

Vote:
 

When we call AcceptChanges on CartHelper, We got a SQL exception from this stored procedure :

ecf_LineItem_Insert

Error : The formal parameter "@AllowBackordersAndPreorders" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output.

Why EPiServer code set @AllowBackordersAndPreorders as an InputOutput parameters ? @LineItemId should be InputOutput parameter according to SQL Schema.

After using decompiled sources on this version, I understand the error but I dont know how to fix it. EPiServer Code set the first MetaField from the MetaClass as an InputOutput parameter. In my case, it's @AllowBackordersAndPreorders not @LineItemId. Can I fix it to make sure @LineItemId it's the first one ?

#131840
Aug 06, 2015 17:54
Vote:
 

Hi,

That's very strange.

What does this query give you when you run it in context of commerce database

SELECT c.[MetaFieldId], f.Name
FROM .[dbo].[MetaClassMetaFieldRelation] c
inner join [dbo].MetaField f
on c.MetaFieldId = f.MetaFieldId
where MetaClassId in (Select metaclassid from [dbo].MetaClass where Name = 'LineItem')

/Q

#131858
Aug 07, 2015 9:32
Vote:
 

Hi,

Here the result for your query :

MetaFieldId Name
557 LineItemId
558 OrderFormId
559 OrderGroupId
560 Catalog
561 CatalogNode
562 ParentCatalogEntryId
563 CatalogEntryId
564 Quantity
565 PlacedPrice
566 ListPrice
567 LineItemDiscountAmount
568 OrderLevelDiscountAmount
569 ShippingAddressId
570 ShippingMethodName
571 ShippingMethodId
572 ExtendedPrice
573 Description
574 Status
575 DisplayName
576 AllowBackordersAndPreorders
577 InStockQuantity
578 PreorderQuantity
579 BackorderQuantity
580 InventoryStatus
581 LineItemOrdering
582 ConfigurationId
583 MinQuantity
584 MaxQuantity
585 ProviderId
586 ReturnReason
587 OrigLineItemId
588 ReturnQuantity
589 WarehouseCode
590 IsInventoryAllocated

I've done the same query with LineItemEx because we have extra fields added to line item :

MetaFieldId Name
307 IsPromoItem
308 PromoMinimumAmount
310 EcoFees
311 PromoID
557 LineItemId
558 OrderFormId
559 OrderGroupId
560 Catalog
561 CatalogNode
562 ParentCatalogEntryId
563 CatalogEntryId
564 Quantity
565 PlacedPrice
566 ListPrice
567 LineItemDiscountAmount
568 OrderLevelDiscountAmount
569 ShippingAddressId
570 ShippingMethodName
571 ShippingMethodId
572 ExtendedPrice
573 Description
574 Status
575 DisplayName
576 AllowBackordersAndPreorders
577 InStockQuantity
578 PreorderQuantity
579 BackorderQuantity
580 InventoryStatus
581 LineItemOrdering
582 ConfigurationId
583 MinQuantity
584 MaxQuantity
585 ProviderId
586 ReturnReason
587 OrigLineItemId
588 ReturnQuantity
589 WarehouseCode
590 IsInventoryAllocated

The @LineItemId seems to be the first one System Meta Field from both query.

#131882
Aug 07, 2015 14:46
Vote:
 

Hi,

I think I found the problem. My website is on a migration process from 6.2 / R1 to the lastest for both product. In MetaField table, the field IsKeyField was set to False (0) for every field. Thats why @LineItemId was not the first one.

Anyway to fix this without having futur problems ? I can set manually via SQL fields from my backup (R1 Commerce) but I can miss new fields ...

Thanks!

#131894
Aug 07, 2015 20:23
Vote:
 

Hi,

The Id metafield (LineItemId, OrderGroupId,... ) should have IsKeyField =1.

I don't know why it is 0 for you but I think you'll have to update them manually.

Regards,

/Q

#131910
Aug 10, 2015 9:29
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.