".$VM_LANG->_PHPSHOP_BROWSE_LBL."\n"; $db_browse = new ps_DB; $dbp = new ps_DB; /* load important class files */ require_once (CLASSPATH."ps_product.php"); $ps_product = new ps_product; require_once (CLASSPATH."ps_product_category.php"); $ps_product_category = new ps_product_category; require_once (CLASSPATH."ps_reviews.php"); $Itemid = mosgetparam($_REQUEST, "Itemid", null); $keyword1 = $vmInputFilter->safeSQL( urldecode(mosGetParam( $_REQUEST, 'keyword1', null ))); $keyword2 = $vmInputFilter->safeSQL( urldecode(mosGetParam( $_REQUEST, 'keyword2', null ))); // possible values: [ASC|DESC] $DescOrderBy = $vmInputFilter->safeSQL( mosGetParam( $_REQUEST, 'DescOrderBy', "ASC" )); $search_limiter= $vmInputFilter->safeSQL( mosGetParam( $_REQUEST, 'search_limiter', null )); $search_op= $vmInputFilter->safeSQL( mosGetParam( $_REQUEST, 'search_op', null )); // possible values: // product_name, product_price, product_sku, product_cdate (=latest additions) $orderby = $vmInputFilter->safeSQL( mosGetParam( $_REQUEST, 'orderby', VM_BROWSE_ORDERBY_FIELD )); if (empty($category_id)) $category_id = $search_category; $default['category_flypage'] = FLYPAGE; if (!empty($category_id) ) { /** * PATHWAY - Navigation List */ echo '
'; $nav_list = $ps_product_category->get_navigation_list($category_id); if( @$_REQUEST['output'] != "pdf") { $mainframe->appendPathWay( $nav_list ); } else { echo "".$nav_list ."
"; } $child_list = $ps_product_category->get_child_list($category_id); if (!empty( $child_list )) { echo $child_list; } echo '
'; if (!empty( $child_list )) { echo '

'; } /** * CATEGORY DESCRIPTION */ $desc = $ps_product_category->get_description($category_id); /* Prepend Product Short Description Meta Tag "description" when applicable */ if( @$_REQUEST['output'] != "pdf") { $mainframe->prependMetaTag( "description", substr(strip_tags($desc ), 0, 255) ); } if( trim(str_replace( "
", "" , $desc)) != "" ) { echo '
'; echo $desc; echo '


