VP-ASP :: Shopping Cart Software

Shopping Cart Software Solutions for anywhere in the World

US/Canada(Toll Free): +1 888 587 2278
Europe/UK: +44 (020) 7193 9408
Australia/New Zealand: +61 3 9016 4497

VP-ASP Shopping Cart Customer Forum

Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VPCart Forum
 Customization
 Featured Products on Home page
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

goshen
VP-ASP New User

132 Posts

Posted - February 25 2007 :  22:16:05  Show Profile  Reply with Quote
I am trying to split the display of the content on the home page and the random product table. I wish to place the dynamic welcome message in a div and then the random product(featured products) in a table below it.

here is the current code:
<%
'**********************************************************************************
' Version 6+ Content management
' shopcontent.asp?type=news
' shopcontent.asp?type=news&template=xxx
' Allows you to add content using the content table
' VP-ASP 6.50 June 28, 2004
'*********************************************************************************
Dim CatalogId, dbtable, idfield, contentdbc, dbc, crs, contentid
Dim messagetype
Dim template
'VP-ASP 6.08a - moved down below generate meta tags
'shoppageheader
setSess "CurrentURL","default.asp"
messagetype="home"
'contentid = request("contentid")
if contentid > "" then
if NOT isnumeric(contentid) then
HandleError "Content ID must be a numeric value"
end if
end if
if messagetype="" and contentid = "" then
HandleError getlang("LangRecordNotFound")
end if
shopopendatabase contentdbc
WriteImpressions
'VP-ASP 6.08a - Generate Dynamic Meta tags
setupdynamiccontent contentdbc, contentid, messagetype
InitializeSystem

shoppageheader

generatecontentsql sql
'debugwrite sql
OpenRecordSet contentdbc, crs, sql
If crs.eof then
handleerror getlang("LangRecordNotFound") & " " & messagetype
else
if crs("loggedin") <> true then
Formatcontent crs
else
if Getsess ("login") > "" then
Formatcontent crs
else
shopwriteerror getlang("langcustadminloginrequired")
end if
end if
end if
closerecordset crs
shopclosedatabase contentdbc

shoppagetrailer
'****************************************************
' write a message
'***************************************************
sub handleError (msg)
shopwriteError msg
end sub
'
'***************************************************************
' Use temaplte or just displaye it
'**************************************************************
Sub Formatcontent (crs)
dim message, message2, image
'message=crs("message")
if contentid = "" then
dim getcontentsql, getcontentrs
getcontentsql = "select contentid from content WHERE messagetype = '" & messagetype & "'"
OpenRecordSet contentdbc, getcontentrs, getcontentsql

if getcontentrs.eof then
shoperrror "There has been an error retrieving the ID for this content."
else
contentid = getcontentrs("contentid")
end if

closerecordset getcontentrs
end if
message=translatelanguage(contentdbc, "content", "message","contentid", contentid, crs("message"))
'message2=crs("message2")
message2=translatelanguage(contentdbc, "content", "message2","contentid", contentid, crs("message2"))
contentid=crs("contentid")
image=crs("contentimage")
If isnull(image) then image=""

' this is where the dynamic content and the random content are joined together

Gettemplate crs, template
if template<>"" then
ShopMergetemplate "content", template, contentid, "contentid"
If serror<>"" then
handleError serror
end if
exit sub
end if
If image<>"" then
Formatimage image
end if
response.write message & "<br /><br />"
response.write message2
end sub

Sub GetTemplate (crs, template)
dim dbtemplate, suffix
template=gettextfield("template")
dbtemplate=crs("template")
If template="" then
if not isnull(dbtemplate) then
template=dbtemplate
end if
end if
if template="" then exit sub
suffix=right(template,3)
if lcase(suffix)<>"htm" then
template=""
end if
end sub

Sub formatimage (image)
Response.write "<p class=""ac"">"
response.write "<img border='0' src='" & image & "'>"
response.write "</p>"
end sub
'************************************************************************
' get last non hidden news or whatever
'***********************************************************************
Sub GenerateContentsql (sql)
if contentid > "" then
sql="select * from content where contentid=" & contentid
else
sql="select * from content where messagetype='" & messagetype & "'"
end if
sql=sql & " and hide=0 "
If getconfig("xselectproductsbylanguage")="Yes" and getsess("language")<>"" then
sql=sql & " and (contentlanguage='" & getsess("language") & "'"
sql=sql & " or contentlanguage is null)"
end if
sql=sql & " order by contentid desc"
end sub

'VP-ASP 6.08 - Impressions weren't writing correctly.
Sub WriteImpressions
contentdbc.execute("UPDATE content SET impressions = 0 WHERE impressions IS NULL")
if contentid <> "" then
'increment content impressions
contentdbc.execute("UPDATE content SET impressions = impressions + 1 WHERE contentid = " & contentid)
Else
If messagetype <> "" Then
contentdbc.execute("UPDATE content SET impressions = impressions + 1 WHERE messagetype LIKE '" & messagetype &"'")
End If
End If
End Sub%>
</div>

devshb
Senior Member

United Kingdom
1898 Posts

Posted - February 26 2007 :  00:56:22  Show Profile  Visit devshb's Homepage  Reply with Quote
Have a look at this, because I think it'll do what you want:

Content-Management Enhancements:
http://www.bigyellowzone.com/shopexd.asp?id=125

That lets you show your dynamic content within existing pages/panels without having to have a "shopcontent.asp?type=blah" url for the page etc, and you can include multiple content within a single page (eg one dynamic bit in a side-panel, another at the top, and another at the bottom etc).

So, you could have your real home page still using "default.asp" and just change default.asp to call the byz show-content function inside that, and then call the random products under that call.

It also lets you create "static" asp files with proper names at the touch of a button (eg "aboutus.asp" that mimics what your "shopcontent.asp?type=aboutus" page would do (those pages still pick-up the content at load-time rather than at file-creation-time; it's only the filename that's "static")

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
Web Design, Online Marketing and VPASP addons

Edited by - devshb on February 26 2007 00:57:50
Go to Top of Page

goshen
VP-ASP New User

132 Posts

Posted - February 26 2007 :  06:33:35  Show Profile  Reply with Quote
Thanks.

My site is going to be relying a lot on the language translation and so your module may not be applicable for me at this time.

I believe there should still be a way to split the dynamic content from the random product display. I have seen a couple vpasp sites do that.

Does anyone please have an idea?

Thanks

Fola
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000