'; } $search_type = mosGetParam($_REQUEST, 'search_type', 'product'); require_once( CLASSPATH . "pageNavigation.class.php" ); require_once( CLASSPATH . "htmlTools.class.php" ); ?>
_PHPSHOP_PRODUCT_LIST_SEARCH_BY_DATE ?> 

check("admin")) { $q = "SELECT vendor_id FROM #__{sc}_auth_user_vendor WHERE user_id='".$auth['user_id']."'"; $db->query( $q ); $db->next_record(); $vendor = $db->f("vendor_id"); } $search_sql = " (#__{sc}_product.product_name LIKE '%$keyword%' OR \n"; $search_sql .= "#__{sc}_product.product_sku LIKE '%$keyword%' OR \n"; $search_sql .= "#__{sc}_product.product_s_desc LIKE '%$keyword%' OR \n"; $search_sql .= "#__{sc}_product.product_desc LIKE '%$keyword%'"; $search_sql .= ") \n"; // Check to see if this is a search or a browse by category // Default is to show all products if (!empty($category_id)) { $list = "SELECT #__{sc}_category.category_name,#__{sc}_product.product_id,#__{sc}_product.product_name,#__{sc}_product.product_sku,#__{sc}_product.vendor_id,product_publish"; $list .= " FROM #__{sc}_product, #__{sc}_product_category_xref, #__{sc}_category WHERE "; $count = "SELECT count(*) as num_rows FROM #__{sc}_product, #__{sc}_product_category_xref, #__{sc}_category WHERE "; $q = "#__{sc}_product_category_xref.category_id='$category_id' "; $q .= "AND #__{sc}_category.category_id=#__{sc}_product_category_xref.category_id "; $q .= "AND #__{sc}_product.product_id=#__{sc}_product_category_xref.product_id "; $q .= "AND #__{sc}_product.product_parent_id='' "; if (!$perm->check("admin")) { $q .= "AND #__{sc}_product.vendor_id = '$ps_vendor_id' "; } elseif( !empty($vendor) ) { $q .= "AND #__{sc}_product.vendor_id='$vendor' "; } if( !empty( $keyword)) { $q .= " AND $search_sql"; } $count .= $q; $q .= "ORDER BY product_publish DESC,product_name "; } elseif (!empty($keyword)) { $list = "SELECT * FROM #__{sc}_product WHERE "; $count = "SELECT COUNT(*) as num_rows FROM #__{sc}_product WHERE "; $q = $search_sql; $q .= "AND #__{sc}_product.product_parent_id='' "; if (!$perm->check("admin")) { $q .= "AND #__{sc}_product.vendor_id = '$ps_vendor_id' "; } elseif( !empty($vendor) ) { $q .= "AND #__{sc}_product.vendor_id='$vendor' "; } $count .= $q; $q .= " ORDER BY product_publish DESC,product_name "; } elseif (!empty($product_parent_id)) { $list = "SELECT * FROM #__{sc}_product WHERE "; $count = "SELECT COUNT(*) as num_rows FROM #__{sc}_product WHERE "; $q = "product_parent_id='$product_parent_id' "; $q .= !empty($vendor) ? "AND #__{sc}_product.vendor_id='$vendor'" : ""; if( !empty( $keyword)) { $q .= " AND $search_sql"; } //$q .= "AND #__{sc}_product.product_id=#__{sc}_product_reviews.product_id "; //$q .= "AND #__{sc}_category.category_id=#__{sc}_product_category_xref.category_id "; $count .= $q; $q .= " ORDER BY product_publish DESC,product_name "; } /** Changed Product Type - Begin */ elseif (!empty($product_type_id)) { $list = "SELECT * FROM #__{sc}_product,#__{sc}_product_product_type_xref WHERE "; $count = "SELECT count(*) as num_rows FROM #__{sc}_product,#__{sc}_product_product_type_xref WHERE "; $q = "#__{sc}_product.product_id=#__{sc}_product_product_type_xref.product_id "; $q .= "AND product_type_id='$product_type_id' "; if (!$perm->check("admin")) { $q .= "AND #__{sc}_product.vendor_id = '$ps_vendor_id' "; } elseif( !empty($vendor) ) { $q .= "AND #__{sc}_product.vendor_id='$vendor' "; } if( !empty( $keyword)) { $q .= " AND $search_sql"; } $q .= " ORDER BY product_publish DESC,product_name "; $count .= $q; } /** Changed Product Type - End */ /** Changed search by date - Begin */ elseif (!empty($search_date)) { list($time,$date) = explode(" ",$search_date); list($d["search_date_hour"],$d["search_date_minute"]) = explode(":",$time); list($d["search_date_day"],$d["search_date_month"],$d["search_date_year"]) = explode(".",$date); $d["search_date_use"] = true; if (process_date_time($d,"search_date",$VM_LANG->_PHPSHOP_SEARCH_LBL)) { $date = $d["search_date"]; switch( $search_type ) { case "product" : $list = "SELECT * FROM #__{sc}_product WHERE "; $count = "SELECT COUNT(*) as num_rows FROM #__{sc}_product WHERE "; break; case "withoutprice" : case "price" : $list = "SELECT DISTINCT #__{sc}_product.product_id,product_name,product_sku,vendor_id,"; $list .= "product_publish,product_parent_id FROM #__{sc}_product "; $list .= "LEFT JOIN #__{sc}_product_price ON #__{sc}_product.product_id = #__{sc}_product_price.product_id WHERE "; $count = "SELECT DISTINCT count(*) as num_rows FROM #__{sc}_product "; $count.= "LEFT JOIN #__{sc}_product_price ON #__{sc}_product.product_id = #__{sc}_product_price.product_id WHERE "; break; } $where = array(); // $where[] = "#__{sc}_product.product_parent_id='0' "; if (!$perm->check("admin")) { $where[] = " #__{sc}_product.vendor_id = '$ps_vendor_id' "; } elseif( !empty($vendor) ) { $where[] = " #__{sc}_product.vendor_id='$vendor' "; } $q = ""; switch( $search_type ) { case "product" : $where[] = "#__{sc}_product.mdate ". $search_order . " $date "; break; case "price" : $where[] = "#__{sc}_product_price.mdate ". $search_order . " $date "; $q = "GROUP BY #__{sc}_product.product_sku "; break; case "withoutprice" : $where[] = "#__{sc}_product_price.mdate IS NULL "; $q = "GROUP BY #__{sc}_product.product_sku "; break; } $q = implode(" AND ",$where) . $q . " ORDER BY #__{sc}_product.product_publish DESC,#__{sc}_product.product_name "; $count .= $q; } else { echo "\n"; } } /** Changed search by date - End */ else { $list = "SELECT * FROM #__{sc}_product WHERE "; $count = "SELECT COUNT(*) as num_rows FROM #__{sc}_product WHERE "; $q = "product_parent_id='0' "; if (!$perm->check("admin")) { $q .= "AND #__{sc}_product.vendor_id = '$ps_vendor_id' "; } elseif( !empty($vendor) ) { $q .= "AND #__{sc}_product.vendor_id='$vendor' "; } //$q .= "AND #__{sc}_product.product_id=#__{sc}_product_reviews.product_id "; //$q .= "AND #__{sc}_category.category_id=#__{sc}_product_category_xref.category_id "; $count .= $q; $q .= " ORDER BY product_publish DESC,product_name "; } $db->query($count); $db->next_record(); $num_rows = $db->f("num_rows"); // Create the Page Navigation $pageNav = new vmPageNav( $num_rows, $limitstart, $limit ); $limitstart = $pageNav->limitstart; $list .= $q . " LIMIT $limitstart, " . $limit; // Create the List Object with page navigation $listObj = new listFactory( $pageNav ); // print out the search field and a list heading $listObj->writeSearchHeader($VM_LANG->_PHPSHOP_PRODUCT_LIST_LBL, '', 'product', 'product_list'); // start the list table $listObj->startTable(); // these are the columns in the table $columns = Array( "#" => "", "" => "", $VM_LANG->_PHPSHOP_PRODUCT_LIST_NAME => "width=\"30%\"", $VM_LANG->_PHPSHOP_PRODUCT_LIST_SKU => "width=\"15%\"", $VM_LANG->_PHPSHOP_CATEGORY => "width=\"15%\"", $VM_LANG->_PHPSHOP_MANUFACTURER_MOD => "width=\"15%\"", $VM_LANG->_PHPSHOP_REVIEWS => "width=\"10%\"", $VM_LANG->_PHPSHOP_PRODUCT_LIST_PUBLISH => "width=\"5%\"", $VM_LANG->_PHPSHOP_PRODUCT_CLONE => "", $VM_LANG->_E_REMOVE => "width=\"5%\"" ); $listObj->writeTableHeader( $columns ); if ($num_rows > 0) { $db->query($list); $i = 0; $db_cat = new ps_DB; $tmpcell = ""; while ($db->next_record()) { $listObj->newRow(); // The row number $listObj->addCell( $pageNav->rowNumber( $i ) ); // The Checkbox $listObj->addCell( mosHTML::idBox( $i, $db->f("product_id"), false, "product_id" ) ); // The link to the product form / to the child products $tmpcell = "url( $_SERVER['PHP_SELF'] . "?page=$modulename.product_form&limitstart=$limitstart&keyword=".urlencode($keyword)."&product_id=" . $db->f("product_id")."&product_parent_id=".$product_parent_id )."\">".$db->f("product_name"). ""; if( $ps_product->parent_has_children( $db->f("product_id") ) ) { $tmpcell .= "   url($_SERVER['PHP_SELF'] . "?page=$modulename.product_list&product_parent_id=" . $db->f("product_id")); $tmpcell .= "\">[ ".$VM_LANG->_PHPSHOP_PRODUCT_FORM_ITEM_INFO_LBL. " ]"; } $listObj->addCell( $tmpcell ); // The product sku $listObj->addCell( $db->f("product_sku") ); // The Categories or the parent product's name $tmpcell = ""; if( empty($product_parent_id) ) { $db_cat->query("SELECT #__{sc}_category.category_id, category_name FROM #__{sc}_category,#__{sc}_product_category_xref WHERE #__{sc}_category.category_id=#__{sc}_product_category_xref.category_id AND #__{sc}_product_category_xref.product_id='".$db->f("product_id") ."'"); while($db_cat->next_record()) { $tmpcell .= $db_cat->f("category_name") . "
"; } } else { $tmpcell .= $VM_LANG->_PHPSHOP_CATEGORY_FORM_PARENT .": url( $url ); $tmpcell .= "\">".$ps_product->get_field($product_parent_id,"product_name"). ""; } $listObj->addCell( $tmpcell ); $listObj->addCell( $ps_product->get_mf_name($db->f("product_id")) ); $db_cat->query("SELECT count(*) as num_rows FROM #__{sc}_product_reviews WHERE product_id='".$db->f("product_id")."'"); $db_cat->next_record(); if ($db_cat->f("num_rows")) { $tmpcell = $db_cat->f("num_rows")." "; $tmpcell .= "f("product_id")."\">"; $tmpcell .= "[".$VM_LANG->_PHPSHOP_SHOW."]"; } else { $tmpcell = " - "; } $listObj->addCell( $tmpcell ); $tmpcell = "url( $_SERVER['PHP_SELF']."?page=product.product_list&category_id=$category_id&product_id=".$db->f("product_id")."&func=changePublishState" ); if ($db->f("product_publish")=='N') { $tmpcell .= "&task=publish\">"; } else { $tmpcell .= "&task=unpublish\">"; } $tmpcell .= vmCommonHTML::getYesNoIcon( $db->f("product_publish"), "Publish", "Unpublish" ); $tmpcell .= ""; $listObj->addCell( $tmpcell ); $tmpcell = "_PHPSHOP_PRODUCT_CLONE."\" onmouseout=\"MM_swapImgRestore();\" onmouseover=\"MM_swapImage('copy_$i','','". IMAGEURL ."ps_image/copy.png',1);\" href=\""; $url = $_SERVER['PHP_SELF'] . "?page=$modulename.product_form&clone_product=1&limitstart=$limitstart&keyword=".urlencode($keyword)."&product_id=" . $db->f("product_id"); if( !empty($product_parent_id) ) $url .= "&product_parent_id=$product_parent_id"; $tmpcell .= $sess->url( $url ); $tmpcell .= "\">\"".$VM_LANG-_PHPSHOP_PRODUCT_CLONE."\" />"; $listObj->addCell( $tmpcell ); $listObj->addCell( $ps_html->deleteButton( "product_id", $db->f("product_id"), "productDelete", $keyword, $limitstart ) ); $i++; } } $listObj->writeTable(); $listObj->endTable(); $listObj->writeFooter( $keyword, "&product_parent_id=$product_parent_id&category_id=$category_id&product_type_id=$product_type_id&search_date$search_date"); ?>