Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 670
  • Last Modified:

GOOGLEBASE HELP NEEDED

I tried to post item to google base and wanted to show
our website link on posted item.If some one clicks on the TiTLE it will take to my website page.

when I add some code for our website link it gives error.

our xml request code sample what we add is
"****

strXML = strXML & "<atom:link rel='alternate' type='text/html' href='"&domainUrl& gsSTRURL & "Default.asp?mainPage=PRODUCT_INFO&P_ID='"& ID & "'/>" & vbcrlf

**"
------------------------
I am getting the response :


"The reference to entity &quot;P_ID&quot; must end with the &#39;;&#39; delimiter."

-------------------------

if I block the line it works fine.but posted item TITLE link shows
"http://base.google.com/base/a/2351340/D7496653615421730200"

i want it to show www.mywebsite.com/product1.html

Thanks in advance for your support and help.

regards,
Sunny
0
sdugar
Asked:
sdugar
  • 8
  • 5
1 Solution
 
BigRatCommented:
The problem lies in the query part of the constructed URL for the href attribute :-

   mainPage=PRODUCT_INFO&P_ID='"& ID

The ampersand before the word P_ID is a separator ampersand for the fields in the query and must be escaped if you want to "xml" it :-

   mainPage=PRODUCT_INFO&amp;P_ID="' & ID

If that still gives you trouble replace the ampersand by it's hex equivalent %26
0
 
sdugarAuthor Commented:
Dear BigRat,

Thanks for the help i will update you sonn.

regards,
sunny
0
 
sdugarAuthor Commented:
Dear BigRat,

I have changed  "PRODUCT_INFO&P_ID='"& ID"  into "PRODUCT_INFO&amp;P_ID"
then response is
"The prefix &quot;atom&quot; for element &quot;atom:link&quot; is not bound."

could not grab the problem

regards

sunny
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
BigRatCommented:
Could you post the full code?
0
 
sdugarAuthor Commented:
Dear BigRat,

I am sending the full code.

regards

sunny
<!--#Include File="../Includes/upload.asp"-->
<!--#include file="../Admin/AdminHeader.asp"-->
<script>
var isNS4 = (navigator.appName=="Netscape")?1:0;
</script>
<!--#include file="variables.asp"-->
<%
action = IIf(Len(Trim(GetRequest("action"))) > 0, Trim(GetRequest("action")), "")
 
Call OpenDBConn()
 
mySql = "Select * From tblGoogleCP"
Call GetDBRecords(mySQL,rsTemp)
If rsTemp.EOF Then
	Response.Write("Your <a href=""GoogleCP.asp"">Control Panel for GoogleBase</a> is not set yet. Set it properly and then <a href=""Insert.asp"">try again</a>")
End If
rsTemp.Close
 
If Trim(LCase(action)) = "send" Then
	ProdID = FVal(Request.QueryString("ProdID"))
	
	Set Uploader = New FileUploader
	Uploader.Upload()
	ProductID= Trim(Uploader.Form("ProductID"))
	ProdName 		= Trim(Uploader.Form("ProdName"))
	ProdCategory 	= Trim(Uploader.Form("ProdCategory"))
	If Len(Trim(ProdCategory)) <= 0 Then
		ProdCategory 	= "Products"			'[Google Checkout is only acceptable in this category]
	End If
	ProdSKU 		= Trim(Uploader.Form("ProdSKU"))
	ProdModel 		= Trim(Uploader.Form("ProdModel"))
	ProdPrevImage 	= Trim(Uploader.Form("ProdPrevImage"))
	ProdImage 		= Trim(Uploader.Form("ProdImage"))
	If Uploader.Files.Exists("ProdImage") Then
		Uploader.Files("ProdImage").SaveToDisk Server.MapPath("../Images/Images_Products")
		ImageFile = Uploader.Files("ProdImage").FileName
		If err.number <> 0 then
			response.redirect "sysMsg.asp?errMsg=" _
				& server.URLEncode("ERROR : File [" _
				& Uploader.Files("ProdImage").FileName _
				& "] could not be saved to disk (" _
				& err.Description & ").")
		End If
		If Len(Trim(ImageFile)) > 0 Then ProdImage = SQLStr("Images_Products/" & ImageFile)
	Else
		ProdImage = Trim(ProdPrevImage)
	End If
	ProdDescription = Trim(Uploader.Form("ProdDescription"))
	ProdDescription = Server.HTMLEncode(ProdDescription)
	ProdPrice		= Uploader.Form("ProdPrice")
	Quantity 		= Uploader.Form("Quantity")
	
	PaymentGC		= Trim(Uploader.Form("PaymentGC"))
	PaymentCash		= Trim(Uploader.Form("PaymentCash"))
	PaymentCheck	= Trim(Uploader.Form("PaymentCheck"))
	PaymentVisa		= Trim(Uploader.Form("PaymentVisa"))
	PaymentMaster	= Trim(Uploader.Form("PaymentMaster"))
	PaymentDiscover	= Trim(Uploader.Form("PaymentDiscover"))
	PaymentAmex		= Trim(Uploader.Form("PaymentAmex"))
	PaymentWire		= Trim(Uploader.Form("PaymentWire"))
	PaymentNotes	= Trim(Uploader.Form("PaymentNotes"))
 
	DeliveryLocation = Trim(Uploader.Form("DeliveryLocation"))
	DeliveryPickup   = Trim(Uploader.Form("DeliveryPickup"))
	DeliveryRadius   = Trim(Uploader.Form("DeliveryRadius"))
	DeliveryNotes	 = Trim(Uploader.Form("DeliveryNotes"))
	
	If Len(Trim(ProdPrice)) > 0 Then
		If FVal(ProdPrice) <= 0 Then
			error = True
		Else
			error = False
		End If
	End If
	If Len(Trim(Quantity)) > 0 Then
		If FVal(Quantity) > 0 Then
			If CInt(FVal(Quantity)) <> FVal(Quantity) Then
				error1 = True
			Else
				error1 = False
			End If
		Else
			error1 = True
		End If
	End If
	
	error2 = Request.QueryString("error2")
	If Len(Trim(error2)) = 0 Or IsNull(error2) Then
		error2 = False
	End If
	
	If error = False And error1 = False And error2 = False Then
		
		strXML = ""
	
		strXML ="<?xml version='1.0'?>" & vbcrlf 
		strXML = strXML & "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:g='http://base.google.com/ns/1.0'>" & vbcrlf 
		strXML = strXML & "<author>" & vbcrlf
		strXML = strXML & "<name>" & UserName & "</name>" & vbcrlf
		strXML = strXML & "<email>" & UserEmail & "</email>" & vbcrlf
		strXML = strXML & "</author>" & vbcrlf  
		strXML = strXML & "<title type=""text"">" & ProdName & "</title>" & vbcrlf 
		strXML = strXML & "<content type=""xhtml"">" & ProdDescription & "</content>" & vbcrlf
