Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 5 of 5

Thread: Moving Order Notes from first checkout page

  1. #1
    omairkha is offline Member
    Join Date
    Aug 2011
    Posts
    89

    Question Moving Order Notes from first checkout page

    Hi All,

    Currently the space for a customer to enter order notes is on the very first page of the checkout process (shoppingcart.aspx).

    I need to move this box so that it appears on the Shipping selection page instead (checkoutshipping.aspx). I have the box on the shipping page but having problems trying to find and move the function which saves the field to the db. Can anyone suggest a simple routine that I could use with new button called "Save Notes" in checkoutshipping.aspx.cs?

    Thanks in advance for the help

    Edit: Using MS 9.1.0.1
    Last edited by omairkha; 05-13-2013 at 10:44 AM.

  2. #2
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    Moving this item isn't too complicated, but can get a little involved. Before I go into it, may I ask why you want to do this?
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  3. #3
    omairkha is offline Member
    Join Date
    Aug 2011
    Posts
    89

    Default

    Hi cjbarth,

    Basically we allow people to charge shipping to their UPS Carrier Account so we need a way for them to enter their UPS account number. We figured it might be easier to just move the Order Notes to the shipping page and have them enter the account number there instead of trying to add another field specifically for the account number to be entered since we don't have access to the source code.

    I have a work around currently in place which is basically a button that says "edit order notes" and just takes the user back to the first checkout page.

  4. #4
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    I had to do the exact same thing. I modified the list of shipping options. Please note the following change logs:

    RTShipping.vb
    Code:
    @@ -768,6 +768,16 @@
     				SM.Sort(rtsComparer)
     			End If
     
    +            'LTL/Other Shipping Method add-on
    +            Dim otherShipMethod As New ShipMethod
    +            otherShipMethod.Carrier = "Other"
    +            otherShipMethod.FreeItemsRate = 0
    +            otherShipMethod.ServiceName = "Other Carrier - Call For Price"
    +            otherShipMethod.ShippingMethodID = 999
    +            otherShipMethod.ServiceRate = 0
    +            otherShipMethod.VatRate = 0
    +            SM.AddMethod(otherShipMethod)
    +
     			' Check list format type, and setup appropriate 
     			Dim output As New StringBuilder(1024)
     			Dim returnObject As Object = Nothing
    RTShipping.vb
    Code:
    @@ -772,7 +772,7 @@
                 Dim otherShipMethod As New ShipMethod
                 otherShipMethod.Carrier = "Other"
                 otherShipMethod.FreeItemsRate = 0
    -            otherShipMethod.ServiceName = "Other Carrier - Call For Price"
    +            otherShipMethod.ServiceName = "Other Carrier - Please Provide Account Number:"
                 otherShipMethod.ShippingMethodID = 999
                 otherShipMethod.ServiceRate = 0
                 otherShipMethod.VatRate = 0
    @@ -864,9 +864,9 @@
     				Case ResultType.CollectionList
     					returnObject = CObj(SM)
     					Exit Select
    -			End Select
    -
    -			Return returnObject
    +            End Select
    +
    +            Return returnObject
     		End Function
     
     		'had to leave for google checkout...google checkout does not support shipping by multiple distributors
    ShoppingCart.vb
    Code:
    @@ -5220,7 +5220,7 @@
     					tmpS.Append("<table width=""100%"" cellpadding=""4"" cellspacing=""0"" border=""0"" style=""" & AppLogic.AppConfig("BoxFrameStyle") & """>" & vbLf)
     					tmpS.Append("<tr><td align=""left"" valign=""top"">" & vbLf)
     
    -					tmpS.Append(OrderNotes)
    +                    tmpS.Append(OrderNotes.Replace(Environment.NewLine, "<br />"))
     
     					tmpS.Append("</td></tr>" & vbLf)
     					tmpS.Append("</table>" & vbLf)
    @@ -8457,7 +8457,7 @@
     		''' <value>The order notes.</value>
     		Public ReadOnly Property OrderNotes() As String
     			Get
    -				Return m_OrderNotes
    +                Return m_OrderNotes
     			End Get
     		End Property
    checkoutshipping.aspx
    Code:
    @@ -167,6 +167,7 @@
     					<tr>
     						<td>
     							<aspdnsfc:ShippingMethodControl ID="ctrlShippingMethods" runat="server"/>
    +							<asp:TextBox ID="txtOtherShippingNotes" runat="server" Visible="false"></asp:TextBox>
     						</td>
     						<td style="width:250px;">
     							<aspdnsf:BuySafeKicker ID="buySAFEKicker" WrapperClass="shippingKicker" runat="server" />
    @@ -202,7 +203,7 @@
     			  />
     		</aspdnsfc:ShoppingCartControl>
     
    -		<asp:Literal ID="CartSummary" runat="server"></asp:Literal>
    +		<asp:Literal ID="CartSummary" Mode="PassThrough" runat="server"></asp:Literal>
     
     		<br />
     		<aspdnsf:OrderOption id="ctrlOrderOption" runat="server" EditMode="false" />
    checkoutshipping.aspx.vb
    Code:
    @@ -233,9 +233,17 @@
     			ctrlShoppingCart.HeaderTabImageURL = AppLogic.SkinImage("OrderInfo.gif")
     			ctrlShoppingCart.HeaderTabEditOderLink = String.Format(" {0}<a href=""ShoppingCart.aspx""> {1}</a>", AppLogic.GetString("checkoutcard.aspx.9", SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("checkoutcard.aspx.10", SkinID, ThisCustomer.LocaleSetting))
     
    -			AppLogic.eventHandler("CheckoutShipping").CallEvent("&CheckoutShipping=true")
    +            AppLogic.eventHandler("CheckoutShipping").CallEvent("&CheckoutShipping=true")
     
    -		End Sub
    +            'mod for Other shipping method
    +            Dim shippingMethods As ShippingMethodCollection = CType(ctrlShippingMethods.DataSource, ShippingMethodCollection)
    +            For Each ShippingMethod In shippingMethods
    +                If ShippingMethod.Name.ToLowerInvariant.Contains("carrier") Then
    +                    txtOtherShippingNotes.Visible = True
    +                End If
    +            Next
    +
    +        End Sub
     
     
     		Public Sub ShippingCountry_Change(ByVal sender As Object, ByVal e As EventArgs)
    @@ -556,38 +564,45 @@
     					ShippingMethod = String.Format(AppLogic.GetString("shoppingcart.aspx.16", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) & " : {0}", cartFreeShippingReason)
     				End If
     
    -				Dim sql As String = String.Empty
    -				If (Not cart.IsAllFreeShippingComponents()) AndAlso (Not cart.ContainsRecurring()) Then
    -					sql = String.Format("update dbo.ShoppingCart set ShippingMethodID={0}, ShippingMethod={1}, ShippingAddressID={4} where CustomerID={2} and CartType={3}", ShippingMethodID.ToString(), DB.SQuote(ShippingMethod), ThisCustomer.CustomerID.ToString(), CInt(Fix(CartTypeEnum.ShoppingCart)).ToString(), ddlChooseShippingAddr.SelectedValue)
    -					DB.ExecuteSQL(sql)
    -				Else
    -					For i As Integer = 0 To cart.CartItems.Count-1
    -						Dim _CartItem As CartItem = CType(cart.CartItems(i), CartItem)
    -						Dim _CartRecID As Integer = DB.GetSqlN(String.Format("select ShoppingCartRecID N from ShoppingCart where CustomerID={0} and ProductID={1} and VariantID={2} and CartType={3}", ThisCustomer.CustomerID.ToString(), _CartItem.ProductID, _CartItem.VariantID, CInt(Fix(_CartItem.CartType)).ToString()))
    +                Dim sql As String = String.Empty
     
    -						If (Not _CartItem.FreeShipping) OrElse AppLogic.AppConfigBool("FreeShippingAllowsRateSelection") Then
    -							sql = String.Format("update dbo.ShoppingCart set ShippingMethodID={0}, ShippingMethod={1}, ShippingAddressID={4} where CustomerID={2} and CartType={3} and ShoppingCartRecID={5}", ShippingMethodID.ToString(), DB.SQuote(ShippingMethod), ThisCustomer.CustomerID.ToString(), CInt(Fix(CartTypeEnum.ShoppingCart)).ToString(), ddlChooseShippingAddr.SelectedValue, _CartRecID.ToString())
    -						Else
    -							sql = String.Format("update dbo.ShoppingCart set ShippingAddressID={0} where CustomerID={1} and CartType={2} and ShoppingCartRecID={3}", ddlChooseShippingAddr.SelectedValue, ThisCustomer.CustomerID.ToString(), CInt(Fix(_CartItem.CartType)).ToString(), _CartRecID.ToString())
    -						End If
    -						DB.ExecuteSQL(sql)
    -					Next i
    -				End If
    +                'mod for Other shipping method
    +                If ctrlShippingMethods.SelectedItem.Value.Contains("Other") Then
    +                    sql = String.Format("update dbo.Customer set OrderNotes = (select convert(varchar(max),OrderNotes) + {0} + {0} + 'SHIPPING NOTES: {2}' from Customer where CustomerID={1}) where CustomerID={1}", Environment.NewLine, ThisCustomer.CustomerID.ToString(), txtOtherShippingNotes.Text)
    +                    DB.ExecuteSQL(sql)
    +                End If
     
    -				sql = String.Format("update dbo.Customer set ShippingAddressID = {0} where CustomerID={1} ", ddlChooseShippingAddr.SelectedValue, ThisCustomer.CustomerID.ToString())
    -				DB.ExecuteSQL(sql)
    +                If (Not cart.IsAllFreeShippingComponents()) AndAlso (Not cart.ContainsRecurring()) Then
    +                    sql = String.Format("update dbo.ShoppingCart set ShippingMethodID={0}, ShippingMethod={1}, ShippingAddressID={4} where CustomerID={2} and CartType={3}", ShippingMethodID.ToString(), DB.SQuote(ShippingMethod), ThisCustomer.CustomerID.ToString(), CInt(Fix(CartTypeEnum.ShoppingCart)).ToString(), ddlChooseShippingAddr.SelectedValue)
    +                    DB.ExecuteSQL(sql)
    +                Else
    +                    For i As Integer = 0 To cart.CartItems.Count - 1
    +                        Dim _CartItem As CartItem = CType(cart.CartItems(i), CartItem)
    +                        Dim _CartRecID As Integer = DB.GetSqlN(String.Format("select ShoppingCartRecID N from ShoppingCart where CustomerID={0} and ProductID={1} and VariantID={2} and CartType={3}", ThisCustomer.CustomerID.ToString(), _CartItem.ProductID, _CartItem.VariantID, CInt(Fix(_CartItem.CartType)).ToString()))
     
    -				If cart.ContainsGiftCard() Then
    -					Response.Redirect("checkoutgiftcard.aspx")
    -				Else
    -					If ThisCustomer.ThisCustomerSession("PayPalExpressToken") = "" Then
    -						Response.Redirect("checkoutpayment.aspx")
    -					Else
    -						Response.Redirect("checkoutreview.aspx?PaymentMethod=PAYPALEXPRESS")
    -					End If
    -				End If
    -			End If
    -		End Sub
    +                        If (Not _CartItem.FreeShipping) OrElse AppLogic.AppConfigBool("FreeShippingAllowsRateSelection") Then
    +                            sql = String.Format("update dbo.ShoppingCart set ShippingMethodID={0}, ShippingMethod={1}, ShippingAddressID={4} where CustomerID={2} and CartType={3} and ShoppingCartRecID={5}", ShippingMethodID.ToString(), DB.SQuote(ShippingMethod), ThisCustomer.CustomerID.ToString(), CInt(Fix(CartTypeEnum.ShoppingCart)).ToString(), ddlChooseShippingAddr.SelectedValue, _CartRecID.ToString())
    +                        Else
    +                            sql = String.Format("update dbo.ShoppingCart set ShippingAddressID={0} where CustomerID={1} and CartType={2} and ShoppingCartRecID={3}", ddlChooseShippingAddr.SelectedValue, ThisCustomer.CustomerID.ToString(), CInt(Fix(_CartItem.CartType)).ToString(), _CartRecID.ToString())
    +                        End If
    +                        DB.ExecuteSQL(sql)
    +                    Next i
    +                End If
    +
    +                sql = String.Format("update dbo.Customer set ShippingAddressID = {0} where CustomerID={1} ", ddlChooseShippingAddr.SelectedValue, ThisCustomer.CustomerID.ToString())
    +                DB.ExecuteSQL(sql)
    +
    +                If cart.ContainsGiftCard() Then
    +                    Response.Redirect("checkoutgiftcard.aspx")
    +                Else
    +                    If ThisCustomer.ThisCustomerSession("PayPalExpressToken") = "" Then
    +                        Response.Redirect("checkoutpayment.aspx")
    +                    Else
    +                        Response.Redirect("checkoutreview.aspx?PaymentMethod=PAYPALEXPRESS")
    +                    End If
    +                End If
    +            End If
    +        End Sub
     
     		Private Sub CreateShipAddress()
     			Dim thisAddress As New Address()
    notification.receipt.xml.config
    Code:
    @@ -255,9 +255,9 @@
     
     				
     
    -																<xsl:call-template name="GenerateOrderNotesSummary">
    -								<xsl:with-param name="OrderInfo" select="/root/Order/OrderInfo" />
    -							</xsl:call-template>
    +							    <xsl:call-template name="GenerateOrderNotesSummary">
    +								    <xsl:with-param name="OrderInfo" select="/root/Order/OrderInfo" />
    +							    </xsl:call-template>
     
     
     									<!--Line Item Section-->
    @@ -1458,7 +1458,9 @@
     							<xsl:value-of select="aspdnsf:StringResource('order.cs.29', $LocaleSetting)" disable-output-escaping="yes" />
     						</xsl:when>
     						<xsl:otherwise>
    -							<xsl:value-of select="$OrderInfo/OrderNotes" />
    +              <xsl:call-template name="PreserveLineBreaks">
    +                <xsl:with-param name="text" select="$OrderInfo/OrderNotes" />
    +              </xsl:call-template>
     						</xsl:otherwise>
     					</xsl:choose>
     				</div>
    @@ -1752,6 +1754,25 @@
     				</table>
     			</xsl:template>
     
    +      <!--http://www.danrigsby.com/blog/index.php/2008/01/03/preserving-line-breaks-in-xml-while-transforming-to-html-with-xslt/-->
    +      <xsl:template name="PreserveLineBreaks">
    +        <xsl:param name="text"/>
    +        <xsl:choose>
    +          <xsl:when test="contains($text,'&#xA;')">
    +            <xsl:value-of select="substring-before($text,'&#xA;')"/>
    +            <br/>
    +            <xsl:call-template name="PreserveLineBreaks">
    +              <xsl:with-param name="text">
    +                <xsl:value-of select="substring-after($text,'&#xA;')"/>
    +              </xsl:with-param>
    +            </xsl:call-template>
    +          </xsl:when>
    +          <xsl:otherwise>
    +            <xsl:value-of select="$text"/>
    +          </xsl:otherwise>
    +        </xsl:choose>
    +      </xsl:template>
    +
     		</xsl:stylesheet>
     
     	</PackageTransform>
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  5. #5
    omairkha is offline Member
    Join Date
    Aug 2011
    Posts
    89

    Default

    Hi cjbarth,

    Thanks for the code. Unfortunately we don't have access to the full source code so I don't think we can do it the way you have. We don't have access to the *.vb files.