BV Commerce Forum
»
BV Commerce Support
»
General Support
»
Adding additional paramaters onto the product URL...
Rank: Member
Joined: 7/3/2007(UTC) Posts: 79
|
Hi,
I'm trying to add on the categoryID to the product url so that the category stays selected in the menu when looking at a product, and was just wondering how to do this.
I've looked at the [2]BuildPhysicalUrlForProduct and BuildlUrlForProduct functions in UrlReWriter.vb but am not sure whether that's the right place to be looking. Any pointers would be most appreciated...[/2]
Thanks,
Jason
|
|
|
|
Rank: Member
Joined: 4/10/2006(UTC) Posts: 462
|
Jason, If you are trying to do what I think you are trying to do, you probably do not need to add the category id to the url. Please see this post and see if this is what your trying to accomplish. The code I posted I never got around to fully testing, however, it appears to have been downloaded 16 times and I haven't heard anything from anybody. http://forums.bvcommerce...lt.aspx?f=78&m=48508 |
Netriplex Corporation<br /> |
|
|
|
Rank: Member
Joined: 7/3/2007(UTC) Posts: 79
|
Hi there,
That's exactly what i'm trying to achieve! We get a lot of users finding our site via search engines and they usually go direct to a product page first and it would benice to show them where they are in the category menu (not using breadcrumbs as our site's too small for that)
I've implemented the code in the forum link you posted, and it kind of works! There's no issue with this route: home page >> category >> product. All the "highlighting" is working fine there, but when you search, or enter a url directly it's remembering the last category that was selected and choosing that to be highlighted. Also, there is one category that's not getting highlighted at all!
I've got a pretty flat hierarchy. In fact it's totally flat, 10 sections that each contain items, and some can be in more than one top level section.
Any ideas?
Regards,
Jason
</FONT>
|
|
|
|
Rank: Member
Joined: 7/3/2007(UTC) Posts: 79
|
Hi Again,
All fixed! I actually pinched some code from the products_edit_categories.aspx page in the admin site and it all works great... assuming you only to reference the 1st category (which I do).
Here's what I replaced in the LoadMenu() function of Category Menu/view.ascx.vb
[1] If Request.QueryString("categoryId") IsNot Nothing Then currentId = Request.QueryString("categoryId") Else '# Old BVC code: currentId = SessionManager.CategoryLastId '# Jason's modification: Dim t As Collection(Of Catalog.Category) = Catalog.InternalProduct.GetCategories(Request.QueryString("productid")) currentId = Catalog.InternalProduct.GetCategories(Request.QueryString("productid")).Item(0).Bvin[/1]
[1] End If[/1]
[1][/1]
Can't believe it's taken me all afternoon to write 2 lines of code! LOL!
Jason
Needapresent.com
|
|
|
|
Rank: Member
Joined: 4/10/2006(UTC) Posts: 462
|
Hi Jason,
Providing a link or exact example would better help me figure out the problem. If you don't want it public you can e-mail me at info [at] caplinkbdc [dot] com.
Based on your description I believe what may be occuring is that you are navigating "directly" to a product page after already establishing a session. If I remember correctly, when I wrote that mod, I basically used the bvc api's SessionManager which has something like a LastCategoryTrail or something like that you can reference. If that was null, then it would use the category structure to determine the "best" category as described in the referenced post. Therefore if you go, Home > category > product and then without closing your browser to end the session, simply navigate to a different product url, it will retrieve the last category breadcrumb from the api as that is a highly unusual way to navigate for any user. However, if you open a fresh browser window and use that same url, it should expand the categories properly for that product.
If that it not what you were referencing, shoot me an e-mail with a link and/or post some screenshots and I will take a look. |
Netriplex Corporation<br /> |
|
|
|
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.