简体   繁体   中英

Hide Confirm button on checkout page from plugin nopcommerce

Introduction

I am working on a plugin which will need a "Confirm" button hide on some condition (written in action filter).

Question :

How to hide Confirm button on checkout page from plugin in nopcommerce.

Problem

Actually i cannot make view overrides (and using ViewData) as suggested in some solutions but i cant do override in views.

Thinking about having solved from action filter i wrote for /Checkout/Complete --get

 //if checkout process is generic
bool IsCheckoutConfirm = (filterContext.RouteData.Values["controller"].Equals("Checkout")
     && (filterContext.RouteData.Values["action"].Equals("Confirm")) && filterContext.HttpContext.Request.HttpMethod == "GET");

If someone have idea or know how it can be done, please help me out. Thanks for your time.

The easiest way to do this is to make a copy of the Confirm.cshtml page and put it one of these two places:

  • The views/checkout/ folder of your theme
  • Create a folder structure in your plugin for Themes/views/checkout/

Once you have your copy of the Confirm.cshtml you can wrap the confirm button inside an "if" condition, coded for the Boolean value in your plugin that determines whether to expose the button.

There are a variety of ways to pass that value, either by extending the CheckoutConfirmModel in your plugin, action filters, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM