[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] IC4.6 -- Others who bought -- Attempt to setmerchandising::times_ordered::whatever in read-only table
Hi list,
I'm trying to get the "Others who bought this, also bought ..."
functionality to work. I'm using IC4.6, referencing the construct
demo. Using the admin UI, Merchandising > Generate "others who..."
(From the admin/build_related.html page):
[perl tables="__UI_META_TABLE__ orderline merchandising"]
my $db = $Db{orderline};
return "NO ORDERLINE table???!" if ! $db;
my $start = tag_data( qw/__UI_META_TABLE__ lookup_exclude
orderline/ );
my $query = "select code,order_number,sku from orderline ";
$query .= " where order_number > '$start'" if $start;
$query .= " order by code";
my $ary = $db->query( { sql => $query } );
for(@$ary) {
my ($line, $on, $sku) = @$_;
push @{$on{$on} ||= []}, $sku;
}
for(keys %on) {
my $ref = $on{$_};
@ary = @$ref;
for(@ary) {
my $sku = $_;
$sku{$sku} = {} unless $sku{$sku};
for (@ary) {
next if $_ eq $sku;
$sku{$sku}->{$_}++;
}
}
}
my $mdb = $Db{merchandising};
for(sort keys %sku) {
my $val = $Tag->uneval( { ref => $sku{$_} } );
$out .= "$_ ==> $val<br>\n";
$mdb->set_field($_, 'others_bought', $val );
}
return $out;
[/perl]
It displays to the browser the correct stuff, but the error.log
reports:
...
209.140.146.41 SACj44vI:209.140.146.41 - [23/January/2001:00:10:51 -0500]
iccvsrw /cgi-bin/iccvsrw/admin/build_related.html Attempt to set
merchandising::others_bought::os29000 in read-only table
209.140.146.41 SACj44vI:209.140.146.41 - [23/January/2001:00:10:51 -0500]
iccvsrw /cgi-bin/iccvsrw/admin/build_related.html Attempt to set
merchandising::times_ordered::os29000 in read-only table
...
I've tested this with my construct demo, my MV3->IC4.6 conversion
project, and the online demo (developer.akopia.com).
I've tried adding "Database merchandising WRITE_ALWAYS 1" to the
db conf, and adding [tag flag write]merchandising[/tag] before the [perl]
call in the Admin page. (It is missing) I tried running the code inside a
test page from my catalog page space (in case it was an admin pages
permission deal) -- no luck.
From Mike Heins
http://developer.akopia.com/archive/interchange-users/2000/msg07035.html,
>You need to do a [flag type=write table=whatever] before you do the [perl
>tables="whatever"]. Once the table is opened read-only, there is no going
>back. If you look for WRITE_CONTROL you can set it to always, but that is
>a bit dangerous.
I figured "no going back" meant that I could remove
merchandising.gdbm and restart -- that doesn't fix it either.
Any ideas? I'm sure that the Akopia boys would like to know that
their demo doesn't work. :-)
Thanks in advance,
-Ryan
Ryan Hertz tel 800-645-BAIT
Webmaster fax 520-645-2588
Advertising Director http://yamamoto.baits.com
Gary Yamamoto Custom Baits, Inc. http://www.insideline.net
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users