Text instead of price on product page when using variants

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
flattmatt
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 25
Joined: Mon May 25, 2009 4:02 pm

Text instead of price on product page when using variants

Post by flattmatt » Tue Jun 30, 2009 10:40 pm

Hi
I couldn't find this anywhere-not sure what to search for - please correct me if I'm wrong.
I have many products, mostly with two variants on the same product. All my products start at $0.00, because most products have a variant of either $39 or $45 or something like that (some $10, and $15, etc...)
So I set the initial product price to $0.00 and use the Variant functions to Modify the price by the full amount. Problem is, when you go to the actual product page, the price is $0.00 to start with - which is rather misleading. I have set the header in the drop down to say "Choose Format", but if the price could begin as something like that, and then once a format is chosen, show me the actual price, that would be perfect.
I am using a Show Product 1 page.

Any help would be greatly appreciated!

William M
Commander (CMDR)
Commander (CMDR)
Posts: 150
Joined: Sat Feb 14, 2009 9:40 am
Contact:

Re: Text instead of price on product page when using variants

Post by William M » Wed Jul 01, 2009 6:34 am

I don't like to start at 0.00. For one thing, it looks kind of silly as you said.

If I know the small size is going to be $20.00, I start the product at $20.00 and the small choice is $0.00, the medium choice is $10.00 more, and the large choice is $20.00 more. Bumping or dropping the price a few dollars later is simpler this way too, only one price to change.

Starting at a positive number allows you to run a sale without the product showing a negative until a choice is made. -$5.00. Now, that looks REALLY dumb - and it looks like bad math when the base still shows $0.00 (instead of -$5.00) but the choice that should add $10.00 only adds $5.00. Much better when a $10.00 item shows the $5.00 sale as $5.00.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Text instead of price on product page when using variants

Post by mazhar » Wed Jul 01, 2009 6:40 am

Edit ConLib/Utility/ProductPrice.ascx.cs file and locate following code line in Page_PreRender method

Code: Select all

Price.Text = string.Format(_PriceFormat, priceWithVAT);
and replace it with

Code: Select all

if (priceWithVAT != 0)
                            Price.Text = string.Format(_PriceFormat, priceWithVAT);
                        else
                        {
                            if (_Product.Variants.Count > 0 && _Product.Price == 0)
                                Price.Text = "Choose Format...";
                        }

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Text instead of price on product page when using variants

Post by jmestep » Wed Jul 01, 2009 6:58 am

When you have your products at a 0 price, they get rejected by GoogleBase feed, so you need to consider that also.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

KreftB
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Thu Jun 11, 2009 8:56 am

Re: Text instead of price on product page when using variants

Post by KreftB » Wed Jul 01, 2009 7:27 pm

Thanks for the code script...this is what some of us were looking for. I added a few additional parameters and ran across a new issue that I'm having trouble with...

The code I'm using to control the price appearance is:

Code: Select all

if (_Product.Variants.Count > 0)
     Price.Text = "As Low As:" + string.Format(_PriceFormat, priceWithVAT);
   else
      {
         if (_Product.Variants.Count == 0)
                 Price.Text = string.Format(_PriceFormat, priceWithVAT);
      }
For variants, the code is doing what I need it do; however, on the "Buy Product Page", the text is carrying over and displaying as "Our Price: As Low As:" <price>.

In short, I need some assistance removing the phrase "As Low As" from this page only:"

Thanks in advance for your assistance.

Ben K
http://www.animalloft.com

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Text instead of price on product page when using variants

Post by mazhar » Thu Jul 02, 2009 10:16 am

Our Price label is inside BuyProductDialog control so you need to put something in that control to hide it when no variant is selected.

KreftB
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Thu Jun 11, 2009 8:56 am

Re: Text instead of price on product page when using variants

Post by KreftB » Thu Jul 02, 2009 3:26 pm

Thanks for posting back...I don't want to hide the "Our Price" label...I want to have the space show only the numeric price, not the text that I added in my code. In other words, I don't want the custom code to be applied to this page, but I do want it to be applied to the Featured Products conlib and the Category Grid pages.

Any suggestions? I'm still learning the AbleCommerce files.

Thanks,

Ben K
http://www.animalloft.com

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Text instead of price on product page when using variants

Post by jmestep » Fri Jul 03, 2009 5:53 am

You could make a customized copy of the Utility/ProductPrice and use it instead
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

KreftB
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Thu Jun 11, 2009 8:56 am

Re: Text instead of price on product page when using variants

Post by KreftB » Fri Jul 03, 2009 8:26 am

Thanks...That makes complete sense...Worked perfectly!

In addition, I constructed a conditional statement that shows the price label text as "As Low As" at page load but changes to "Our Price" when a variant is selected.

Exactly what I wanted!

Thanks again,

Ben K
http://www.animalloft.com

flattmatt
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 25
Joined: Mon May 25, 2009 4:02 pm

Re: Text instead of price on product page when using variants

Post by flattmatt » Tue Jul 07, 2009 11:55 am

Code: Select all

Price.Text = string.Format(_PriceFormat, priceWithVAT);
and replace it with

Code: Select all

if (priceWithVAT != 0)
                            Price.Text = string.Format(_PriceFormat, priceWithVAT);
                        else
                        {
                            if (_Product.Variants.Count > 0 && _Product.Price == 0)
                                Price.Text = "Choose Format...";
                        }
I tried this, and it seems simple enough - but it generates this error on my category listing pages and search pages:


