Здравствуйте
такая проблема.. вообщем, у меня почему-то
shop.browse.php [VirtueMart 1.1.2 stable(сайт сделан с готовой сборки)] хотя я ковырялся в виртумарте 1.1.3, но там тоже некоторых строчек не было.. мне нужно сделать как и всем в прошлых постах: точно так же как сделал
beagler.. но дело в том, что
/administrator/components/com_virtuemart/html/shop.browse.php<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
* This is the Main Product Listing File!
*
* @version $Id: shop.browse.php 1489 2008-07-30 19:38:04Z gregdev $
* @package VirtueMart
* @subpackage html
* @copyright Copyright (C) 2004-2008 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName( __FILE__ );
// 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_product_files.php");
require_once (CLASSPATH."ps_reviews.php");
require_once (CLASSPATH."imageTools.class.php");
require_once (CLASSPATH."PEAR/Table.php");
require_once(CLASSPATH . 'ps_product_attribute.php' );
$ps_product_attribute = new ps_product_attribute;
$Itemid = $sess->getShopItemid();
$keyword1 = $vmInputFilter->safeSQL( urldecode(vmGet( $_REQUEST, 'keyword1', null )));
$keyword2 = $vmInputFilter->safeSQL( urldecode(vmGet( $_REQUEST, 'keyword2', null )));
$search_op= $vmInputFilter->safeSQL( vmGet( $_REQUEST, 'search_op', null ));
$search_limiter= $vmInputFilter->safeSQL( vmGet( $_REQUEST, 'search_limiter', null ));
if (empty($category_id)) $category_id = $search_category;
$default['category_flypage'] = FLYPAGE;
$db_browse = new ps_DB;
$dbp = new ps_DB;
// 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 );
}
if( $category_id ) {
/**
* CATEGORY DESCRIPTION
*/
$db->query( "SELECT category_id, category_name FROM #__{vm}_category WHERE category_id='$category_id'");
$db->next_record();
$category_name = shopMakeHtmlSafe( $db->f('category_name') );
/* Set Dynamic Page Title */
$mainframe->setPageTitle( $db->f("category_name") );
$desc = $ps_product_category->get_description($category_id);
$desc = vmCommonHTML::ParseContentByPlugins( $desc );
/* Prepend Product Short Description Meta Tag "description" when applicable */
$mainframe->prependMetaTag( "description", substr(strip_tags($desc ), 0, 255) );
}
// when nothing has been found we tell this here and say goodbye
if ($num_rows == 0 && (!empty($keyword)||!empty($keyword1))) {
echo $VM_LANG->_('PHPSHOP_NO_SEARCH_RESULT');
}
elseif( $num_rows == 0 && empty($product_type_id) && !empty($child_list)) {
echo $VM_LANG->_('EMPTY_CATEGORY');
}
elseif( $num_rows == 1 && ( !empty($keyword) || !empty($keyword1) ) ) {
// If just one product has been found, we directly show the details page of it
$db_browse->query( $list );
$db_browse->next_record();
$flypage = $db_browse->sf("category_flypage")? $db_browse->sf("category_flypage") : FLYPAGE;
$url_parameters = "page=shop.product_details&flypage=$flypage&product_id=" . $db_browse->f("product_id"). "&category_id=" . $db_browse->f("category_id");
vmRedirect( $sess->url($url_parameters, true, false ) );
}
else {
// NOW START THE PRODUCT LIST
$tpl = vmTemplate::getInstance();
if( $category_id ) {
/**
* CATEGORY DESCRIPTION
*/
$browsepage_lbl = $category_name;
$tpl->set( 'browsepage_lbl', $browsepage_lbl );
$tpl->set( 'desc', $desc );
$category_childs = $ps_product_category->get_child_list($category_id);
$tpl->set( 'categories', $category_childs );
$navigation_childlist = $tpl->fetch( 'common/categoryChildlist.tpl.php');
$tpl->set( 'navigation_childlist', $navigation_childlist );
// Set up the CMS pathway
$category_list = array_reverse( $ps_product_category->get_navigation_list($category_id) );
$pathway = $ps_product_category->getPathway( $category_list );
$vm_mainframe->vmAppendPathway( $pathway );
$tpl->set( 'category_id', $category_id );
$tpl->set( 'category_name', $category_name );
$browsepage_header = $tpl->fetch( 'browse/includes/browse_header_category.tpl.php' );
}
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") );
$browsepage_lbl = shopMakeHtmlSafe( $db->f("mf_name") );
$tpl->set( 'browsepage_lbl', $browsepage_lbl );
$browsepage_lbltext = $db->f("mf_desc");
$tpl->set( 'browsepage_lbltext', $browsepage_lbltext );
$browsepage_header = $tpl->fetch( 'browse/includes/browse_header_manufacturer.tpl.php' );
}
elseif( $keyword ) {
$mainframe->setPageTitle( $VM_LANG->_('PHPSHOP_SEARCH_TITLE',false) );
$browsepage_lbl = $VM_LANG->_('PHPSHOP_SEARCH_TITLE').': '.shopMakeHtmlSafe( $keyword );
$tpl->set( 'browsepage_lbl', $browsepage_lbl );
$browsepage_header = $tpl->fetch( 'browse/includes/browse_header_keyword.tpl.php' );
}
else {
$mainframe->setPageTitle( $VM_LANG->_('PHPSHOP_BROWSE_LBL',false) );#
$browsepage_lbl = $VM_LANG->_('PHPSHOP_BROWSE_LBL');
$tpl->set( 'browsepage_lbl', $browsepage_lbl );
$browsepage_header = $tpl->fetch( 'browse/includes/browse_header_all.tpl.php' );
}
$tpl->set( 'browsepage_header', $browsepage_header );
if (!empty($product_type_id) && @$_REQUEST['output'] != "pdf") {
$tpl->set( 'ps_product_type', $ps_product_type);
$tpl->set( 'product_type_id', $product_type_id);
$parameter_form = $tpl->fetch( 'browse/includes/browse_searchparameter_form.tpl.php' );
}
else {
$parameter_form = '';
}
$tpl->set( 'parameter_form', $parameter_form );
// Decide whether to show the limit box
$show_limitbox = ( $num_rows > 5 && @$_REQUEST['output'] != "pdf" );
$tpl->set( 'show_limitbox', $show_limitbox );
// Decide whether to show the top navigation
$show_top_navigation = ( PSHOP_SHOW_TOP_PAGENAV =='1' && $num_rows > $limit );
$tpl->set( 'show_top_navigation', $show_top_navigation );
// Prepare Page Navigation
require_once( CLASSPATH . 'pageNavigation.class.php' );
$pagenav = new vmPageNav( $num_rows, $limitstart, $limit );
$tpl->set( 'pagenav', $pagenav );
$search_string = '';
if ( $num_rows > 1 && @$_REQUEST['output'] != "pdf") {
if ( $num_rows > $limit || $num_rows > 5 ) {
$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";
}
}
if (!empty($product_type_id)){
foreach($_REQUEST as $key => $value){
if (substr($key, 0,13) == "product_type_"){
$val = vmGet($_REQUEST, $key );
if( is_array( $val )) {
foreach( $val as $var ) {
$search_string .="&".$key."[]=".urlencode($var);
}
} else {
$search_string .="&".$key."=".urlencode($val);
}
}
}
}
}
$tpl->set( 'VM_BROWSE_ORDERBY_FIELDS', $VM_BROWSE_ORDERBY_FIELDS);
if ($DescOrderBy == "DESC") {
$icon = "sort_desc.png";
$selected = Array( "selected=\"selected\"", "" );
$asc_desc = Array( "DESC", "ASC" );
}
else {
$icon = "sort_asc.png";
$selected = Array( "", "selected=\"selected\"" );
$asc_desc = Array( "ASC", "DESC" );
}
$tpl->set( 'orderby', $orderby );
$tpl->set( 'icon', $icon );
$tpl->set( 'selected', $selected );
$tpl->set( 'asc_desc', $asc_desc );
$tpl->set( 'category_id', $category_id );
$tpl->set( 'manufacturer_id', $manufacturer_id );
$tpl->set( 'keyword', urlencode( $keyword ) );
$tpl->set( 'keyword1', urlencode( $keyword1 ) );
$tpl->set( 'keyword2', urlencode( $keyword2 ) );
$tpl->set( 'Itemid', $Itemid );
if( $show_top_navigation ) {
$tpl->set( 'search_string', $search_string );
}
$orderby_form = $tpl->fetch( 'browse/includes/browse_orderbyform.tpl.php' );
$tpl->set( 'orderby_form', $orderby_form );
}
else {
$tpl->set( 'orderby_form', '' );
}
$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;
}
$buttons_header = '';
/**
* Start caching all product details for a later loop
*
**/
if(@$_REQUEST['output'] != "pdf") {
// Show the PDF, Email and Print buttons
$tpl->set('option', $option);
$tpl->set('category_id', $category_id );
$tpl->set('product_id', $product_id );
$buttons_header = $tpl->fetch( 'common/buttons.tpl.php' );
$templatefile = (!empty($category_id))? $db_browse->f("category_browsepage") : CATEGORY_TEMPLATE;
if( $templatefile == 'managed' ) {
// automatically select the browse template with the best match for the number of products per row
$templatefile = file_exists(VM_THEMEPATH.'templates/browse/browse_'.$products_per_row.'.php' )
? 'browse_'.$products_per_row
: 'browse_5';
} elseif( !file_exists(VM_THEMEPATH.'templates/browse/'.$templatefile.'.php')) {
$templatefile = 'browse_5';
}
}
else {
$templatefile = "browse_lite_pdf";
}
$tpl->set( 'buttons_header', $buttons_header );
$tpl->set('products_per_row', $products_per_row );
$tpl->set('templatefile', $templatefile );
$db_browse->reset();
$products = array();
$counter = 0;
/*** 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_parameters = "page=shop.product_details&flypage=$flypage&product_id=" . $db_browse->f("product_id"). "&category_id=" . $db_browse->f("category_id");
if( $manufacturer_id ) {
$url_parameters .= "&manufacturer_id=" . $manufacturer_id;
}
if( $keyword != '') {
$url_parameters .= "&keyword=".urlencode($keyword);
}
$url = $sess->url( $url_parameters );
// 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 = "";
}
// @var array $product_price_raw The raw unformatted Product Price in Float Format
$product_price_raw = $ps_product->get_adjusted_attribute_price($db_browse->f('product_id'));
// i is the index for the array holding all products, we need to show. to allow sorting by discounted price,
// we need to use the price as first part of the index name!
$i = $product_price_raw['product_price'] . '_' . ++$counter;
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=";
}
elseif( !file_exists( IMAGEPATH."product/".$product_thumb_image )) {
$product_thumb_image = VM_THEMEURL.'images/'.NO_IMAGE;
}
}
}
else {
$product_thumb_image = VM_THEMEURL.'images/'.NO_IMAGE;
}
// Get the full image path, or URL if set, or the no_image
if( $db_browse->f("product_full_image") ) {
$product_full_image = $db_browse->f("product_full_image");
} elseif( $product_parent_id != 0 ) {
$product_full_image = $dbp->f("product_full_image"); // Use product_full_image from Parent Product
}
else {
$product_full_image = VM_THEMEURL . 'images/' . NO_IMAGE;
// Get the size information for the no_image
if( file_exists( VM_THEMEPATH . 'images/' . NO_IMAGE ) ) {
$full_image_info = getimagesize( VM_THEMEPATH . 'images/' . NO_IMAGE );
$full_image_width = $full_image_info[0]+40;
$full_image_height = $full_image_info[1]+40;
}
}
// Get image size information and add the full URL
if( substr( $product_full_image, 0, 4)!= 'http' ) {
// This is a local 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;
}
$product_full_image = IMAGEURL . 'product/' . $product_full_image;
} elseif( !isset( $full_image_width ) || !isset( $full_image_height ) ) {
// This is a URL image
$full_image_info = getimagesize( $product_full_image );
$full_image_width = $full_image_info[0]+40;
$full_image_height = $full_image_info[1]+40;
}
$files = ps_product_files::getFilesForProduct( $db_browse->f('product_id') );
$products[$i]['files'] = $files['files'];
$products[$i]['images'] = $files['images'];
$product_name = $db_browse->f("product_name");
if( $db_browse->f("product_publish") == "N" ) {
$product_name .= " (". $VM_LANG->_('CMN_UNPUBLISHED',false).")";
}
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 = ps_reviews::allvotes( $db_browse->f("product_id") );
}
else {
$product_rating = "";
}
// Add-to-Cart Button
if (USE_AS_CATALOGUE != '1' && $product_price != ""
&& !stristr( $product_price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL') )
&& !ps_product::product_has_attributes( $db_browse->f('product_id'), true )
&& $tpl->get_cfg( 'showAddtocartButtonOnProductList' ) ) {
$tpl->set( 'i', $i );
$tpl->set( 'product_id', $db_browse->f('product_id') );
$tpl->set( 'product_in_stock', $db_browse->f('product_in_stock') );
$tpl->set( 'ps_product_attribute', $ps_product_attribute );
$products[$i]['form_addtocart'] = $tpl->fetch( 'browse/includes/addtocart_form.tpl.php' );
$products[$i]['has_addtocart'] = true;
}
else {
$products[$i]['form_addtocart'] = '';
$products[$i]['has_addtocart'] = false;
}
$products[$i]['product_flypage'] = $url;
$products[$i]['product_thumb_image'] = $product_thumb_image;
$products[$i]['product_full_image'] = $product_full_image;
$products[$i]['full_image_width'] = $full_image_width;
$products[$i]['full_image_height'] = $full_image_height;
// Unset these for the next product
unset($full_image_width);
unset($full_image_height);
$products[$i]['product_name'] = shopMakeHtmlSafe( $product_name );
$products[$i]['product_s_desc'] = $product_s_desc;
$products[$i]['product_details'] = $product_details;
$products[$i]['product_rating'] = $product_rating;
$products[$i]['product_price'] = $product_price;
$products[$i]['product_price_raw'] = $product_price_raw;
$products[$i]['product_sku'] = $db_browse->f("product_sku");
$products[$i]['product_weight'] = $db_browse->f("product_weight");
$products[$i]['product_weight_uom'] = $db_browse->f("product_weight_uom");
$products[$i]['product_length'] = $db_browse->f("product_length");
$products[$i]['product_width'] = $db_browse->f("product_width");
$products[$i]['product_height'] = $db_browse->f("product_height");
$products[$i]['product_lwh_uom'] = $db_browse->f("product_lwh_uom");
$products[$i]['product_in_stock'] = $db_browse->f("product_in_stock");
$products[$i]['product_available_date'] = $VM_LANG->convert( vmFormatDate($db_browse->f("product_available_date"), $VM_LANG->_('DATE_FORMAT_LC') ));
$products[$i]['product_availability'] = $db_browse->f("product_availability");
$products[$i]['cdate'] = $VM_LANG->convert( vmFormatDate($db_browse->f("cdate"), $VM_LANG->_('DATE_FORMAT_LC') ));
$products[$i]['mdate'] = $VM_LANG->convert( vmFormatDate($db_browse->f("mdate"), $VM_LANG->_('DATE_FORMAT_LC') ));
$products[$i]['product_url'] = $db_browse->f("product_url");
} // END OF while loop
// Need to re-order here, because the browse query doesn't fetch discounts
if( $orderby == 'product_price' ) {
if ($DescOrderBy == "DESC") {
// using krsort when the Array must be sorted reverse (Descending Order)
krsort($products, SORT_NUMERIC);
} else {
// using ksort when the Array must be sorted in ascending order
ksort($products, SORT_NUMERIC);
}
}
$tpl->set( 'products', $products );
$tpl->set( 'search_string', $search_string );
if ( $num_rows > 1 ) {
$browsepage_footer = $tpl->fetch( 'browse/includes/browse_pagenav.tpl.php' );
$tpl->set( 'browsepage_footer', $browsepage_footer );
} else {
$tpl->set( 'browsepage_footer', '' );
}
$recent_products = $ps_product->recentProducts(null,$tpl->get_cfg('showRecent', 5));
$tpl->set('recent_products',$recent_products);
$tpl->set('ps_product',$ps_product);
echo $tpl->fetch( $tpl->config->get( 'productListStyle' ) );
}
?>
/administrator/components/com_virtuemart/html/shop.product_detailes.php<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
*
* @version $Id: shop.product_details.php 1364 2008-04-09 16:44:28Z soeren_nb $
* @package VirtueMart
* @subpackage html
* @copyright Copyright (C) 2004-2008 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName( __FILE__ );
require_once(CLASSPATH . 'ps_product_files.php' );
require_once(CLASSPATH . 'imageTools.class.php' );
require_once(CLASSPATH . 'ps_product.php' );
$ps_product = $GLOBALS['ps_product'] = new ps_product;
require_once(CLASSPATH . 'ps_product_category.php' );
$ps_product_category = new ps_product_category;
require_once(CLASSPATH . 'ps_product_attribute.php' );
$ps_product_attribute = new ps_product_attribute;
require_once(CLASSPATH . 'ps_product_type.php' );
$ps_product_type = new ps_product_type;
require_once(CLASSPATH . 'ps_reviews.php' );
$product_id = intval( vmGet($_REQUEST, "product_id", null) );
$product_sku = $db->getEscaped( vmGet($_REQUEST, "sku", '' ) );
$category_id = vmGet($_REQUEST, "category_id", null);
$pop = (int)vmGet($_REQUEST, "pop", 0);
$manufacturer_id = vmGet($_REQUEST, "manufacturer_id", null);
$Itemid = $sess->getShopItemid();
$db_product = new ps_DB;
// Get the product info from the database
$q = "SELECT * FROM `#__{vm}_product` WHERE ";
if( !empty($product_id)) {
$q .= "`product_id`=$product_id";
}
elseif( !empty($product_sku )) {
$q .= "`product_sku`='$product_sku'";
}
else {
vmRedirect( $sess->url( $_SERVER['PHP_SELF']."?keyword=".urlencode($keyword)."&category_id={$_SESSION['session_userstate']['category_id']}&limitstart={$_SESSION['limitstart']}&page=shop.browse", false, false ), $VM_LANG->_('PHPSHOP_PRODUCT_NOT_FOUND') );
}
if( !$perm->check("admin,storeadmin") ) {
$q .= " AND `product_publish`='Y'";
if( CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {
$q .= " AND `product_in_stock` > 0 ";
}
}
$db_product->query( $q );
// Redirect back to Product Browse Page on Error
if( !$db_product->next_record() ) {
$vmLogger->err( $VM_LANG->_('PHPSHOP_PRODUCT_NOT_FOUND',false) );
return;
}
if( empty($product_id)) {
$product_id = $db_product->f('product_id');
}
$product_parent_id = (int)$db_product->f("product_parent_id");
if ($product_parent_id != 0) {
$dbp= new ps_DB;
$dbp->query('SELECT * FROM `#__{vm}_product` WHERE `product_id`='.$product_parent_id );
$dbp->next_record();
}
// Create the template object
$tpl = vmTemplate::getInstance();
// Let's have a look wether the product has related products.
$q = "SELECT product_sku, related_products FROM #__{vm}_product,#__{vm}_product_relations ";
$q .= "WHERE #__{vm}_product_relations.product_id='$product_id' AND product_publish='Y' ";
$q .= "AND FIND_IN_SET(#__{vm}_product.product_id, REPLACE(related_products, '|', ',' )) LIMIT 0, 4";
$db->query( $q );
/*// This shows randomly selected products from the products table
// if you don't like to set up related products for each product
$q = "SELECT product_sku FROM #__{vm}_product ";
$q .= "WHERE product_publish='Y' AND product_id != $product_id ";
$q .= "ORDER BY RAND() LIMIT 0, 4";
$db->query( $q );*/
$related_products = '';
if( $db->num_rows() > 0 ) {
$tpl->set( 'ps_product', $ps_product );
$tpl->set( 'products', $db );
$related_products = $tpl->fetch( '/common/relatedProducts.tpl.php' );
}
// GET THE PRODUCT NAME
$product_name = shopMakeHtmlSafe( $db_product->f("product_name") );
if( $db_product->f("product_publish") == "N" ) {
$product_name .= " (".$VM_LANG->_('CMN_UNPUBLISHED').")";
}
$product_description = $db_product->f("product_desc");
if( (str_replace("<br />", "" , $product_description)=='') && ($product_parent_id!=0) ) {
$product_description = $dbp->f("product_desc"); // Use product_desc from Parent Product
}
$product_description = vmCommonHTML::ParseContentByPlugins( $product_description );
// Get the CATEGORY NAVIGATION
$navigation_pathway = "";
$navigation_childlist = "";
$pathway_appended = false;
$flypage = vmGet($_REQUEST, "flypage" );
// Each Product is assigned to one or more Categories, if category_id was omitted, we must fetch it here
if (empty($category_id) || empty( $flypage )) {
$q = "SELECT cx.category_id, category_flypage FROM #__{vm}_category c, #__{vm}_product_category_xref cx WHERE product_id = '$product_id' AND c.category_id=cx.category_id LIMIT 0,1";
$db->query( $q );
$db->next_record();
if( !$db->f("category_id") ) {
// The Product Has no category entry and must be a Child Product
// So let's get the Parent Product
$q = "SELECT product_id FROM #__{vm}_product WHERE product_id = '".$db_product->f("product_parent_id")."' LIMIT 0,1";
$db->query( $q );
$db->next_record();
$q = "SELECT cx.category_id, category_flypage FROM #__{vm}_category c, #__{vm}_product_category_xref cx WHERE product_id = '".$db->f("product_id")."' AND c.category_id=cx.category_id LIMIT 0,1";
$db->query( $q );
$db->next_record();
}
$_GET['category_id'] = $category_id = $db->f("category_id");
}
$ps_product->addRecentProduct($product_id,$category_id,$tpl->get_cfg('showRecent', 5));
if( empty( $flypage )) {
$flypage = $db->f('category_flypage')? $db->f('category_flypage') : FLYPAGE;
}
// Flypage Parameter has old page syntax: shop.flypage
// so let's get the second part - flypage
$flypage = str_replace( 'shop.', '', $flypage);
$flypage = stristr( $flypage, '.tpl')? $flypage : $flypage . '.tpl';
// Set up the pathway
// Retrieve the pathway items for this product's category
$category_list = array_reverse( $ps_product_category->get_navigation_list( $category_id ) );
$pathway = $ps_product_category->getPathway( $category_list );
// Add this product's name to the pathway, with no link
$item = new stdClass();
$item->name = $product_name;
$item->link = '';
$pathway[] = $item;
// Set the CMS pathway
$vm_mainframe->vmAppendPathway( $pathway );
// Set the pathway for our template
$tpl->set( 'pathway', $pathway );
$tpl->set( 'product_name', $product_name );
// Get the neighbor Products to allow navigation on product level
$neighbors = $ps_product->get_neighbor_products( !empty( $product_parent_id )? $product_parent_id : $product_id );
$next_product = $neighbors['next'];
$previous_product = $neighbors['previous'];
$next_product_url = $previous_product_url = '';
if( !empty($next_product) ) {
$url_parameters = 'page=shop.product_details&product_id='.$next_product['product_id'].'&flypage='.$ps_product->get_flypage($next_product['product_id']).'&pop='.$pop;
if( $manufacturer_id ) {
$url_parameters .= "&manufacturer_id=" . $manufacturer_id;
}
if( $keyword != '') {
$url_parameters .= "&keyword=".urlencode($keyword);
}
if( $pop == 1 ) {
$next_product_url = $sess->url( $_SERVER['PHP_SELF'].'?'.$url_parameters );
} else {
$next_product_url = str_replace("index2","index",$sess->url( $url_parameters ));
}
}
if( !empty($previous_product) ) {
$url_parameters = 'page=shop.product_details&product_id='.$previous_product['product_id'].'&flypage='.$ps_product->get_flypage($previous_product['product_id']).'&pop='.$pop;
if( $manufacturer_id ) {
$url_parameters .= "&manufacturer_id=" . $manufacturer_id;
}
if( $keyword != '') {
$url_parameters .= "&keyword=".urlencode($keyword);
}
if( $pop == 1 ) {
$previous_product_url = $sess->url( $_SERVER['PHP_SELF'].'?'.$url_parameters );
} else {
$previous_product_url = str_replace("index2","index",$sess->url( $url_parameters ));
}
}
$tpl->set( 'next_product', $next_product );
$tpl->set( 'next_product_url', $next_product_url );
$tpl->set( 'previous_product', $previous_product );
$tpl->set( 'previous_product_url', $previous_product_url );
$parent_id_link = $db_product->f("product_parent_id");
$return_link = "";
if ($parent_id_link <> 0 ) {
$q = "SELECT product_name FROM #__{vm}_product WHERE product_id = '$product_parent_id' LIMIT 0,1";
$db->query( $q );
$db->next_record();
$product_parent_name = $db->f("product_name");
$return_link = " <a class=\"pathway\" href=\"";
$return_link .= $sess->url($_SERVER['PHP_SELF'] . "?page=shop.product_details&product_id=$parent_id_link");
$return_link .= "\">";
$return_link .= $product_parent_name;
$return_link .= "</a>";
$return_link .= " ".vmCommonHTML::pathway_separator()." ";
}
$tpl->set( 'return_link', $return_link );
// Create the pathway for our template
$navigation_pathway = $tpl->fetch( 'common/pathway.tpl.php');
if ($ps_product_category->has_childs($category_id) ) {
$category_childs = $ps_product_category->get_child_list($category_id);
$tpl->set( 'categories', $category_childs );
$navigation_childlist = $tpl->fetch( 'common/categoryChildlist.tpl.php');
}
// Set Dynamic Page Title
$vm_mainframe->setPageTitle( html_entity_decode( substr($product_name, 0, 60 ), ENT_QUOTES ));
// Prepend Product Short Description Meta Tag "description"
if( vmIsJoomla('1.5')) {
$document = JFactory::getDocument();
$document->setDescription(strip_tags( $db_product->f("product_s_desc")));
} else {
$mainframe->prependMetaTag( "description", strip_tags( $db_product->f("product_s_desc")) );
}
// Show an "Edit PRODUCT"-Link
if ($perm->check("admin,storeadmin")) {
$edit_link = '<a href="'. $sess->url( 'index2.php?page=product.product_form&next_page=shop.product_details&product_id='.$product_id).'">
<img src="images/M_images/edit.png" width="16" height="16" alt="'. $VM_LANG->_('PHPSHOP_PRODUCT_FORM_EDIT_PRODUCT').'" border="0" /></a>';
}
else {
$edit_link = "";
}
// LINK TO MANUFACTURER POP-UP
$manufacturer_id = $ps_product->get_manufacturer_id($product_id);
$manufacturer_name = $ps_product->get_mf_name($product_id);
$manufacturer_link = "";
if( $manufacturer_id && !empty($manufacturer_name) ) {
$link = "$mosConfig_live_site/index2.php?page=shop.manufacturer_page&manufacturer_id=$manufacturer_id&output=lite&option=com_virtuemart&Itemid=".$Itemid;
$text = '( '.$manufacturer_name.' )';
$manufacturer_link .= vmPopupLink( $link, $text );
// Avoid JavaScript on PDF Output
if( @$_REQUEST['output'] == "pdf" )
$manufacturer_link = "<a href=\"$link\" target=\"_blank\" title=\"$text\">$text</a>";
}
// PRODUCT PRICE
if (_SHOW_PRICES == '1') {
if( $db_product->f("product_unit") && VM_PRICE_SHOW_PACKAGING_PRICELABEL) {
$product_price_lbl = "<strong>". $VM_LANG->_('PHPSHOP_CART_PRICE_PER_UNIT').' ('.$db_product->f("product_unit")."):</strong>";
}
else {
$product_price_lbl = "<strong>". $VM_LANG->_('PHPSHOP_CART_PRICE'). ": </strong>";
}
$product_price = $ps_product->show_price( $product_id );
}
else {
$product_price_lbl = "";
$product_price = "";
}
// @var array $product_price_raw The raw unformatted Product Price in Float Format
$product_price_raw = $ps_product->get_adjusted_attribute_price($product_id);
// Change Packaging - Begin
// PRODUCT PACKAGING
if ( $db_product->f("product_packaging") ) {
$packaging = $db_product->f("product_packaging") & 0xFFFF;
$box = ($db_product->f("product_packaging") >> 16) & 0xFFFF;
$product_packaging = "";
if ( $packaging ) {
$product_packaging .= $VM_LANG->_('PHPSHOP_PRODUCT_PACKAGING1').$packaging;
if( $box ) $product_packaging .= "<br/>";
}
if ( $box ) {
$product_packaging .= $VM_LANG->_('PHPSHOP_PRODUCT_PACKAGING2').$box;
}
$product_packaging = str_replace("{unit}",$db_product->f("product_unit")?$db_product->f("product_unit") : $VM_LANG->_('PHPSHOP_PRODUCT_FORM_UNIT_DEFAULT'),$product_packaging);
}
else {
$product_packaging = "";
}
// Change Packaging - End
// PRODUCT IMAGE
$product_full_image = $product_parent_id!=0 && !$db_product->f("product_full_image")?
$dbp->f("product_full_image") : $db_product->f("product_full_image"); // Change
$product_thumb_image = $product_parent_id!=0 && !$db_product->f("product_thumb_image")?
$dbp->f("product_thumb_image") : $db_product->f("product_thumb_image"); // Change
/* MORE IMAGES ? */
$files = ps_product_files::getFilesForProduct( $product_id );
$more_images = "";
if( !empty($files['images']) ) {
$more_images = $tpl->vmMoreImagesLink( $files['images'] );
}
// Does the Product have files?
$file_list = ps_product_files::get_file_list( $product_id );
$product_availability = '';
if( @$_REQUEST['output'] != "pdf" ) {
// Show the PDF, Email and Print buttons
$tpl->set('option', $option);
$tpl->set('category_id', $category_id );
$tpl->set('product_id', $product_id );
$buttons_header = $tpl->fetch( 'common/buttons.tpl.php' );
$tpl->set( 'buttons_header', $buttons_header );
// AVAILABILITY
// This is the place where it shows: Availability: 24h, In Stock: 5 etc.
// You can make changes to this functionality in the file: classes/ps_product.php
$product_availability = $ps_product->get_availability($product_id);
}
$product_availability_data = $ps_product->get_availability_data($product_id);
/** Ask seller a question **/
$ask_seller_href = $sess->url( $_SERVER ['PHP_SELF'].'?page=shop.ask&flypage='.@$_REQUEST['flypage']."&product_id=$product_id&category_id=$category_id" );
$ask_seller_text = $VM_LANG->_('VM_PRODUCT_ENQUIRY_LBL');
$ask_seller = '<a class="button" href="'. $ask_seller_href .'">'. $ask_seller_text .'</a>';
/* SHOW RATING */
$product_rating = "";
if (PSHOP_ALLOW_REVIEWS == '1') {
$product_rating = ps_reviews::allvotes( $product_id );
}
$product_reviews = $product_reviewform = "";
/* LIST ALL REVIEWS **/
if (PSHOP_ALLOW_REVIEWS == '1') {
/*** Show all reviews available ***/
$product_reviews = ps_reviews::product_reviews( $product_id );
/*** Show a form for writing a review ***/
if( $auth['user_id'] > 0 ) {
$product_reviewform = ps_reviews::reviewform( $product_id );
}
}
/* LINK TO VENDOR-INFO POP-UP **/
$vend_id = $ps_product->get_vendor_id($product_id);
$vend_name = $ps_product->get_vendorname($product_id);
$link = "$mosConfig_live_site/index2.php?page=shop.infopage&vendor_id=$vend_id&output=lite&option=com_virtuemart&Itemid=".$Itemid;
$text = $VM_LANG->_('PHPSHOP_VENDOR_FORM_INFO_LBL');
$vendor_link = vmPopupLink( $link, $text );
// Avoid JavaScript on PDF Output
if( @$_REQUEST['output'] == "pdf" )
$vendor_link = "<a href=\"$link\" target=\"_blank\" title=\"$text\">$text</a>";
if ($product_parent_id!=0 && !$ps_product_type->product_in_product_type($product_id)) {
$product_type = $ps_product_type->list_product_type($product_parent_id);
}
else {
$product_type = $ps_product_type->list_product_type($product_id);
}
$recent_products = $ps_product->recentProducts($product_id,$tpl->get_cfg('showRecent', 5));
/**
* This has changed since VM 1.1.0
* Now we have a template object that can use all variables
* that we assign here.
*
* Example: If you run
* $tpl->set( "product_name", $product_name );
* The variable "product_name" will be available in the template under this name
* with the value of $product_name
*
* */
// This part allows us to copy ALL properties from the product table
// into the template
$productData = $db_product->get_row();
$productArray = get_object_vars( $productData );
$productArray["product_id"] = $product_id;
$productArray["product_full_image"] = $product_full_image; // to display the full image on flypage
$productArray["product_thumb_image"] = $product_thumb_image;
$tpl->set( 'productArray', $productArray );
foreach( $productArray as $property => $value ) {
$tpl->set( $property, $value);
}
// Assemble the thumbnail image as a link to the full image
// This function is defined in the theme (theme.php)
$product_image = $tpl->vmBuildFullImageLink( $productArray );
$tpl->set( "product_id", $product_id );
$tpl->set( "product_name", $product_name );
$tpl->set( "product_image", $product_image );
$tpl->set( "more_images", $more_images );
$tpl->set( "images", $files['images'] );
$tpl->set( "files", $files['files'] );
$tpl->set( "file_list", $file_list );
$tpl->set( "edit_link", $edit_link );
$tpl->set( "manufacturer_link", $manufacturer_link );
$tpl->set( "product_price", $product_price );
$tpl->set( "product_price_lbl", $product_price_lbl );
$tpl->set( 'product_price_raw', $product_price_raw );
$tpl->set( "product_description", $product_description );
/* ADD-TO-CART */
$tpl->set( 'manufacturer_id', $manufacturer_id );
$tpl->set( 'flypage', $flypage );
$tpl->set( 'ps_product_attribute', $ps_product_attribute );
$addtocart = $tpl->fetch('product_details/includes/addtocart_form.tpl.php' );
$tpl->set( "addtocart", $addtocart );
// Those come from separate template files
$tpl->set( "navigation_pathway", $navigation_pathway );
$tpl->set( "navigation_childlist", $navigation_childlist );
$tpl->set( "product_reviews", $product_reviews );
$tpl->set( "product_reviewform", $product_reviewform );
$tpl->set( "product_availability", $product_availability );
$tpl->set( "product_availability_data", $product_availability_data );
$tpl->set( "related_products", $related_products );
$tpl->set( "vendor_link", $vendor_link );
$tpl->set( "product_type", $product_type ); // Changed Product Type
$tpl->set( "product_packaging", $product_packaging ); // Changed Packaging
$tpl->set( "ask_seller_href", $ask_seller_href ); // Product Enquiry!
$tpl->set( "ask_seller_text", $ask_seller_text ); // Product Enquiry!
$tpl->set( "ask_seller", $ask_seller ); // Product Enquiry!
$tpl->set( "recent_products", $recent_products); // Recent products
/* Finish and Print out the Page */
echo $tpl->fetch( '/product_details/'.$flypage . '.php' );
?>
проблема та же: нету строчек
shop.browse.php:
$product_cell = str_replace( "{product_name}", shopMakeHtmlSafe( $product_name ), $product_cell );shop.product_detailes.php:
/** NOW LET'S BEGIN AND FILL THE TEMPLATE **/2. В свой файл /administrator/components/com_virtuemart/html/templates/browse/browse*.php добавляем заглушку в нужное место
Все.
вообще не знаю... нету у меня никаких папок в /administrator/components/com_virtuemart/html/
4-ый пункт: тоже самое - нету ничего кроме php-шников
--
пробовал сделать так как
ibrogim - не подействовало (без понятия почему)
--
плачу