Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 Cross Sell by Category
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dragon_tat
Starting Member

USA
17 Posts

Posted - January 17 2004 :  04:55:29  Show Profile  Reply with Quote
I am working on a "cross sell by category" feature on the site I am developing. After recieving a few clues as to which routines to tinker with from Radek and Howard, I wrote the simple functions. I was successful in ONLY cross selling by category on the extended description page, however, it worked a bit to well - it added every product in category as a cross sell.

My site contains a primary category labled "Gourmet Foods," which also contains 10 or so sub categories. What I am aiming for is a routine that randomly cross sells 3 to 5 products which are naturally related to the product and product category the customer is currently browsing. This would provide what I believe to be an extremely usefull feature in terms of cross selling product management. When my client adds new products to the database they would know that a cross sell is automatically generated and pertinent to the customer's current selection. They would still have the option of using the normal cross sell function built into VP-ASP. Once I am happy with my new feature, I will post the code to this forum in the event anyone else would be interested.

dragon_tat
Starting Member

USA
17 Posts

Posted - January 18 2004 :  17:32:17  Show Profile  Reply with Quote
I thought I would give everyone an update. I have added a few routines to shopfileio.asp, shopproductformat.asp and changed the template used by shopexd.asp. The result is that I am now cross selling by category, not by catalogid. I have one minor change to make (check to be sure the upsell does not include the current catalogid), add some comments to the code, and I will post it here for all. My thanks to Howard and Radek for being patient with my sometimes out of line questions. Howard, I understand your position completely!

Demo for client tomorrow, so look for the code sometime on Tuesday, Jan 20. Lots of little things to clean up in the project...

Go to Top of Page

siraj
VP-CART New User

USA
194 Posts

Posted - January 18 2004 :  23:29:17  Show Profile  Visit siraj's Homepage  Reply with Quote
Hi,
Have you incorporated the qunatity price into shopexd.asp if quantity price available. Thanks for your heads up and we are looking forward your code contribution.
GOOD LUCK.
SJ.

Edited by - siraj on January 18 2004 23:29:46
Go to Top of Page

dragon_tat
Starting Member

USA
17 Posts

Posted - January 19 2004 :  05:44:44  Show Profile  Reply with Quote
siraj,

I am not sure I understand your question. I am using shopexd.asp to create all my extended descriptions, with Price, Weight, and Quantities as my client deems fit to enter into the product table. The cross sell by category just adds a user definable number of "You may also be interested in:" url links and product names in the cross selling portion of my template. I am considering changing the loop that generates the number of links to another random generator so that the number of cross sells varies between 2 and 5. I have a pet peave about websites that upsell customers 5 or 6 items when they are only considering 1 purchase... I'm still thinking it over.

Go to Top of Page

dragon_tat
Starting Member

USA
17 Posts

Posted - January 20 2004 :  18:47:36  Show Profile  Reply with Quote
All,

Here they are, my routines for Category based cross selling. But first, my disclaimer: these routines work for me on the site I am developing. Your mileage may vary. I only wanted cross selling on the extended description page, not along with the normal product listings. It always strikes me as pushy when websites up-sell me before I have even selected a particular item as my interest. Nothing like looking at a $5 item and being up-sold something for $1,500 which is basically unrelated to my area of interest.

1. Using the Option pack I have shopexd.asp in the CDESCURL in the product database.
2. Backup shopfileio.asp. My backup is named shopfileio_sav.asp.
3. The randomize routine to shuffle the order of catalogids is optional, but it adds some variety to the cross selling.
4. In the end I discovered that it was not necessary to modify shopproductformat.asp, so I nuked the subroutine previously added.
5. On my tmp_product.htm template I changed [ADD_CROSSSELLING] to [ADDCATSELLING]
6. In shopfileio.asp add the following around line number 445 after the last Case statement. Notice Case/Select is formatted just like all the others

Case "ADD_CATSELLING"
Handle_CatSelling value, parsearray, parseRS
rc=0

7. In shopfileio.asp add the following at the bottom of the code:

'************************************************************
' Add Category Based Cross Selling
'*************************************************************
Sub Handle_CatSelling (ivalue, parsearray, parseRS)
Dim lngcstock
Dim strCrossProductIDs, strsql, rs, strmessage, strcdescurl, strurl
Dim fieldtype, rc, intLower, intUpper, strsql2
'
' New variable declarations
'
Dim arrCATSELL ' Array of catalog ID's selected from field catselling
Dim arrRANDCATSELL ' The sorted array of CatSelling catalogids
Dim intCATSELL ' The size of arrCATSELL
Dim intIndex ' Integer for index of array elements
Dim i, intTemp, intMAXRECORDS, strName, intNumCatSell, strCatProductIDs
intNumCatSell = 4 ' Number of Category cross sell products