'		If Len(PaymentGC) > 0 Then
'			strXML = strXML & "<payment_accepted type=""text"">GoogleCheckout</payment_accepted>" & vbcrlf
'		End If
		
		strXML = strXML & "<g:id>" & ProdSKU & "</g:id>" & vbcrlf 
	 	 strXML = strXML & "<atom:link rel='alternate' type='text/html' href='"&domainUrl& gsSTRURL & "Default.asp?mainPage=PRODUCT_INFO&amp;P_ID="&ProductID &"'/>" & vbcrlf 
		 strXML = strXML & "<g:item_language type=""text"">en</g:item_language>" & vbcrlf 
		strXML = strXML & "<g:item_type type=""text"">" & ProdCategory & "</g:item_type>" & vbcrlf 
		strXML = strXML & "<g:sku type=""text"">" & ProdSKU & "</g:sku>" & vbcrlf
		strXML = strXML & "<g:model type=""text"">" & ProdModel & "</g:model>" & vbcrlf
		strXML = strXML & "<g:price type=""floatunit"">" & ProdPrice & "</g:price>" & vbcrlf
		strXML = strXML & "<g:quantity type=""int"">" & Quantity & "</g:quantity>" & vbcrlf
		strXML = strXML & "<g:image_link>" &domainUrl& gsImgDir & ProdImage & "</g:image_link>"
		If Len(PaymentGC) > 0 Then
			strXML = strXML & "<g:payment type=""text"">Google Checkout</g:payment>" & vbcrlf
		End If
		If Len(PaymentCash) > 0 Then
			strXML = strXML & "<g:payment type=""text"">Cash</g:payment>" & vbcrlf
		End If
		If Len(PaymentCheck) > 0 Then
			strXML = strXML & "<g:payment type=""text"">Check</g:payment>" & vbcrlf
		End If
		If Len(PaymentVisa) > 0 Then
			strXML = strXML & "<g:payment type=""text"">Visa</g:payment>" & vbcrlf
		End If
		If Len(PaymentMaster) > 0 Then
			strXML = strXML & "<g:payment type=""text"">MasterCard</g:payment>" & vbcrlf
		End If
		If Len(PaymentDiscover) > 0 Then
			strXML = strXML & "<g:payment type=""text"">Discover</g:payment>" & vbcrlf
		End If
		If Len(PaymentAmex) > 0 Then
			strXML = strXML & "<g:payment type=""text"">American Express</g:payment>" & vbcrlf
		End If
		If Len(PaymentWire) > 0 Then
			strXML = strXML & "<g:payment type=""text"">Wire transfer</g:payment>" & vbcrlf
		End If
		If Len(PaymentNotes) > 0 Then
			strXML = strXML & "<g:payment_notes type=""text"">" & PaymentNotes & "</g:payment_notes>" & vbcrlf
		End If
		If Len(DeliveryLocation) > 0 Then
			strXML = strXML & "<g:location type=""location"">" & DeliveryLocation & "</g:location>" & vbcrlf
		End If
		If Len(DeliveryPickup) > 0 Then
			strXML = strXML & "<g:pickup type=""boolean"">" & DeliveryPickup & "</g:pickup>" & vbcrlf
		End If
		If Len(DeliveryRadius) > 0 Then
			strXML = strXML & "<g:delivery_radius type=""floatunit"">" & DeliveryRadius & " km</g:delivery_radius>" & vbcrlf
		End If
		If Len(DeliveryNotes) > 0 Then
			strXML = strXML & "<g:delivery_notes type=""text"">" & DeliveryNotes & "</g:delivery_notes>" & vbcrlf
		End If
		strXML = strXML & "</entry>" & vbcrlf
		
		''''210409
		set fstemp=Server.CreateObject("Scripting.FileSystemObject")
		inserttemp = (EBayXMLDir & "/inserttemp.xml")
		set tfile=fstemp.CreateTextFile(inserttemp)
		tfile.WriteLine(strXML)
		tfile.close
		set tfile=nothing
		set fstemp=nothing
		
		''''210409
		
		Response.Buffer = true
		Response.Expires = -1500
		
		Set oWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
		
		oWinHttp.Open "POST", ServerUrl, False
		
		'Set necessary headers
		oWinHttp.SetRequestHeader "Content-Type","application/atom+xml"
		oWinHttp.SetRequestHeader "Authorization", "AuthSub token=""" & UserToken & """"
		oWinHttp.SetRequestHeader "X-Google-Key", "key=" & key
		
		'Send XML request to eBay and store response in AddItemResponse
		oWinHttp.Send strXML
		
		AddItemResponse = oWinHttp.ResponseText
		
		'Write contents of the response to a file on the server
		set fs=Server.CreateObject("Scripting.FileSystemObject")
		AddItemResponseXML = (EBayXMLDir & "/insert.xml")
		set tfile=fs.CreateTextFile(AddItemResponseXML)
		tfile.WriteLine(AddItemResponse)
		tfile.close
		set tfile=nothing
		set fs=nothing
 
		If Len(Trim(AddItemResponse)) >= 8 Then
			If LCase(mid(Trim(AddItemResponse), 2, 4)) <> "html" And LCase(mid(Trim(AddItemResponse), 2, 6)) <> "errors" Then
				'open the XML document
				Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
				xmlDoc.Async = false
				xmlDoc.LoadXML(AddItemResponse)
				
				'parse data from xml and handle accordingly
				Set AddItemResponseNode = xmlDoc.selectNodes("/entry")
				For Each node In AddItemResponseNode
					dd = Day(date())
					If Cdbl(dd) < 10 Then dd = "0" & dd
					mm = Month(date())
					If Cdbl(mm) < 10 Then mm = "0" & mm
					yy = Year(date())
					DateTime = ""&mm&"/"&dd&"/"&yy
					IDURL = TryNode(node, "id")
					ItemID = Mid(Trim(IDURL), 40, Len(Trim(IDURL))-39)
					ItemURL = Left(Trim(IDURL),39)
					
					EndTime = TryNode(node, "g:expiration_date")
					EndDate = (Left(EndTime,10))
					EndDateSplit = Split(EndDate, "-")
					EndMo = EndDateSplit(1)
					EndDay = EndDateSplit(2)
					EndYear = EndDateSplit(0)
					EndDate = EndMo&"/"&EndDay&"/"&EndYear
					EndTimestamp = EndDate
					
					ProdPrice = formatnumber(FVal(Left(TryNode(node, "g:price"), Len(Trim(TryNode(node, "g:price"))) - 4)), 2)
					Quantity = TryNode(node, "g:quantity")
				Next
				Set AddItemResponseNode = Nothing
			
				mySQL = "UPDATE tblProducts SET Upload=1,GoogleID = '" & SQLStr(ItemID) & "' " _
				& "WHERE ProdID = " & FVal(ProdID)
				gsConnect.Execute(mySQL)
			
				mySQL = strDeleteSyntax & "tblGoogleProduct WHERE ProdID = " & SQLVal(ProdID)
				gsConnect.Execute(mySQL)
				
				mySQL = "INSERT INTO tblGoogleProduct(GoogleID,ProdID,ProdUrl,Price,Quantity,InsertDate,ExpiryDate,Upload) Values(" _
				& "'" & SQLStr(ItemID) & "'," & SQLVal(ProdID) & ",'" & ItemURL & "', " _
				& "" & SQLVal(ProdPrice) & ", " & SQLVal(Quantity) & ", '" & DateTime & "', '" & EndTimestamp & "',1) "
				gsConnect.Execute(mySQL)
					
				Set xmlDoc = Nothing
				Response.Redirect("Insert.asp")
			ElseIf LCase(mid(Trim(AddItemResponse), 2, 4)) = "html" Then
				Response.Write(AddItemResponse)
				Response.Write("<BR><BR>")
				Response.Write("<a href=""Insert.asp"">Try Again</a>")
				Response.End()
			ElseIf LCase(mid(Trim(AddItemResponse), 2, 6)) = "errors" Then
				mySql = strDeleteSyntax & "tblGoogleResponse Where ProdID=" & FVal(ProdID)
				gsConnect.Execute(mySql)
 
				Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
				xmlDoc.Async = false
				xmlDoc.LoadXML(AddItemResponse)
				
				'parse data from xml and handle accordingly
				Set AddItemResponseNode = xmlDoc.selectNodes("/errors")
				For Each node In AddItemResponseNode
					errorReason = Trim(node.selectSingleNode("error").Attributes(2).Value)
					errorField = Trim(node.selectSingleNode("error").Attributes(1).Value)
					
					mySql = "Insert into tblGoogleResponse (ProdID, errorField, errorReason,Upload) values ( " _
					& "" & FVal(ProdID) & ",'" & Replace(errorField,"'","''") & "','" & Replace(errorReason,"'","''") & "',1)"
					gsConnect.Execute(mySql)
				Next
				
				Set xmlDoc = Nothing
				
			End If
		Else
			Response.Redirect "sysmsg.asp?errMsg=" & Server.URLEncode("Some errors occured while processing your request. Press 'Refresh Page' button and then try again.")
		End If
	End If
ElseIf Trim(LCase(action)) = "bulksend" Then
	selected = false
	For each f in Request.Form
		If Left(f,2) = "ID" Then
			selected = true
			Exit For
		End If
	Next
	If Not selected Then
		Response.Redirect "sysMsg.asp?errMsg=" & Server.URLEncode("No Item was selected from the list.<BR>Select a Item to continue send operation?")	
	End If
	
	For each f in Request.Form
		If Left(f,2) = "ID" Then
			ID = Mid(f,3)
			Quantity = FVal(Request.Form("QTY" & ID))
			If FVal(Quantity) <= 0 Then
				Response.Redirect "sysMsg.asp?errMsg=" & Server.URLEncode("Invalid Product Quantity")
			End If
			ProdPrice = FVal(Request.Form("ProdPrice" & ID))
			If FVal(ProdPrice) <= 0 Then
				Response.Redirect "sysMsg.asp?errMsg=" & Server.URLEncode("Invalid Product Price")
			End If
		End If
	Next
	
	mySql = "Select * From tblGoogleCP"
	Call GetDBRecords(mySql, rsTemp)
	If Not rsTemp.EOF Then
		PaymentGC 			= Trim(rsTemp("PaymentGC"))
		PaymentCash 		= Trim(rsTemp("PaymentCash"))
		PaymentCheck 		= Trim(rsTemp("PaymentCheck"))
		PaymentVisa 		= Trim(rsTemp("PaymentVisa"))
		PaymentMaster 		= Trim(rsTemp("PaymentMaster"))
		PaymentDiscover 	= Trim(rsTemp("PaymentDiscover"))
		PaymentAmex 		= Trim(rsTemp("PaymentAmex"))
		PaymentWire 		= Trim(rsTemp("PaymentWire"))
		PaymentNotes 		= Trim(rsTemp("PaymentNotes"))
		DeliveryLocation	= Trim(rsTemp("DeliveryLocation"))
		DeliveryPickup 		= Trim(rsTemp("DeliveryPickup"))
		DeliveryRadius 		= Trim(rsTemp("DeliveryRadius"))
		DeliveryNotes 		= Trim(rsTemp("DeliveryNotes"))
	End If
	rsTemp.Close
	
	strXML = ""
 
	strXML ="<?xml version='1.0' encoding='UTF-8'?>"
	strXML = strXML & "<feed xmlns='http://www.w3.org/2005/Atom' xmlns:g='http://base.google.com/ns/1.0' xmlns:batch='http://schemas.google.com/gdata/batch'>"
	
	i = 1
	HaveRecord = false
	For each f in Request.Form
		If Left(f,2) = "ID" Then
			ID = Mid(f,3)
			If FVal(ID) <= 0 Then
				Response.Redirect "sysMsg.asp?errMsg=" & Server.URLEncode("Invalid Product")
			End If
			
			HaveRecord = true
			IDP = IDP & ID & "|"
			
			Quantity = FVal(Request.Form("QTY" & ID))
			ProdPrice = formatnumber(FVal(Request.Form("ProdPrice" & ID)), 2)
 
			ProdSKU =""
			ProdTitle = ""
			ProdDesc = ""
			ProdImage = ""
	
			mySQL = "SELECT tblProducts.ProdSKU,tblProductsDescription.ProdName,tblProductsDescription.ProdDescription,tblProducts.ProdImage,tblProducts.ProdModel FROM tblProducts,tblProductsDescription " _
			& "WHERE tblProducts.ProdID = tblProductsDescription.ProdID AND tblProducts.ProdID = " & SQLVal(ID)
			Call GetDBRecords(mySQL,rsTemp)
			If Not rsTemp.EOF Then
				ProdSKU = Trim(rsTemp("ProdSKU"))
				ProdTitle = Trim(rsTemp("ProdName"))
				ProdDesc = Trim(rsTemp("ProdDescription"))
				ProdDesc = Server.HTMLEncode(ProdDesc)
				ProdImage = Trim(rsTemp("ProdImage"))
				ProdModel = Trim(rsTemp("ProdModel"))
			End If
			rsTemp.Close
			
			prodCategory = ""
			mySql = "Select cd.CatName from tblProductsCategories pc, tblCategoriesDescription cd Where pc.CatID = cd.CatID And cd.LangID = 1 And pc.ProdId = " & SQLVal(ID)
			Call GetDBRecords(mySql, rsTemp)
			If Not rsTemp.EOF Then
				rsTemp.MoveFirst
				ProdCategory = rsTemp("CatName")
			End If
			rsTemp.Close
			
			If Len(Trim(ProdCategory)) = 0 Then
				ProdCategory = "NOCategory"
			End If
	
			strXML = strXML & "<entry>" & vbcrlf
			strXML = strXML & "<batch:id>item" & ID & "</batch:id>" & vbcrlf
    		strXML = strXML & "<batch:operation type='insert'/>" & vbcrlf
			strXML = strXML & "<author>" & vbcrlf
			strXML = strXML & "<name>" & UserName & "</name>" & vbcrlf
			strXML = strXML & "<email>" & UserEmail & "</email>" & vbcrlf
			strXML = strXML & "</author>" & vbcrlf
			 strXML = strXML & "<atom:link rel='alternate' type='text/html' href='"&domainUrl& gsSTRURL & "Default.asp?mainPage=PRODUCT_INFO&amp;P_ID='"& ID & "'/>" & vbcrlf 
			strXML = strXML & "<title type=""text"">" & ProdTitle & "</title>" & vbcrlf 
			strXML = strXML & "<content type=""xhtml"">" & ProdDesc & "</content>" & vbcrlf 
			strXML = strXML & "<g:item_language type=""text"">en</g:item_language>" & vbcrlf 
			strXML = strXML & "<g:item_type type=""text"">" & ProdCategory & "</g:item_type>" & vbcrlf 
			strXML = strXML & "<g:sku type=""text"">" & ProdSKU & "</g:sku>" & vbcrlf 
			strXML = strXML & "<g:model type=""text"">" & ProdModel & "</g:model>" & vbcrlf
			strXML = strXML & "<g:price type=""floatunit"">" & ProdPrice & "</g:price>" & vbcrlf
			strXML = strXML & "<g:quantity type=""int"">" & Quantity & "</g:quantity>" & vbcrlf
			strXML = strXML & "<g:image_link>" &domainUrl& gsImgDir & ProdImage &  "</g:image_link>"
			strXML = strXML & "</entry>" & vbcrlf
			If Len(PaymentGC) > 0 Then
				strXML = strXML & "<g:payment type=""text"">Google Checkout</g:payment>" & vbcrlf
			End If
			If Len(PaymentCash) > 0 Then
				strXML = strXML & "<g:payment type=""text"">Cash</g:payment>" & vbcrlf
			End If
			If Len(PaymentCheck) > 0 Then
				strXML = strXML & "<g:payment type=""text"">Check</g:payment>" & vbcrlf
			End If
			If Len(PaymentVisa) > 0 Then
				strXML = strXML & "<g:payment type=""text"">Visa</g:payment>" & vbcrlf
			End If
			If Len(PaymentMaster) > 0 Then
				strXML = strXML & "<g:payment type=""text"">MasterCard</g:payment>" & vbcrlf
			End If
			If Len(PaymentDiscover) > 0 Then
				strXML = strXML & "<g:payment type=""text"">Discover</g:payment>" & vbcrlf
			End If
			If Len(PaymentAmex) > 0 Then
				strXML = strXML & "<g:payment type=""text"">American Express</g:payment>" & vbcrlf
			End If
			If Len(PaymentWire) > 0 Then
				strXML = strXML & "<g:payment type=""text"">Wire transfer</g:payment>" & vbcrlf
			End If
			If Len(PaymentNotes) > 0 Then
				strXML = strXML & "<g:payment_notes type=""text"">" & PaymentNotes & "</g:payment_notes>" & vbcrlf
			End If
			If Len(DeliveryLocation) > 0 Then
				strXML = strXML & "<g:location type=""location"">" & DeliveryLocation & "</g:location>" & vbcrlf
			End If
			If Len(DeliveryPickup) > 0 Then
				strXML = strXML & "<g:pickup type=""boolean"">" & DeliveryPickup & "</g:pickup>" & vbcrlf
			End If
			If Len(DeliveryRadius) > 0 Then
				strXML = strXML & "<g:delivery_radius type=""floatunit"">" & DeliveryRadius & " km</g:delivery_radius>" & vbcrlf
			End If
			If Len(DeliveryNotes) > 0 Then
				strXML = strXML & "<g:delivery_notes type=""text"">" & DeliveryNotes & "</g:delivery_notes>" & vbcrlf
			End If
			
			i = i + 1
		End If
	Next
	strXML = strXML & "</feed>" & vbcrlf
	
	''''290409
		set fstemp=Server.CreateObject("Scripting.FileSystemObject")
		inserttemp = (EBayXMLDir & "/bulktemp.xml")
		set tfile=fstemp.CreateTextFile(inserttemp)
		tfile.WriteLine(strXML)
		tfile.close
		set tfile=nothing
		set fstemp=nothing
		
		''''290409
	
	If HaveRecord = true Then
		Response.Buffer = true
		Response.Expires = -1500
		
		Set oWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
		
		oWinHttp.Open "POST", ServerUrl & "/batch", False
		
		'Set necessary headers
		oWinHttp.SetRequestHeader "Content-Type","application/atom+xml"
		oWinHttp.SetRequestHeader "Authorization", "AuthSub token=""" & UserToken & """"
		oWinHttp.SetRequestHeader "X-Google-Key", "key=" & key
		
		'Send XML request to eBay and store response in AddItemResponse
		oWinHttp.Send strXML
		
		AddItemResponse = oWinHttp.ResponseText
		AddItemResponse = Replace(AddItemResponse, "&lt;", "<")
		AddItemResponse = Replace(AddItemResponse, "&gt;", ">")
		
		'Write contents of the response to a file on the server
		set fs=Server.CreateObject("Scripting.FileSystemObject")
		AddItemResponseXML = (EBayXMLDir & "/batch.xml")
		set tfile=fs.CreateTextFile(AddItemResponseXML)
		tfile.WriteLine(AddItemResponse)
		tfile.close
		set tfile=nothing
		set fs=nothing
  
  		If Len(Trim(AddItemResponse)) >= 8 Then
			If LCase(mid(Trim(AddItemResponse), 2, 4)) <> "html" And LCase(mid(Trim(AddItemResponse), 2, 6)) <> "errors" Then
				'open the XML document
				Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
				xmlDoc.Async = false
				xmlDoc.LoadXML(AddItemResponse)
				If Len(IDP) > 0 Then
					IDP = Split(IDP, "|")
				Else
					Response.Redirect "sysMsg.asp?errMsg=" & Server.URLEncode("Unfortunately there are some error. Please try again.")
				End If
				i = 0
				
				'parse data from xml and handle accordingly
				Set AddItemResponseNode = xmlDoc.selectNodes("/atom:feed")
				For Each node In AddItemResponseNode
					For Each cnode In node.childnodes
						If cnode.nodename = "atom:entry" Then
							If Trim(Lcase(tryNode(cnode, "atom:title"))) <> "error" Then
								dd = Day(date())
								If Cdbl(dd) < 10 Then dd = "0" & dd
								mm = Month(date())
								If Cdbl(mm) < 10 Then mm = "0" & mm
								yy = Year(date())
								DateTime = ""&mm&"/"&dd&"/"&yy
								IDURL = TryNode(cnode, "atom:id")
								ItemID = Mid(Trim(IDURL), 40, Len(Trim(IDURL))-39)
								ItemURL = Left(Trim(IDURL),39)
								
								EndTime = TryNode(cnode, "g:expiration_date")
								EndDate = (Left(EndTime,10))
								EndDateSplit = Split(EndDate, "-")
								EndMo = EndDateSplit(1)
								EndDay = EndDateSplit(2)
								EndYear = EndDateSplit(0)
								EndDate = EndMo&"/"&EndDay&"/"&EndYear
								EndTimestamp = EndDate
								
								ProdPrice = FVal(Left(TryNode(cnode, "g:price"), Len(Trim(TryNode(cnode, "g:price"))) - 4))
								Quantity = TryNode(cnode, "g:quantity")
					
								mySQL = "UPDATE tblProducts SET Upload=1,GoogleID = '" & SQLStr(ItemID) & "' " _
								& "WHERE ProdID = " & FVal(IDP(i))
								gsConnect.Execute(mySQL)
							
								mySQL = strDeleteSyntax & "tblGoogleProduct WHERE ProdID = " & SQLVal(IDP(i))
								gsConnect.Execute(mySQL)
								
								mySQL = "INSERT INTO tblGoogleProduct(GoogleID,ProdID,ProdUrl,Price,Quantity,InsertDate,ExpiryDate,Upload) Values(" _
								& "'" & SQLStr(ItemID) & "'," & SQLVal(IDP(i)) & ",'" & ItemURL & "', " _
								& "" & SQLVal(ProdPrice) & ", " & SQLVal(Quantity) & ", '" & DateTime & "', '" & EndTimestamp & "',1) "
								gsConnect.Execute(mySQL)
							Else
								mySql = strDeleteSyntax & "tblGoogleResponse Where ProdID=" & FVal(IDP(i))
								gsConnect.Execute(mySql)
 
								For Each ccnode in cnode.childnodes
									If ccnode.NodeName = "batch:status" Then
										For Each cccnode in ccnode.childnodes		'errors
											errorReason = Trim(cccnode.selectSingleNode("error").Attributes(2).Value)
											errorField = Trim(cccnode.selectSingleNode("error").Attributes(1).Value)
											
											mySql = "Insert into tblGoogleResponse (ProdID, errorField, errorReason,Upload) values ( " _
											& "" & FVal(IDP(i)) & ",'" & Replace(errorField,"'","''") & "','" & Replace(errorReason,"'","''") & "',1)"
											gsConnect.Execute(mySql)
										Next
									End If
								Next
							End If
							i = i + 1
						End If
					Next
				Next
				Set AddItemResponseNode = Nothing
					
				Set xmlDoc = Nothing
				Response.Redirect("Insert.asp")
			Else
				Response.Write(AddItemResponse)
				Response.Write("<BR><BR>")
				Response.Write("<a href=""Insert.asp"">Try Again</a>")
				Response.End()
			End If
		Else
			Response.Redirect "sysmsg.asp?errMsg=" & Server.URLEncode("Some errors occured while processing your request. Press 'Refresh Page' button and then try again.")
		End If
	Else
		Response.Redirect "sysMsg.asp?errMsg=" & Server.URLEncode("Unfortunately there are no records to post. Try again.")
	End If
ElseIf Trim(action) = "refresh" Then
	Response.Buffer = true
	Response.Expires = -1500
	mySql = "Select GoogleID,ProdID from tblGoogleProduct"
	Call GetDBRecords(mySql, rsTemp)
	If Not rsTemp.EOF Then
		rsTemp.MoveFirst
		Do While Not rsTemp.EOF
			GID = GID & rsTemp("GoogleID") & ","
			PID = PID & rsTemp("ProdID") & ","
			rsTemp.MoveNext
		Loop
		rsTemp.Close
	End If
	If Len(Trim(GID)) > 0 Then GoogleID = Split(GID, ",")
	If Len(Trim(PID)) > 0 Then ProdID = Split(PID, ",")
	
	If IsArray(ProdID) And IsArray(GoogleID) Then
		For i = LBound(ProdID) To UBound(ProdID)
				
			Set oWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
			
			oWinHttp.Open "GET", ServerUrl & "/" & GoogleID(i), False
			
			'Set necessary headers
			oWinHttp.SetRequestHeader "Content-Type","application/atom+xml"
			oWinHttp.SetRequestHeader "Authorization", "AuthSub token=""" & UserToken & """"
			oWinHttp.SetRequestHeader "X-Google-Key", "key=" & key
			
			'Send XML request to eBay and store response in AddItemResponse
			oWinHttp.Send ""
			
			AddItemResponse = oWinHttp.ResponseText
	
			set fs=Server.CreateObject("Scripting.FileSystemObject")
			AddItemResponseXML = (EBayXMLDir & "/query.xml")
			set tfile=fs.CreateTextFile(AddItemResponseXML)
			tfile.WriteLine(AddItemResponse)
			tfile.close
			set tfile=nothing
			set fs=nothing
			
			If Len(Trim(AddItemResponse)) >= 8 Then
				If LCase(Left(Trim(AddItemResponse),6)) <> "<html>" And LCase(Left(Trim(AddItemResponse),8)) <> "<errors>" Then
					'open the XML document
					Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
					xmlDoc.Async = false
					xmlDoc.LoadXML(AddItemResponse)
					
					'parse data from xml and handle accordingly
					Set AddItemResponseNode = xmlDoc.selectNodes("/entry")
					For Each node In AddItemResponseNode
						DateTime = Left(Trim(TryNode(node, "published")), 10)
						EndDate = (Left(DateTime,10))
						EndDateSplit = Split(EndDate, "-")
						EndMo = EndDateSplit(1)
						EndDay = EndDateSplit(2)
						EndYear = EndDateSplit(0)
						DateTime = EndMo&"/"&EndDay&"/"&EndYear
						
						IDURL = TryNode(node, "id")
						ItemID = Mid(Trim(IDURL), 40, Len(Trim(IDURL))-39)
						ItemURL = Left(Trim(IDURL),39)
						Response.Write("ItemId : " & ItemID & "<BR>")
						
						EndTime = TryNode(node, "g:expiration_date")
						EndDate = (Left(EndTime,10))
						EndDateSplit = Split(EndDate, "-")
						EndMo = EndDateSplit(1)
						EndDay = EndDateSplit(2)
						EndYear = EndDateSplit(0)
						EndDate = EndMo&"/"&EndDay&"/"&EndYear
						EndTimestamp = EndDate
						
						ProdPrice = formatnumber(FVal(Left(TryNode(node, "g:price"), Len(Trim(TryNode(node, "g:price"))) - 4)), 2)
						Quantity = TryNode(node, "g:quantity")
					Next
					Set AddItemResponseNode = Nothing
					
					mySQL = "UPDATE tblProducts SET Upload=1,GoogleID = '" & SQLStr(ItemID) & "' " _
					& "WHERE ProdID = " & FVal(ProdID(i))
					gsConnect.Execute(mySQL)
					
					mySQL = "Update tblGoogleProduct Set Upload=1,GoogleID='" & SQLStr(ItemID) & "'," _
					& "ProdUrl='" & ItemURL & "',Price=" & SQLVal(ProdPrice) & ",Quantity=" & SQLVal(Quantity) & "," _
					& "InsertDate='" & DateTime & "',ExpiryDate='" & EndTimestamp & "' Where ProdID=" & SQLVal(ProdID(i))
					gsConnect.Execute(mySQL)
		
				Else
					mySQL = "UPDATE tblProducts SET Upload=1,GoogleID = '' WHERE ProdID = " & FVal(ProdID(i))
					gsConnect.Execute(mySQL)
				
					mySQL = strDeleteSyntax & "tblGoogleProduct WHERE ProdID = " & SQLVal(ProdID(i))
					gsConnect.Execute(mySQL)
				End If
				set oWinHttp = Nothing
			End If
		Next
	End If
	Set xmlDoc = Nothing
	Response.Redirect("Insert.asp")
ElseIf Trim(action) = "edit" Then
	ProdID = FVal(Request.QueryString("ID"))
	Quantity= FVal(Request.QueryString("QTY"))
	If ProdID = 0 Then
		Response.Redirect "sysMsg.asp?errMsg=" & Server.URLEncode("There are some errors while processing your request. Try again.")
	End If
	mySql = "Select pd.ProdName, pd.prodDescription, p.prodID, p.prodSKU, p.prodModel, p.prodImage, p.prodPrice" _
	& " From tblProducts p, tblProductsDescription pd Where p.ProdID=pd.ProdID and pd.LangID=1 and p.ProdID=" & FVal(ProdID)
	
	Call GetDBRecords(mySql, rsTemp)
	If Not rsTemp.EOF Then
		ProdName = rsTemp("ProdName")
		ProdSKU = rsTemp("prodSKU")
		ProdModel = rsTemp("prodModel")
		ProdImage = rsTemp("prodImage")
		ProdDescription = rsTemp("prodDescription")
		ProdPrice = rsTemp("prodPrice")
	Else
		Response.Redirect "sysMsg.asp?errMsg=" & Server.URLEncode("There are some errors while processing your request. Try again.")
	End If
	
	mySql = "Select * From tblGoogleCP"
	Call GetDBRecords(mySql, rsTemp)
	If Not rsTemp.EOF Then
		PaymentGC 			= Trim(rsTemp("PaymentGC"))
		PaymentCash 		= Trim(rsTemp("PaymentCash"))
		PaymentCheck 		= Trim(rsTemp("PaymentCheck"))
		PaymentVisa 		= Trim(rsTemp("PaymentVisa"))
		PaymentMaster 		= Trim(rsTemp("PaymentMaster"))
		PaymentDiscover 	= Trim(rsTemp("PaymentDiscover"))
		PaymentAmex 		= Trim(rsTemp("PaymentAmex"))
		PaymentWire 		= Trim(rsTemp("PaymentWire"))
		PaymentNotes 		= Trim(rsTemp("PaymentNotes"))
		DeliveryLocation	= Trim(rsTemp("DeliveryLocation"))
		DeliveryPickup 		= Trim(rsTemp("DeliveryPickup"))
		DeliveryRadius 		= Trim(rsTemp("DeliveryRadius"))
		DeliveryNotes 		= Trim(rsTemp("DeliveryNotes"))
	End If
	rsTemp.Close
End If
If Trim(action) = "edit" Or Trim(action) = "send" Then
%>
<script language="javascript"><!--
 
function check_form() {
  	var error = 0;
  	var error_message = "Errors have occurred during the processing of your form!\nPlease make the following corrections:\n\n";
 
  	var ProdName = document.customers.ProdName.value;
	var ProdSKU = document.customers.ProdSKU.value;
  	var ProdModel = document.customers.ProdModel.value;
  	var ProdDescription = document.customers.ProdDescription.value;
  	var ProdPrice = document.customers.ProdPrice.value;
  	var Quantity = document.customers.Quantity.value;
 
  	if (ProdName == "" || ProdName.length < 2) {
    	error_message = error_message + "* The \'Product Name\' entry must have at least 2 characters.\n";
    	error = 1;
  	}
 
  	if (ProdSKU == "") {
    	error_message = error_message + "* The \'Product SKU\' must be entered.\n";
    	error = 1;
  	}
	
  	if (ProdModel == "") {
    	error_message = error_message + "* The \'Product Model\' must be entered.\n";
    	error = 1;
  	}
 
  	if (ProdDescription == "" || ProdDescription.length < 10) {
    	error_message = error_message + "* The \'Product Description\' entry must have at least 10 characters.\n";
    	error = 1;
  	}
  	if (ProdPrice == "") {
    	error_message = error_message + "* The \'Price\' must be entered.\n";
    	error = 1;
  	}
  	if (Quantity == "") {
    	error_message = error_message + "* The \'Quantity\' must be entered.\n";
    	error = 1;
  	}
  	if (error == 1) {
    	alert(error_message);
    	return false;
  	} else {
    	return true;
  	}
}
//--></script>
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="VertMenuBorder">
    <tr>
		<td class="VertMenuTitleBox">
			<table border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td valign="top"><font class="VertMenuTitle">Send Item To GoogleBase</font></td>
				<td align="right"><img src="images/pixel_trans.gif" border="0" alt="" width="57" height="10"></td>
			</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>
	</tr>
	<form name="customers" action="Insert.asp?ProdID=<%=ProdID%>&action=send" method="post" onSubmit="return check_form(customers);" enctype="multipart/form-data">
	<tr>
		<td class="formAreaTitle" style="padding:5px">In Site Data</td>
	</tr>
	<tr>
		<td class="main" style="padding:5px">
			<fieldset style="padding:5px; border:#999933 1px solid; background-color:#EEEEEE">
			<table border="0" cellspacing="0" cellpadding="5" width="100%">
				<tr>
					<td class="main" width="25%">Product Title:</td>
					<td class="main">
					<input type="text" readonly="true" name="ProdNameL" value="<%=ProdName%>" size = "33" maxlength = "32">&nbsp;
				<%
					If Trim(Lcase(errorField)) = "title" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					Else
				%>
						<span class="fieldRequired">* Required</span>
				<%
					End If
				%>
					<input type="hidden" name="ProdName" value="<%=ProdName%>">
                    <input type="hidden" name="ProductID" value="<%=ProdID%>">
					</td>
				</tr>
				<tr>
					<td class="main" width="25%">Product Description:</td>
					<td class="main">
					<textarea name="ProdDescription" wrap="soft" cols="55" rows="12"><%=ProdDescription%></textarea>&nbsp;
				<%
					If Trim(Lcase(errorField)) = "content" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					Else
				%>
						<span class="fieldRequired">* Required</span>
				<%
					End If
				%>
					</td>
				</tr>
				<script language="JavaScript1.2" defer>
					editor_generate('ProdDescription');
				</script>
				<tr>
					<td class="main" width="25%" valign="top">Product Category:</td>
					<td class="main" valign="top">
			<%
				mySql = "Select CatName from tblCategoriesDescription Where LangID=1"
				Call GetDBRecords(mySql, rsTemp)
				If Not rsTemp.EOF Then
			%>
					<select rel="dropdown" name="ProdCategory">
						<option value=""></option>
			<%
					Do While Not rsTemp.EOF
			%>
						<option value="<%=rsTemp("CatName")%>" <%=OutMatch(rsTemp("CatName"),ProdCategory,"SELECTED","")%>><%=rsTemp("CatName")%></option>
			<%
						rsTemp.MoveNext
					Loop
			%>
					</select>&nbsp;
			<%
				End If
				rsTemp.Close
					If Trim(Lcase(errorField)) = "item_type" Then
			%>
						<span class="errorText"><%=errorReason%></span>
			<%
					End If
			%>
					<br />[Leave this blank if you want to use <strong>GOOGLE CHECKOUT</strong>. Your default category will be <strong>PRODUCTS</strong>]
					</td>
				</tr>
				<tr>
					<td class="main" width="25%">Product SKU:</td>
					<td class="main"><input type="text" name="ProdSKU" value="<%=ProdSKU%>" size = "33" maxlength = "32">&nbsp;
				<%
					If Trim(Lcase(errorField)) = "sku" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					Else
				%>
						<span class="fieldRequired">* Required</span>
				<%
					End If
				%>
					</td>
				</tr>
				<tr>
					<td class="main" width="25%">Product Model:</td>
					<td class="main"><input type="text" name="ProdModel" value="<%=ProdModel%>" size = "50" maxlength= "100">&nbsp;
				<%
					If Trim(Lcase(errorField)) = "model" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					Else
				%>
						<span class="fieldRequired">* Required</span>
				<%
					End If
				%>
					</td>
				</tr>
				<tr>
					<td class="main" width="25%">Product Image:</td>
					<td class="main">
					<input type="file" name="ProdImage" size="30" >&nbsp;<BR />Image Name: &nbsp;<%=IIf(Len(trim(ProdImage)) > 0, "<A href=""javascript:popupWindow('popupimage.asp?P_ID=" & ProdID & "&ImageURL=" & ProdImage & "')"">" & ProdImage & "</A>","NONE")%> 
				<%
					If Trim(Lcase(errorField)) = "image_link" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					End If
				%>
					<input type="hidden" name="ProdPrevImage" value="<%=ProdImage%>" />
					</td>
				</tr>
			<%
				If error = True Then
			%>
				<tr>
					<td class="main" width="25%">Product Price:</td>
					<td class="main"><input type="text" name="ProdPrice" value="<%=ProdPrice%>" size = "10" maxlength= "8">&nbsp;<span class="errorText">Price must be numeric or decimal!</span></td>
				</tr>
			<%
				Else
			%>
				<tr>
					<td class="main" width="25%">Product Price:</td>
					<td class="main"><input type="text" name="ProdPrice" value="<%=ProdPrice%>" size = "10" maxlength= "8">&nbsp;
				<%
					If Trim(Lcase(errorField)) = "price" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					Else
				%>
						<span class="fieldRequired">* Required</span>
				<%
					End If
				%>
					</td>
				</tr>
			<%
				End If
				If error1 = True Then
			%>
				<tr>
					<td class="main" width="25%">Product Quantity:</td>
					<td class="main"><input type="text" name="Quantity" value="<%=Quantity%>" size = "10" maxlength= "8">&nbsp;<span class="errorText">Quantity must be numeric!</span></td>
				</tr>
			<%
				Else
			%>
				<tr>
					<td class="main" width="25%">Product Quantity:</td>
					<td class="main"><input type="text" name="Quantity" size = "10" maxlength= "100" value="<%=Quantity%>">&nbsp;
				<%
					If Trim(Lcase(errorField)) = "quantity" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					Else
				%>
						<span class="fieldRequired">* Required</span>
				<%
					End If
				%>
					</td>
				</tr>
			<%
				End If
			%>
			</table>
			</fieldset>
		</td>
	</tr>
	<tr>
		<td><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>
	</tr>
	<tr>
		<td class="formAreaTitle" style="padding:5px">Payment&nbsp;&nbsp;
			<%
				If Trim(Lcase(errorField)) = "payment" Then
			%>
					<span class="errorText" style="font-weight:normal;"><%=errorReason%></span>
			<%
				End If
			%>
		</td>
	</tr>
	<tr>
		<td class="main" style="padding:5px">
			<fieldset style="padding:5px; border:#999933 1px solid; background-color:#EEEEEE">
			<table border="0" cellspacing="0" cellpadding="5" width="100%">
				<tr>
					<td class="main" width="25%" valign="top">I Accept:</td>
					<td class="main">
						<input type="checkbox" name="PaymentGC" value="Google Checkout" <%=outMatch(PaymentGC,"Google Checkout","CHECKED","")%>>&nbsp;&nbsp;<img src="../images/google_checkout.gif" border="0" align="absmiddle" /><br />
						<strong>[Note : You must have an Google Checkout Account to use this payment type]</strong>
						<br /><br />
						<table border="0" cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td class="main" width="50%">
									<input type="checkbox" name="PaymentCash" value="Cash" <%=outMatch(PaymentCash,"Cash","CHECKED","")%>>&nbsp;&nbsp;Cash
								</td>
								<td class="main" width="50%">
									<input type="checkbox" name="PaymentCheck" value="Check" <%=outMatch(PaymentCheck,"Check","CHECKED","")%>>&nbsp;&nbsp;Check
								</td>
							</tr>
							<tr>
								<td class="main" width="50%">
									<input type="checkbox" name="PaymentVisa" value="Visa" <%=outMatch(PaymentVisa,"Visa","CHECKED","")%>>&nbsp;&nbsp;Visa
								</td>
								<td class="main" width="50%">
									<input type="checkbox" name="PaymentMaster" value="MasterCard" <%=outMatch(PaymentMaster,"MasterCard","CHECKED","")%>>&nbsp;&nbsp;MasterCard
								</td>
							</tr>
							<tr>
								<td class="main" width="50%">
									<input type="checkbox" name="PaymentDiscover" value="Discover" <%=outMatch(PaymentDiscover,"Discover","CHECKED","")%>>&nbsp;&nbsp;Discover
								</td>
								<td class="main" width="50%">
									<input type="checkbox" name="PaymentAmex" value="American Express" <%=outMatch(PaymentAmex,"American Express","CHECKED","")%>>&nbsp;&nbsp;American Express
								</td>
							</tr>
							<tr>
								<td class="main" width="50%" colspan="2">
									<input type="checkbox" name="PaymentWire" value="Wire Transfer" <%=outMatch(PaymentWire,"Wire Transfer","CHECKED","")%>>&nbsp;&nbsp;Wire Transfer
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td class="main" width="25%" valign="top">Notes:</td>
					<td class="main">
					<textarea name="PaymentNotes" wrap="soft" cols="35" rows="8"><%=PaymentNotes%></textarea>&nbsp;
				<%
					If Trim(Lcase(errorField)) = "payment_notes" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					End If
				%>
					</td>
				</tr>
			</table>
			</fieldset>
		</td>
	</tr>
	<tr>
		<td><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>
	</tr>
	<tr>
		<td class="formAreaTitle" style="padding:5px">Location and delivery&nbsp;&nbsp;
			<%
				If Trim(Lcase(errorField)) = "item" Then
			%>
					<span class="errorText" style="font-weight:normal;"><%=errorReason%></span>
			<%
				End If
			%>
		</td>
	</tr>
	<tr>
		<td class="main" style="padding:5px">
			<fieldset style="padding:5px; border:#999933 1px solid; background-color:#EEEEEE">
			<table border="0" cellspacing="0" cellpadding="5" width="100%">
				<tr>
					<td class="main" width="25%" valign="top">Location:</td>
					<td class="main">
					<textarea name="DeliveryLocation" wrap="soft" cols="35" rows="5"><%=DeliveryLocation%></textarea>&nbsp;
				<%
					If Trim(Lcase(errorField)) = "location" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					End If
				%>
					</td>
				</tr>
				<tr>
					<td class="main" width="25%">Pickup:</td>
					<td class="main">
					<input type="checkbox" name="DeliveryPickup" value="True" <%=outMatch(DeliveryPickup,"true","CHECKED","")%>>&nbsp;&nbsp;Customer can pick up from this location
				<%
					If Trim(Lcase(errorField)) = "pickup" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					End If
				%>
					</td>
				</tr>
				<tr>
					<td class="main" width="25%">Radius:</td>
					<td class="main">
					I will deliver within <input type="text" name="DeliveryRadius" value="<%=DeliveryRadius%>" size="6" maxlength="8"> Kilometers of this location
					<!--<input type="checkbox" name="DeliveryRadius" value="True" <%'=outMatch(DeliveryRadius,"American Express","CHECKED","")%>>&nbsp;&nbsp;Customer can pick up from this location-->
				<%
					If Trim(Lcase(errorField)) = "delivery_radius" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					End If
				%>
					</td>
				</tr>
				<tr>
					<td class="main" width="25%" valign="top">Addtional Notes:</td>
					<td class="main">
					<textarea name="DeliveryNotes" wrap="soft" cols="35" rows="5"><%=DeliveryNotes%></textarea>&nbsp;
				<%
					If Trim(Lcase(errorField)) = "delivery_notes" Then
				%>
						<span class="errorText"><%=errorReason%></span>
				<%
					End If
				%>
					</td>
				</tr>
			</table>
			</fieldset>
		</td>
	</tr>
	<tr>
		<td><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>
	</tr>
	<tr>
		<td class="main" align="right" style="padding:5px">
			<fieldset style="padding:5px; border:#999933 1px solid; background-color:#EEEEEE">
			<table border="0" width="100%" cellspacing="0" cellpadding="0" id="cartContentsDisplay">
				<tr>
					<td align="right">
					<input type="image" src="images/buttons/button_update.gif" border="0" alt="Update" title=" Update ">&nbsp;&nbsp;
					<a href="Insert.asp"><img src="images/buttons/button_cancel.gif" border="0" alt="Cancel" title=" Cancel "></a>
					</td>
				</tr>
			</table>
			</fieldset>					
		</td>
	</tr>
	</form>
</table>
<%
End If
 
Function TryNode(Node, Loc)
	On Error Resume Next
	TryNode = ""
	TryNode = Node.selectSingleNode(Loc).Text
End Function
 
If Len(Trim(action)) = 0 Then
%>
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="VertMenuBorder">
    <tr>
		<td class="VertMenuTitleBox">
			<table border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td valign="top"><font class="VertMenuTitle">Send Item To GoogleBase</font></td>
				<td align="right"><img src="images/pixel_trans.gif" border="0" alt="" width="57" height="10"></td>
			</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td valign="top"><BR />
			<table border="0" width="100%" cellspacing="2" cellpadding="5">
				<tr>
					<td align="left" colspan="5">
					<a href="javascript: checkAll(true, document.ebayfeed, 'ID.');" style="color:#996600">Check all</a> / <a href="javascript: checkAll(false, document.ebayfeed, 'ID.');" style="color:#996600">Uncheck all</a>
					</td>
					<td align="right" colspan="4">
					<input type="button" name="refreshpage" id="refreshpage" value="RefreshPage" onclick="window.location.href='Insert.asp?action=refresh';" />
					</td>
				</tr>
                <form name="ebayfeed" action="Insert.asp?action=bulksend" method="post" onsubmit="return anyChecked();">
                <tr>
						<td colspan="9" valign="top"><span style="font-size:13px"><strong>Update Stock Quantity for displayed items to: </strong></span>
						<input type="text" name="txtAllUpdate" size="10" maxlength="5" value="999" style="font-size:11px;" onKeypress="if(!isNS4){if(event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;}else{if(event.which < 48 || event.which > 57) returnfalse;}" />&nbsp;&nbsp;<input type="button" name="Update" value="Update" onclick="validateUpdateAll();" style="font-size:11px"/></td>
					</tr>
				<tr class="dataTableHeadingRow">
					<td class="dataTableHeadingContent" align="left" valign="top">&nbsp;</td>
					<td class="dataTableHeadingContent" align="left" valign="top">Google ID</td>
					<td class="dataTableHeadingContent" align="left" valign="top">Item SKU</td>
					<td class="dataTableHeadingContent" align="left" valign="top">Item Name</td>
					<td class="dataTableHeadingContent" align="left" valign="top">Item Price</td>
					<td class="dataTableHeadingContent" align="left" valign="top">Google Response</td>
					<td class="dataTableHeadingContent" align="left" valign="top">Selling Price</td>
					<td class="dataTableHeadingContent" align="left" valign="top">Qty</td>
					<td class="dataTableHeadingContent" align="left" valign="top">Action</td>
				</tr>
				
				<%
				mySQL = "SELECT p.ProdID, p.ProdSKU, p.GoogleID, pd.ProdName, p.ProdCost, p.ProdPrice, " _
				& "p.ProdTaxClassID, s.SpecialNewProdPrice, c.CondName " _
				& "FROM (((tblProducts AS p INNER JOIN tblProductsDescription AS pd ON p.ProdID = pd.ProdID) " _
				& "LEFT JOIN tblSpecials AS s ON p.ProdID = s.ProdID) LEFT JOIN tblConditions AS c ON p.CondID = c.CondID) " _
				& "Where p.ProdID not in (Select ProdID from tblGoogleProduct) ORDER BY pd.ProdName;"
 
				Call GetDBRecords(mySQL,rsTemp)
				setClass = "dataTableRow"
				Do While Not rsTemp.EOF
				%>
				<tr class="<%=setClass%>">
					<td class="dataTableContent" align="left" valign="top">
					<input type="checkbox" name="ID<%=rsTemp("ProdID")%>" value="<%=rsTemp("ProdID")%>">
					</td>
					<td class="dataTableContent" align="left" valign="top"><%=rsTemp("GoogleID")%></td>
					<td class="dataTableContent" align="left" valign="top"><%=rsTemp("ProdSKU")%></td>
					<td class="dataTableContent" align="left" valign="top"><%=rsTemp("ProdName")%></td>
					<td class="dataTableContent" align="right" valign="top"><%=FormatNumber(rsTemp("ProdPrice"),2)%></td>
					<td class="dataTableContent" align="left" valign="top">
				<%
					mySql = "Select * from tblGoogleResponse Where ProdID = " & FVal(rsTemp("ProdID"))
					Call GetDBRecords(mySql, rs)
					If Not rs.EOF Then rs.MoveFirst
					Do While Not rs.EOF
						Response.Write "<B>" & rs("errorField") & ":<B> " & rs("errorReason") & "<BR>"
						rs.MoveNext
					Loop
					rs.Close
				%>
					</td>
					<td class="dataTableContent" align="right" valign="top">
					<input type="text" name="ProdPrice<%=rsTemp("ProdID")%>" size="6" value="<%=FormatNumber(FVal(rsTemp("ProdPrice")),2)%>" maxlength="10" style="font-size:9px">
					</td>
					<td class="dataTableContent" align="right" valign="top">
					<input type="text" name="QTY<%=rsTemp("ProdID")%>" size="4" value="" maxlength="10" style="font-size:9px">
					</td>
					<td class="dataTableContent"><input type="button" name="send" alt="Send this product to Google" value="Send" onClick="go(<%=rsTemp("ProdID")%>,document.ebayfeed.QTY<%=rsTemp("ProdID")%>.value,document.ebayfeed.ProdPrice<%=rsTemp("ProdID")%>.value);" style="font-size:10px"></td>
				</tr>
				<%
					If setClass = "dataTableRow" then
						setClass = "dataTableRowOdd"
					Else
						setClass = "dataTableRow"
					End If
					rsTemp.MoveNext
				Loop
				rsTemp.Close
				%>
				<tr>
					<td colspan="7"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>
				</tr>
				<tr class="dataTableHeadingRow">
					<td align="right" colspan="9">
					<input type="submit" name="submit" value="Send All" alt=" Send To Google ">&nbsp;&nbsp;
					</td>
				</tr>
				</form>
				<tr>
					<td align="right" colspan="9">
					<input type="button" name="refreshpage" id="refreshpage" value="RefreshPage" onclick="window.location.href='Insert.asp?action=refresh';" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<br /><br />
<script language="javascript" type="text/javascript">
function validateUpdateAll(){
	if(document.ebayfeed.txtAllUpdate.value==""){
		alert('Product Quantity is a required field.')
		document.ebayfeed.txtAllUpdate.focus();
		return false;
	}
	if(confirm("Update all displayed products to Qty: " + document.ebayfeed.txtAllUpdate.value + " ?")){
		var reg = new RegExp("^"+'QTY.', "");
		for (var i = 0; i < document.ebayfeed.elements.length; i++) {
			if ((document.ebayfeed.elements[i].type == "text") && (document.ebayfeed.elements[i].name.search(reg) == 0) && (!document.ebayfeed.elements[i].disabled)){
				document.ebayfeed.elements[i].value = document.ebayfeed.txtAllUpdate.value
			}
		}
		document.ebayfeed.submit();
	}
	return false;
}
 
 
	function go(id,qty,ProdPrice){
		var href="Insert.asp?action=edit&ID="+id+"&QTY="+qty+"&ProdPrice="+ProdPrice;
		document.location.href=href;
	}
	function checkAll(flag, form, prefix) {
		if (!form)
			return;
	
		if (prefix)
			var reg = new RegExp("^"+prefix, "");
		for (var i = 0; i < form.elements.length; i++) {
			if (form.elements[i].type == "checkbox" && (!prefix || form.elements[i].name.search(reg) == 0) && !form.elements[i].disabled)
				form.elements[i].checked = flag;
		}
	}
	function anyChecked()
	{
		if (confirm("Google Checkout facility is not available for this bulk upload. Are you sure?"))
		{
			var  l = document.ebayfeed.elements.length;
			var anyChecked=false;
			for(i=0;i<l;i++){
				if(document.ebayfeed.elements[i].type=="checkbox" && document.ebayfeed.elements[i].checked && document.ebayfeed.elements[i].name.search('^ID') == 0) anyChecked=true;
			}
			if(!anyChecked)
				{
					alert('No Item was selected from the list.\nSelect a Item to continue send operation?');
					return false;
				}
			return true;
		}
		else
		{
			return false;
		}
	}
 
</script>
<%
End If
%>
<!--#include file="../Admin/AdminFooter.asp"-->

Open in new window

0
 
BigRatCommented:
As I suspected there is NO namespace declaration for the element "link" which has the namespace prefix "atom". It seems that the RSS feed namespace is the default namespace, the google namespace has "g" for a prefix. I suspect that the "atom" prefix to the "link" element is a copy/paste error and you should simply delete the prefix "atom:"

HTH.
0
 
sdugarAuthor Commented:
Dear Bigrat,

Thanks for your help.I will reply you soon with the update for your help

regards,
sunny
0
 
sdugarAuthor Commented:
Dear Bigrat,

I have change that but it gives another error.

******
Microsoft VBScript runtime error '800a01a8'

Object required: 'node.selectSingleNode(...)'

/price/Admin/Insert.asp, line 259

********

Regards

Sunny
0
 
BigRatCommented:
THe line is :-

errorReason = Trim(node.selectSingleNode("error").Attributes(2).Value)

and the question is exactly what XML is being returned in line 254?

The code ASSUMES that there will be two ATTRIBUTES AND IRRESPECTIVE OF THE ORDER ASSUMES that the first is the field and the second is the reason. This is bad programming. You should access the attributes by name and test if they are present BEFORE extracting any values.
0
 
sdugarAuthor Commented:
Dear Bigrat

xml returned in line 254  
****
<errors>
<error type="request" reason="Service not found"/>
</errors>

****

Regards

Sunny
0
 
BigRatCommented:
Well the code dones't work, so the node cannot be an "error" node. Try outputting the nodeName property of the node in the for loop.

BTW: THe "service not found" means you have the URL wrong.

And debugging your code subsequent to answering the original question is worthy of a new question.
0
 
sdugarAuthor Commented:
Dear bigrat

Here is the new posting.Please help me.

http://www.experts-exchange.com/Web_Development/Software/Web_APIs/Q_24486893.html

thanks
regards
0
 
sdugarAuthor Commented:
thanks bigrat! very helpful.
could you please help on this
http://www.experts-exchange.com/Web_Development/Software/Web_APIs/Q_24486893.html
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now