Author |
Topic |
|
bme
Starting Member
35 Posts |
Posted - March 22 2005 : 21:18:55
|
I have just purchased 5.5 and have altered the code and database to allow dynamic meta description and meta keyword tags.
Couple of points; * I use the access database, not sure if it will work with sql. * This mod will allow you to enter the description and keyword in the cat table in vpasp admin. * So far, I've only done it for the shopdisplayproducts.asp page, but can probably figure it out for the others.
This will take some time to type up and post, so I'm not gonna unless someone wants it. Any takers?
Bill
|
|
dcwebman
VP-CART New User
USA
127 Posts |
Posted - March 23 2005 : 06:47:12
|
Bill, Just wanted to let you know that someone read your message. I just finished the website I was working on otherwise I would have taken you up on your offer. I did do some changes for dynamic meta description for the extended product pages which I thought helpful. You'll find you can do a lot with 5.5! Jeff
|
|
|
bme
Starting Member
35 Posts |
Posted - March 24 2005 : 08:30:49
|
I'm finding out you can. I didn't do them for the extented pages though. The way my site is set up, each category has multiple products and they are all displayed on the shopdisplayproducts.asp page. Therefore, each category has 1 page with all the products. These are the pages I needed to have the dynamic meta title, meta description, and meta keywords tags.
Now, for any category, all you do is go to the vpasp admin category page and enter in the data you want. It will then show up when that category is displayed.
|
|
|
apswater
VP-CART Super User
444 Posts |
Posted - March 24 2005 : 14:23:03
|
We talked about dynamic tags a while back... http://www.vp-asp.com/virtprog/vpaspforum/topic.asp?TOPIC_ID=3494&whichpage=1&ARCHIVE=
Basically I was able to add dynamic tags for title, description and keywords with a few fairly simple mods. At least on 4.5.
The extended page is easy becasue in the template you can do something like this :
<head> <title>Product Data Sheet - [cname] - Model [ccode]</title> <meta NAME="description" content="[ccode] [cdescription]" <meta NAME="keywords" Content="[cdescription]" </head>
Then all your extended description pages will have dynamic titles, description and keywords.
|
|
|
bme
Starting Member
35 Posts |
Posted - March 24 2005 : 17:29:03
|
With 5.5, you can't do it that way, or at least I couldn't figure it out. I did get the basic idea from your original post however.
Now my shoppage_header looks like:
<head>
<title><%shopdynamictitle%></title> <meta name="Description" content="<%shopdynamicdescription%>" /> <meta name="Keywords" content="<%shopdynamickeywords%>" />
</head>
Doing it this way might be time consuming if you have a lot of categories, but I just did copy and paste with small adjustments in each.
|
|
|
dcwebman
VP-CART New User
USA
127 Posts |
Posted - March 25 2005 : 07:42:58
|
Bill, Turns out I'm starting out on another website so I would be interested in your mod. Looks like you created some new functions shopdynamicdescription and shopdynamickeywords, and perhaps more. Thanks, Jeff
|
|
|
PhoenixA
Starting Member
41 Posts |
Posted - March 27 2005 : 08:51:34
|
I'd definitely be interested in that, as with "apswater" i have the tags displaying in my extended pages but nothing for my category pages which are also just one page per category so i'd really like to know how you did the mod?
Thanks
|
|
|
apswater
VP-CART Super User
444 Posts |
Posted - March 27 2005 : 09:01:03
|
THis is how I did the categories in 4.5 maybe you can use the concept for 5.5
(I use 4.5 not sure about 5 and 5.5 Here is what I did on shopdisplaycategories.asp
on your shoppage_header delete the whole the <head> to </head> section at the top. This mod will replace that section and add a different title for each category and will add descriptions to the metatags. Try it and see...
Find
Sub ShopCategories highercategoryid=request("id") If not isnumeric(highercategoryid) then highercategoryid=""
Replace entire from there to the end of the sub with
Sub ShopCategories highercategoryid=request("id")
If not isnumeric(highercategoryid) then highercategoryid=""
dim rs dim title dim description if highercategoryid="" then highercategoryid=0 end if if highercategoryid <> "0" then SQL="Select * from categories " sql = Sql & " where categoryid=" & highercategoryid OpenRecordSet dbc, rs, sql title = rs("catdescription") description = rs("catmemo") if Title = "" then Title = "Water Purification Products - Softeners - Carbon - Reverse Osmosis" end if %> <head> <title><% response.write title %> </title> <!<link rel="stylesheet" href="shop.css" type="text/css"> <meta NAME="description" content=" <% Response.write description %> <meta NAME="keywords" content=" <% Response.write title %>" </head> <%
CloseRecordSet rs end if
if highercategoryid="" then highercategoryid=0 end if ShopPageHeader ' Page header for shop CategoryHeader ' category header on this page Showcategories ' format categories on this page ShopPageTrailer ' shop page trailer end sub
|
|
|
bme
Starting Member
35 Posts |
Posted - March 27 2005 : 12:38:03
|
Ok here it is.....
Before you begin, save a copy of your current files just in case.
Database Setup
Step 1) Create 3 new fields in the shopping 550 database in the category section. a. CatMetaDescrip b. CatMetaKey c. CatTitle (you can use Vpasp's shopdynamictitle tag instead of this if you want ...I just wanted more control)
Step 2)In MSAccess, while in the category tables, select design view. a. Set datatype as "text" b. Field size= 255 c. required= No d. Allow Zero length= Yes e. Indexed= No f. Unicode= Yes (these are the same settings of the catextra. If you don't set the field size, you will get errors when you try to enter stuff)
Step 3) Exit database
Admin Setup
(The lines I added are approximate for version 5.5...plus i have added other stuff)
Step 1) Open shopa_addcategory.asp
Step 2) Add the following variables to approx line 21
dim strcattitle dim strcatmetadescrip dim strcatmetakey
Step 3) In Sub GetFormData (apprx line 78) add
CatGetFieldRequest objrs,strcattitle,"cattitle" CatGetFieldRequest objrs,strcatmetadescrip,"catmetadescrip" CatGetFieldRequest objrs,strcatmetakey,"catmetakey"
Step 4) In Sub UpdateProduct (approx line 114) add
CatUpdateField objrs,strcattitle,"cattitle" CatUpdateField objrs,strcatmetadescrip,"catmetadescrip" CatUpdateField objrs,strcatmetakey,"catmetakey"
( do this around line 144 with the others)
Step 5) In Sub DisplayForm (approx line 185) add
catformateditrow "Meta Title","cattitle" ,strcattitle PCreateRowText "Meta Description","catmetadescrip",strcatmetadescrip,3,"catmetadescrip" PCreateRowText "Meta Keywords","catmetakey",strcatmetakey,3,"catmetakey"
(I put these lines after PcreateRowTExt "catextra","catextra",strcatextra,1,"catextra") (These lines control where it is displayed on the admin page)
Step 6) In Sub GetExistingProduct (approx line 284) add the following under "If objRS.EOF Then"
CatResetField objRS, strCatTitle, "cattitle" catresetfield objrs,strcatmetadescrip,"catmetadescrip" catresetfield objrs,strcatmetakey,"catmetakey"
Step 7) Now add the same 3 lines above under Else in the same sub (approx 309)
Now you should have these fields in your shopa_addcategory and you can write to the database. If you try to put more than 255 caracters, including spaces, you will get an error message when you try to save.
More in the next posting.................
|
|
|
bme
Starting Member
35 Posts |
Posted - March 27 2005 : 14:00:06
|
Next Posting.....
Step 1) Change the following lines in the Sub SetupdynamicCategory(approx. line 117), if and only if, you want category control over your Meta Title. Otherwise, leave it alone and your category title will serve as your meta title.
line 131 setsess "Dynamictitle",rs("cattitle")
Step 2) Next, for your description, you need to add the following SUB in shopheader.asp
'***************************************************************************************** ' allows dynamic description ' place in shoppage_header '***************************************************************************************** sub ShopDynamicDescription dim sdyd dim value , sessionfieldname sdyd="description" sessionfieldname="dynamic" & sdyd value=Getsess(sessionfieldname) if value="" then value="Whatever you want this to say" end if response.write value setsess sessionfieldname,"" ' so it is not reused end sub
sub SetupDynamicDescription ( conn, categoryid) setsess "DynamicDescription","" on error resume next dim sql, rs If categoryid=0 then setsess "DynamicDescription","" exit sub end if sql="select * from categories where categoryid=" & categoryid set rs=conn.execute(sql) if not rs.eof then setsess "DynamicDescription",rs("CatMetaDescrip") end if closerecordset rs end sub
In the sub ShopDynamicDescription, find:
if value="" then value="Whatever you want this to say" end if
Whatever you want this to say, can be whatever you want. This is what will display when there is no description. If you don't want this or don't care, just comment it out.
Step 3) Now, for keywords, add the following sub in shopheaders.asp
'***************************************************************************************** ' allows dynamic keywords ' place in shoppage_header '*****************************************************************************************
sub ShopDynamicKeywords dim sdyk dim value , sessionfieldname sdyk="keywords" sessionfieldname="dynamic" & sdyk value=Getsess(sessionfieldname) if value="" then value="Whatever you want this to say" end if response.write value setsess sessionfieldname,"" ' so it is not reused end sub
sub SetupDynamicKeywords ( conn, categoryid) setsess "DynamicKeywords","" on error resume next dim sql, rs If categoryid=0 then setsess "DynamicKeywords","" exit sub end if sql="select * from categories where categoryid=" & categoryid set rs=conn.execute(sql) if not rs.eof then setsess "DynamicKeywords",rs("CatMetaKey") end if closerecordset rs end sub
Once again, in sub ShopDynamicKeywords, find
if value="" then value="Whatever you want this to say" end if
Whatever you want this to say, can be whatever you want. This is what will display when there is no description. If you don't want this or don't care, just comment it out.
Step 4) Add
SetupDynamicDescription dbc, cat_id SetupDynamicKeywords dbc, cat_id
beneath SetupdynamicCategory dbc, cat_id (approx. line 76) in shopdisplayproducts.asp
Step 5) Add
SetupDynamicDescription dbc, highercategoryid SetupDynamicKeywords dbc, highercategoryid
beneath SetupdynamicCategory dbc, highercategoryid in shopdisplaycategories.asp
step 6)
In shoppage_header.htm, change your metas to
<head> <title><%shopdynamictitle%></title> <meta name="Description" content="<%shopdynamicdescription%>" /> <meta name="Keywords" content="<%shopdynamickeywords%>" /> </head>
Step 7) Cross your fingers :) This worked for me. You can probably do something similar for the individual products. Also, I use access database....I don't know a thing about SQL.
Bill
|
|
|
dcwebman
VP-CART New User
USA
127 Posts |
Posted - March 28 2005 : 06:50:32
|
Thanks to both apswater and Bill for posting their solutions! Jeff
|
|
|
dssquirt
Starting Member
31 Posts |
Posted - October 20 2005 : 21:41:08
|
I have been reading about the meta tags and I am still a bit confused. After reading the above posts, it looks like I need to add the following lines to shoppage_header.htm:
<head>
<title><%shopdynamictitle%></title> <meta name="Description" content="<%shopdynamicdescription%>" /> <meta name="Keywords" content="<%shopdynamickeywords%>" />
</head>
Okay, so after I change the shoppage_header file, is there an additional file I need to change anywhere? Right now the pages have no keywords and just a generic description. I would like this changed.
Anyone?
www.gizmocreations.com |
|
|
bme
Starting Member
35 Posts |
Posted - October 27 2005 : 22:38:19
|
If you followed all the instructions correctly, you simply enter what you want in the category page in your shopping cart admin.
Bill
|
|
|
rodney
VP-CART New User
USA
75 Posts |
Posted - January 07 2006 : 20:50:22
|
quote: Originally posted by bme
If you followed all the instructions correctly, you simply enter what you want in the category page in your shopping cart admin.
Bill
What about the product pages?
-Rodney Web Site Now Technologies, LPP |
|
|
bme
Starting Member
35 Posts |
Posted - January 08 2006 : 21:16:26
|
I don't have individual product pages so I didn't make a mod for that. Sorry.... |
|
|
|
Topic |
|