‘ This could also be the CCATEGORY field

FindInDatabase "CATSELLING", strCrossProductIDs, fieldtype, rc, parsearray
If RC > 0 Then Exit Sub
If strCrossProductIDs = "" Then Exit Sub
strsql="select * from products where catselling = (" & strCrossProductIDs & ")"
strsql=strsql & " and hide=0"
if getconfig("xstocklow")<>"" then
lngcstock= clng(getconfig("xstocklow"))
strsql = strsql & " and cstock> " & lngcstock
end if
'
set rs = dbc.execute(strsql)
While Not rs.EOF
intCatSell = intCatSell + 1
rs.movenext
Wend
intMAXRECORDS = intCATSELL - 1
'
rs.close
Set rs = dbc.execute(strsql)
redim arrCATSELL(intCatSell)
intCATSELL = 0
For i = 0 to intMAXRECORDS
'While Not rs.EOF
strCDescUrl = rs("cdescurl")
arrCATSELL(intCATSELL) = rs("catalogid")
intCatSell = IntCatSell + 1
If IsNull(strcdescurl) then
strcdescurl = getconfig("xCrossLinkUrl")
End If
If ucase(strcDESCURL) = "SHOPEXD.ASP" Then
' strurl = "shopexd.asp?id=" & rs("catalogid")
strurl = "shopexd.asp?id=" & arrCATSELL(intCATSELL - 1)
End If
rs.MoveNext
Next
rs.close
set rs = Nothing
'
' Time to Randomize!
'
Redim arrRANDCATSELL(intCATSELL - 1)
Randomize
intLower = Lbound(arrRANDCATSELL)
intUpper = Ubound(arrRANDCATSELL)
arrRANDCATSELL = arrCATSELL
For i = intLower to intUpper
arrRANDCATSELL(i) = i
Next
For i = intLower to intUpper
'intIndex = Int(Rnd * (intUpper - intLower + 1))
intIndex = Int((intUpper - intLower + 1) * Rnd + intLower)
intTemp = arrCATSELL(i)
arrRANDCATSELL(i) = arrRANDCATSELL(intIndex)
arrRANDCATSELL(intIndex) = intTemp
Next

arrCATSELL = arrRANDCATSELL
For i = intLower to intNumCatSell
If i < intNumCatSell Then
strCatProductIDS = strCatProductIDS & arrCATSELL(i) & ", "
else
strCatProductIDS = strCatProductIDS & arrCATSELL(i)
End If
Next

‘ This step is possibly redundant…

strsql2="select * from products where catalogid in ("& strCatProductIDS &")"
strsql2=strsql2 & " and CATSELLING = ("& strCrossProductIDs &") and hide=0"
set rs=dbc.execute(strsql2)
While Not rs.EOF
strCDescURL=rs("cdescurl")
If isnull(Strcdescurl) then
strCDescURL=getconfig("xCrossLinkURL")
end if
if ucase(strcDESCURL)="SHOPEXD.ASP" then
strurl="shopexd.asp?id=" & rs("catalogid")
'else
' strurl="shopquery.asp?catalogid=" & rs("catalogid")
end if
strMessage=strMessage & "<br><a href='" & strURL & "'>" & Rs("cname") & "</a>"
RS.MoveNext
WEND
RS.Close
set RS=Nothing
strMessage="<BR>" & getlang("LangCrossSellingMessage") & strMessage
Response.write strmessage

End Sub

OK, I think that’s all there is. If I have forgotten something, shoot me an email and I’ll scratch my brain a bit to see what I forgot. Oh, and remember you can opt out of the whole deal by just changing tmp_product.htm back to [ADD_CROSSSELLING]. Good luck.

Ian
[email protected]


Go to Top of Page

dragon_tat
Starting Member

USA
17 Posts

Posted - January 20 2004 :  18:55:12  Show Profile  Reply with Quote
Oops, I forgot something. I have added a CATSELLING field to my Product table. My reason is that my site has maybe 15 Art items and I wanted to cross sell to Gifts, which is in another category. No point in cross selling the items displayed previously to the extended description.

Go to Top of Page

Admiral The X
VP-CART New User

USA
52 Posts

Posted - March 06 2009 :  00:13:39  Show Profile  Visit Admiral The X's Homepage  Reply with Quote
Well, i just put this online a couple of days ago and came back with feedback - but then i noticed how Old the post is, lol. Either way. There are some things your going to need to know about this!

BUG---

