Notification for ready to ship and complete payment

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 13 ans
Hi !!
In my website customers pay only 30% of their total order. The 70% must be paid when their order is ready to be shipped. I already changed the paypal payment method to accept 30% on the client side.
So my costumers choose if they want to do a complete payment, or pay just 30%.
Now i would like to add the option to notify costumers that their order is ready to be shipped and they must pay the rest of order's total (70%).
My solution is to change Orders page in the back-end by adding another filter (Search by Payment Method) to filter orders with not complete payment. Then i would like to add Notificate bouton to send mail to all the list of costumers with paypal link to pay the rest amount.

My question :  Is there a better method to do my Notification for ready to ship and remind to complete payment ?
and can you help me please to add (Search by Payment Method) filter.

Here is my code if someone can help ;)

Administration/Modules/Orders.ascx

<tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblPaymentMethod" Text="<% $NopResources:Admin.OrderDetails.PaymentMethod %>"
                ToolTip="<% $NopResources:Admin.OrderDetails.PaymentMethod.Tooltip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:DropDownList ID="ddlPaymentMethod" runat="server" CssClass="adminInput">
            </asp:DropDownList>
        </td>
    </tr>


Administration/Modules/Orders.acsx.cs

            this.ddlPaymentMethod.Items.Clear();
            ListItem itemPaymentMethod = new ListItem (GetLocaleResourceString("Admin.Common.All"), "0");
          
// How can i get the values of my active payment method.
            }


I know also that i must to change searOrders function so if someone have any idea !! GREAAAT THANKS
Il y a 13 ans

this.ddlPaymentMethod.Items.Clear();
            ListItem itemPaymentMethod = new ListItem (GetLocaleResourceString("Admin.Common.All"), "0");
            this.ddlPaymentMethod.Items.Add(itemPaymentMethod);
            PaymentMethodCollection PaymentMethods = PaymentMethodManager.GetAllPaymentMethods();
            foreach (PaymentMethod PaymentMethod in PaymentMethods)
            {
                if (PaymentMethod.IsActive)
                {
                    ListItem item2 = new ListItem(PaymentMethod.Name, PaymentMethod.PaymentMethodId.ToString());
                    
                    this.ddlPaymentMethod.Items.Add(item2);
                }
            }
Il y a 13 ans
Here is my complete solution to add Payment Method filter :

1 ) Add The dropdown list for PaymentMethods : \NopCommerceStore\Administration\Modules\Orders.ascx


// Line 95
<tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblPaymentMethod" Text="<% $NopResources:Admin.OrderDetails.PaymentMethod %>"
                ToolTip="<% $NopResources:Admin.OrderDetails.PaymentMethod.Tooltip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:DropDownList ID="ddlPaymentMethod" runat="server" CssClass="adminInput">
            </asp:DropDownList>
        </td>
    </tr>



