Is it possible to allow customer to mark his order as delivered on the order details page?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 year ago
NC 3.90

I want to add MARK AS DELIVERED button on the order details page, so some customers could mark their orders as delivered.

By default I am going to hide this button, but I will show it only for special orders (like when it is pick-up order and etc..)

Is it possible to add such button using some .cshtml code at MySite\Views\Order\Details.cshtml?

If yes, please, give me the piece of code for this button...

Thanks in advance!
1 year ago
Yes it is possible
you need to display one button for delivery and add the condition where you want to display

First, you need to put set as shipped the order, and after that, you can change it to Set as Delivered


            var shipment = _shipmentService.GetShipmentById(id);
            if (shipment == null)
                //No shipment found with the specified id
                return RedirectToAction("List");

            try
            {
                _orderProcessingService.Deliver(shipment, true);
                LogEditOrder(shipment.OrderId);
                return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
            }

this is a code you can add as delivered but before you need to set as shipped

You can take reference from Admin > OrderController
SetAsShipped Method for that and after that SetAsDelivered
1 year ago
ilyas_patel wrote:
Yes it is possible
you need to display one button for delivery and add the condition where you want to display

First, you need to put set as shipped the order, and after that, you can change it to Set as Delivered


            var shipment = _shipmentService.GetShipmentById(id);
            if (shipment == null)
                //No shipment found with the specified id
                return RedirectToAction("List");

            try
            {
                _orderProcessingService.Deliver(shipment, true);
                LogEditOrder(shipment.OrderId);
                return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
            }

this is a code you can add as delivered but before you need to set as shipped

You can take reference from Admin > OrderController
SetAsShipped Method for that and after that SetAsDelivered


Thank you. What is the code for the button itself please? :)
1 year ago
as you are making customize, you can add as per your requirement,
in nop Commerce, they are using this in the admin > shipment details Page

<button type="submit" name="setasdelivered" id="setasdelivered" class="btn btn-info btn-flat">
@T("Admin.Orders.Shipments.DeliveryDate.Button")</button>


you can modify the method name and other things and add according to your requirement
1 year ago
ilyas_patel wrote:
as you are making customize, you can add as per your requirement,
in nop Commerce, they are using this in the admin > shipment details Page

<button type="submit" name="setasdelivered" id="setasdelivered" class="btn btn-info btn-flat">
@T("Admin.Orders.Shipments.DeliveryDate.Button")</button>


you can modify the method name and other things and add according to your requirement


Wait. I need this on the front end order details page. Will this work on customer side on order details page?

I just need to put mark as delivered button but on front end.
1 year ago
yes, it will work on the front side too !!

you need to do some customization into the code because you need to add a set as shipped before delivered into the background too and add conditions according to your requirement.
1 year ago
In nopC there really is no concept of an 'order delivered'.  If you are not using "Shipments", then the above does not work.  Read the docs about Shipping management.

(Otherwise, your 'button' will need to set the order status to Complete.)
1 year ago
ilyas_patel wrote:
yes, it will work on the front side too !!

you need to do some customization into the code because you need to add a set as shipped before delivered into the background too and add conditions according to your requirement.
1 year ago
New York wrote:
In nopC there really is no concept of an 'order delivered'.  If you are not using "Shipments", then the above does not work.  Read the docs about Shipping management.

(Otherwise, your 'button' will need to set the order status to Complete.)


I will use it only when it has shipment and it is MARKED AS SHIPPED. I will configure it myself.

Can you please give me the piece of code for MARK AS DELIVERED button? I just need this button in front order details page.

Thanks.
1 year ago
New York wrote:
In nopC there really is no concept of an 'order delivered'.  If you are not using "Shipments", then the above does not work.  Read the docs about Shipping management.

(Otherwise, your 'button' will need to set the order status to Complete.)


Yes, that is what I really want.

The scenario:
For this button I have separate pickup point like "pick-up from parcel locker". I show this button only when this pick-up point is selected and only when I mark it as shipped on admin side.
Customer places order and pays it. Then I put his order in parcel locker cell and install password for this lock then I put this password as shipment track number, this password will be shown to customer on order details page. Then customer comes to parcel locker gets his parcel and clicks MARK AS DELIVERED, then order automatically becomes as COMPLETE.

So, just give me please the code for MARK AS DELIVERED button for front end order details page?


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.