[[ConLib:Custom/CategoryGridPage4]] c:\websites\Able70_new2\ConLib\Utility\ProductPrice.ascx.cs(244): error CS1502: The best overloaded method match for 'CommerceBuilder.Orders.BasketItemDataSource.CreateForProduct(int, short, string, string)' has some invalid arguments

I can't even get past that to view a product

Here's what the code looks like:

Code: Select all

  protected void Page_PreRender(object sender, EventArgs e)
    {
        if (_Product != null)
        {
            if (!_Product.UseVariablePrice)
            {
                // UPDATE THE INCLUDED KITPRODUCTS (Included-Hidden and Included-Shown)
                if (_SelectedKitProducts == null || _SelectedKitProducts.Count == 0) UpdateIncludedKitOptions();
                ProductCalculator pcalc = ProductCalculator.LoadForProduct(_Product.ProductId, 1, _OptionList, _SelectedKitProducts);
                //IF REQUIRED MAKE ADJUSTMENTS TO DISPLAYED PRICE TO INCLUDE VAT
                LSDecimal basePriceWithVAT = TaxHelper.GetShopPrice(_Product.Price, _Product.TaxCodeId);
                LSDecimal priceWithVAT = TaxHelper.GetShopPrice(pcalc.Price, _Product.TaxCodeId);
                LSDecimal msrpWithVAT = TaxHelper.GetShopPrice(_Product.MSRP, _Product.TaxCodeId);
                if (!_Product.HidePrice)
                {
                    //PRICE IS VISIBLE, NO POPUP
                    phPricePopup.Visible = false;
                    //SHOW RETAIL PRICE IF INDICATED
                    if (_ShowRetailPrice && _Product.MSRP > 0 && !_Product.UseVariablePrice)
                    {
                        RetailPrice1.Text = string.Format(_RetailPriceFormat, _Product.MSRP);
                    }
                    else RetailPrice1.Text = string.Empty;
                    //SHOW THE PRICE
                    if (pcalc.AppliedSpecial != null && pcalc.AppliedSpecial.EndDate != DateTime.MinValue)
                    {
                        // SHOW THE BASE PRICE AND SPECIAL PRICE
                        RetailPrice1.Text = string.Format(_BasePriceFormat, basePriceWithVAT);
                        Price.Text = string.Format(_SpecialPriceFormat, priceWithVAT, pcalc.AppliedSpecial.EndDate);
                    }
                    else
                    {
                        if (priceWithVAT != 0)
                            Price.Text = string.Format(_PriceFormat, priceWithVAT);
                        else
                        {
                            if (_Product.Variants.Count > 0 && _Product.Price == 0)
                                Price.Text = "Choose Format...";
                        }
                    }
                }
                else
I don't think you need more than that.

Thanks!

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Text instead of price on product page when using variants

Post by jmestep » Tue Jul 07, 2009 12:30 pm

You might be using code from a different build. Some of those things changed.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

flattmatt
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 25
Joined: Mon May 25, 2009 4:02 pm

Re: Text instead of price on product page when using variants

Post by flattmatt » Tue Jul 07, 2009 12:34 pm

My build info is:
PLATFORM: ASP.NET
VERSION: 7.0.3
BUILD: 12458

Any ideas there?

flattmatt
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 25
Joined: Mon May 25, 2009 4:02 pm

Re: Text instead of price on product page when using variants

Post by flattmatt » Tue Jul 07, 2009 1:54 pm

To make things even worse, when I upload my backup file with the original code, the error is still there!

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Text instead of price on product page when using variants

Post by jmestep » Tue Jul 07, 2009 4:14 pm

I tested the code and it worked fine on product, category and search pages.
Is this what your code in the ProductPrice.ascx.cs is showing? That code did change in 7.0.3

Code: Select all

            //USE VALUES FROM VS, CURRENT PROPERTIES MAY NOT BE CORRECT
            BasketItem basketItem = BasketItemDataSource.CreateForProduct(_AddProductId, 1, _AddOptionList, AlwaysConvert.ToList(",", _AddKitProducts));

Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

flattmatt
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 25
Joined: Mon May 25, 2009 4:02 pm

Re: Text instead of price on product page when using variants

Post by flattmatt » Tue Jul 07, 2009 4:28 pm

Nope, it shows this:

Code: Select all

 //USE VALUES FROM VS, CURRENT PROPERTIES MAY NOT BE CORRECT
            BasketItem basketItem = BasketItemDataSource.CreateForProduct(_AddProductId, 1, _AddOptionList, _AddKitProducts);
            if (basketItem != null)

flattmatt
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 25
Joined: Mon May 25, 2009 4:02 pm

Re: Text instead of price on product page when using variants

Post by flattmatt » Tue Jul 07, 2009 4:36 pm

It also returns this in a product page where the price should be:

Code: Select all

[[ConLib:BuyProductDialog]] c:\websites\Able70_new2\ConLib\Utility\ProductPrice.ascx.cs(244): error CS1502: The best overloaded method match for 'CommerceBuilder.Orders.BasketItemDataSource.CreateForProduct(int, short, string, string)' has some invalid arguments 
What is baffling me, is all I did was change that line of code from above - got the error - uploaded my backup file that I had just duplicated, and I still get this error - it's the same file that was there before. We even compared it to several backup files and line for line it's identical!

flattmatt
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 25
Joined: Mon May 25, 2009 4:02 pm

Re: Text instead of price on product page when using variants

Post by flattmatt » Wed Jul 08, 2009 7:21 am

We got it fixed - installed the file from the latest build and it corrected the problem, and the code for the text instead of price worked.
Thanks for all the input and help!

Post Reply