The var intNumCatSell can become greater than the number of items in a category. This will cause a database error on your page and only on a page in a category with the low product number.

to resolve find
For i = intLower to intNumCatSell
insert
if intNumCatSell > intMAXRECORDS then
intNumCatSell = intMAXRECORDS
end if


you may also want to know - If you DO NOT use the xstocklow feature, you will need to define a value in some other manner. i chose to set it manually to 1 so that any products with less than 1 unit in stock will not show in the random product results

'if getconfig("xstocklow")<>"" then
lngcstock= 1 'clng(getconfig("xstocklow"))
'end if

Great thing about this code is its very flexable. i currently have the category selection pined to my Recently Added category, but you can associate it with any given category through any method. I plan to build a table of associated categorys that the category you are in will map to to provide the ultimate in random up selling.

last i should mention - out of the box, this is built as a text feature, but with very little effort you can make this a random picture display. This actually for me means i will have to build new thumbs because i feel mine are to big for this application. but with a little asp and table work, its very easy to achieve.

first kill the text stuff
'strMessage=strMessage & "<br><font size=""1""><a href='" & strURL & "'>" & Rs("cname") & "</a></font><hr>"
then add this- i tried to removed everything that was specific to my site, let me know if anything is amis. its basically a routine to just creae a 2x4 table as long as rows are returned and put in those tables pictures and product text. I really doubt what i have done here is the best some of you guys could come up with, but, just a decent idea to lay on top of an already really cool idea.

