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 3 of 3

Thread: Where in the Source Code does the OrderedProductPrice get set?

  1. #1
    awoomer is offline Member
    Join Date
    Jul 2006
    Posts
    73

    Default Where in the Source Code does the OrderedProductPrice get set?

    Can somebody please tell me where the OrderedProductPrice gets set in the Orders_ShoppingCart table?

    It looks to me like it's supposed to get filled with the ProductPrice column of the ShoppingCart table but that's not the value it's getting. It's getting the SalePrice value from the ProductVariant table.

    As a result and due to some custom code, my receipt is getting the wrong prices in each line item.

    Thanks

    AspDotNetStorefront ML 6.1.3.1/6.1
    DB Version: 6.1
    w/Source Code
    ASPDNSF MultiStore 9
    w/Source Code

  2. #2
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    That's inserted/updated in Gateway.MakeOrder() method. The OrderedProductPrice value is the NET of all discounts applied in the cart. For example: Item A's regular price is $50, the customer is under a 'Customer Level' with $1 off the product price.

    The result would be: $50 - $1 = $49 (OrderedProductPrice)

  3. #3
    awoomer is offline Member
    Join Date
    Jul 2006
    Posts
    73

    Default

    Thanks Alfred but no matter what I try, I get the price from the ProductVariant table in the Orders_ShoppingCart table

    I even went as far as commenting out this entire block

    Code:
    '' now set extended pricing info in the order cart to take into account all levels, quantities, etc...so the order object doesn't have to recompute cart stuff
                    'For Each c As CartItem In cart.CartItems
                    '    If (Not c.m_CustomerEntersPrice) AndAlso (Not AppLogic.IsAKit(c.m_ProductID)) AndAlso (Not AppLogic.IsAPack(c.m_ProductID)) Then
                    '        Dim Q As Integer = c.m_Quantity
                    '        Dim IsOnSale As Boolean = False
                    '        Dim pr As Decimal = 0D
                    '        If cart.CartType = CartTypeEnum.RecurringCart Then
                    '            pr = c.m_Price ' price is grandfathered
                    '        Else
                    '            pr = AppLogic.DetermineLevelPrice(c.m_VariantID, cart.ThisCustomer.CustomerLevelID, IsOnSale)
                    '        End If
                    '        pr = pr * Q
                    '        Dim ActiveDID As Integer = 0
                    '        Dim DIDPercent As Decimal = 0D
                    '        If AppLogic.CustomerLevelAllowsQuantityDiscounts(cart.ThisCustomer.CustomerLevelID) Then
                    '            ActiveDID = AppLogic.LookupActiveVariantQuantityDiscountID(cart.EntityHelpers, c.m_VariantID)
                    '            DIDPercent = AppLogic.GetDIDPercent(ActiveDID, Q)
                    '            If ActiveDID <> 0 AndAlso DIDPercent <> 0D Then
                    '                pr = (1D - (DIDPercent / 100D)) * pr
                    '            End If
                    '        End If
                    '        Dim regular_pr As Decimal = System.Decimal.Zero
                    '        Dim sale_pr As Decimal = System.Decimal.Zero
                    '        Dim extended_pr As Decimal = System.Decimal.Zero
                    '        If cart.CartType <> CartTypeEnum.RecurringCart Then
                    '            regular_pr = AppLogic.GetVariantPrice(c.m_VariantID)
                    '            sale_pr = AppLogic.GetVariantSalePrice(c.m_VariantID)
                    '            extended_pr = AppLogic.GetVariantExtendedPrice(c.m_VariantID, cart.ThisCustomer.CustomerLevelID)
    
                    '            ' adjust for color & size price modifirers:
                    '            Dim PrMod As Decimal = AppLogic.GetColorAndSizePriceDelta(c.m_ChosenColor, c.m_ChosenSize)
                    '            If PrMod <> System.Decimal.Zero Then
                    '                pr += (PrMod * Q)
                    '            End If
                    '            If pr < System.Decimal.Zero Then
                    '                pr = System.Decimal.Zero ' never know what people will put in the modifiers :)
                    '            End If
                    '        Else
                    '            regular_pr = c.m_Price
                    '            sale_pr = System.Decimal.Zero
                    '            extended_pr = System.Decimal.Zero
                    '        End If
    
                    '        DB.ExecuteSQL("update orders_ShoppingCart set OrderedProductPrice=" & Localization.CurrencyStringForDBWithoutExchangeRate(pr) & ", OrderedProductRegularPrice=" & Localization.CurrencyStringForDBWithoutExchangeRate(regular_pr) & ", OrderedProductSalePrice=" & Localization.CurrencyStringForDBWithoutExchangeRate(sale_pr) & ", OrderedProductExtendedPrice=" & Localization.CurrencyStringForDBWithoutExchangeRate(extended_pr) & " where OrderNumber=" & OrderNumber.ToString() & " and ShoppingCartRecID=" & c.m_ShoppingCartRecordID.ToString())
                    '    Else
                    '        Dim Q As Integer = c.m_Quantity
                    '        Dim pr As Decimal = c.m_Price * Q
                    '        DB.ExecuteSQL("update orders_ShoppingCart set OrderedProductPrice=" & Localization.CurrencyStringForDBWithoutExchangeRate(pr) & " where OrderNumber=" & OrderNumber.ToString() & " and ShoppingCartRecID=" & c.m_ShoppingCartRecordID.ToString())
                    '    End If
                    'Next c
    and replacing it with this

    Code:
    Dim sql7 As String = "select ProductPrice, ShoppingCartRecID from ShoppingCart " & String.Format(" where CustomerID={0} ", cart.ThisCustomer.CustomerID)
                    Dim myRS As IDataReader = DB.GetRS(sql7)
                    Do While myRS.Read()
                        Dim pr As Decimal = DB.RSFieldDecimal(myRS, "ProductPrice")
                        Dim cartID As Integer = DB.RSFieldInt(myRS, "ShoppingCartRecID")
    
                        DB.ExecuteSQL("update orders_ShoppingCart set OrderedProductPrice=" & Localization.CurrencyStringForDBWithoutExchangeRate(pr) & " where OrderNumber=" & OrderNumber.ToString() & " and ShoppingCartRecID=" & cartID.ToString())
                    Loop
                    myRS.Close()
    and my ShoppingCart table prices of
    1.9900
    1.1300
    1.9900
    1.1300
    1.9900
    1.9900
    1.9900

    still end up as these in the Orders_ShoppingCart table
    1.9900
    1.4900
    1.9900
    1.4900
    1.9900
    1.9900
    1.9900

    There aren't getting updated after that block because if I hard code 2D into

    Code:
    Dim sql7 As String = "select ProductPrice, ShoppingCartRecID from ShoppingCart " & String.Format(" where CustomerID={0} ", cart.ThisCustomer.CustomerID)
                    Dim myRS As IDataReader = DB.GetRS(sql7)
                    Do While myRS.Read()
                        Dim pr As Decimal = DB.RSFieldDecimal(myRS, "ProductPrice")
                        Dim cartID As Integer = DB.RSFieldInt(myRS, "ShoppingCartRecID")
    
                        DB.ExecuteSQL("update orders_ShoppingCart set OrderedProductPrice=" & Localization.CurrencyStringForDBWithoutExchangeRate(2D) & " where OrderNumber=" & OrderNumber.ToString() & " and ShoppingCartRecID=" & cartID.ToString())
                    Loop
                    myRS.Close()
    I get these values in the Orders_ShoppingCart table
    2.0000
    2.0000
    2.0000
    2.0000
    2.0000
    2.0000
    2.0000

    I'm thoroughly confused.

    Thanks
    ASPDNSF MultiStore 9
    w/Source Code