3 Suggestions: Single Payment Method on Checkout and Partial Controllers and

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 Jahre weitere
I posted this in the general forum and realized it might be better to cross post here.   I added the following line to the PaymentMethod Controller to bypass the selection if there is only one.  I didn't fully test it however it seems to work ok..


  if (model.PaymentMethods.Count == 1)
  {
    return SelectPaymentMethod(model.PaymentMethods[0].PaymentMethodSystemName, model);
  }


Lastly, I'm definitely not as strong in MVC as I maybe should be however I've made a few modifications to controllers and I think it would really help if they were partial classes.  This allows me to add some methods to it for instance I needed to do something different with regards to the blog on the home page so I felt it would be better to just make the blog controller partial, create the same controller in my theme with a slight customization as well as a view.  Just a thought.

Lastly, the PrepareProductOverviewModel isn't populating the fullsizeimageurl when I think it should.

   
if (picture != null)
                {
                    model.DefaultPictureModel.ImageUrl = _pictureService.GetPictureUrl(picture, _mediaSetting.ProductThumbPictureSize, true);
                    model.DefaultPictureModel.FullSizeImageUrl = _pictureService.GetPictureUrl(picture,0,true);
                  
                }


Keep up the good work and I've quite enjoyed and ease of the system and ability to customize..
13 Jahre weitere
pictoric wrote:
I added the following line to the PaymentMethod Controller to bypass the selection if there is only one...

In this case customers will not be able to use reward points when enabled.

pictoric wrote:
Lastly, the PrepareProductOverviewModel isn't populating the fullsizeimageurl when I think it should[/code]

Thanks.
13 Jahre weitere
Thanks for the response.. I hadn't played around yet with the rewards points much:

This is the preferred way?

 
// this only is returned if both enabled and customer has reward points
if (model.PaymentMethods.Count == 1 && model.RewardPointsAmount==null)  
  {
    return SelectPaymentMethod(model.PaymentMethods[0].PaymentMethodSystemName, model);
  }

13 Jahre weitere
I would better write:
 
if (model.PaymentMethods.Count == 1 && !model.DisplayRewardPoints)
            {
                _workContext.CurrentCustomer.SelectedPaymentMethodSystemName = model.PaymentMethods[0].PaymentMethodSystemName;
                _customerService.UpdateCustomer(_workContext.CurrentCustomer);
                return RedirectToRoute("CheckoutPaymentInfo");
            }
13 Jahre weitere
I plan using a single payment processor Google and would like to hide the system or site "Checkout" so only the GOOGLE CHECKOUT is available.  The system checkout is shown even when we have no payment options available. Any easy fix?
13 Jahre weitere
emslie wrote:
I plan using a single payment processor Google and would like to hide the system or site "Checkout" so only the GOOGLE CHECKOUT is available.  The system checkout is shown even when we have no payment options available. Any easy fix?

1. Open \Views\ShoppingCart\OrderSummary.cshtml file (Nop.Web project)
2. And remove the following code
<input type="submit" name="checkout" value="@T("Checkout")" id="checkout" class="checkoutbutton" onclick="startcheckout()" />
13 Jahre weitere
Tried you suggestion but CHECKOUT still there and fuctioning as well.
13 Jahre weitere
I described how to hide "Checkout" button on the shopping cart page. If you want to completely remove checkout process then open \Presentation\Nop.Web\Controllers\CheckoutController.cs file and remove all methods except 'Completed' and 'CheckoutProgress' ones.
13 Jahre weitere
Hidden CHECKOUT button is what I wanted.  I guess I need to do a bit more than just remove the line of code. Is there a reload or compile process I need to run to make the changed code active?  Sorry for the lack of understanding here.
13 Jahre weitere
No, removing the code is enough and should work
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.