[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Main Page Layout Help
****** message to minivend-users from "Bill Randle" <billr@exgate.tek.com> ******
Ven,
Are you displaying images in each of those cells? If so, maybe
something along the lines of this (MV4+) to display the product
image and product code (sku). You can extend this to include
other fields such as [area] tags to the order page for each cell.
Note that this is completely untested by me and is presented
as a possible way to approach the solution to your problem.
The part of the code that grabs the search results is from
a past article on the mailing list by Mike H. and the sprintf()
trick is from some previous things I've done.
[comment]
setup a search return a random selection of 12 items from
a database then paste the search results into a rather
complicated table layout
[/comment]
[search-region search="your-search-criteria" random=12]
[mvasp tables="products"]
<%
# Define the HTML for the table layout, composed of big and small
# cells. This example is for layout 1. It includes placeholders
# for the product image and sku; other fields are easily added.
# If no image is being displayed, you may want to set the table
# cell size in the <td> tags instead.
my $bigcell = "<td><img src=%s width=300 height=300>Product Code: %s</td>";
my $smcell = "<td><img src=%s width=100 height=100>Product Code: %s</td>";
my $tbl = "<table><tr>" . $bigcell . "</tr>"; # 1
$tbl .= "<td><table><tr>" . $smcell . "</tr>"; # 2
$tbl .= "<tr>" . $smcell . "</tr>"; # 3
$tbl .= "<tr>" . $smcell . "</tr></table></td></tr>"; # 4
$tbl .= "<tr>" . $smcell . $smcell . $smcell . $smcell . "</tr>"; # 5-8
$tbl .= "<tr>" . $smcell . $smcell . $smcell . $smcell . "</tr>"; # 9-12
$tbl .= "</table>";
# this sample code is from "Re: [mv] Efficient [perl] Results page"
# on the minivend mailing list, Sat, 29 Jul 2000, by Mike Hinds
# The empty key is the default search passed in by URL or form
my $s = $Search->{''};
return "No search passed." if ! $s;
# mv_results is the result array
my $ary = $s->{mv_results};
return "Bad search object." if ! $ary;
return "No match." unless @$ary;
# If you used mv_return_fields / rf, the array will contain all
# of the fields
# ra=yes/rf=sku,title,price,image will look something like:
# [
# [ '00-0011', 'Mona Lisa', 50000000, 'images/monalisa.jpg' ],
# [ '00-0011a', 'Gilded Frame', 1000, 'images/gildedframe.jpg' ],
# [ 'etc.', 'etc.', 0, 'etc.' ],
#
# ]
my @srchdata;
foreach $row (@$ary) {
my ($sku, $title, $price, $img) = @$row;
push @srchdata, $img, $sku;
}
my $out = sprintf $tbl, @srchdata;
HTML($out);
%>
[/mvasp]
[search-region]
-Bill
-
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