[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Suggest an item in basket code, example related products
****** message to minivend-users from Ryan Hertz <rhertz@gyb.baits.com> ******
I thought I'd share this with the list, since I'm very proud of my
accomplishment. (gloat)
The following code is a modification of the idea presented in the simple
demo. It resides in the basket.html page and will loop through the
'related' field of the selected products. I use it to make suggestions ala
Amazon.com as to other products that compliment what is currently contained
in the cart.
The difference with my code is that it only displays a suggested product
once (unlike the demo) and it places the suggestions in a scratch var that
can be printed elsewhere. I found that in the simple demo code the
suggested items would clutter the basket display. Anyways, here we go:
basket.html
At top of page. (not sure if this is needed):
[set proactive][/set][set proactiveuniq][/set]
Inside your [item-list]:
[if-field related]
[loop arg="[item-field related]"]
[if !ordered [loop-code]]
[perl arg=scratch interpolate=1]
$Safe{'scratch'}{'proactive'} .= '[page [loop-code]][loop-field
description][/page] for your [item-description]<BR>' unless
$Safe{'scratch'}{'proactiveuniq'} =~ '[loop-code]';
$Safe{'scratch'}{'proactiveuniq'} .= '[loop-code]|';
return '';
[/perl]
[/if]
[/loop]
[/if-field]
And beneath my basket table:
[if scratch proactive]<BR><B>You may also be interested in having:</B><BR>
[scratch proactive]<P><BR>[/if]
Happy minivending!
Ryan Hertz tel 520-645-3812
Webmaster tel 800-645-BAIT
Advertising Director fax 520-645-2588
Gary Yamamoto Custom Baits, Inc. http://www.yamamoto.baits.com
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list