Applying Template to Product vs. Category

Jul 29, 2009 at 6:20 PM

I am currently using templates that are associated with products via their category. However, within a single category, how can I associate one template for one product, and another for another product? For example, within a single category, some products have multiple options that would have different prices and I would like to use the Details template; however other products have no options (but belong to the same category) and just have a single price. How can I assign a specific template to a specific product?

Thanks for any help!

Coordinator
Jul 29, 2009 at 9:35 PM

HI,

The quick answer is you can't link individual products to a template!!

However I seem to think that when an option is not present in a product the option tokens don;t display anything, is this not correct?

 

Regards,

Dave.

Jul 29, 2009 at 10:45 PM

Yes, that is true.

I'm faced with a dilemma regarding the "Price" tag line. I'm using the productdetail2 template for an entire category in order to display product details. Some of the products do have options with associated prices, so I don't want to see the "Price: [TAG:FromPrice]" below the options for these types of products. I do, however, need to see that line for the products in the category that do not have options associated with separate prices. Is there a way to conditionally show the "Price..." line for only items with a separate price value and not products whose prices are listed with their options?

Thanks again!

Coordinator
Jul 30, 2009 at 7:11 AM

Hi,

I can see what you mean.  The only answer I have at the moment is to place a custom field in the product detail as a dropdown or radiobuttonlist with "","Price" as the values and use this to display the price label in the template, although this will need selecting for each product when there is not a price.

Regards,

Dave.

Coordinator
Jul 30, 2009 at 7:12 AM

BTW..you'll need to be running v1.1.7 in order to use the custom field options.

Aug 28, 2009 at 6:40 AM

I really need some out-of-the-box creative problem solving help, here. I cannot upgrade to v1.1.7 as it's still in beta, and my client has a Sept.1st launch date. My problem persists and I'm stumped for a solution. At the first walk-through of this e-store with my client, I described the scenario of the proposed solution, and they didn't want to require users to click on a price selection if only one price existed... I have to admit it doesn't seem that great to me, either.

Problem: I need to resolve the appearance of two prices on the productdetail.template for items that have different prices listed for different models. Since the category contains products that may or may not have different models I need to keep the price tag visible for those products without additional models. However, The products with additional models (and associated prices) should not have a price listed at the bottom of the page. Is there any way I can "hide" the price line when there are models for a product? In other words, only show the price line when there are not multiple models? Can I replicate the logic that only shows the Model's drop down when there are more than one model, only apply it to display a separate price, or not?

Anyway, any help or suggestions would really be great and truly appreciated.

Thanks!

 

 

Coordinator
Aug 28, 2009 at 8:29 AM

Hi,

In productTemplate.vb you could change the fromprice databinding:

From

Private Sub FromPrice_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim lc As Literal
            lc = CType(sender, Literal)
            Dim container As DataListItem
            container = CType(lc.NamingContainer, DataListItem)
            Dim fromPrice As Double = DataBinder.Eval(container.DataItem, "FromPrice")
            If fromPrice > 0 Or _ZeroPriceMsg = "" Then
                lc.Text = Format(fromPrice, "0.00")
            Else
                lc.Text = _ZeroPriceMsg
            End If
        End Sub
        
 To
            
            
        Private Sub FromPrice_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim lc As Literal
            lc = CType(sender, Literal)
            Dim container As DataListItem
            container = CType(lc.NamingContainer, DataListItem)
            Dim fromPrice As Double = DataBinder.Eval(container.DataItem, "FromPrice")
            Dim objCtrl As New ProductController
            Dim aryList As ArrayList

            aryList = objCtrl.GetModelList(-1, CInt(DataBinder.Eval(container.DataItem, "ProductID")), DataBinder.Eval(container.DataItem, "Lang"))
            If aryList.Count > 1 Then
                lc.Text = ""
            Else
                If fromPrice > 0 Or _ZeroPriceMsg = "" Then
                    lc.Text = Format(fromPrice, "0.00")
                Else
                    lc.Text = _ZeroPriceMsg
                End If
            End If
        End Sub

 

This would then not display a price if multiple models exist..

PLEASE NOTE: I've not tested, compliled or in anyway verified this code, it's just off the top of my head.

Of couse, your still going to have a problem when trying to upgrade NB_Store....I'm currently going through the last fixes to v1.1.7 before making it stable, hopefully next week. ( I have v1.1.7 running fine on 2 live sites and as long as you test before going live, I don't see any major problems in using v1.1.7 at the moment.)

Regards,

Dave.

Aug 28, 2009 at 4:32 PM

Hi Dave,

Thanks for your super-quick response! I will definitely give this a try and let you know how it goes as soon as I can.

I realize all the benefits of upgrading, yet I'm afraid I've put too much time into the latest version 1.1.6 to undergo the upgrade process right before launch. I do anticipate other issues when I upgrade as I've made some changes to the resource files, however I've been meticulously keeping track of my changes, and am prepared to repeat them... just not yet.

I must say, this would/could be a show-stopper for me, and I'm greatly relieved to have something to try. It is really a pleasure to work with you and your wonderful product!

THANK YOU! :)

Dana.

Sep 10, 2009 at 11:30 PM

Hi Dave,

I'm working with Dana, above, to make the change in productTemplate.vb on FromPrice_databinding that you suggested above, which looks straightforward.  Here's my problem - I'm having a hard time re-publishing NB_Store after making the change.  I think it's my lack of experience creating modules within DNN - so I'm not sure how to restore the source files for NB_Store, make the change, then re-create the .dll - separate from DNN (which I don't think is a WAP, right?)

I'm using Visual Studio 2008 , and can see that NB_Store is a Web Application Project, correct?  So I basically created a new, empty WAP in a separate folder from DNN, and then copied your NB_Store files - all .ascx and .vb files - into the new WAP, which I did call "NB_Store".  I then tried to "publish" the project - get errors.  The errors may come from the fact that I didn't copy all the files successfully, so I'm going to try the whole thing again...

In the meantime - can you just let me know if I have the right approach with this?  Is there an easier way for me to make the change to the productTemplate.vb file and recompile the NB_Store.dll?

Thanks for any help!

 

Coordinator
Sep 11, 2009 at 8:54 AM

Hi Lisa,

There are a lots of ways to do this, including just using notepad.....I wouldn't recommand this as it takes quite a bit of understanding of the project refs etc.

If you've got vs2008 your OK, I find the easiest way is to:

1. Create a DNN installation.

2. Install NB_Store as a module.

3. Download the source from codeplex from the SVN source tab...click the download button and you'll be able to download a zip. (The zip is also in the "source" package, but I like to get the codeplex one)

4. Unzip the zip into the /Desktopmodules/NB_Store  directory.

5 Open the NB_Store.sln

6. Now you need to relink any missing refs.  Especially the Dotnetnuke.dll.  You can link this directory to the /bin/dotnetnuke.dll.  I use localhost to automatically copy the compile link to the bin folder, but you don't need this in the project.

Good luck.

Dave.

Sep 14, 2009 at 3:22 PM

Hi Dave,

Thank you so much, everything worked great!!  Your suggested code  to remove the price from multiple models worked fine too.  Thanks for all your help with our application - NB_Store is a wonderful piece of software, and our user is thrilled with it.

Lisa