ddlQuery($sql); $num=$objDB->numberRow($res); if($num > 0) { while($row = $objDB->get_row($res)) { $filepath = "/home/fresherimage/upload_content/".$row['ZipFile_Path']; $ssize = filesize($filepath)/1024; $sql_adhoc[] = "update `product` set `Size` = '$ssize' where `ProductID` = ".$row['ProductID']; } } foreach($sql_adhoc as $val) { $res = $objDB->ddlQuery($val); } */ /****** FILTERING THE BUYOUTS FROM `ORDERS` TABLE **********/ $sql_orders_buyout = "SELECT * FROM `$orders` WHERE `CreditPurchaseType`='BuyOut' AND (`StatusByAdmin`='Paid' OR `StatusByAdmin`='Approved')"; $res_orders_buyout = $objDB->ddlQuery($sql_orders_buyout); $num_orders_buyout = $objDB->numberRow($res_orders_buyout); if($num_orders_buyout) { $arr_prod_id = array(); while($row_orders_buyout = $objDB->get_row($res_orders_buyout)) { $arr_prod_id[] = $row_orders_buyout['ProductID']; } $ProdID = implode(",",$arr_prod_id); $sql_buyout_clause = "AND `$product`.ProductID NOT IN (".$ProdID.")"; } else { $sql_buyout_clause = ''; } /*****************************************************************/ $orderby = htmlentities($_GET['sortby'], ENT_QUOTES, 'UTF-8'); $order = htmlentities($_GET['order'], ENT_QUOTES, 'UTF-8'); $orderby_IN = mysql_real_escape_string($_GET['sortby']); $order_IN = mysql_real_escape_string($_GET['order']); if (!empty($orderby_IN)) { if(empty($order) || $order == 'A') $orderby_IN .= " ASC, "; else $orderby_IN .= " DESC, "; } $CatID = htmlentities($_REQUEST['CatID'], ENT_QUOTES, 'UTF-8'); $ThemeID = htmlentities($_REQUEST['ThemeID'], ENT_QUOTES, 'UTF-8'); $CatID_IN = mysql_real_escape_string($_REQUEST['CatID']); $ThemeID_IN = mysql_real_escape_string($_REQUEST['ThemeID']); $CatID_RAW = $_REQUEST['CatID']; if(!empty($CatID_IN) || !empty($ThemeID_IN)) { $sql = "SELECT DISTINCT($product.`ProductID`), `FirstName` AS `UserFName` FROM `$product`, `$user_table`, `$category` WHERE $product.UserID=$user_table.UserID AND (FIND_IN_SET($category.`CatID`,$product.`CatID`)) AND ($category.`CatID`=".$CatID_IN." OR $category.`ParentID`=".$CatID_IN.") AND $product.`Status`='Active' ".$sql_buyout_clause." ORDER BY $orderby_IN $product.`UploadedOn` DESC"; $param = "&CatID=".$CatID; if($CatID == '') { $CategoryName = " Viewing All Products"; } if( !empty($ThemeID) && !empty($CatID_IN) ) $sql = "SELECT DISTINCT($product.`ProductID`), `FirstName` AS `UserFName` FROM `$product`, `$user_table`, `$category`,`$theme` WHERE $product.UserID=$user_table.UserID AND ((FIND_IN_SET($category.`CatID`,$product.`CatID`)) AND(FIND_IN_SET($theme.`ThemeID`,$product.`ThemeID`))) AND (($category.`CatID`=".$CatID_IN." OR $category.`ParentID`=".$CatID_IN.") AND ($theme.`ThemeID`=".$ThemeID.")) AND $product.`Status`='Active' ".$sql_buyout_clause." ORDER BY $orderby_IN $product.`UploadedOn` DESC"; else if(!empty($ThemeID)) $sql = "SELECT DISTINCT($product.`ProductID`), `FirstName` AS `UserFName` FROM `$product`, `$user_table`, `$category`,`$theme` WHERE $product.UserID=$user_table.UserID AND ((FIND_IN_SET($category.`CatID`,$product.`CatID`)) AND(FIND_IN_SET($theme.`ThemeID`,$product.`ThemeID`))) AND ($theme.`ThemeID`=".$ThemeID.") AND $product.`Status`='Active' ".$sql_buyout_clause." ORDER BY $orderby_IN $product.`UploadedOn` DESC"; if($ThemeID) { $param .= "&ThemeID=".$ThemeID; $objThemeName = new Theme(); $objThemeName->setTheme($ThemeID); $ThemeName = " > ".$objThemeName->getThemeName(); } $objCategory->setCategory($CatID_RAW); if($CatID!='') { $BreadCrumbArr = array(); $BreadCrumbArr = breadcrumbsByCategory($CatID); $count = count($BreadCrumbArr); //$CategoryName =""; $c=1; foreach($BreadCrumbArr as $key => $val) { if(($c != $count)) { $CategoryName .= " > ".$val['CatName'].""; } else { if($ThemeName != '') { $CategoryName .= " > ".$val['CatName'].""; } else { $CategoryName .= " > ".$val['CatName']; } } $c++; } $CategoryName = substr($CategoryName,2); } $CategoryName .= $ThemeName; unset($BreadCrumbArr); } else { $CatID = ''; $CategoryName = " Viewing All Products"; if($ThemeID) { $param .= "&ThemeID=".$ThemeID; $objThemeName = new Theme(); $objThemeName->setTheme($ThemeID); $ThemeName = " > ".$objThemeName->getThemeName().""; } $CategoryName .= $ThemeName; $sql = "SELECT `ProductID`, `FirstName` AS `UserFName` FROM `$product`, `$user_table` WHERE $product.Status='Active' AND $product.UserID=$user_table.UserID ".$sql_buyout_clause." ORDER BY $orderby_IN `UploadedOn` DESC"; } $CategoryName = $CategoryName; $smarty->assign("CategoryName", $CategoryName); // Title text $TitleText = "Product Catalog > " . $CategoryName; $smarty->assign("TitleText", strip_tags($TitleText)); $res = $objDB->ddlQuery($sql); $num=$objDB->numberRow($res); /******* pagination starts here ***********************************/ $totalrecords = $num; if(!empty($CatID)) { $param = "&CatID=".$CatID; } if(!empty($ThemeID)) $param .= "&ThemeID=".$ThemeID; if(!empty($orderby)) $param .= "&sortby=".$orderby; if(!empty($order)) $param .= "&order=".$order; $limit = htmlentities($_REQUEST['limit'], ENT_QUOTES, 'UTF-8'); if(empty($limit)) $limit = 5; /**** Main Listing Page ****/ include ("product-listing.inc.php"); /**************/ /*** RSS Link ***/ if($CatID) $RSSLink = "rss/rss-category-listing.php?CatID=".$CatID; else $RSSLink = "rss/rss-category-listing.php"; $smarty->assign("RSSLink", $RSSLink); /* for meta description and keywords */ if($CatID) { $objCategory->setCategory($CatID_RAW); $CatDescription = strip_tags($objCategory->getCatDescription()); $CatKeywords = $objCategory->getCatKeywords(); $HeaderContent = ''; // use product keyword on meta keyword // get all keywords and assign them as an array $KeywordsStr = $CatKeywords; $KeywordsArr = $KeywordNamesArr = array(); $KeywordsArr = explode(",", $KeywordsStr); foreach($KeywordsArr as $Keyword) { $Keyword = trim($Keyword); $KeywordNamesArr[] = $Keyword; } $KeywordNames = implode(",", $KeywordNamesArr); $HeaderContent .= ''; $smarty->assign("HeaderContent", $HeaderContent); } /* Get all themes */ $sql = "SELECT * FROM `$theme` WHERE `Status`='Active' ORDER BY `ThemeName`"; $res = $objDB->ddlQuery($sql); $num = $objDB->numberRow($res); $num_per_column = ceil($num/4); $npc = 1; $ThemesArr = array(); $i = 1; while ( $row = $objDB->get_row($res, "MYSQL_ASSOC") ) { if($i==$num_per_column) { $change="Change"; $i=1; } else { $change=""; $i++; } if( $ThemeID == $row['ThemeID'] ) { $Highlight = " class=\"Highlight\" "; } else { $Highlight = ""; } $ThemesArr[] = array( "ThemeID"=>$row['ThemeID'], "ThemeName"=>$row['ThemeName'], "Change"=>$change, "Highlight"=>$Highlight ); } $smarty->assign("ThemesArr", $ThemesArr); /********/ $QueryString = $_SERVER['QUERY_STRING']; if(!empty($QueryString)) { $URLListView = "category-product-listing.php?".$QueryString; $URLGalleryView = "category-product-listing-gallery-view.php?".$QueryString; } else { $URLListView = "category-product-listing.php"; $URLGalleryView = "category-product-listing-gallery-view.php"; } $smarty->assign("URLListView", $URLListView); $smarty->assign("URLGalleryView", $URLGalleryView); $smarty->assign("RecordFrom",$RecordFrom); $smarty->assign("RecordTo",$RecordTo); $smarty->assign("recPerPage", $recPerPage); $smarty->assign("recPerPageBottom", $recPerPageBottom); // to display the top pagination bar only for category prodcut listing page $smarty->assign("DisplayTopPaginationBar", true); if(isset($_COOKIE['ThemeDisplay']) && ($_COOKIE['ThemeDisplay']!='')) { $ThemeDisplay = $_COOKIE['ThemeDisplay']; } else { $ThemeDisplay = ''; } if(isset($_COOKIE['ThemeText']) && ($_COOKIE['ThemeText']!='')) { $ThemeText = $_COOKIE['ThemeText']; } else { $ThemeText = 'Hide Themes'; } $smarty->assign("ThemeDisplay", $ThemeDisplay); $smarty->assign("ThemeText", $ThemeText); $smarty->assign("tpl_page","category_product_listing.tpl"); $smarty->display("container_hundred_per.tpl"); ?>