'; } } // NEW: Include the query section from an external file require_once( PAGEPATH. "shop_browse_queries.php" ); $db_browse->query( $count ); $num_rows = $db_browse->f("num_rows"); if( $limitstart > 0 && $limit >= $num_rows) { $list = str_replace( 'LIMIT '.$limitstart, 'LIMIT 0', $list ); } /*** when nothing has been found * we tell this here and say goodbye */ /*********************************************************************************** *********Remove or modify the Empty Category text on the Browse page *********http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=15680.0 ********* *********line 107 in shop.broswe.php was ********* *********elseif( $num_rows == 0 && empty($product_type_id) ) { ********* *********changed to ********* *********elseif( $num_rows == 0 && empty($product_type_id) && empty($child_list) ) { ************************************************************************************/ if ($num_rows == 0 && !empty($keyword)) { echo $VM_LANG->_PHPSHOP_NO_SEARCH_RESULT; } elseif( $num_rows == 0 && empty($product_type_id) && empty($child_list) ) { echo _EMPTY_CATEGORY; } /*** NOW START THE PRODUCT LIST ***/ else { /* Set Dynamic Page Title */ if( $category_id ) { $db->query( "SELECT category_id, category_name FROM #__{vm}_category WHERE category_id='$category_id'"); $db->next_record(); $mainframe->setPageTitle( $db->f("category_name") ); } elseif( $manufacturer_id) { $db->query( "SELECT manufacturer_id, mf_name FROM #__{vm}_manufacturer WHERE manufacturer_id='$manufacturer_id'"); $db->next_record(); $mainframe->setPageTitle( $db->f("mf_name") ); } elseif( $keyword ) { $mainframe->setPageTitle( html_entity_decode( $VM_LANG->_PHPSHOP_SEARCH_TITLE ) ); } else { $mainframe->setPageTitle( html_entity_decode($VM_LANG->_PHPSHOP_BROWSE_LBL) ); } if (!empty($product_type_id) && @$_REQUEST['output'] != "pdf") { ?>
" method="post" name="back"> get_parameter_form($product_type_id); ?> _PHPSHOP_PARAMETER_SEARCH_IN_CATEGORY.": ".$ps_product_type->get_name($product_type_id); ?>  
1 && @$_REQUEST['output'] != "pdf") { // Prepare Page Navigation if ( $num_rows > $limit || $num_rows > 5 ) { require_once( $mosConfig_absolute_path.'/includes/pageNavigation.php'); $pagenav = new mosPageNav( $num_rows, $limitstart, $limit); $search_string = $mm_action_url."index.php?option=com_virtuemart&page=$modulename.browse&category_id=$category_id&keyword=".urlencode( $keyword )."&manufacturer_id=$manufacturer_id&Itemid=$Itemid"; $search_string .= !empty($orderby) ? "&orderby=".urlencode($orderby) : ""; if (!empty($keyword1)) { $search_string.="&keyword1=".urlencode($keyword1); $search_string.="&search_category=$search_category"; $search_string.="&search_limiter=$search_limiter"; if (!empty($keyword2)) { $search_string.="&keyword2=".urlencode($keyword2); $search_string.="&search_op=$search_op"; } } } ?>
" method="get" name="order"> _PHPSHOP_ORDERBY ?>: '. $VM_LANG->_PHPSHOP_PARAMETER_SEARCH_DESCENDING_ORDER .'', ' '); ?> get_parameter_form($product_type_id); } if( PSHOP_SHOW_TOP_PAGENAV =='1' && ($num_rows > $limit || $num_rows > 5)) { echo "    "._PN_DISPLAY_NR."  "; //echo ""; $pagenav->writeLimitBox( $search_string ); echo "
"; } else { echo "\n"; } if( PSHOP_SHOW_TOP_PAGENAV =='1' && $num_rows > $limit ) { // PAGE NAVIGATION AT THE TOP echo "
"; echo $pagenav->writePagesLinks( $search_string ); echo "

"; } } $use_tables = @$_REQUEST['output'] == "pdf" ? true : false; if( $use_tables ) { echo ''; } else { echo '
'; } $i = 0; $row = 0; $tmp_row = 0; $db_browse->query( $list ); $db_browse->next_record(); $products_per_row = (!empty($category_id)) ? $db_browse->f("products_per_row") : PRODUCTS_PER_ROW; if( $products_per_row < 1 ) { $products_per_row = 1; } /** * Read the template file into a String variable. * Then replace the placeholders with HTML formatted product details * * function read_file( $file, $defaultfile='') ***/ if(@$_REQUEST['output'] != "pdf") { $templatefile = (!empty($category_id)) ? $db_browse->f("category_browsepage") : CATEGORY_TEMPLATE; } else { $templatefile = "browse_lite_pdf"; } $template = read_file( PAGEPATH."templates/browse/$templatefile.php", PAGEPATH."templates/browse/".CATEGORY_TEMPLATE.".php"); $db_browse->reset(); /*** Start printing out all products (in that category) ***/ while ($db_browse->next_record()) { // If it is item get parent: $product_parent_id = $db_browse->f("product_parent_id"); if ($product_parent_id != 0) { $dbp->query("SELECT product_full_image,product_thumb_image,product_name,product_s_desc FROM #__{vm}_product WHERE product_id='$product_parent_id'" ); $dbp->next_record(); } // Set the flypage for this product based on the category. // If no flypage is set then use the default as set in virtuemart.cfg.php $flypage = $db_browse->sf("category_flypage"); if (empty($flypage)) { $flypage = FLYPAGE; } $url = $sess->url( $mm_action_url."index.php?page=shop.product_details&flypage=$flypage&product_id=" . $db_browse->f("product_id") . "&category_id=" . $db_browse->f("category_id"). "&manufacturer_id=" . $manufacturer_id); if( $db_browse->f("product_thumb_image") ) { $product_thumb_image = $db_browse->f("product_thumb_image"); } else { if( $product_parent_id != 0 ) { $product_thumb_image = $dbp->f("product_thumb_image"); // Use product_thumb_image from Parent Product } else { $product_thumb_image = 0; } } if( $product_thumb_image ) { if( substr( $product_thumb_image, 0, 4) != "http" ) { if(PSHOP_IMG_RESIZE_ENABLE == '1') { $product_thumb_image = $mosConfig_live_site."/components/com_virtuemart/show_image_in_imgtag.php?filename=".urlencode($product_thumb_image)."&newxsize=".PSHOP_IMG_WIDTH."&newysize=".PSHOP_IMG_HEIGHT."&fileout="; } else { if( file_exists( IMAGEPATH."product/".$product_thumb_image )) { $product_thumb_image = IMAGEURL."product/".$product_thumb_image; } else { $product_thumb_image = IMAGEURL.NO_IMAGE; } } } } else { $product_thumb_image = IMAGEURL.NO_IMAGE; } if( $db_browse->f("product_full_image") ) { $product_full_image = $db_browse->f("product_full_image"); } else { if( $product_parent_id != 0 ) { $product_full_image = $dbp->f("product_full_image"); // Use product_full_image from Parent Product } else { $product_full_image = "..".NO_IMAGE; } } if( file_exists( IMAGEPATH."product/$product_full_image" )) { $full_image_info = getimagesize( IMAGEPATH."product/$product_full_image" ); $full_image_width = $full_image_info[0]+40; $full_image_height = $full_image_info[1]+40; } else { $full_image_width = $full_image_height = ""; } $product_name = $db_browse->f("product_name"); if( $db_browse->f("product_publish") == "N" ) { $product_name .= " (".vmHtmlEntityDecode(_CMN_UNPUBLISHED).")"; } if( empty($product_name) && $product_parent_id!=0 ) { $product_name = $dbp->f("product_name"); // Use product_name from Parent Product } $product_s_desc = $db_browse->f("product_s_desc"); if( empty($product_s_desc) && $product_parent_id!=0 ) { $product_s_desc = $dbp->f("product_s_desc"); // Use product_s_desc from Parent Product } $product_details = $VM_LANG->_PHPSHOP_FLYPAGE_LBL; if (PSHOP_ALLOW_REVIEWS == '1' && @$_REQUEST['output'] != "pdf") { /** * Average customer rating: xxxxx * Total votes: x */ $product_rating = $VM_LANG->_PHPSHOP_CUSTOMER_RATING .":
"; $product_rating .= ps_reviews::allvotes( $db_browse->f("product_id") ); } else $product_rating = ""; /** Price: xx.xx EUR ***/ if (_SHOW_PRICES == '1' && $auth['show_prices']) { $product_price = $ps_product->show_price( $db_browse->f("product_id") ); } else { $product_price = ""; } /*** Add-to-Cart Button ***/ if (USE_AS_CATALOGUE != '1' && $product_price != "" && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) { $form_addtocart = "
\n \n _PHPSHOP_CART_ADD_TO ."\" title=\"".$VM_LANG->_PHPSHOP_CART_ADD_TO."\" /> \n f("product_id") ."\" />\n \n \n \n \n \n"; } else $form_addtocart = ""; /*** Now fill the template * Customizing: * a. Define your own placeholders(e.g. {product_weight} ) * b. Add a line below like this (must be below first str_replace call!): $product_cell = str_replace( "{product_weight}", $db_browse->f("product_weight"), $product_cell ); * c. put the placeholder {product_weight} somewhere in the template (/html/templates)
* d. save the template file under a new name (e.g. browse_weight.php ) * e. Assign the browse page "browse_weight" to the categories, * you want to have using that template file (do that in the category form!) **/ $product_cell = str_replace( "{product_flypage}", $url, $template ); $product_cell = str_replace( "{product_thumb_image}", $product_thumb_image, $product_cell ); $product_cell = str_replace( "{product_full_image}", $product_full_image, $product_cell ); $product_cell = str_replace( "{full_image_width}", $full_image_width, $product_cell ); $product_cell = str_replace( "{full_image_height}", $full_image_height, $product_cell ); if( substr( $product_full_image, 0, 4) == "http" ) $product_cell = str_replace( "{image_url}product/", "", $product_cell ); else $product_cell = str_replace( "{image_url}", IMAGEURL, $product_cell ); if( PSHOP_IMG_RESIZE_ENABLE=='1' ) { $product_cell = str_replace( "{image_width}", "", $product_cell ); $product_cell = str_replace( "{image_height}", "", $product_cell ); } else { if( file_exists( str_replace( IMAGEURL, IMAGEPATH, $product_thumb_image))) { $arr = @getimagesize( str_replace( IMAGEURL, IMAGEPATH, $product_thumb_image) ); $height_greater = $arr[0] < $arr[1]; } if( @$height_greater === false ) { $product_cell = str_replace( "{image_width}", "width=\"".PSHOP_IMG_WIDTH."\"", $product_cell ); $product_cell = str_replace( "{image_height}", "", $product_cell ); } else { $product_cell = str_replace( "{image_width}", "", $product_cell ); $product_cell = str_replace( "{image_height}", "height=\"".PSHOP_IMG_HEIGHT."\"", $product_cell ); } } $product_cell = str_replace( "{product_name}", shopMakeHtmlSafe( $product_name ), $product_cell ); $product_cell = str_replace( "{product_s_desc}", $product_s_desc, $product_cell ); $product_cell = str_replace( "{product_details...}", $product_details, $product_cell ); $product_cell = str_replace( "{product_rating}", $product_rating, $product_cell ); $product_cell = str_replace( "{product_price}", $product_price, $product_cell ); $product_cell = str_replace( "{form_addtocart}", $form_addtocart, $product_cell ); $product_cell = str_replace( "{product_sku}", $db_browse->f("product_sku"), $product_cell ); /*** Now echo the filled cell ***/ if( $tmp_row != $row || $row == 0 ) { if ( $db_browse->num_rows() - ($i) < $products_per_row ) { $cell_count = $db_browse->num_rows() - ($i); } else { $cell_count = $products_per_row; } $row++; $tmp_row = $row; } $colspan = $products_per_row - $cell_count + 1; if( $cell_count < 1 ) { $cell_count = 1; } if( $use_tables ) { echo ""; } else { echo "\n
"; } } else { if( $use_tables ) { echo "\n"; } else { echo "\n"; } } } /*** END OF while loop ***/ echo '
'; if( $use_tables ) { echo '
Product Weight: {product_weight}
"; } else { echo "
"; } echo $product_cell; $i++; /*** START NEXT ROW ??? ***/ if ( ($i) % $products_per_row == 0) { $row++; /** if yes, close the current row and print out a horizontal bar ***/ if( $use_tables ) { echo "\n
'; } else { echo ''; } ?>
$limit && @$_REQUEST['output'] != "pdf") { if( !isset($pagenav) ) { require_once( $mosConfig_absolute_path.'/includes/pageNavigation.php'); $pagenav = new mosPageNav( $num_rows, $limitstart, $limit); } echo $pagenav->writePagesLinks( $search_string ); } if( $num_rows > 5 && @$_REQUEST['output'] != "pdf") { echo "

"._PN_DISPLAY_NR."  "; $pagenav->writeLimitBox( $search_string ); echo "
"; } ?>