dim strDescription
strDescription = rs("cdescription")
strurl="shopexd.asp?id=" & rs("catalogid")
strMessage=strMessage & "<br><table width=""100%"" border=""0""><tr><td align=""center"" valign=""middle""><a href='" & strURL & "' name=""" & strDescription & """><img src=""" & rs("cimageurl") & """ alt=""" & strDescription & """ /></a></td>"
description1=rs("cname")
RS.MoveNext


if rs.eof <> true then
strDescription = rs("cdescription")
strurl="shopexd.asp?id=" & rs("catalogid") & "&name=" & strDescription
strMessage=strMessage & "<td align=""center"" valign=""middle""><a href='" & strURL & "' name=""" & strDescription & """><img src=""" & rs("cimageurl") & """ alt=""" & strDescription & """ /></td></td>"
strMessage=strMessage & "</tr><tr><td align=""center"">" & description1 & "</td><td align=""center"">" & rs("cname") & "</td></tr></table>"
RS.movenext
else
strMessage=strMessage & "<td align=""center"" valign=""middle""></td>"
strMessage=strMessage & "</tr><tr><td align=""center"">" & description1 & "</td><td align=""center""></td></tr></table>"
end if

Anyway, like i was sayin... sorry for bring this one back from the dead but.. its an oldie but a goodie.

Air Armory - Airsoft
http://www.AirArmory.com - shop
http://sitrep.airarmory.com - news
Go to Top of Page

devshb
Senior Member

United Kingdom
1904 Posts

Posted - March 06 2009 :  08:02:14  Show Profile  Visit devshb's Homepage  Reply with Quote
We've got some addons related to the cross-selling of categories; it's different to the above in that it displays a list of related categories rather than a list of products within related categories, but it's still very useful/relevant to what you're trying to achieve.

There are 3 main modules relevant to this:

1. BYZ121 - Related Categories Display for VPASP:
http://www.bigyellowkey.com/mysoftware_product_details.asp?prdid=322&opu=n
What this does is let you stamp cross-sold categories onto each category (ie like you'd stamp cross-sold products onto products), and then when you view a given category it'll also show you the list/links for the related categories.

2. BYZ116 - Enhanced Paging/Searching for VPASP:
http://www.bigyellowkey.com/mysoftware_product_details.asp?prdid=317&opu=n
This also has related categories, but it's different logic to if you just installed BYZ121 on its own. What it'll do when BYZ116 is used in conjunction with BYZ121 is to display a list of "hit" categories when you do a search.
eg if you look for "tv" then as well as seeing the products which match "tv", it'll also show a list of categories which have "tv" in them, showing the relevant links.
NOTE: BYZ121 is included within BYZ116, so if you bought BYZ116 then you don't need to buy BYZ121, but remember that the related categories aspect works differently if used for BYZ116.

3. BYZ146 - VPASP SEO Bundle:
http://www.bigyellowkey.com/mysoftware_product_details.asp?prdid=343&opu=n
This includes BYZ116/121 plus absolutely tons of other stuff, such as keyword tools, product feeds etc.

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

Edited by - devshb on March 06 2009 08:04:11
Go to Top of Page

Admiral The X
VP-CART New User

USA
52 Posts

Posted - March 07 2009 :  01:46:57  Show Profile  Visit Admiral The X's Homepage  Reply with Quote
so - i figure i like the sounds of the first product, and i purchased VPASP because i didnt want to reinvent the wheel in the first place... this leaves me with one question. Is there a demo page for this product? it seems like its conceptially on the same page as me.

i'm just about sold. maybe i just need to jump. =)

Air Armory - Airsoft
http://www.AirArmory.com - shop
http://sitrep.airarmory.com - news
Go to Top of Page

devshb
Senior Member

United Kingdom
1904 Posts

Posted - March 07 2009 :  06:56:19  Show Profile  Visit devshb's Homepage  Reply with Quote
There are demo links within the extended descriptions on the urls mentioned above, but I admit they're a bit hard to spot because they're in a lightgray font and the same face/size as the rest of the text.
I was going to post the demo links here for easy reference but then thought perhaps not because they often change, whereas our product pages/urls stay the same. Take a look at the urls above again, and look for the "Click here for demo" links and they'll show you how it looks/works.

If you're starting with a fresh version of vpasp, then it's best to install the addons before you start creating all your real data or changing your headers, ie get it running with the addons in place using the standard vpasp demo data first, then start entering real data and tweaking the headers etc, rather than start entering data and then installing the addons; it's just easier/safer that way (and take backups of any files before you change them too).

If I were starting with a fresh version of vpasp, I think I'd use the seo bundle (byz146) because in time I think I'd want to have all those modules which are in it in place. They can get layered with all different kinds of permutations depending on what you're after.

If, however, all you want is to cross-sell categories as per option 1 above, then you obviously wouldn't need the seo bundle and can simply use BYZ121 on its own, but it's definitely worth considering the overall picture/bundle too.

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
Web Design, Online Marketing and VPASP addons
Go to Top of Page

Admiral The X
VP-CART New User

USA
52 Posts

Posted - March 08 2009 :  00:41:57  Show Profile  Visit Admiral The X's Homepage  Reply with Quote
I took a look at the demo. It shows the prodct categories that are related - what i'm hoping for is a lisitng of images and products that are related by tangent.

basically the style in this listing now with one key difference.
http://www.airarmory.com/shopping/shopexd.asp?id=63&name=G&G%20GR%2016%20Carbine%20Full%20Metal

in the listing above the extra products are associated with the reciently added category- not targited at all. I want to make the recomended products for the GR 16 carbine be compatible magazines, foregrips, things related to the category the gun is in like the category selection above but not requiring the user do anything more than happen to notice there are cool choices for things they may want below the product they do want. Gotta keep em clicking.

OF course SEO is a constant arms race for anyone looking to seriously sell stuff on the internet so we gotta look into that stuff.

Air Armory - Airsoft
http://www.AirArmory.com - shop
http://sitrep.airarmory.com - news

Edited by - Admiral The X on March 08 2009 00:49:59
Go to Top of Page

devshb
Senior Member

United Kingdom
1904 Posts

Posted - March 08 2009 :  05:30:49  Show Profile  Visit devshb's Homepage  Reply with Quote
Something to bear in mind is that people won't necessarily have gone via the category route to get to the product detail page (they might have just done a search in the search mini-form, or got the url direct from a search engine), so the breadcrumbs aspects won't necessarily be populated and so it won't necessarily have the category variable/session set internally.

It sounds like what you're after is similar to the code posting that was made on this topic, ie that you stamp cross-sold categories onto each product as a field in its own right, and then query products from those cross-sold categories when viewing the product, but that you want it to be a bit more flexible.

What might be useful is another addon we do, which is:
BYZ093 - Product ShowCase (Enhanced Front-Page) Functions for VP-ASP:
http://www.bigyellowkey.com/mysoftware_product_details.asp?prdid=222&opu=n

Because that can display products in any format you want using any query you want, and it takes account of the stock options etc too, but also has loads of other options/overrides.
What I'd do would be to use byz093 to get/show products for a given cross-sold category list, define that call as a function in its own right and add it to shopfileio.asp or shop$db.asp, and then create a new template field (eg via byz033; an extra-template-fields addon) which calls that function with the catselling column that you're using.

ie:
1) Install byz093
2) Create a function which calls byz093 with the relevant arguments for what you want to show
3) Create a template field which calls the function you created from point 2
4) Place that template-field call into your template (eg [CROSS_SELL_CATEGORIES pother2])

The alternative would be to simply use standard cross-selling, but that'd rely on you manually cross-referencing all the different products.

A third alternative would be to muck around in sql to generate the relevant cross-sold catalogids automatically in the data, but I think option 1 (byz093+byz033) would be a lot less hassle than that.

Having said all that, if you're cross-selling those products at category level only (ie you don't want/need to stamp the cross-sold categories at product level, you want to only stamp cross-sold categories at category level) then that'd be possible too via something like byz093+byz033+tweaking. byz121 has some functions within it which would help too I think.

Sometimes cross selling at category level gets quite complex because a product can be in multiple category branches and multiple levels within each branch, but there are some functions within byz121 which can help pull the relevant info back on that front.

I guess it depends on exactly how you want to define/find the data as to how it's best done, but I think the main point is that it is possible to do it with a bit of tweaking and optionally some addons to help.

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

Edited by - devshb on March 08 2009 05:55:36
Go to Top of Page

Admiral The X
VP-CART New User

USA
52 Posts

Posted - March 08 2009 :  12:05:07  Show Profile  Visit Admiral The X's Homepage  Reply with Quote
Don'T worry, were were not evaluating bread crumbs! lol even our menu system which remembers which category you last click on uses cookies not the bread crumbs which are rather unreliable.

and yes, we were expecting it to be tedious even with a tool. for every product built we would have to specify, gun GR16 cross sell with category magazines m4/m16, rails in category carbine length, mag pouches for said mags, etc. Its the only way to get the desired effect.

A cross sell that loads random products that are still targeted to some degree. Marketing wise, i really dislike the "customers who purchased this also bought" because people buy random crap. Being able to gently steer a customers focus is HUGE. Especially if they don't feel they are being lead around by the wallet =)

it will probably be easier at this point to just finish modifying this code to get to that next step. I'd like to have Category to Category associations and then product to category addons, but we'll have to see if i take it to that level.

the code that builds the display is very open to this, but there is very little currently flexibility in the way this app gets the products to populate its arrays.

strCatProductIDS
before output is simply a coma delimited list of products to display - getting there is the tough part.
strsql2="select * from products where catalogid in ("& strCatProductIDS &")" ...

if you guys built a good interface for this you would probably have a cool product on your hands.

Air Armory - Airsoft
http://www.AirArmory.com - shop
http://sitrep.airarmory.com - news
Go to Top of Page

devshb
Senior Member

United Kingdom
1904 Posts

Posted - March 08 2009 :  16:06:20  Show Profile  Visit devshb's Homepage  Reply with Quote
ok; yes, byz093 essentially is the interface that you mention; it'll let you pass across your core query (ie the main where clause you want to use) and the name of the product-template, plus various other arguments, and then does all the processing and things like the stock/language conditions for you. It also caters for the sqlserver bug whereby you need to reference text (ie memo) fields before anything else (like other template-driven vpasp stuff does), because if you don't cater for that then your cursors can start showing blank values half way through the output.
And part of the byz093 arguments are how many products you want to display as a maximum, and whether you want to randomize the results, how many columns (products) you want to show in each row etc; very flexible.

One of these days we'll be uploading the readme files of our addons onto our bigyellowkey.com site so that people can see the installation steps and usage notes etc, but as a brief example here's one note regarding one of byz093's main functions' argument list:

<%
BYZShowCaseProducts _
"usehideflag", _
"usestockflag", _
"mandatorycolumnname", _
"mandatorycolumnbitflag", _
"matchingcolumnname", _
"matchingcolumntype", _
"matchingcondition", _
"matchingvalue", _
"extrasqlwhereclausetext", _
"templatefilename", _
"orderingcolumns", _
"randomizeresultsflag", _
"maximum_columns", _
"maximum_records", _
"header_html", _
"trailer_html", _
"odd_row_start_html", _
"odd_row_end_html", _
"even_row_start_html", _
"even_row_end_html", _
"odd_column_start_html", _
"odd_column_end_html", _
"even_column_start_html", _
"even_column_end_html", _
"context_sensitive_levels_to_try", _
"context_sensitive_show_if_no_matches_flag"
%>

there's also a corresponding top-sellers function which has extra arguments like:
"usingsalestype", _
This is the type of logic that you want to use to define what you regard as a top-seller. The values you can use are:
"SUMOFNUMITEMS" for: Total Qty Sold
"COUNTOFORDERS" for: Number of Orders Placed with this product in it
"COUNTOFORDERITEMS" for: Number of Order Items with this product in it
"COUNTOFCUSTOMERS" for: Number of distinct customers who bought it
"SUMOFSALESAMOUNTS" for: Total monetary volume of sales

Optional; leave this as "" if you want to use the default ("SUMOFNUMITEMS")

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

Edited by - devshb on March 08 2009 16:37:18
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00