We have a custom product creation page, this page create a product and you have two option, save the product or save the product and add pictures.
When saving the product and add pictures in the controller: CreateProductController, we send the product object to a new view (other custom page), so there we can add files(pictures) to the product.
We do it like this:
// Return FindProductView if save and continue
if (productModel.UploadImages)
{
var modelFindProduct = new FindProductViewModel();
modelFindProduct.SavedProduct = productModel;
return View("~/Views/FindProduct/Index.cshtml", modelFindProduct);
}
In this page, the the user add the files and save it, other functionality of this same custom page (FindProduct) is if the user go directly to the page then it shows first a search so the user can search for a product and if the search finds a product then the upload files part it is shown and do the same thing to save the pictures for that product.
case 1. Go to the addpictures custome page (FindProduct) → search and find a product → select images from your local computer, click save. All works fine. controller name: FindProductController
case 2. From the create product controller after creating the product we call the view to upload files(FindProduct), the view loads, we get the product object, so the search part is not display only the upload files part is display, then when saving the images all works, if I see in the Litium admin, the product was created, the images where uploaded and assigned to the product but after all logic is done we get this error:
Object reference not set to an instance of an object.
Line 93: var pageTypeName = context.CurrentState.PageType.Name;
Any ideas what we are missing?
Litium version: 6