Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6802371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:12:55+00:00 2026-05-26T19:12:55+00:00

I have some code here: (It basically checks if a product is a kit

  • 0

I have some code here:
(It basically checks if a product is a kit product or not then applys the New Price with the Price Modification)

if (!newItem.m_IsAKit)
{
    NewPR = AppLogic.DetermineLevelPrice(newItem.m_VariantID, m_ThisCustomer.CustomerLevelID, out IsOnSale);
    Decimal PrMod = AppLogic.GetColorAndSizePriceDelta(DB.RSField(rs, "ChosenColor"), DB.RSField(rs, "ChosenSize"), DB.RSFieldInt(rs, "TaxClassID"), ThisCustomer, true, false);
    if (PrMod != System.Decimal.Zero)
    {
        NewPR += PrMod;
    }
}
else
{
    NewPR = DB.RSFieldDecimal(rs, "ProductPrice");
    if (LevelDiscountPercent != 0.0M)
    {
        NewPR = AppLogic.GetKitTotalPrice(m_ThisCustomer.CustomerID, m_ThisCustomer.CustomerLevelID, newItem.m_ProductID, newItem.m_VariantID, newItem.m_ShoppingCartRecordID);
    }
 }

I have a product which IS a kit product so i am refering to the code after the else statement.

I need to apply NewPr += PrMod.

NewPr = 22
PrMod = 5

I have tried adding this code:

Decimal PrMod = AppLogic.GetColorAndSizePriceDelta(DB.RSField(rs, "ChosenColor"), DB.RSField(rs, "ChosenSize"), DB.RSFieldInt(rs, "TaxClassID"), ThisCustomer, true, false);
if (PrMod != System.Decimal.Zero)
{
    NewPR += PrMod;
}

But during debugging the PrMod doesnt seem to hold a value.

Can you help point me in the right direction?

Thanks


I have the following method but i cant seem to see where the problem is. When the product IS a kit product it works fine.

static public decimal GetColorAndSizePriceDelta(String ChosenColor, String ChosenSize, int TaxClassID, Customer ThisCustomer, bool WithDiscount, bool WithVAT)
        {
            bool VATEnabled = AppLogic.ProductIsMLExpress() == false && AppLogic.AppConfigBool("VAT.Enabled");
            bool VATOn = (VATEnabled && ThisCustomer.VATSettingReconciled == VATSettingEnum.ShowPricesInclusiveOfVAT);

            decimal CustLevelDiscountPct = 1.0M;
            decimal price = System.Decimal.Zero;
            String ColorPriceModifier = String.Empty;
            String SizePriceModifier = String.Empty;
            if (ThisCustomer.CustomerLevelID > 0 && WithDiscount)
            {
                decimal LevelDiscountPercent = System.Decimal.Zero;                
                using (SqlConnection dbconn = new SqlConnection(DB.GetDBConn()))
                {
                    dbconn.Open();
                    string sSql = string.Format("select LevelDiscountPercent from CustomerLevel with (NOLOCK) where CustomerLevelID={0}", ThisCustomer.CustomerLevelID);
                    using (IDataReader rs = DB.GetRS(sSql, dbconn))
                    {
                        if (rs.Read())
                        {
                            LevelDiscountPercent = DB.RSFieldDecimal(rs, "LevelDiscountPercent");
                        }
                    }
                }               

                if (LevelDiscountPercent != System.Decimal.Zero)
                {
                    CustLevelDiscountPct -= LevelDiscountPercent / 100.0M;
                }
            }
            if (ChosenColor.IndexOf("[") != -1)
            {
                int i1 = ChosenColor.IndexOf("[");
                int i2 = ChosenColor.IndexOf("]");
                if (i1 != -1 && i2 != -1)
                {
                    ColorPriceModifier = ChosenColor.Substring(i1 + 1, i2 - i1 - 1);
                }
            }
            if (ChosenSize.IndexOf("[") != -1)
            {
                int i1 = ChosenSize.IndexOf("[");
                int i2 = ChosenSize.IndexOf("]");
                if (i1 != -1 && i2 != -1)
                {
                    SizePriceModifier = ChosenSize.Substring(i1 + 1, i2 - i1 - 1);
                }
            }

            if (ColorPriceModifier.Length != 0)
            {
                price += Localization.ParseDBDecimal(ColorPriceModifier);
            }
            if (SizePriceModifier.Length != 0)
            {
                price += Localization.ParseDBDecimal(SizePriceModifier);
            }
            if (VATOn && WithVAT)
            {
                decimal TaxRate = 0.0M;
                TaxRate = ThisCustomer.TaxRate(TaxClassID);
                Decimal TaxMultiplier = (1.0M + (TaxRate / 100.00M));
                price = TaxMultiplier * price;
            }
            return price * CustLevelDiscountPct;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:12:56+00:00Added an answer on May 26, 2026 at 7:12 pm

    Why dont you initialize the varaible PrMod tp Zero

    You need to debbug AppLogic.GetColorAndSizePriceDelta method because if the return type is Decimal, it should atleast return a deafult value as 0.0M

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code here which works perfectly in firefox but not in chrome
We have some old C code here that's built with nmake. Is there an
I have some code where I'm returning an array of objects. Here's a simplified
I have some code that is using SyncEnumerator. As you can see here ,
Here's my problem - I have some code like this: <mx:Canvas width=300 height=300> <mx:Button
I am trying to reduce some code here. I will explain how I have
I have found some code on measuring execution time here http://www.dreamincode.net/forums/index.php?showtopic=24685 However, it does
So I have some PHP code that looks like: $message = 'Here is the
Here's the situation: We have some generic graphics code that we use for one
I have a piece of code here that i really could use some help

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.