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
 Wishlist Modification - HELP!
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

webpro
Starting Member

United Kingdom
11 Posts

Posted - April 02 2004 :  13:20:37  Show Profile  Visit webpro's Homepage  Reply with Quote
Whilst I've got some 5 projects up-and-running happily using VPASP, I've got one demanding customer for whom I've done a fair bit of tweaking.

He wants, and I can understand him on this, a much simpler and better wishlist.

I found a very good wishlist on a certain (rival) cart, in OS, and their wishlist is excellent - each product has "add to wishlist", and the list is a table of saved products with options to Add/Remove/View.

What I'm trying to do is alter the code and add pages to integrate this, then modify pages to disable the VPASP wishlist.

If anyone out there could help/contribute I'd be very grateful - I'm not very good with raw code, a bit of a hacker in truth!

I realise I'll need to utilise some of the spare fields in the customers table, and write a sub to display the "add to wishlist" link for the shopdisplayproducts page.

Then, there are three new pages, listed and pasted below:

(I've started hacking the code but NEED HELP - PLEASE!)

1. WISHLISTADD.ASP

quote:
<%
' Details: add one item to customer wish list
%>
<!--#include file="shop$db.asp"-->
<!--#include file="shopproductcreatesql.asp"-->
<!--#include file="shopproductformat_template.asp"-->
<!--#include file="shopfileio.asp"-->
<!--#include file="shopreadfile.asp"-->

<%
on error resume next

dim connTemp, rsTemp


'-------------added
Dim search
Dim dbc
Dim customerid
Dim PRODUCTNAME, CATALOGID
Dim rc
'-------------




'-------------added
customerid=getsess("customerid")
sError=""
sAction=Request("action")
shopopendatabase conn
ShopPageHeader
If getsess("customerid") = "" then
Responseredirect "shopcustadminlogin.asp"
end if
if saction="" then
sAction=Request("action.x")
end if
If sAction <> "" Then
HandleAction
end if

PRODUCTNAME=Request("PRODUCT") ' product name
CleanseMessage productname, rc
if rc>0 then
productname=""
end if
'-------------


'-------original code starts
customerid = session("customerid")
catalogid = getUserInput(request.querystring("catalogid"),10)

' check if that item exists
sql="SELECT catalogid FROM wishList WHERE customerid=" &customerid& " AND catalogid=" &catalogid

call getFromDatabase(sql, rsTemp, "customerWishListAdd")

if not rstemp.eof then
response.write "That item is already in your Favorites List"
end if

' add to whish list

sql="INSERT INTO wishList (customerid, catalogid) VALUES (" &customerid& "," &catalogid& ")"

call updateDatabase(sql, rsTemp, "customerWishListAdd")

call closeDb()

response.redirect "WishListView.asp"
'-------original code ends

%>



2. WISHLISTREMOVE.ASP

quote:
<%
' Details: remove an item from wish list
%>
<!--#include file="shop$db.asp"-->
<!--#include file="shopproductcreatesql.asp"-->
<!--#include file="shopproductformat_template.asp"-->
<!--#include file="shopfileio.asp"-->
<!--#include file="shopreadfile.asp"-->

<%
on error resume next

dim connTemp, rsTemp

'-------------added
Dim search
Dim dbc
Dim customerid
Dim PRODUCTNAME, CATALOGID
Dim rc
'-------------

'-------------added

customerid=getsess("customerid")
sError=""
sAction=Request("action")
shopopendatabase conn
ShopPageHeader
If getsess("customerid") = "" then
Responseredirect "shopcustadminlogin.asp"
end if
if saction="" then
sAction=Request("action.x")
end if
If sAction <> "" Then
HandleAction
end if

PRODUCTNAME=Request("PRODUCT") ' product name
CleanseMessage productname, rc
if rc>0 then
productname=""
end if
'-------------

catalogid = getUserInput(request.querystring("catalogid"),10)

' check if that item exists
sql="SELECT catalogid FROM wishList WHERE customerid=" &customerid& " AND catalogid=" &catalogid

call getFromDatabase(sql, rsTemp, "customerWishListRemove")

if rstemp.eof then
response.write "That item wasn't in your Favorites List"
end if

sql="DELETE FROM wishList WHERE customerid=" &customerid& " AND catalogid=" &catalogid

call updateDatabase(sql, rsTemp, "customerWishListRemove")

call closeDb()

response.redirect "WishListView.asp"

%>



2. WISHLISTVIEW.ASP

quote:
<%
' Details: show wish list
%>
<!--#include file="shop$db.asp"-->
<!--#include file="shopproductcreatesql.asp"-->
<!--#include file="shopproductformat_template.asp"-->
<!--#include file="shopfileio.asp"-->
<!--#include file="shopreadfile.asp"-->

<%
on error resume next

dim connTemp, rsTemp

'-------------added
Dim search
Dim dbc
Dim customerid
Dim PRODUCTNAME, CATALOGID
Dim rc
'-------------

'-------------added
Sub ProductCreateSQL (sql, dbc)
'*****************************************************
' VP-ASP 5.00
' Generates SQL to display a product.
' Creates SQL for dispaly products, search and shopquery
' expects most parameters to be in global
' June 26 fix categoriessimple
'*****************************************************
sql=""
dim strProductFields
dim i
dim strdistinct
strdistinct="DISTINCTROW"
if UCASE(xdatabasetype)="SQLSERVER" or ucase(getconfig("xdatabasetype"))="SQLSERVER" then
strdistinct="DISTINCT"
end if
strProductFields=Getsess("strProductFields")
If strProductFields="" then
GetProductfields dbc
strProductFields=Getsess("strProductFields")
end if
If getconfig("xCategoriesSimple")="Yes" then
NewProductSQL sql
exit sub
end if
sql="select " & strdistinct & " " & strproductfields
sql=sql & " from products p, prodcategories cc, categories c"
sql=sql & " where cc.intcatalogid=p.catalogid and cc.intcategoryid=c.categoryid and"
if cat_id <> "" then
sql = sql & " cc.intcategoryid = " & cat_id
else
if catalogid<>"" then
sql = sql & " p.catalogid = " & catalogid
else
if productname="" then
sql = sql & " c.catdescription like '"& category & "%'"
else
sql = sql & "p.cname like '"& productname & "%'"
end if
end if
end if
sql=sql & " and hide=0 "
if getconfig("xstocklow")<>"" then
lngcstock= clng(getconfig("xstocklow"))
sql = sql & " and cstock> " & lngcstock
end if
if getconfig("xproductmatch")="Yes" then
sql=sql & " and (p.productmatch='" & xproductmatch & "'"
sql=sql & " or p.productmatch is null)"
end if
if getconfig("xproductmatchcustomer")="Yes" then
if GetSess("CustomerProductGroup")<>"" then
sql=sql & " and (p.customermatch like '%" & getsess("customerProductgroup") & "%'"
sql=sql & " or p.customermatch is null)"
else
sql=sql & " and p.customermatch is null"
end if
end if
If getconfig("xselectproductsbylanguage")="Yes" and getsess("language")<>"" then
sql=sql & " and (clanguage='" & getsess("language") & "'"
sql=sql & " or clanguage is null)"
end if
sql = sql & " order by " & getconfig("xsortproducts")
'SetSess "SQL", sql
if getconfig("xdebug")="Yes" then
debugwrite sql
end if
end sub






'-------------added

customerid=getsess("customerid")
sError=""
sAction=Request("action")
shopopendatabase conn
ShopPageHeader
If getsess("customerid") = "" then
Responseredirect "shopcustadminlogin.asp"
end if
if saction="" then
sAction=Request("action.x")
end if
If sAction <> "" Then
HandleAction
end if

PRODUCTNAME=Request("PRODUCT") ' product name
CleanseMessage productname, rc
if rc>0 then
productname=""
end if
'-------------


' get email

sql="SELECT email FROM customers WHERE customerid="&customerid

call getFromDatabase(sql, rsTemp, "customerWishListView")

if not rstemp.eof then pEmail=rstemp("email")

sql="SELECT products.catalogid, cdescription, cprice, products WHERE products.catalogid=wishList.catalogid AND customerid="&customerid

call getFromDatabase(sql, rsTemp, "customerWishListView")

%>

<br><br>
<b>Favorites List</b><br><br>
<i>Save the favorites in your List! Come back at any time to purchase these items.</i><br>
<%if rstemp.eof then%>
<br>No items in your Favorites
<%else%>
<br>
<table width="579"border="0">
<tr bgcolor="#D0CC98">
<td width="68" bgcolor="#ffcc00">Item</td>
<td width="301" bgcolor="#ffcc00">Description</td>
<td width="41" bgcolor="#ffcc00">Price</td>
<td width="79" bgcolor="#ffcc00">Actions</td>
</tr>
<%

wishListTotal=Cint(0)
do while not rstemp.eof
pBtoBPrice = rstemp("bToBPrice")
pPrice = rstemp("price")
pShowPrice = 0
wishListTotal=wishListTotal+pPrice
pShowPrice = pPrice

%>
<tr>
<td><%
response.write rstemp("catalogid")
%>
</td>
<td><%=rstemp("cdescription")%></td>
<td><%=money(pShowPrice)%></td>
<td><a href="comersus_viewItem.asp?idproduct=<%=rstemp("idproduct")%>">View</a> - <a href="comersus_customerWishListRemove.asp?idProduct=<%=rstemp("idproduct")%>">Remove</a> - <a href="comersus_addItem.asp?idProduct=<%=rstemp("idproduct")%>">Add</a></td>
</tr>
<%
rstemp.movenext
loop
%>
</table>
<br>Total of Favorites  <%=money(wishListTotal)%>


<%end if
call closeDb()
ShopPageTrailer ' normal trailer
%>



support
Administrator

4266 Posts

Posted - April 02 2004 :  16:42:24  Show Profile  Visit support's Homepage  Reply with Quote
We are developing individual product wishlists for VP-ASP 5.50. We may be able to help by porting the code back to 5.0. Contact us directly at [email protected]

Howard Kadetz
VP-ASP

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