Hi Chris,
it's a really easy fix to shopwishlist.asp and I'll post it in here for any others that may want to add it. It stops the user from seeing the "View" and "Order Now" links on any product where the cname matches "Not Available". And I also added a stock column to the wish list so that the customer can see how many are in stock and if the stock is 0 the "Order Now" link is removed. We have quite a few customers who use the Wishlist for items that they order on a regular basis so it seemed like a good time for an overhaul. For any product that you hide, you change the cname field to Not Available but keep the description as is so the customer can see what the product was. Better to let the customer know why the "Order Now" link is hidden. We occasionally have to hide products even though they may still be in stock, so the stock check alone is not enough.
Right, here's the code
Open shopwishlist.asp (make a backup copy just in case)
Find Sub Formatwishlistentry (line 125 approx.)
Add the code highlighted in red (and green if you want to add a stock column)
Sub Formatwishlistentry (conn, catalogid)
dim rc, price, fieldvalue
dim my_link
CartGetProduct catalogid, rc
if rc>0 then exit sub
response.write "<tr>"
FormatProductcolumn strcname
FormatProductcolumn memcdescription
price=shopformatcurrency(curcprice, getconfig("xdecimalpoint"))
FormatProductcolumn price
FormatProductcolumn lngcstock
'
my_link="shopwishlist.asp?action=delete&id=" & catalogid
my_link=addwebsess(my_link)
fieldvalue="<a href=""" & my_link & """>" & getlang("LangCommonDelete") & "</a>"
FormatProductcolumn fieldvalue
If strcname<>"Not Available" then
my_link="shopquery.asp?catalogid=" & catalogid
my_link=addwebsess(my_link)
fieldvalue="<a href=""" & my_link & """>" & getlang("LangCommonView") & "</a>"
FormatProductcolumn fieldvalue
else
FormatProductcolumn " " ' no view
end if
If strinventoryproducts="" AND strcname<>"Not Available" AND lngcstock>0 then
my_link="shopaddtocart.asp?catalogid=" & catalogid
my_link=addwebsess(my_link)
fieldvalue="<a href=""" & my_link & """>" & getlang("LangCommonOrderNow") & "</a>"
FormatProductcolumn fieldvalue
else
FormatProductcolumn " " ' no buy
end if
response.write "</tr>"
end sub
If you want to add a stock column find sub WriteWishlistheaders (line 170 approx) and add the code highlighted in green
Sub WriteWishlistheaders
dim i
Fieldnames="cname,cdescription,cprice,cstock"
parserecord fieldnames, fields, fieldcount,","
Captions(0)=getlang("langproductname")
Captions(1)=getlang("Langproductdescription")
Captions(2)=getlang("Langproductprice")
Captions(3)=getlang("Langproductstock")
Captions(fieldcount)=" "
fieldcount=fieldcount+1
Captions(fieldcount)=" "
fieldcount=fieldcount+1
Captions(fieldcount)=" "
response.write ReportTableDef
response.write ReportHeadRow
for i = 0 to fieldcount
Response.write ReportHeadColumn & Captions(i) & ReportHeadColumnEnd
next
response.write ReportRowEnd
end sub
Here's a screen shot of our wishlist with 3 products all with a different status. I use the ccode field instead of the cname field
http://www.deanston-electrical.co.uk/WishlistScreenShot.htm
However, there is another way that the customers can order hidden products - through links to products from Google to shopexd.asp. Please have a look at this thread for a fix to that - thanks to Steve for posting this
http://www.vpasp.com/virtprog/vpaspforum/topic.asp?TOPIC_ID=13908
I hope all this helps,
Regards,
Carrol
www.deanston-electrical.co.uk