Shipping provider Display name - Change through API

Matt Mason asked on September 29, 2014 18:10

In order to communicate to our customer the expected delivery date using our custom shipping provider I thought I could change the display name periodically through the day (like after 4 change next day to the day after). Any ideas on where I could do this through the API?

Thanks, Matt

Recent Answers


Brenden Kehren answered on September 30, 2014 13:51

This brings all kinds of concerns and questions.

  • What about the people not in the same time zone as your physical store/shipping location?
  • What about changing it back?
  • Would you create a scheduled task to do this work or every time a page loads?
  • Why not have a bullet point on the page that states your shipping policy/timeframe vs. changing it all the time?
0 votesVote for this answer Mark as a Correct answer

Matt Mason answered on September 30, 2014 17:58

Ya, that all came to me after I submitted the question. I didn't realize that there were different delivery times throughout the country. Naive! Anyway, so now what is being bandied about is appending it to the label in the shippingSelector.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 1, 2014 14:30

The shopping cart is now based off of transformations, so why not create a custom method to put in your transformation that determines based on time of day, could even be users time of day, and display the text below the shipping selector. The custom transformation method could be based on what the user has selected in the shipping selector.

0 votesVote for this answer Mark as a Correct answer

Peter Gren answered on October 1, 2014 16:16

Hello Matt
You can create a custom form control based on ShippingSelector.ascx.cs and override this method

protected override DataSet OnAfterRetrieveData(DataSet ds)

After calling a base method you can modify resulting DataSet like this:

protected override DataSet OnAfterRetrieveData(DataSet ds)
{
    if ((ds == null) || (ShoppingCart == null))
    {
        return ds;
    }

    DataSet result = base.OnAfterRetrieveData(ds);
    var shippingOptions = result.Tables[0].Select();

    foreach (DataRow optionRow in shippingOptions2)
        {
            int optionID = ValidationHelper.GetInteger(optionRow["ShippingOptionID"], 0);
            ShippingOptionInfo option = ShippingOptionInfoProvider.GetShippingOptionInfo(optionID);

            // Here comes a condition
            if ((option != null) && "codeNameOfYourShippingOption".Equals(option.ShippingOptionName))  
            {
                string value = ValidationHelper.GetString(optionRow[0], string.Empty);
                value += " YourLabel"; // Here comes the label
                optionRow["ShippingOptionDisplayName"] = value;
            }
        }

    return result;
}

Best regards
Peter Gren

0 votesVote for this answer Mark as a Correct answer

Matt Mason answered on October 2, 2014 23:38

What I ended up doing was to load the ShoppingCartCustomData with ALL the transit time information for each shipping method on the first call to the CustomShippingOptionInfoProvider (and not subsequent calls.) Then in the ShippingSelector I modified the OnListItemCreated method to add the estimated shipping time to the item text. At some point in the future I will come back and re-write that control as a Radio list so I can show all the shipping methods to the customer all at once.

@BRENDEN KEHREN - I haven't seen or heard of documentation on the the shipping methods, or the cart as a transformation, so if you could point me to that documentation I would appreciate it.

Thanks to everyone for all your help, Matt

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.