nopSolutions / nopCommerce

ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
https://www.nopcommerce.com
Other
9.31k stars 5.33k forks source link

Laybuy Plugin #5671

Closed SelectSystemsInternational closed 3 years ago

SelectSystemsInternational commented 3 years ago

nopCommerce version: AlI versions I assume

Steps to reproduce the problem: I have a client that wanted the pluign for verion 4.2 so I have converted the plugin and it works But there are a couple of problems I wanted to make you aware with the Price Breakdown Widgets

1. Using the plugin with a nop-Templates theme issue in the Product Box - Price Breakdown Widget Using the PublicWidgetZones.ProductBoxAddinfoMiddle causes a display issue DeafultClean Theme Product Box - With Default Theme nop-Templates Motion Theme Product Box - With Theme I attached the Code to the PublicWidgetZones.ProductBoxAddinfoAfter instead Product Box - With Theme - Widget Changed to After

2. When using the plugin with a nop-Templates theme - Product Page - Price Breakdown Widget Because the CSS is changed and structured differently to the DefaultClean theme the Product Widget Does not display. DeafultClean Theme Product Page - No Theme nop-Templates Motion Theme Product Page - With Theme

Ideally if there was a widget located after the prices box the Price Breakdown could be attached to that widget rather than attaching to the CSS via the PublicWidgetZones.ProductDetailsBottom. I used PublicWidgetZones.ProductDetailsOverviewBottom instead and did not use the CSS injection.

3. Shoping Cart - Price Breakdown Widget If an item has shipping then the widget does not display Product shipping required Shopping Cart - With Shipping Product shipping not required Shopping Cart - No Shipping

I created a new field in the PublicInfoModel

namespace Nop.Plugin.Payments.Afterpay.Models
{
    public class PublicInfoModel : BaseNopModel
    {
        public string PriceValue { get; set; }
    }
}

Then stored the Price (less shipping - to be added later) in the model when it is created Then used @Model.PriceValue in the script file to get the Price Breakdown

RomanovM commented 3 years ago

@SelectSystemsInternational Thanks for the info. Moved to https://github.com/nopSolutions/laybuy-plugin-for-nopcommerce/issues/1. BTW, the widget on a cart with shipping items is already displayed in 4.40.

SelectSystemsInternational commented 3 years ago

There is another question - Is there a reason why you call public (Order order, string ErrorMessage) CheckRefunds(int orderId) everytime you view an order ?

In the case where you use multiple payment methods then of course if you try to check the Refund on an order which is paid via another payment method then it creates an error that is logged. This is because Laybuy does not know about that order number.

Order not found error

Order not found error in log

Given that in the normal course of events when an Order refund is carried out the Payment Status is set to Refunded. I assume the above is just a double check that the refund return was captured which is done if the order is ever viewed again.

I will change my code so that it only does the CheckRefunds if the Order payment method is Payments.Laybuy and the Order Status != Refunded