Close

Profile: ierhalim

Avatar

User posts

7 years ago

Hi,
I want to modify /quickviewdata  html result.
After some debug i find quickviewdata route defaults ,it is

SevenSpikes.Nop.Plugins.QuickView.Controllers.QuickViewCatalog.QucikViewData

But can't find any .cshtml file in Theme folder.

My question is How i have edit Quickview html content(also i have to add custom property to model).

Thanks.

7 years ago

hristian.dimov wrote:

Hi hristian,
maybe you can use ActionFilters ...


Hi, i was think about ActionFilters before posting this topic but it was just feelt wrong.
But i have to focus deadline, so i'll use action filters.
Thanks a lot.

7 years ago

hristian.dimov wrote:

...

Hi,
You can override the FindPartialView and FindView

Hi,
Thanks a lot it worked well.

Now i can develop custom views.

But still having trouble with adding item to cart. Dou you have any recommendation for that?

7 years ago

hristian.dimov wrote:



Hi,
Lets start with the Custom View Engine. ..


Hi hristian thanks for attention,

I found a some hacky way for ensuring myviewengine is the first viewengine. Ofcourse this is only for debugging i have a  good idea for this.

End of the Global_asax.Application_Start i change the ViewEngines



            var xxxViewEngine = ViewEngines.Engines[1];
            var pluginViewEngine = ViewEngines.Engines[0];

            ViewEngines.Engines[0] = xxxViewEngine;
            ViewEngines.Engines[1] = pluginViewEngine;
              


But it still does not work, i think it's not about the theme, it's about the ThemeableVirtualPathProviderViewEngine

ThemeableVirtualPathProviderViewEngine.FindView method called with parameter useCache = true and pass this parameter to ThemeableVirtualPathProviderViewEngine.GetPath in this method looking for cached view (i don't understand how i put view to cache) and return null.

I try to set useCache false on debugging and it work well.

I know it's not about theme but any help would be appreciated.

7 years ago

Hi,
I try to use Pavilion theme with my custom (heavy) plugin and try to override some views and controllers. And i dont want  to change thirty part code(nopCommerce or any plugin,theme code).

So i was write a CustomViewEngine which insert some PartialViewLocationFormats and ViewLocationFormats.

In RouteProvider i'm insert this ViewEngine as a first Engine.



  public int Priority
        {
            get
            {
                return int.MaxValue;
            }
        }


  
ViewEngines.Engines.Insert(0, new XXXViewEngine());




Also i override ShoppingCartController.AddProductToCart_Details and ShoppingCartController.AddProductToCart_Catalog  (they are still use base methods but i manage some form data before and after Add operation.)




public class ShoppingCartOverridesController : Nop.Web.Controllers.ShoppingCartController
{
public override ActionResult AddProductToCart_Details(int productId, int shoppingCartTypeId, FormCollection form)
{
//Some code which use RequestFormData

  var result =  base.AddProductToCart_Details(productId,shoppingCartTypeId,form);

//Some code

return result;


}

}






public override ActionResult AddProductToCart_Catalog(int productId, int shoppingCartTypeId, int quantity, bool forceredirection = false)
{
   //Some code which use RequestFormData
  var result =   AddProductToCart_Catalog(productId, shoppingCartTypeId, quantity, forceredirection)
   //Some code

return result;

}



And ofcourse i create new route on my routeprovider.



   //add product to cart (without any attributes and options). used on catalog pages.
            routes.MapLocalizedRoute("XXX.YYY.Integration.Override.AddProductToCart-Catalog",
                            "addproducttocart/catalog/{productId}/{shoppingCartTypeId}/{quantity}",
                            new { controller = "ShoppingCartOverrides", action = "AddProductToCart_Catalog" },
                            new { productId = @"\d+", shoppingCartTypeId = @"\d+", quantity = @"\d+" },
                            new[] { "XXX.YYY.Integration.Controllers" });


            //add product to cart (with attributes and options). used on the product details pages.
            routes.MapLocalizedRoute("XXX.YYY.Integration.Override.AddProductToCart-Details",
                            "addproducttocart/details/{productId}/{shoppingCartTypeId}",
                            new { controller = "ShoppingCartOverrides", action = "AddProductToCart_Details" },
                            new { productId = @"\d+", shoppingCartTypeId = @"\d+" },
                            new[] { "XXX.YYY.Integration.Controllers" });



But after installation of Pavilion theme my all overrides blow up.

My CustomViewEngine does not work. (I wan't to check my custom folders first if there is a file with same name should use my view.)

My Controllers does not work cause the request adress is diffrent new requests urls are AddProductToCartAjax,AddProductFromProductDetailsPageToCartAjax so i should override this rotues and override methods but plugins probanbly(SevenSpikes.Nop.Plugins.AjaxCart) are not open source and i would like to inheritance from original controller and use original base.methods after my custom work).

Thank You