[ic] Re: Making flypage based on fields other than sku (SOLVED)

Oleg Raskin oleg at eville.us
Wed Sep 20 14:06:01 EDT 2006

Thank you, that's exactly what I had in mind!

> I did something like this to convert old urls for products to new urls, it
> may help you out:
> ## Map a subroutine to happen if the page is not there
> SpecialSub  missing  ncheck_sku
> Sub ncheck_sku <<EOS
> sub {
>     my ($name) = @_;
>     return unless $name =~ m/^(\w)+-([A-Za-z0-9-])+$/;
>     my $bounce = $Tag->lookup_sku($name);
>     if (! $bounce) {
>     return;
>     }
>     $CGI->{iid} = $bounce;
>     $Tag->update('process');
>     return (1, 'flypage');
> }
> This runs anytime a page is not found in IC.
> My lookup_sku usertag checks if the page name passed is a valid sku for
> the old urls and if it is it returns the new sku and that is set in iid.
> The flypage uses the iid to determine which product to show, otherwise it
> shows the missing page as normal.
> You'll need to update it to do what you want but this should get you
> started.  You won't need the regex to check if it's in the sku format,
> since you'll be passing titles.  Your lookup_sku could return the sku for
> a given title.  You'll also need to pass the sku back in $Session->{arg}
> unless your flypage makes use of a cgi variable.
> You could even have your lookup_sku function convert the passed url to
> take out the underlines and replace them with spaces and then compare it
> against the title field of the product, then you wouldn't need a special
> field.
> After you do all this you'll need to come up with a tag to generate
> product links and use that throughout your site whenever you want to link
> to a product.  This tag could take the title and convert it to a safe url,
> or use the value in your custom field.
> Lastly if you don't mind having the url be one directory deep you can
> update JT's code to be directory /p/ instead of /details/.

More information about the interchange-users mailing list