2) Change GetOrders() and  FillDropDowns() in this file \NopCommerceStore\Administration\Modules\Orders.ascx.cs


  protected OrderCollection GetOrders()
        {
            DateTime? startDate = ctrlStartDatePicker.SelectedDate;
            DateTime? endDate = ctrlEndDatePicker.SelectedDate;
            if(startDate.HasValue)
            {
                startDate = DateTimeHelper.ConvertToUtcTime(startDate.Value, DateTimeHelper.CurrentTimeZone);
            }
            if(endDate.HasValue)
            {
                endDate = DateTimeHelper.ConvertToUtcTime(endDate.Value, DateTimeHelper.CurrentTimeZone).AddDays(1);
            }

            OrderStatusEnum? orderStatus = null;
            int orderStatusId = int.Parse(ddlOrderStatus.SelectedItem.Value);
            if (orderStatusId > 0)
                orderStatus = (OrderStatusEnum)Enum.ToObject(typeof(OrderStatusEnum), orderStatusId);

            PaymentStatusEnum? paymentStatus = null;
            int paymentStatusId = int.Parse(ddlPaymentStatus.SelectedItem.Value);
            if (paymentStatusId > 0)
                paymentStatus = (PaymentStatusEnum)Enum.ToObject(typeof(PaymentStatusEnum), paymentStatusId);

            ShippingStatusEnum? shippingStatus = null;
            int shippingStatusId = int.Parse(ddlShippingStatus.SelectedItem.Value);
            if (shippingStatusId > 0)
                shippingStatus = (ShippingStatusEnum)Enum.ToObject(typeof(ShippingStatusEnum), shippingStatusId);

            
            // START CHANGE
            RecurringPaymentTypeEnum? paymentMethod = null;
            int paymentMethodId = int.Parse(ddlPaymentMethod.SelectedItem.Value);
            if (paymentMethodId > 0)
                paymentMethod = (RecurringPaymentTypeEnum)Enum.ToObject(typeof(RecurringPaymentTypeEnum), paymentMethodId);
           // END CHANGE

                                        
            OrderCollection orders = OrderManager.SearchOrders(startDate, endDate, txtCustomerEmail.Text, orderStatus, paymentStatus, shippingStatus, paymentMethod);

            
            
            
            return orders;
        }

        protected void FillDropDowns()
        {
            this.ddlOrderStatus.Items.Clear();
            ListItem itemOrderStatus = new ListItem(GetLocaleResourceString("Admin.Common.All"), "0");
            this.ddlOrderStatus.Items.Add(itemOrderStatus);
            OrderStatusCollection orderStatuses = OrderManager.GetAllOrderStatuses();
            foreach (OrderStatus orderStatus in orderStatuses)
            {
                ListItem item2 = new ListItem(OrderManager.GetOrderStatusName(orderStatus.OrderStatusId), orderStatus.OrderStatusId.ToString());
                this.ddlOrderStatus.Items.Add(item2);
            }

            this.ddlPaymentStatus.Items.Clear();
            ListItem itemPaymentStatus = new ListItem(GetLocaleResourceString("Admin.Common.All"), "0");
            this.ddlPaymentStatus.Items.Add(itemPaymentStatus);
            PaymentStatusCollection paymentStatuses = PaymentStatusManager.GetAllPaymentStatuses();
            foreach (PaymentStatus paymentStatus in paymentStatuses)
            {
                ListItem item2 = new ListItem(PaymentStatusManager.GetPaymentStatusName(paymentStatus.PaymentStatusId), paymentStatus.PaymentStatusId.ToString());
                this.ddlPaymentStatus.Items.Add(item2);
            }

            this.ddlShippingStatus.Items.Clear();
            ListItem itemShippingStatus = new ListItem(GetLocaleResourceString("Admin.Common.All"), "0");
            this.ddlShippingStatus.Items.Add(itemShippingStatus);
            ShippingStatusCollection shippingStatuses = ShippingStatusManager.GetAllShippingStatuses();
            foreach (ShippingStatus shippingStatus in shippingStatuses)
            {
                ListItem item2 = new ListItem(ShippingStatusManager.GetShippingStatusName(shippingStatus.ShippingStatusId), shippingStatus.ShippingStatusId.ToString());
                this.ddlShippingStatus.Items.Add(item2);
            }

            //START CHANGE
            this.ddlPaymentMethod.Items.Clear();
            ListItem itemPaymentMethod = new ListItem (GetLocaleResourceString("Admin.Common.All"), "0");
            this.ddlPaymentMethod.Items.Add(itemPaymentMethod);
            PaymentMethodCollection PaymentMethods = PaymentMethodManager.GetAllPaymentMethods();
            foreach (PaymentMethod PaymentMethod in PaymentMethods)
            {
                if (PaymentMethod.IsActive)
                {
                    ListItem item2 = new ListItem(PaymentMethod.Name, PaymentMethod.PaymentMethodId.ToString());
                    
                    this.ddlPaymentMethod.Items.Add(item2);
                }
            }
            //----- END CHANGE
            
        }


3) Change SearchOrder :  \Libraries\Nop.BusinessLogic\Orders\OrderManager.cs

