[perl] $testing++ if ($Generic::ENVIRONMENT::SERVER eq 'dev'); urlparams qw(CATEGORY_ID PRODUCT_ID link); #US $is_free_shipping_item = include('/templates/products/freeshipping_hash.tmpl'); $MAX_WWW_SIZE = 2; # fetch category object $product_catalog_error_page = '/home.tmpl'; $request->redirect( $product_catalog_error_page ) && return unless ($CATEGORY_ID || $PRODUCT_ID); # obtain the category and product if ($CATEGORY_ID) { $category = $request->get( 'Category', CATEGORY_ID => $CATEGORY_ID ); # the passed category id is not (or no longer valid). $request->redirect( $product_catalog_error_page ) && return unless (ref($category)); $product = $request->get( 'Product', PRODUCT_KEY => join( $;, $CATEGORY_ID, $PRODUCT_ID ) ); # the passed PRODUCT_KEY derived from the CATEGORY_ID and PRODUCT_ID is invalid $request->redirect( $product_catalog_error_page ) && return unless (ref($product)); } else { # obtain the product, then get its category $product = $request->get( 'Product', PRODUCT_ID => $PRODUCT_ID ); # the passed PRODUCT_ID is invalid $request->redirect( $product_catalog_error_page ) && return unless (ref($product)); # get the parent category $category = $product->category; # this should not happen and indicates bad internal product data $request->redirect( $product_catalog_error_page ) && return unless (ref($category)); $CATEGORY_ID = $category->CATEGORY_ID; } # category processing @catstack = $category->catstack; $supercat = shift @catstack; $supercat_basename = $supercat->basename; $leftnav_basename = $supercat_basename; $testing && print STDERR "supercat basename: $supercat_basename\n"; $leftnav_category_id = $CATEGORY_ID; # certain categories require we advance a level to obtain the ID to pass to the leftnav server module if ($supercat_basename =~ /(whatsnew|whatshot)/ && (scalar(@catstack) > 3)) { map { $testing && print STDERR "stack: " . $_->basename . "\n" } @catstack; $leftnav_category_id = $catstack[-2]->CATEGORY_ID if (ref $catstack[-2]); } $background_class = "bg_${supercat_basename}"; # BG color changes for specific categories # title and metatag data $meta_resource = $request->get( 'Resource', CONFIG_LIST => [qw(metatags)] ); #$title = $product->SUBLINE." - ".$$meta_resource{product_title_fixed}; $title = '雅诗兰黛 '. $product->SUBLINE. ' 最新价格和使用方法雅诗兰黛(Estee Lauder)中文官方购物网站'; include( '/templates/includes/subs/product_subs.tmpl' ); pagesubs qw( setup_product_vars ); $meta_product_vars = {}; setup_product_vars( {product => $product, product_vars => $meta_product_vars} ); #$meta_keyword = $product->SUBLINE . ',' . $category->DISPLAY_NAME . ',' . $product->KEYWORDS; $meta_keyword = $product->SUBLINE . ',' . $category->DISPLAY_NAME; ''; [/perl]