# file: product.html # Copyright (c) 1996-2008 Cuesta Technologies, LLC # All rights reserved. # This document contains confidential and/or proprietary information # beloging to Cuesta Technologies, LLC. # Package: sss # # Purpose: # # Requires: # # 8-25-98 mes: NOTE: This page uses Feng's new GrokRec system to get the # product record data. It puts it in an array called 'prod()' set pageID PG_7 cw source mysql.tcl cw source searchlimit.tcl if {[info exists cw_args(record)]} { set record $cw_args(record) } else { cw redirect search.html$nocache+prod@no force } # Figure out the previous and next pages if [info exists sdb(search_result_list)] { set l $sdb(search_result_list) set i [lsearch $l $record] if {$i > 0} { set prev [lindex $l [expr $i-1]] if {[regexp Match_found_in $prev]} { if {$i > 1} { set prev [lindex $l [expr $i-2]] } else { unset prev } } } if {$i >= 0 && $i < [expr [llength $l] - 1]} { set next [lindex $l [expr $i+1]] if {[regexp Match_found_in $next]} { set next [lindex $l [expr $i+2]] } } } # Define the Previous Button if [info exists prev] { set Button_Prev "Previous" } else { set Button_Prev "\"No" } # Define the Next Button if [info exists next] { set Button_Next "Next" } else { set Button_Next "\"No" } # fetch the product record from the product database MysqlConnectProdDB set data [MysqlGrokRec $mysqlProdtbl Record_ID $record] if {$data == 0} { cw log 0 "record=$record; data=$data" MysqlDisconnect cw redirect search.html$nocache+prod@no force } DataStringToArray $data prod $cw_product_tablepath cw stats PRODUCT $record $prod(Title) if {[string length $prod(Series_Record_ID)]} { set query "select Title from $mysqlProdtbl where Record_ID='$prod(Series_Record_ID)';" set tmp [sql $query] set seriesTitle [lindex [lindex $tmp 0] 0] if {![string length $seriesTitle]} { set seriesTitle "This series record is missing." } } ############### products in this Series ################### set chiquery "SELECT Record_ID, Title FROM $mysqlProdtbl WHERE Series_Record_ID='$prod(Record_ID)' ORDER BY Title_Alpha" set chiresult [sql $chiquery] set itemrecs {} set itemtitles {} foreach item $chiresult { lappend itemrecs [lindex $item 0] lappend itemtitles [lindex $item 1] } set limit [llength $itemrecs] ################################ Related Titles ############################## set results {} set qaddition "AND (Record_Type='Product' OR Record_Type='Series')" if {[string length $prod(General_Catalog_Page)]} { set query "SELECT Record_ID FROM $mysqlProdtbl WHERE General_Catalog_Page='$prod(General_Catalog_Page)' $qaddition ORDER BY Title_Alpha" set results [sql $query] if {[llength $results]} { set catalog "General Catalog" } elseif {[string length $prod(Guidance_Catalog_Page)]} { set query "SELECT Record_ID FROM $mysqlProdtbl WHERE Guidance_Catalog_Page='$prod(Guidance_Catalog_Page)' $qaddition ORDER BY Title_Alpha" set results [sql $query] if {[llength $results]} { set catalog "Guidance Catalog" } elseif {[string length $prod(Writing_Catalog_Page)]} { set query "SELECT Record_ID FROM $mysqlProdtbl WHERE Writing_Catalog_Page='$prod(Writing_Catalog_Page)' $qaddition ORDER BY Title_Alpha" set results [sql $query] if { [llength $results]} { set catalog "Writing Catalog" } elseif {[string length $prod(Health_Catalog_Page)]} { set query "SELECT Record_ID FROM $mysqlProdtbl WHERE Health_Catalog_Page='$prod(Health_Catalog_Page)' $qaddition ORDER BY Title_Alpha" set results [sql $query] set results [getindexlist Health_Catalog_Page $prod(Health_Catalog_Page)] if {[llength $results]} { set catalog "Health Catalog" } elseif {[string length $prod(Primary_Catalog_Page)]} { set query "SELECT Record_ID FROM $mysqlProdtbl WHERE Primary_Catalog_Page='$prod(Primary_Catalog_Page)' $qaddition ORDER BY Title_Alpha" set results [sql $query] if {[llength $results]} { set catalog "Primary_Catalog" } elseif {[string length $prod(Internet_Catalog_Page)]} { set query "SELECT Record_ID FROM $mysqlProdtbl WHERE Internet_Catalog_Page='$prod(Internet_Catalog_Page)' $qaddition ORDER BY Title_Alpha" set results [sql $query] if { [llength $results]} { set catalog "Internet Catalog" } } } } } } } MysqlDisconnect if {[string length $prod(Picture_File)] > 2} { set TableWidth 100% } else { set TableWidth 75% } cw source $cw_templatePath/templateTop.tcl ### load facebook sdk puts "
" #### end facebook sdk if {[llength $sdb(search_result_list)] == 1 && [string match $record $sdb(search_result_list)]} { puts " 
$sdb(listcriteria)   1 item matches your request.

