Posted on 30/11/2020 19:04:40
I did try to create a shipping method using the GLS provider to see if I could access the values in the frontend but that was not successfull either. What I did was.
1. Create the shipping method (see image GLS-shipping-provider)
2. Add it to the shipping methods of my cart app (see image selected-shipping-methods)
3. Access it in the front end, the loop renders the name of the shipping method but there is no content, and when I read the documentation this is the correct tag
https://doc.dynamicweb.com/documentation-9/how-tos/shipping-providers/gls-shopdelivery
What I do notice is that when I implement the RenderFrontend method in my custom shipping provider and place a breakpoint there, it is never executed.
Also I cannot output the Template Tags because as soon as I try to do it I get the following stack trace.
System.NullReferenceException: Object reference not set to an instance of an object. at Dynamicweb.Ecommerce.Products.ProductService.ReFactorProductList(ICollection`1 products, Currency currency, Country country, StockLocation stockLocation, User user, Boolean useAssortments) at Dynamicweb.Ecommerce.Products.ProductService.GetRelatedCountFrontend(Product product, Currency currency, Country country, StockLocation stockLocation, User user) at Dynamicweb.Ecommerce.Frontend.Renderer.GetRelatedCount(Product product, Boolean isFrontend, RenderingContext renderingContext) at Dynamicweb.Ecommerce.Frontend.Renderer.RenderProduct(Product product, Boolean extendedProperties, Template template, Int32 loopCounter, Boolean renderRelated, String productUrl, Int32 quantity, Int32 wishListId, Boolean renderPublicList, Boolean isRecursiveCall, Lazy`1 categoryFieldSorting, Int32 orderLineOfProductCount, RenderingContext renderingContext, String unitId) at Dynamicweb.Ecommerce.Frontend.Renderer.RenderProducts(ProductCollection products, Template parentTemplate, String loopName, Int32 loopCounter, Boolean renderRelatedProducts, Boolean renderRelatedLists, Boolean isRecursive, RenderingContext renderingContext) at Dynamicweb.Ecommerce.Frontend.Renderer.RenderRelatedProductLists(Template template, RelatedProductListProviderEventArgs relatedParams, Boolean isCalledInsideRecursion, ExecutionTable currentExecutionTable) at Dynamicweb.Ecommerce.Frontend.Renderer.RenderProduct(Product product, Boolean extendedProperties, Template template, Int32 loopCounter, Boolean renderRelated, String productUrl, Int32 quantity, Int32 wishListId, Boolean renderPublicList, Boolean isRecursiveCall, Lazy`1 categoryFieldSorting, Int32 orderLineOfProductCount, RenderingContext renderingContext, String unitId) at Dynamicweb.Ecommerce.Frontend.Renderer.RenderOrderLine(OrderLine orderLine, Template template) at Dynamicweb.Ecommerce.Frontend.Renderer.RenderOrderLines(OrderLineCollection orderLines, Template parentTemplate, String loopName) at Dynamicweb.Ecommerce.Frontend.Renderer.RenderOrderDetails(Template template, Order order, Boolean extendedProperties, OrderTemplateExtenderContext orderContext) at Dynamicweb.Ecommerce.Cart.Renderer.RenderStep(Order order, PageView pageView, IEnumerable`1 validationErrors, IEnumerable`1 removedProductNames, Boolean useNewsletterSubscription, String imagePatternProductCatalog, Boolean selectAllPayments, IEnumerable`1 payments, Boolean selectAllDeliveries, IEnumerable`1 deliveries, Template template) at Dynamicweb.Ecommerce.Cart.Renderer.RenderStep(Order order, ModuleSettings settings, Int32 stepIndex, PageView pageView, IEnumerable`1 validationErrors, IEnumerable`1 removedProductNames) at Dynamicweb.Ecommerce.Cart.Frontend.RenderStep(Order order, Int32 stepIndex, IEnumerable`1 removedProductNames, IEnumerable`1 errors) at Dynamicweb.Ecommerce.Cart.Frontend.GetContent()
The Foreach loop in the cart information template
@foreach (LoopItem item in GetLoop("Shippingmethods"))
{
<span>@item.GetString("Ecom:Cart.Shippingmethod.Name")</span>
<span>@item.GetString("Ecom:ShippingProvider.Content")</span> <br/>
}