/// Search orders
        /// </summary>
        /// <param name="startTime">Order start time; null to load all orders</param>
        /// <param name="endTime">Order end time; null to load all orders</param>
        /// <param name="customerEmail">Customer email</param>
        /// <param name="os">Order status; null to load all orders</param>
        /// <param name="ps">Order payment status; null to load all orders</param>
        /// <param name="ss">Order shippment status; null to load all orders</param>
        /// <param name="pt">Order Payment method null to load all orders</param>
        /// <returns>Order collection</returns>
        public static OrderCollection SearchOrders(DateTime? startTime, DateTime? endTime,
            string customerEmail, OrderStatusEnum? os, PaymentStatusEnum? ps,
            ShippingStatusEnum? ss, RecurringPaymentTypeEnum? pt)
        {
            int? orderStatusId = null;
            if (os.HasValue)
                orderStatusId = (int)os.Value;

            int? paymentStatusId = null;
            if (ps.HasValue)
                paymentStatusId = (int)ps.Value;

            int? shippingStatusId = null;
            if (ss.HasValue)
                shippingStatusId = (int)ss.Value;

            int? paymentMethod = null;
            if (pt.HasValue)
                paymentMethod = (int)pt.Value;

            var dbCollection = DBProviderManager<DBOrderProvider>.Provider.SearchOrders(startTime,
                endTime, customerEmail, orderStatusId, paymentStatusId, shippingStatusId, paymentMethod);
            var orders = DBMapping(dbCollection);
                      
            return orders;
        }


4) Change SearchOrders \Application\Libraries\Nop.DataAccess\Orders\DBOrderProvider.cs

/// Search orders
/// </summary>
/// <param name="startTime">Order start time; null to load all orders</param>
/// <param name="endTime">Order end time; null to load all orders</param>
/// <param name="customerEmail">Customer email</param>
/// <param name="orderStatusId">Order status identifier; null to load all orders</param>
/// <param name="paymentStatusId">Order payment status identifier; null to load all orders</param>
/// <param name="shippingStatusId">Order shipping status identifier; null to load all orders</param>
/// <param name="paymentMethod">Order payment method; null to load all orders</param>
/// <returns>Order collection</returns>
public abstract DBOrderCollection SearchOrders(DateTime? startTime,
DateTime? endTime, string customerEmail, int? orderStatusId,
int? paymentStatusId, int? shippingStatusId, int? paymentMethod);


5) Change Nop_OrderSearch database SP :

/****** Object:  StoredProcedure [dbo].[Nop_OrderSearch]    Script Date: 08/09/2010 15:17:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Nop_OrderSearch]
(
  @StartTime datetime = NULL,
  @EndTime datetime = NULL,
  @CustomerEmail nvarchar(255) = NULL,
  @OrderStatusID int,
  @PaymentStatusID int,
  @ShippingStatusID int,
  @PaymentMethodID int
)
AS
BEGIN
  SET NOCOUNT ON

  SELECT
    o.*
  FROM [Nop_Order] o
  LEFT OUTER JOIN [Nop_Customer] c ON o.CustomerID = c.CustomerID
  WHERE
    (@CustomerEmail IS NULL or LEN(@CustomerEmail)=0 or (c.Email like '%' + COALESCE(@CustomerEmail,c.Email) + '%')) and
    (@StartTime is NULL or @StartTime <= o.CreatedOn) and
    (@EndTime is NULL or @EndTime >= o.CreatedOn) and
    (@OrderStatusID IS NULL or @OrderStatusID=0 or o.OrderStatusID = @OrderStatusID) and
    (@PaymentStatusID IS NULL or @PaymentStatusID=0 or o.PaymentStatusID = @PaymentStatusID) and
    (@ShippingStatusID IS NULL OR @ShippingStatusID = 0 OR o.ShippingStatusID = @ShippingStatusID) and
    (@PaymentMethodID IS NULL OR @PaymentMethodID = 0 OR o.PaymentMethodID = @PaymentMethodID) and
    (o.Deleted=0)
  ORDER BY o.CreatedOn desc
END

Il y a 13 ans
Any idea to how to send mail ??
Il y a 13 ans
1- Create new Campaign mail.

2- Use :  
 int totalEmailsSent = CampaignManager.SendCampaign(2, subscriptions);
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.