Virtual Happy Hour is canceled this month (March) due to Good Friday.
Try our conversational search powered by Generative AI!
AI OnAI Off
Virtual Happy Hour is canceled this month (March) due to Good Friday.
I'm assuming you are inside the "ConfigureShippingMethod.ascx" - the control that loads the Shipping Provider Parameters tab inside Commerce Manager. I use the following code:
//inside your save method:
var parameterRow = GetParameterByName(shippingMethod, parameterName);
if (parameterRow != null)
{
parameterRow.Value = value;
}
else
{
CreateParameter(shippingMethod, parameterName, value, methodId);
}
//GetParameterByName method
protected ShippingMethodDto.ShippingMethodParameterRow
GetParameterByName(ShippingMethodDto shippingMethod, string parameterName)
{
var rowArray =
(ShippingMethodDto.ShippingMethodParameterRow[])
shippingMethod.ShippingMethodParameter.Select(string.Format("Parameter = '{0}'", parameterName));
return rowArray.Any() ? rowArray[0] : null;
}
// create method
protected void CreateParameter(ShippingMethodDto dto, string parameterName, string value, Guid paymentMethodId)
{
var row = dto.ShippingMethodParameter.NewShippingMethodParameterRow();
row.ShippingMethodId = paymentMethodId;
row.Parameter = parameterName;
row.Value = value;
if (row.RowState == DataRowState.Detached)
{
dto.ShippingMethodParameter.Rows.Add(row);
}
}
I'm trying to setup a custom shipping provider with extra parameters and have followed the instructions found here
http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Commerce1/751/Shipping/Shipping-methods/
and here
http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Commerce1/751/Shipping/Shipping-gateways-and-providers/
But I have trouble retrieving and storing the parameters. In the examples it says (one is about ShippingMethodCase, but it is handled in the same way as ShippingMethodParameter):
//retrieving data