" } if {[info exists cw_args(bad_quant)] && [string match "yup" $cw_args(bad_quant)]} { ### user entered an invalid quantity puts "

Oops! Please enter a valid quantity.

" }
$Button_Prev ####################### -- Title -- ########################### puts "

$prod(Title)

"

$Button_Next

### 1.20.0 6 mes: added align=left cuz it was centering on IE! puts "
" if { [string length $prod(Description)] } { regsub -all {(/)*pdf/} $prod(Description) {/pdf/} prod(Description) #cw log 2 "prod(Description)=$prod(Description)" set pic [glob -nocomplain $cw_pkgdocroot/$itemimages/medium/$prod(Picture_File).JPG] puts "
" if {[string length $prod(Picture_File)] && ([llength $pic] > 0)} { puts "\"$prod(Title)\"" } else { puts "\"Image" } set desStr "
$prod(Description)
" } else { set desStr "" } cw log 2 "bubbletext: $prod(Bubble_Text)" puts "
$prod(Bubble_Text)
" $desStr
############################### Related Resources ############################# set reSource "" if { [string length $prod(Sample_Lesson)] } { append reSource "$prod(Sample_Lesson)
" } if { [string length $prod(Video_Preview)] } { append reSource "$prod(Video_Preview)
" } if { [string length $prod(Online_Activity)] } { append reSource "$prod(Online_Activity)
" } if { [string length $prod(Related_Web_Site)] } { append reSource "$prod(Related_Web_Site)
" } if { [string length $reSource] } { puts " $reSource " } puts "

" ## If it's a Product record, display the Ordering Instructions ## and it's a Form... if { [string match Series $prod(Record_Type)]} { # List the titles in this series... set printoutputstring 0 set outputstring "
" append outputstring "Titles in this series:
    " set i 0 while {$i < $limit} { set rid [lindex $itemrecs $i] set rtitle [lindex $itemtitles $i] if {$rid!={} && $rtitle!={}} { set printoutputstring 1 append outputstring "
  • $rtitle" } incr i } append outputstring "
" if {$printoutputstring} { puts "$outputstring" } else { puts "

There are no titles in this series.

" } } elseif { [info exists prod(Series_Record_ID)] && [string length $prod(Series_Record_ID)]} { puts "
This Title is part of the Series: $seriesTitle

" } if {[regexp {^(Product|Series)$} $prod(Record_Type)] && [llength $prod(Catalog_Number_Web)]} { puts "

" if {$prod(Qty) > 0} { puts "" set cellTag 5 } else { set cellTag 4 } puts "" set blankcount 0 set i 0 foreach ordercode $prod(Catalog_Number_Web) { set itemText [lindex $prod(Media_Text) $i] set price1 [lindex $prod(Price_A) $i] set price2 [lindex $prod(Price_B) $i] if {![string length $ordercode] || [regexp {[^a-zA-Z0-9\_\-]} $ordercode] } { #set ordercode "Bad Data" set nodata 1 incr blankcount 1 } if {$itemText == {}} { #set itemText "Bad Data" incr blankcount 1 set commentLine 0 } else { set commentLine 1 } if {$price1 == {} && ([string compare Bundle $prod(Bundle)] || $i == 0 )} { #set price1 "Bad Data" incr blankcount 1 } if {$price2 == {}} { set price2 0 } #if {$blankcount > 0 } { #puts "" #continue #} puts "" if {$cellTag == 5} { if { $price2 > 0 } { puts "" } else { puts "" } } incr i } puts "" } ### move this part up. if [info exists cellTag] { puts "
Quantity Order Code Media/Contents Price$prod(Qty) or more Price
Bad information for this configuration.
" if {[string compare Bundle $prod(Bundle)] || $i == 0 } { if {$blankcount == 0} { puts "" } } puts " " if {[string compare Bundle $prod(Bundle)] || $i == 0 } { puts "$ordercode" } puts " $itemText " if {[string compare Bundle $prod(Bundle)] || $i == 0 } { puts "[dollarstring $price1]" } puts "[dollarstring $price2]N/A
" } else { puts "
" } puts "$Button_Prev" if {[regexp -nocase {product|series} $prod(Record_Type)] && [info exists prod(Media)] && [string length $prod(Media_Text)] && $prod(Media) != {} && $blankcount == 0 } { puts " " } puts "$Button_Next
" if { [llength $results] > 1 && [info exists catalog] } { set sdb(catalog) $catalog set sdb(related_result_list) $results ### tell list.html come from which link #set sdb(fromcontent) 2 puts "

Visit Related Titles in our catalog.

" include_file related_files_note.txt } cw source $cw_templatePath/templateBottom.tcl