include_once("../../startweb.pinc"); include(mapPath("/_/incs/widgets/reporttable.pinc")); include(mapPath("/tpp/tpp.pinc")); fr("c", "subsite"); if ($subsite) { handleSubsiteLogin($TPP_SUBSITES); } $vars = array( fr("i", "ProductTypeId", null), fr("c", "productSearch"), fr("c", "productCategory"), fr("c", "subcat"), fr("i", "pg", 1), fr("i", "sz", 50), fr("l", "APA_imageUpload"), fr("c", "subsite"), "allProductTypeIds", ); $allProductTypeIds = $ProductTypeId ? array($ProductTypeId) : array(); if ($productCategory) { $productType = sqlr("select ProductTypeId from ProductTypes where WebDir = ".toSqlString($productCategory)); if (!$productType->eof()) { $ProductTypeId = $productType->gcv("ProductTypeId"); } for ($f=0; $f<$productType->fieldCount; $f++) { for ($r=0; $r < $productType->count; $r++) { if (!$productType->gcv(0, $f)) { $productType->scv(0, $productType->gcv($r, $f)); } } } $allProductTypeIds = $productType->getDataAsList(array("ProductTypeId")); } $scripts["/accounts/viewartwork.js"] = 1; $scripts["/_/js/events.js"] = 1; /*$pricelists = sqlr("select ProductTypeId, ProductTypeName from PriceLists where Name like 'hwt' group by ProductTypeId, ProductTypeName order by ProductTypeName"); $pricelistsTb = new Table("pricelists", $pricelists); $pricelistsTb->setFieldTypes(array( "ProductTypeName" => cf('$t,$v',' ?>"> '), )); $pricelistsTb->setLabels(array("ProductTypeName" => "Product Category"));*/ function doSpecials() { $tppInfo = sqlr("select Specials, SpecialsDate from tppInfo"); if ($tppInfo->gcv("Specials")) { ?>
|
(gcv("SpecialsDate"));?>)
|
Please register to receive our weekly specials.
|
|
if ($ProductTypeId) {
global $subcats, $TPP_SUBSITES;
$subcats = sqlr(SB("select distinct SubCategoryName from (PriceLists left join ProductTypes on PriceLists.ProductTypeId = ProductTypes.ProductTypeId)", null, array(true, "SubCategoryName"), SQLC("and", array(
true, "PriceLists.ProductTypeId = ".$ProductTypeId,
$subsite, "(Name like '".toSqlStringRaw($subsite)."%' or Name like '%[".toSqlStringRaw($subsite)."]%')",
!$subsite, "Name not regexp '\\\\[".join($TPP_SUBSITES,"|")."\\\\]'",
)))->getString());
if ($subcats->count>1) {
$subcatMenu = new Lookup(array("id" => "subcat", "rs" => $subcats, "firstOptions" => array("", "Subcategories >")));
$subcatMenu->setProps(array("onchange" => "window.location.href = '".($subsite?"/".$subsite:"")."/products/".$pricelist->gcv("WebDir")."/'+this.value+'/';"));
$subcatMenu->run();
?>
/*
$first = true;
for ($subcats->moveFirst(); !$subcats->eof(); $subcats->moveNext()) {
if (!$first) { echo " · "; } else { $first = false; }
?>/gcv("SubCategoryName")))?>/">gcv("SubCategoryName"))?>
}*/
}
}
$first = true;
$i = 1;
$entries = glob(mapPath("/images/tpp/products/".$pricelist->gcv("WebDir")."/*.jpg" ));
function randomize(&$arr) {
for ($i=0; $i
?>
}
if ($APA_imageUpload) {
?>
}
$lastProductId = -1;
$pricelistTb = new GroupTable("pricelist", $pricelist);
$pricelistTb->includeStyle = false;
$pricelistTb->hdrRsMoveNext = false;
if ($productSearch) {
$pricelistTb->setAllGroups(array("ProductTypeName:ProductTypeName:*", "SubCategoryName:SubCategoryName:*"));
}
else {
$pricelistTb->setAllGroups(array("SubCategoryName:SubCategoryName:*"));
}
$pricelistTb->setTotalsRs("SubCategoryName", new Recordset(array("s_Quantity", "s_Price"), array(-1, -1)));
for ($pricelist->moveFirst(); !$pricelist->eof(); $pricelist->moveNext()) {
if ($pricelist->gcv("ProductId")==$lastProductId) {
$pricelist->scv("ProductTypeName", $pricelist->gcv("Name").'SERVTABLE:((class="blank"))');
$pricelist->scv("Name", $pricelist->gcv("Name").'SERVTABLE:((class="blank"))');
/*$pricelist->scv("Quantity", $pricelist->gcv("Quantity").'SERVTABLE:((class="dashed"))');
$pricelist->scv("Price", $pricelist->gcv("Price").'SERVTABLE:((class="dashed"))');*/
}
else {
$lastProductId = $pricelist->gcv("ProductId");
}
}
function pricelist_trHandler($t,$pk) {
if ($t->rs->gcv("WebSpecial")) {
?>class="webSpecial"
}
}
$pricelistTb->setTrHandler('pricelist_trHandler');
function fWebSpecial($t,$v) {
if ($v) {
?>Samples
$first = false;
}
$entry = basename($entry);
?>
if (preg_match('|^\d+.jpg$|', $entry)) {
$numSamples++;
$imageName = "/images/tpp/products/".$pricelist->gcv("WebDir")."/".$entry;
$largeImageName = preg_replace('|.jpg|', '-large.jpg', $imageName);
$size = getimagesize(mapPath($largeImageName));
?>
}
}
if (!$first) {
?>on special
}
}
$pricelistTb->setFieldTypes(array(
"ProductId" => TB_HIDDEN,
"Description" => TB_HIDDEN,
"ProductTypeId" => TB_HIDDEN,
"WebDir" => TB_HIDDEN,
"TypeDescription" => TB_HIDDEN,
"HasThumb" => TB_HIDDEN,
"WebSpecial" => 'fWebSpecial',
"ProductImageUpload" => TB_HIDDEN,
"SubCategoryName" => ($productSearch ? new Table_Default('
global $pricelist;
if ($v) {?>gcv("ProductTypeName")?> >} else { ?>gcv("ProductTypeName")?>} ') : new Table_Default(' global $pricelist, $subcats; if ($v && $subcats && $subcats->count > 1) {?> } /*else { ?>gcv("ProductTypeName")?>}*/') ), "ProductTypeName" => ($productSearch ? new Table_Default('') : TB_HIDDEN), "LastUpdate" => TB_HIDDEN, "Price" => cf('$t,$v', ' if (isset($t->header)) { ?>Qty
}
else {
echo (($t->rs->gcv("Price")==0 || $t->rs->gcv("Quantity")==0) ? "" : $v);
}
'),
"Name" => new Table_Default('
global $lastProductId;
if ($t->rs->gcv("ProductId")!=$lastProductId) {
//$d = $t->rs->gcv("Description");
echo $d;
echo htmlspecialchars(formatProductName($v));
//echo ($d ? " (".htmlspecialchars($d).")" : "");
echo " ";
$lastProductId = $t->rs->gcv("ProductId");
}
'),
));
if ($APA_imageUpload) {
$pricelistTb->setFieldTypes(array(
"ProductImageUpload" => new Table_Default('
?>
')
));
}
$pricelistTb->setFieldTypes(array(
"ProductImage" => new Table_Default('
global $subsite;
if (in_array($subsite,array("cor","res"))) return;
if ($t->rs->gcv("HasThumb")) {
$thumbLoc = "/images/tpp/products/".$t->rs->gcv("ProductId").".jpg";
}
else {
$thumbLoc = "/images/tpp/blankProduct.png";
}
/* OLD: ?>&id=rs->gcv("ProductId")?>&noQty=1&noQty=1&catdir=rs->gcv("WebDir"))?>">No results. Please try another search. } else { $pricelistTb->run(); } if (!$productSearch) { $pricelist->moveFirst(); /*?>Last updated gcv("LastUpdate"))?>.*/ } ?> |
if ($pricelist->gcv("TypeDescription")) {
?> ', preg_split('/\n\n/', $pricelist->gcv("TypeDescription")))?> |