Rank: Member
Joined: 5/24/2004(UTC) Posts: 4,147
|
I'm creating a new product page module based on the BVC5 product module for a project. I need to place the first additional image under the primary image. I've got everything set up, but not sure how to grab the ImageURL of the first additional image for the product. Any ideas? |
|
|
|
|
Rank: Member
Joined: 1/3/2004(UTC) Posts: 1,497
|
Are you referring to the image used for the pop-up with additional images? I would look at the code for that pop-up page to see how it loads an image. |
|
|
|
|
Rank: Member
Joined: 5/24/2004(UTC) Posts: 4,147
|
Yep. OK, I screwed around with that code until I managed to get something out of it. I'm not much of a developer, so I'm sure there is a better way to do this in my situation, since I only want to show the first image. This does seem to work, though: Code: Try Dim images As Collection(Of Catalog.ProductImage) = Catalog.ProductImage.FindByProductId(LocalProduct.Bvin) If images IsNot Nothing Then Dim i As Integer Me.ProductSecondImage.ImageUrl = Page.ResolveUrl(Utilities.ImageHelper.GetValidImage(images(i).FileName, True)) Me.ProductSecondImage.AlternateText = images(i).Caption Me.ProductSecondImage.ToolTip = images(i).Caption End If Catch ex As Exception EventLog.LogEvent(ex) End Try I'd definitely be interested to know if there is a better way. This is my favorite way to learn. ;) |
|
|
|
|
Rank: Member
Joined: 11/18/2003(UTC) Posts: 1,465
|
I don't see where you are setting the value for the variable: i ? |
TIM
BVC Add-Ons and Development |
|
|
|
Rank: Member
Joined: 5/24/2004(UTC) Posts: 4,147
|
I don't either, which is why I'm surprised it works. Not sure what to set, though. |
|
|
|
|
Rank: Member
Joined: 11/5/2003(UTC) Posts: 2,136
Was thanked: 1 time(s) in 1 post(s)
|
Integers have a default value of 0. |
|
|
|
|
Rank: Member
Joined: 5/24/2004(UTC) Posts: 4,147
|
Guess that's why it works, heheh. :)
Would be nice to be able to say Me.LocalProduct.AdditionalImage(0), or something like that. |
|
|
|
|
Rank: Member
Joined: 5/24/2004(UTC) Posts: 4,147
|
I'm getting a lot of the following error in the EventLog, which I think is related to my code. This usually happens when coming back to the product page from the cart, and could have to do with that stupid URL change (why are we still seeing URLs like BVModules/ProductTemplates/BVC5/Product.aspx?productid=d2c569d8-326c-4090-887b-50c74acd28f1&LineItemId=29b8dc62-839b-48ed-8744-e50b0314c935 when coming back from the cart, instead of the rewritten myproduct.aspx?LineItemId=29b8dc62-839b-48ed-8744-e50b0314c935?)
================================== mscorlib
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index[ at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.ThrowHelper.ThrowArgumentOutOfRangeException() at System.Collections.Generic.List`1.get_Item(Int32 index) at BVModules_ProductTemplates_blacksheepstyle_Product.PopulateProductInfo(Boolean IsValidCombination) ] |
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.