[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Get value(s) out of mv_searchspec
On Thu, Apr 11, 2002 at 07:15:00PM +0200, Frank wrote:
>
> Hello List,
>
> I am migrating a minivend 3.14 store to ic 4.8 and have
> a problem with embedded perl-code and mv_searchspec on
> my resultpages.
>
> I have a one-click search with se=xxx/sf=xxx etc.
> On the resultpage I want to print out a text depending to
> the value of mv_searchspec.
>
> On minivend 3.14 I did the following (and it works):
>
> Searchstring: <A HREF="/cgi-bin/shop/scan/se=dmd016/sf=aaa/se=jpg/sf=thumb/ml=10/sp=res_dmd.html">
scan pages like that have changed too, I believe.
>
> Perl-Code on resultpage:
>
> [perl interpolate=1]$rub = '[value mv_searchspec]';
> if ($rub =~ /^dmd010/) {$txt = 'textstring 1'}
> if ($rub =~ /^dmd011/) {$txt = 'textstring 2'}
> if ($rub =~ /^dmd015/) {$txt = 'textstring 3'}
> if ($rub =~ /^dmd016/) {$txt = 'textstring 4'}
> $out = "$txt";
> $out; [/perl]
>
> On ic 4.8 the [value mv_searchspec] is an array like 'ARRAY(0x8306eb0)'
> and not a string like "dmd016jpg" as it is on mv 3.14.
>
> After looking through the mailing-list archives, I found (and tried) the following:
>
> [set name="dummy" interpolate=1][value mv_searchspec[/set]
> [perl arg="scratch"]
> my($msg1) = $Safe{'scratch'}->{'dummy'};
> my(@items)=split (/\0/, $msg1);
> $Safe{'values'}{'se_1'} = $items[0];
> $Safe{'values'}{'se_2'} = $items[1];
>
> $rub = $Values->{'se_1'};
> if ($rub =~ /^dmd010/) {$txt = 'textstring 1'}
> if ($rub =~ /^dmd011/) {$txt = 'textstring 2'}
> if ($rub =~ /^dmd015/) {$txt = 'textstring 3'}
> if ($rub =~ /^dmd016/) {$txt = 'textstring 4'}
> $out = "$txt";
> $out;
> [/perl]
>
> ---> No textstring, next try with:
>
> $rub = $items[0];
>
> ---> No textstring, next try with:
>
> [perl interpolate=1]$rub = '[value my_searchspec]';
>
> --->Again, there is NO textstring printed.
>
> So how can I get (or set a perl variable with) the values
> (or one of the values) of the mv_searchspec array??
>
>
> Anyone any idea????
>
As an interim measure, we found the place in the code
where ic builds the @mv_searchspec and added the lines from
3.14 to create a $my_searchspec just like 3.14 mv_searchspec.
Then just s/mv_searchspec/my_searchspec/ in all the pages.
That might buy you more time but it won't help with se=.
Instead of null delimited string like this
@specs=split /\000/,$mv_searchspec;
You need to do
@specs=@{$mv_searchspec} where you see ARRAY
I don't know if @{[values mv_searchspec]} will work or not. Shudder.
>
> ThanX in advance
>
> -;-))==
>
> Frank
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users
--
Christopher F. Miller, Publisher cfm@maine.com
MaineStreet Communications, Inc 208 Portland Road, Gray, ME 04039
1.207.657.5078 http://www.maine.com/
Content/site management, online commerce, internet integration, Debian linux