• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

rgreen
#1 Posted : Wednesday, June 11, 2008 3:02:10 PM(UTC)
rgreen

Rank: Member

Joined: 4/3/2007(UTC)
Posts: 56

In our case we wanted the author name displayed with each book in content blocks, product page, and category pages.
We also wanted fields for flash video paths and a field for program air dates.

This works if you create one type property and designate only that type property as visible to drop-shippers.

You can then populate that one type property on the product page with XML code in the text box.
For example enter: <customfields><authorname>Sample Name</authorname><videopath>Sample Video Path</videopath></customfields>

Here is the code: (modified version of code provided by the forum about a year ago to include XML parsing)

Imports BVSoftware.Bvc5.Core
Imports System.Collections.ObjectModel
Imports System
Imports System.Xml
Imports System.IO




'Author Display Name
Dim adnid As String = LocalProduct.ProductTypeId
Dim productTypePropertiesValues As New Collection(Of String)
Dim props As Collections.Generic.List(Of Catalog.ProductProperty) = Catalog.ProductType.FindPropertiesForType(adnid)
Dim sb As New StringBuilder()
Dim xmlsb As New StringBuilder()

xmlsb.Append("<div class=""authorname"">")
For Each prop As Catalog.ProductProperty In props
productTypePropertiesValues.Add(Catalog.InternalProduct.GetPropertyValue(LocalProduct.Bvin, prop.Bvin))
Next

For i As Integer = 0 To (props.Count - 1)
If props(i).DisplayToDropShipper Then

Dim currentValue As String = Catalog.ProductProperty.GetProductTypePropertyValue(props(i), productTypePropertiesValues(i))
' If text property is empty, do not display
If (props(i).TypeCode = Catalog.ProductPropertyType.TextField) AndAlso (currentValue = String.Empty) Then
Continue For
End If
If currentValue <> String.Empty Then
sb.Append(currentValue)
End If
End If

Next
Try


Dim XMLText As New XmlTextReader(New StringReader(sb.ToString))
While (XMLText.Read())
If (XMLText.LocalName.Equals("authorname")) Then
xmlsb.Append(XMLText.ReadElementString("authorname"))
End If

End While

Catch ex As Exception

End Try

xmlsb.Append("</div>")

Me.authordisplayname.Text = xmlsb.ToString


'End Author Display Name
sternyy
#2 Posted : Thursday, June 12, 2008 5:59:24 PM(UTC)
sternyy

Rank: Member

Joined: 1/10/2005(UTC)
Posts: 714

Thanks: 14 times
Was thanked: 1 time(s) in 1 post(s)
do you have a site that uses this?
rgreen
#3 Posted : Friday, June 13, 2008 12:46:08 PM(UTC)
rgreen

Rank: Member

Joined: 4/3/2007(UTC)
Posts: 56

www.dhp.org uses it to display author name on product templates, category templates, and in a content block on the home page
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.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012