Possible BUG in OPTIONS tag WAS:"[ic] [item-options] + javascript"

Tobias Henle interchange-users@interchange.redhat.com
Wed Oct 17 05:27:01 2001


Hi List,

i don't know why nobody _answered_ my request ;( so i decided to fix it.
i do not really know wether it is a bug or not and my solution for this 
problem is not the best (my perl is as good as my english!) so i think 
if someone of you has any idea of fixing this problem without my "dirty" 
workaround i will be very  glad!!!!

my code is placed in the sub "tag_accessories" in the file 
"/usr/local/interchange/lib/Vend/Interpolate.pm".

it looks for the possible options saved in $data and trys to find the 
entry for each option in the options table. wether it find the entry or 
not it adds the  option to the option array @opts.

so if you want to change it try it out!

goto line 2263 and delete:
         my @opts = split /\s*$delimiter\s*/, $data;
insert:
## # START byT.
# removes options which are not in the database
# but in the o_value field
::logGlobal("filter opts for '".$code,"'");
         my @my_bufopt = split /\s*$delimiter\s*/, $data; ## # NOT byT.
         my ($my_option, $my_dbq, $my_arr, $my_sku, $my_ref);
         my @my_line;
         my @opts;

         ## # funny stuff
         $opt = get_option_hash($opt);
         my $table = $opt->{table} || $::Variable->{MV_OPTION_TABLE} || 
'options';
         my $db = $Db{$table} || Vend::Data::database_exists_ref($table);

         $my_dbq = "SELECT code FROM options WHERE sku = '".$code."' AND 
o_group = '' ORDER BY sku";
         $my_arr = $db->query($my_dbq);

         foreach $my_option (@my_bufopt) {
                 @my_line = split /=/, $my_option;
                 # FIXME: not very fast!
                 foreach $my_ref (@$my_arr) {
                         if ($code."-".@my_line[0] eq $my_ref->[0]) {
                                 push @opts, $my_option;
                         }
                 }
         }
## # END byT.




_cu_ (mit freundliche Grüßen)

-Tobias Henle
                          _   _    _
  __ __ ____ __ ____ __ _| |_| |_ (_)___ ___ ___ _ _    __ ___ _ __
  \ V  V /\ V  V /\ V  V /  _| ' \| / -_|_-</ -_) ' \ _/ _/ _ \ '  \
   \_/\_/  \_/\_/  \_/\_(_)__|_||_|_\___/__/\___|_||_(_)__\___/_|_|_|
--
________E-Mail________________________URL____________________________
	mailto:t.henle@thiesen.com    http://www.thiesen.com
_____________________________________________________________________