| Current Path : /proc/1908984/root/proc/1908984/root/home/digilove/www/41423/ |
| Current File : //proc/1908984/root/proc/1908984/root/home/digilove/www/41423/category.tar |
tmpl/default.php 0000644 00000015453 15234453517 0007676 0 ustar 00 <?php
/**
*
* Show the products in a category
*
* @package VirtueMart
* @subpackage
* @author RolandD
* @author Max Milbers
* @todo add pagination
* @link https://virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. 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.
* @version $Id: default.php 10682 2022-06-28 13:23:55Z Milbo $
*/
defined ('_JEXEC') or die('Restricted access');
if (vRequest::getInt('dynamic',false) and vRequest::getInt('virtuemart_product_id',false)) {
if (!empty($this->products)) {
if($this->fallback){
$p = $this->products;
$this->products = array();
$this->products[0] = $p;
vmdebug('Refallback');
}
echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('products'=>$this->products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));
}
return ;
}
?> <div class="category-view"> <?php
$js = "
jQuery(document).ready(function ($) {
$('.orderlistcontainer').hover(
function() { $(this).find('.orderlist').stop().show()},
function() { $(this).find('.orderlist').stop().hide()}
)
});
";
vmJsApi::addJScript('vm-hover',$js);
if ($this->show_store_desc and !empty($this->vendor->vendor_store_desc)) { ?>
<div class="vendor-store-desc">
<?php echo $this->vendor->vendor_store_desc; ?>
</div>
<?php }
if (!empty($this->showcategory_desc) and empty($this->keyword)){
if(!empty($this->category)) {
?>
<div class="category_description">
<?php echo $this->category->category_description; ?>
</div>
<?php }
if(!empty($this->manu_descr)) {
?>
<div class="manufacturer-description">
<?php echo $this->manu_descr; ?>
</div>
<?php }
}
// Show child categories
if ($this->showcategory and empty($this->keyword)) {
if (!empty($this->category->has_children)) {
echo ShopFunctionsF::renderVmSubLayout('categories',array('categories'=>$this->category->children, 'categories_per_row'=>$this->categories_per_row));
}
}
if (!empty($this->products) or ($this->showsearch or $this->keyword !== false)) {
?>
<div class="browse-view">
<?php
if ($this->showsearch or $this->keyword !== false) {
//id taken in the view.html.php could be modified
$category_id = vRequest::getInt ('virtuemart_category_id', 0); ?>
<!--BEGIN Search Box -->
<div class="virtuemart_search">
<form action="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=category&limitstart=0', FALSE); ?>" method="get">
<?php if(!empty($this->searchCustomList)) { ?>
<div class="vm-search-custom-list">
<?php echo $this->searchCustomList ?>
</div>
<?php } ?>
<?php if(!empty($this->searchCustomValuesAr)) { ?>
<div class="vm-search-custom-values">
<?php
echo ShopFunctionsF::renderVmSubLayoutAsGrid(
'searchcustomvalues',
array (
'searchcustomvalues' => $this->searchCustomValuesAr,
'options' => array (
'items_per_row' => array (
'xs' => 2,
'sm' => 2,
'md' => 2,
'lg' => 2,
'xl' => 2,
),
),
)
);
?>
</div>
<?php if(count($this->searchCustomValuesAr)>1){
?>
<div><?php echo vmText::_('COM_VM_COMBINETAGS');
echo VmHtml::checkbox ('combineTags', $this->combineTags, 1, 0, '', 'combineTags'); ?></div>
<?php }
} ?>
<div class="vm-search-custom-search-input">
<input name="keyword" class="inputbox" type="text" size="40" value="<?php echo $this->keyword ?>"/>
<input type="submit" value="<?php echo vmText::_ ('COM_VIRTUEMART_SEARCH') ?>" class="button" onclick="this.form.keyword.focus();"/>
<?php //echo VmHtml::checkbox ('searchAllCats', (int)$this->searchAllCats, 1, 0, 'class="changeSendForm"'); ?>
<span class="vm-search-descr"> <?php echo vmText::_('COM_VM_SEARCH_DESC') ?></span>
</div>
<!-- input type="hidden" name="showsearch" value="true"/ -->
<input type="hidden" name="view" value="category"/>
<input type="hidden" name="option" value="com_virtuemart"/>
<input type="hidden" name="virtuemart_category_id" value="<?php echo $category_id; ?>"/>
<input type="hidden" name="Itemid" value="<?php echo $this->Itemid; ?>"/>
</form>
</div>
<!-- End Search Box -->
<?php
/*if($this->keyword !== false){
?><h3><?php echo vmText::sprintf('COM_VM_SEARCH_KEYWORD_FOR', $this->keyword); ?></h3><?php
}*/
$j = 'jQuery(document).ready(function($) {
$(".changeSendForm")
.off("change",Virtuemart.sendCurrForm)
.on("change",Virtuemart.sendCurrForm);
})';
vmJsApi::addJScript('sendFormChange',$j);
} ?>
<?php // Show child categories
if(!empty($this->orderByList)) { ?>
<div class="orderby-displaynumber">
<div class="floatleft vm-order-list">
<?php echo $this->orderByList['orderby']; ?>
<?php echo $this->orderByList['manufacturer']; ?>
</div>
<div class="vm-pagination vm-pagination-top">
<?php echo $this->vmPagination->getPagesLinks (); ?>
<span class="vm-page-counter"><?php echo $this->vmPagination->getPagesCounter (); ?></span>
</div>
<div class="floatright display-number"><?php echo $this->vmPagination->getResultsCounter ();?><br/><?php echo $this->vmPagination->getLimitBox ($this->category->limit_list_step); ?></div>
<div class="clear"></div>
</div> <!-- end of orderby-displaynumber -->
<?php } ?>
<?php if (!empty($this->category->category_name)) { ?>
<h1><?php echo vmText::_($this->category->category_name); ?></h1>
<?php } ?>
<?php
if (!empty($this->products)) {
//revert of the fallback in the view.html.php, will be removed vm3.2
if($this->fallback){
$p = $this->products;
$this->products = array();
$this->products[0] = $p;
vmdebug('Refallback');
}
echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('products'=>$this->products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));
if(!empty($this->orderByList)) { ?>
<div class="vm-pagination vm-pagination-bottom"><?php echo $this->vmPagination->getPagesLinks (); ?><span class="vm-page-counter"><?php echo $this->vmPagination->getPagesCounter (); ?></span></div>
<?php }
} elseif ($this->keyword !== false) {
echo vmText::_ ('COM_VIRTUEMART_NO_RESULT') . ($this->keyword ? ' : (' . $this->keyword . ')' : '');
}
?>
</div>
<?php } ?>
</div>
<!-- end browse-view -->
tmpl/default.xml 0000644 00000036166 15234453517 0007713 0 ustar 00 <?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_VIRTUEMART_CATEGORY_VIEW_DEFAULT_TITLE">
<message><![CDATA[COM_VIRTUEMART_CATEGORY_VIEW_DEFAULT_DESC]]></message>
</layout>
<fields name="request" addfieldpath="/administrator/components/com_virtuemart/fields">
<fieldset name="request" >
<field name="virtuemart_category_id" type="vmcategory"
default="0"
label="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_TITLE" required="true"
extension="com_virtuemart"
description="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_TITLE_DESC" />
<field name="virtuemart_manufacturer_id" type="manufacturer"
default="0"
label="COM_VIRTUEMART_MANUFACTURER_FIELD_SELECT_TITLE" required="true"
extension="com_virtuemart"
description="COM_VIRTUEMART_MANUFACTURER_FIELD_SELECT_TITLE_DESC" />
<field name="clearCart" type="radio"
default="0"
label="COM_VIRTUEMART_CLEAR_CART" required="false"
extension="com_virtuemart"
description="COM_VIRTUEMART_CLEAR_CART_DESC" >
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="limitstart" type="hidden" default="0" />
</fieldset>
</fields>
<fields name="params" addfieldpath="/administrator/components/com_virtuemart/fields">
<fieldset name="DISPLAY" >
<field name="storefront" type="radio" default=""
label="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_STOREFRONT"
extension="com_virtuemart"
description="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_STOREFRONT_DESC" >
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="show_store_desc" type="list" default=""
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_STORE_DESC"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_STORE_DESC_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="categorylayout" type="vmlayout" view="category"
label="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_LAYOUT"
extension="com_virtuemart"
description="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_LAYOUT_DESC" />
<field name="showcategory_desc" type="list" default=""
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_CATEGORYDESC"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_CATEGORYDESC_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="showcategory" type="list" default=""
label="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_SHOWCAT"
extension="com_virtuemart"
description="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_SHOWCAT_DESC" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="categories_per_row" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_CATEGORIES_PER_ROW"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="showproducts" type="list" default=""
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_PRODUCTS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_PRODUCTS_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="showsearch" type="list" default=""
label="COM_VM_CATEGORY_FIELD_SELECT_SHOWSEARCH"
extension="com_virtuemart"
description="COM_VM_CATEGORY_FIELD_SELECT_SHOWSEARCH_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="productsublayout" type="vmproductsublayout"
label="COM_VIRTUEMART_CFG_PRODUCTS_SUBLAYOUT"
extension="com_virtuemart"
description="COM_VIRTUEMART_CFG_PRODUCTS_SUBLAYOUT_TIP" />
<field name="products_per_row" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_PRODUCTS_PER_ROW"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="featured" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_FEATURED"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_FEATURED_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="featured_rows" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_FEAT_PROD_ROWS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="discontinued" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_DISCONTINUED"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_DISCONTINUED_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="discontinued_rows" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_DISC_PROD_ROWS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="latest" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_LATEST"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_LATEST_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="latest_rows" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_LAT_PROD_ROWS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="topten" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_TOPTEN"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_TOPTEN_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="topten_rows" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_TOPTEN_PROD_ROWS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="recent" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_RECENT"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_RECENT_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="recent_rows" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_REC_PROD_ROWS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
</fieldset>
<fieldset name="STOREFRONT" >
<field name="COM_VIRTUEMART_STOREFRONT_HELP" type="vmhelptext"
label="COM_VIRTUEMART_STOREFRONT_HELP_TITLE"
description="COM_VIRTUEMART_STOREFRONT_HELP_DESC" />
<field name="stf_itemid" type="text"
label="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_ITEMID"
extension="com_virtuemart"
description="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_ITEMID_TIP" />
<field name="stf_categorylayout" type="vmlayout" view="category"
label="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_LAYOUT"
extension="com_virtuemart"
description="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_LAYOUT_DESC" />
<field name="stf_show_store_desc" type="list" default=""
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_STORE_DESC"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_STORE_DESC_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="stf_showcategory_desc" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_CATEGORYDESC"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_CATEGORYDESC_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="stf_showcategory" type="list"
label="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_SHOWCAT"
extension="com_virtuemart"
description="COM_VIRTUEMART_CATEGORY_FIELD_SELECT_SHOWCAT_DESC" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="stf_categories_per_row" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_CATEGORIES_PER_ROW"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="stf_showproducts" type="list" default=""
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_PRODUCTS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_PRODUCTS_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="stf_showsearch" type="list"
label="COM_VM_CATEGORY_FIELD_SELECT_SHOWSEARCH"
extension="com_virtuemart"
description="COM_VM_CATEGORY_FIELD_SELECT_SHOWSEARCH_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="stf_productsublayout" type="vmproductsublayout"
label="COM_VIRTUEMART_CFG_PRODUCTS_SUBLAYOUT"
extension="com_virtuemart"
description="COM_VIRTUEMART_CFG_PRODUCTS_SUBLAYOUT_TIP" />
<field name="stf_products_per_row" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_PRODUCTS_PER_ROW"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="stf_featured" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_FEATURED"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_FEATURED_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="stf_featured_rows" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_FEAT_PROD_ROWS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="stf_discontinued" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_DISCONTINUED"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_DISCONTINUED_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="stf_discontinued_rows" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_DISC_PROD_ROWS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="stf_latest" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_LATEST"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_LATEST_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="stf_latest_rows" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_LAT_PROD_ROWS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="stf_topten" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_TOPTEN"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_TOPTEN_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="stf_topten_rows" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_TOPTEN_PROD_ROWS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
<field name="stf_recent" type="list"
label="COM_VIRTUEMART_ADMIN_CFG_SHOW_RECENT"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_SHOW_RECENT_TIP" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="stf_recent_rows" type="text"
label="COM_VIRTUEMART_ADMIN_CFG_REC_PROD_ROWS"
extension="com_virtuemart"
description="COM_VIRTUEMART_ADMIN_CFG_PER_ROW_TIP" />
</fieldset>
</fields>
</metadata>
tmpl/index.html 0000644 00000000037 15234453517 0007526 0 ustar 00 <!DOCTYPE html><title></title>
index.html 0000644 00000000037 15234453517 0006552 0 ustar 00 <!DOCTYPE html><title></title>
view.html.php 0000644 00000070766 15234453517 0007223 0 ustar 00 <?php
/**
*
* Handle the category view
*
* @package VirtueMart
* @subpackage
* @author Max Milbers
* @link https://virtuemart.net
* @copyright Copyright (c) 2004 - 2019 VirtueMart Team. 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.
* @version $Id: view.html.php 10847 2023-05-03 08:53:29Z Milbo $
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
/**
* Handle the category view
*
* @package VirtueMart
* @author Max Milbers
*/
class VirtuemartViewCategory extends VmView {
public $combineTags = true;
public function display($tpl = null) {
//For BC, we convert first the new config param names to the old ones
//Attention, this will be removed around 2020.
if(VmConfig::get('legacylayouts',false)){
VmConfig::set('show_featured', VmConfig::get('featured'));
VmConfig::set('show_discontinued', VmConfig::get('discontinued'));
VmConfig::set('show_topTen', VmConfig::get('topten'));
VmConfig::set('show_recent', VmConfig::get('recent'));
VmConfig::set('show_latest', VmConfig::get('latest'));
VmConfig::set('featured_products_rows', VmConfig::get('featured_rows'));
VmConfig::set('discontinued_products_rows', VmConfig::get('discontinued_rows'));
VmConfig::set('topTen_products_rows', VmConfig::get('topten_rows'));
VmConfig::set('recent_products_rows', VmConfig::get('recent_rows'));
VmConfig::set('latest_products_rows', VmConfig::get('latest_rows'));
VmConfig::set('omitLoaded_topTen', VmConfig::get('omitLoaded_topten'));
VmConfig::set('showCategory', VmConfig::get('showcategory'));
}
$this->show_prices = (int)VmConfig::get('show_prices',1);
$document = JFactory::getDocument();
$this->app = JFactory::getApplication();
$pathway = $this->app->getPathway();
if( vmAccess::isFEmanager('product.edit') ){
$add_product_link = JURI::root() . 'index.php?option=com_virtuemart&tmpl=component&view=product&task=edit&virtuemart_product_id=0&managing=1' ;
$add_product_link = $this->linkIcon($add_product_link, 'COM_VIRTUEMART_PRODUCT_FORM_NEW_PRODUCT', 'edit', false, false);
} else {
$add_product_link = "";
}
$this->assignRef('add_product_link', $add_product_link);
$menus = $this->app->getMenu();
$menu = $menus->getActive();
//vmdebug('My active menu item',$menu);
if(!empty($menu->id)){
$itemId = $menu->id;
} else {
$itemId = vRequest::getInt('Itemid',false);
if($itemId){
$menus->setActive($itemId);
$menu = $menus->getActive();
}
if(empty($menu->id)){
$menu = $menus->getDefault();
vmdebug('$menu = $menus->getDefault',$itemId);
}
}
if(empty($menu)){
$menu = new stdClass;
$menuParams = new JRegistry();
} else {
$menuParams = $menu->getParams();
}
$stf_itemid = $menuParams->get('stf_itemid',false);
if(!empty($stf_itemid) ){
$mstf=$menus->getItem($stf_itemid);
if(!empty($mstf)){
$menu = $mstf;
}
}
ShopFunctionsF::setLastVisitedItemId($itemId);
$this->Itemid = $itemId;
$this->productModel = VmModel::getModel('product');
$this->keyword = $this->productModel->keyword;
$this->virtuemart_manufacturer_id = vRequest::getInt('virtuemart_manufacturer_id', -1 );
if($this->virtuemart_manufacturer_id ===-1 and isset($menu->query['virtuemart_manufacturer_id'])){
$this->virtuemart_manufacturer_id = $menu->query['virtuemart_manufacturer_id'];
vRequest::setVar('virtuemart_manufacturer_id',$this->virtuemart_manufacturer_id);
}
//vmdebug('caetgory view $this->virtuemart_manufacturer_id',$this->virtuemart_manufacturer_id,$menu->query['virtuemart_manufacturer_id'],vRequest::getInt('virtuemart_manufacturer_id', -1 ),$_REQUEST);
$this->categoryId = vRequest::getInt('virtuemart_category_id', -1);
if($this->categoryId === -1 and isset($menu->query['virtuemart_category_id'])){
$this->categoryId = $menu->query['virtuemart_category_id'];
vRequest::setVar('virtuemart_category_id',$this->categoryId);
} else if ( $this->categoryId === -1 and $this->virtuemart_manufacturer_id === -1 and empty($this->keyword)){
$this->categoryId = ShopFunctionsF::getLastVisitedCategoryId();
}
if(empty($this->categoryId) and $this->virtuemart_manufacturer_id===''){
vmInfo(vmText::_('COM_VIRTUEMART_MANU_NOT_FOUND'));
$this->handle404();
}
if ($this->categoryId === -1 and $this->virtuemart_manufacturer_id){
$this->categoryId = 0;
}
$this->setCanonicalLink($tpl,$document,$this->categoryId,$this->virtuemart_manufacturer_id);
if($this->categoryId===-1) $this->categoryId = 0;
if($this->virtuemart_manufacturer_id===-1) $this->virtuemart_manufacturer_id = 0;
$prefix = '';
if(empty($this->keyword)) $this->keyword = false;
if( (isset($menu->query['virtuemart_category_id']) and $menu->query['virtuemart_category_id']!=$this->categoryId) or
(isset($menu->query['virtuemart_manufacturer_id']) and $menu->query['virtuemart_manufacturer_id']!=$this->virtuemart_manufacturer_id) or
!empty($this->keyword ) ) {
$prefix = 'stf_';
}
$paramNames = array('itemid'=>'',
'categorylayout' => VmConfig::get('categorylayout', 0),
'show_store_desc' => VmConfig::get('show_store_desc',1),
'showcategory_desc' => VmConfig::get('showcategory_desc', 1),
'showcategory' => VmConfig::get('showcategory',1),
'categories_per_row' => VmConfig::get('categories_per_row',3),
'showproducts' => VmConfig::get('showproducts',1),
'showsearch' => VmConfig::get('showsearch',0),
'productsublayout' => VmConfig::get('productsublayout', 0),
'products_per_row' => VmConfig::get('products_per_row', 3),
'featured' => VmConfig::get('featured',1),
'featured_rows' => VmConfig::get('featured_rows',1),
'discontinued' => VmConfig::get('discontinued',0),
'discontinued_rows' => VmConfig::get('discontinued_rows',1),
'latest' => VmConfig::get('latest',1),
'latest_rows' => VmConfig::get('latest_rows',1),
'topten' => VmConfig::get('topten',1),
'topten_rows' => VmConfig::get('topten_rows',1),
'recent' => VmConfig::get('recent',0),
'recent_rows' => VmConfig::get('recent_rows',1));
$categoryModel = VmModel::getModel('category');
// set search and keyword
if ($this->productModel->keyword){
$pathway->addItem(strip_tags(htmlspecialchars_decode($this->keyword)));
}
$this->category = $categoryModel->getCategory($this->categoryId, false);
foreach($paramNames as $k => $v){
if(!isset($this->category->{$k}) or $this->category->{$k}==''){
$this->{$k} = $menuParams->get($prefix.$k,$v);
} else if(isset($this->category->{$k})){
$this->{$k} = $this->category->{$k};
}
}
$this->storefront = $menuParams->get('storefront',0);
$this->perRow = $this->products_per_row = empty($this->category->products_per_row)? $menuParams->get($prefix.'products_per_row',$paramNames['products_per_row']):$this->category->products_per_row;
$vendorId = $this->category->virtuemart_vendor_id;
if(empty($vendorId)) $vendorId = 1; //If we are in the root category, the id is empty
//No redirect here, for category id = 0 means show ALL categories! note by Max Milbers
if ((!empty($this->categoryId) and $this->categoryId!==-1 ) and (empty($this->category->slug) or !$this->category->published)) {
$this->handle404();
}
$ratingModel = VmModel::getModel('ratings');
$this->productModel->withRating = $this->showRating = $ratingModel->showRating();
$this->vmPagination = '';
$this->orderByList = array();
$this->searchcustom = '';
$this->searchCustomValues = ''; //deprecated
$this->searchCustomValuesAr = array ();
$app = JFactory::getApplication();
if(!empty($this->keyword) or $this->showsearch){
$this->getSearchCustom();
$this->searchAllCats = $app->getUserStateFromRequest('com_virtuemart.customfields.searchAllCats','searchAllCats',false);
}
shopFunctionsF::setLastVisitedCategoryId($this->categoryId);
shopFunctionsF::setLastVisitedManuId($this->virtuemart_manufacturer_id);
//We need to load the cart here, to get correct discounts
if(!VmConfig::get('use_as_catalog',false)) $cart = VirtuemartCart::getCart();
$imgAmount = VmConfig::get('prodimg_browse',1);
$dynamic = vRequest::getInt('dynamic',false);
$id = vRequest::getInt('virtuemart_product_id',false);
$legacy = VmConfig::get('legacylayouts',1);
$this->products = array();
$this->productModel->cartattribute = (int)VmConfig::get('BrowseProductCartattributeOnly',1);
if ($dynamic and $id) {
$p = $this->productModel->getProduct ($id);
$this->products['products'][] = $p;
$this->productModel->addImages($this->products['products'], $imgAmount );
$this->orderByList = array('orderby' => '', 'manufacturer' => '');
if($legacy) {
$this->vmPagination = $this->productModel->getPagination($this->perRow);
}
} else {
//The search must be executed first
if(!empty($this->keyword) or !empty($this->productModel->searchcustoms)) {
vmdebug('Lets load the search',$this->keyword,$this->productModel->searchcustoms);
// Load the products in the given category
$ids = $this->productModel->sortSearchListQuery (TRUE, $this->categoryId);
VirtueMartModelProduct::$_alreadyLoadedIds = array_merge(VirtueMartModelProduct::$_alreadyLoadedIds,$ids);
$this->vmPagination = $this->productModel->getPagination($this->perRow);
$this->orderByList = $this->productModel->getOrderByList($this->categoryId);
$this->products['products'] = $this->productModel->getProducts ($ids);
$this->productModel->addImages($this->products['products'], $imgAmount );
}
if($legacy) {
if($this->showproducts){
$opt = array('products');
} else {
$opt = array();
}
} else {
$sequence = VmConfig::get('ProductGroupsSequence','');
if(empty($sequence)){
$opt = array('featured', 'discontinued', 'latest', 'topten', 'recent');
} else {
$opt = explode(',',$sequence);
}
if($this->showproducts and empty($this->keyword) and empty($this->productModel->searchcustoms)){
$opt[] = 'products';
}
}
foreach( $opt as $o ) {
$o = trim($o);
if($o == 'products') {
VirtueMartModelProduct::$omitLoaded = VmConfig::get('omitLoaded');
$ids = $this->productModel->sortSearchListQuery( TRUE, $this->categoryId );
VirtueMartModelProduct::$_alreadyLoadedIds = array_merge( VirtueMartModelProduct::$_alreadyLoadedIds, $ids );
$this->vmPagination = $this->productModel->getPagination( $this->perRow );
$this->orderByList = $this->productModel->getOrderByList( $this->categoryId );
$this->products['products'] = $this->productModel->getProducts( $ids );
$this->productModel->addImages( $this->products['products'], $imgAmount );
} else {
//Lets check, if we use the new Frontpages settings
VirtueMartModelProduct::$omitLoaded = VmConfig::get( 'omitLoaded_'.$o, true );
if(!empty( $this->{$o} ) and !empty( $this->{$o.'_rows'} )) {
$this->products[$o] = $this->productModel->getProductListing( $o, $this->perRow*$this->{$o.'_rows'} );
$this->productModel->addImages( $this->products[$o], $imgAmount );
}
}
}
}
$this->productModel->cartattribute = -1;
if ($this->products) {
$this->currency = CurrencyDisplay::getInstance( );
$display_stock = VmConfig::get('display_stock',1);
$showCustoms = VmConfig::get('show_pcustoms',1);
//Unset the empty product groups to avoid errors with old layouts
foreach($this->products as $pType => $productSeries) {
if($productSeries===false) unset($this->products[$pType]);
}
if($display_stock or $showCustoms){
if(!$showCustoms){
foreach($this->products as $pType => $productSeries){
foreach($productSeries as $i => $productItem){
$this->products[$pType][$i]->stock = $this->productModel->getStockIndicator($productItem);
}
}
} else {
foreach($this->products as $pType => $productSeries) {
shopFunctionsF::sortLoadProductCustomsStockInd($this->products[$pType],$this->productModel);
}
}
}
}
// Add feed links
if ($this->products && VmConfig::get('feed_cat_published', 0)==1) {
$link = vmURI::getCurrentUrlBy('get').'&format=feed&limitstart=';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link . '&type=rss', false), 'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link . '&type=atom', false), 'alternate', 'rel', $attribs);
}
$this->showBasePrice = (vmAccess::manager() or vmAccess::isSuperVendor());
// Add the category name to the pathway
if ($this->category->parents) {
foreach ($this->category->parents as $c){
if(!empty($c->virtuemart_category_id) and !empty($c->category_name) and !empty($c->published)){
$pathway->addItem(strip_tags(vmText::_($c->category_name)),JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$c->virtuemart_category_id, FALSE));
} else vmdebug('parent category is empty',$this->category->parents);
}
}
$catImgAmount = VmConfig::get('catimg_browse',1);
$categoryModel->addImages($this->category,$catImgAmount);
if($this->showcategory){
$this->category->children = $categoryModel->getChildCategoryList( $vendorId, $this->categoryId, $categoryModel->getDefaultOrdering(), $categoryModel->_selectedOrderingDir );
$categoryModel->addImages($this->category->children,$catImgAmount);
//$this->category->has_children = (boolean)count($this->category->children);
//Whatever fallback
$this->category->haschildren = $this->category->has_children;
} else {
$this->category->children = false;
}
if (VmConfig::get('enable_content_plugin', 0)) {
shopFunctionsF::triggerContentPlugin($this->category, 'category','category_description');
}
if(empty($this->category->category_template)){
$this->category->category_template = VmConfig::get('categorytemplate');
}
if(!empty($this->categorylayout)){
$this->category->category_layout = $this->categorylayout;
}
vmJsApi::jPrice();
$this->productsLayout = 'products'; //VmConfig::get('productsublayout','products');
if(!empty($this->productsublayout)){
$this->productsLayout = $this->productsublayout;
}
VmTemplate::setVmTemplate($this,$this->category->category_template,0,$this->category->category_layout);
$customtitle = '';
$metadesc = '';
$metakey = '';
$metarobot = '';
$metaauthor = '';
$metadesc = $menuParams->get('menu-meta_description');
$metakey = $menuParams->get('menu-meta_keywords');
$metarobot = $menuParams->get('robots');
$customtitle = $menuParams->get('page_title');
if(($this->storefront and empty($prefix)) or $this->show_store_desc or empty($this->categoryId)){
$vendorModel = VmModel::getModel('vendor');
if(!empty($this->category->virtuemart_vendor_id)){
$vendorModel->setId($this->category->virtuemart_vendor_id);
} else {
$vendorModel->setId(1);;
}
$this->vendor = $vendorModel->getVendor();
}
$this->manu_descr = '';
if(($this->storefront and empty($prefix)) or (empty($this->categoryId) and empty($this->virtuemart_manufacturer_id)) ){
if(empty($this->vendor->customtitle)){
if(empty($customtitle)) {
$customtitle = vmText::sprintf('COM_VIRTUEMART_HOME',$this->vendor->vendor_store_name);
}
} else {
$customtitle = $this->vendor->customtitle;
}
if(!empty($this->vendor->metadesc)) $metadesc = $this->vendor->metadesc;
if(!empty($this->vendor->metakey)) $metakey = $this->vendor->metakey;
if(!empty($this->vendor->metarobot)) $metarobot = $this->vendor->metarobot;
if(!empty($this->vendor->metaauthor)) $metaauthor = $this->vendor->metaauthor;
} else {
if(empty($this->categoryId)){
$metaObj = VmModel::getModel('manufacturer')->getManufacturer($this->virtuemart_manufacturer_id);
$this->manu_descr = $metaObj->mf_desc;
} else {
$metaObj = $this->category;
}
if (!empty($metaObj->metadesc)) {
$metadesc = $metaObj->metadesc;
}
if (!empty($metaObj->metakey)) {
$metakey = $metaObj->metakey;
}
if (!empty($metaObj->metarobot)) {
$metarobot = $metaObj->metarobot;
}
if(!empty($metaObj->customtitle)){
$customtitle = $metaObj->customtitle;
}
if ($this->app->getCfg('MetaAuthor') == '1' and !empty($this->category->metaauthor)) {
$metaauthor = $this->category->metaauthor;
}
}
if(empty($metadesc)){
$description = '';
if(!empty($this->categoryId)){
$description=$this->category->category_description;
$name=$this->category->category_name;
} else if(!empty($this->virtuemart_manufacturer_id)){
$metaObj = VmModel::getModel('manufacturer')->getManufacturer($this->virtuemart_manufacturer_id);
$description=$metaObj->mf_desc;
$name=$metaObj->mf_name;
}
$qdesc = strip_tags(html_entity_decode($description,ENT_QUOTES)) ;
$qdesc = str_replace(array("\n", "\r","\t"), "", $qdesc);
$qdesc = str_replace(array(" "), " ", $qdesc);
$qdesc = shopFunctionsF::limitStringByWord($qdesc,120);
$metadesc = $this->category->category_name . ". ". $qdesc . ' ' .vmText::_('COM_VIRTUEMART_READ_MORE');
}
// quorvia get rid of any excess data
$metadesc = str_replace(array("\n", "\r","\t"), "", $metadesc);
$metadesc = str_replace(array(" "), " ", $metadesc);
$document->setMetaData('description',$metadesc);
$document->setMetaData('keywords', $metakey);
$document->setMetaData('robots', $metarobot);
$document->setMetaData('author', $metaauthor);
// Set the titles
if (!empty($customtitle)) {
$title = strip_tags($customtitle);
} elseif (!empty($this->category->category_name)) {
$title = strip_tags($this->category->category_name);
} else {
$title = $this->setTitleByJMenu();
}
$title = vmText::_($title);
if(vRequest::getInt('error')){
$title .=' '.vmText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
}
if($this->keyword !== false and !empty($this->keyword)){
$title .=' ('.strip_tags(htmlspecialchars_decode($this->keyword)).')';
}
if ($this->virtuemart_manufacturer_id>0 and isset($metaObj->mf_name)){
if(VmConfig::get('addManuNameToCatBrowseTitle',true)){
// in case of multi mf, don't take the one of the 1rst product, but the mf name is in the $metaObj
if (isset($metaObj->mf_name)) $title .=' '.$metaObj->mf_name;
}
// Override Category name when viewing manufacturers products !IMPORTANT AFTER page title.
// in case of multi mf, don't take the one of the 1rst product, but the mf name is in the $metaObj
if (isset($metaObj->mf_name) and isset($this->category->category_name)) $this->category->category_name = $metaObj->mf_name ;
}
$document->setTitle( $title );
if ($this->app->getCfg('MetaTitle') == '1') {
$document->setMetaData('title', $title);
}
//Fallback for older layouts, will be removed vm3.4
$this->fallback=false;
if(count($this->products)===1 and isset($this->products['products'])){
$this->products = $this->products['products'];
$this->fallback=true;
vmdebug('Fallback active');
}
if (VmConfig::get ('jdynupdate', TRUE)) {
vmJsApi::jDynUpdate();
}
if(VmConfig::get ('ajax_category', false)){
vmJsApi::jDynUpdate('.category-view');
}
parent::display($tpl);
}
public function setTitleByJMenu(){
$menus = $this->app->getMenu();
$menu = $menus->getActive();
$title = 'VirtueMart Category View';
if ($menu) $title = $menu->title;
// $title = $this->params->get('page_title', '');
// Check for empty title and add site name if param is set
if (empty($title)) {
$title = $this->app->getCfg('sitename');
}
elseif ($this->app->getCfg('sitename_pagetitles', 0) == 1) {
$title = vmText::sprintf('JPAGETITLE', $this->app->getCfg('sitename'), $title);
}
elseif ($this->app->getCfg('sitename_pagetitles', 0) == 2) {
$title = vmText::sprintf('JPAGETITLE', $title, $this->app->getCfg('sitename'));
}
return $title;
}
public function setCanonicalLink($tpl,$document,$categoryId,$manId){
// Set Canonic link
if (!empty($tpl)) {
$format = $tpl;
} else {
$format = vRequest::getCmd('format', 'html');
}
if ($format == 'html') {
// remove joomla canonical before adding it
foreach ( $document->_links as $k => $array ) {
if ( $array['relation'] == 'canonical' ) {
unset($document->_links[$k]);
break;
}
}
$link = 'index.php?option=com_virtuemart&view=category';
if($categoryId!==-1){
$link .= '&virtuemart_category_id='.$categoryId;
}
if($manId!==-1 and !empty($manId)){
$link .= '&virtuemart_manufacturer_id='.$manId;
}
//vmdebug('caetgory view setCanonicalLink',$link);
$document->addHeadLink( JUri::getInstance()->toString(array('scheme', 'host', 'port')).JRoute::_($link, FALSE) , 'canonical', 'rel', '' );
}
}
/*
* generate custom fields list to display as search in FE
*/
public function getSearchCustom() {
$emptyOption = array('virtuemart_custom_id' =>'', 'custom_title' => vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'));
$this->custom_parent_id = vRequest::getInt('custom_parent_id', 0);
$this->searchCustomList = '';
$db =JFactory::getDBO();
$q1= 'SELECT c.* FROM #__virtuemart_customs as c ';
if(!empty($this->categoryId)){
$q1 .= 'INNER JOIN #__virtuemart_product_customfields as pc on (c.virtuemart_custom_id=pc.virtuemart_custom_id)
INNER JOIN #__virtuemart_product_categories as cat ON (pc.virtuemart_product_id=cat.virtuemart_product_id)';
}
$q1 .= ' WHERE';
if(!empty($this->categoryId)){
$q1 .= ' virtuemart_category_id="'.$this->categoryId.'" and';
}
$q1 .= ' searchable="1" and (field_type="S" or field_type="P") and c.published = 1 GROUP BY c.virtuemart_custom_id';
$db->setQuery($q1);
$this->selected = $db->loadObjectList();
// if((int)VmConfig::get('debug_Sql',0))vmdebug('getSearchCustom '.str_replace('#__',$db->getPrefix(),$db->getQuery()),$this->selected);//,$this->categoryId,$this->selected);
if($this->selected) {
$app = JFactory::getApplication();
foreach ($this->selected as $selected) {
$valueOptions = array();
if($selected->field_type=="S") {
//if($selected->is_list) {
//if($selected->is_list == "1") {
$q2= 'SELECT pc.* FROM #__virtuemart_product_customfields as pc ';
$q2 .= 'INNER JOIN #__virtuemart_products as p on (pc.virtuemart_product_id=p.virtuemart_product_id)';
if(!empty($this->categoryId)){
$q2 .= 'INNER JOIN #__virtuemart_product_categories as cat on (pc.virtuemart_product_id=cat.virtuemart_product_id)';
}
$q2 .= ' WHERE virtuemart_custom_id="'.$selected->virtuemart_custom_id.'" and p.published="1" ';
if(!empty($this->categoryId)){
$q2 .= ' and virtuemart_category_id="'.$this->categoryId.'" ';
}
$q2 .= ' GROUP BY `customfield_value`';
/*$q2 = 'SELECT * FROM `#__virtuemart_product_customfields` WHERE virtuemart_custom_id="'.$selected->virtuemart_custom_id.'" ';
if(!empty($this->categoryId)){
$q1 .= ' virtuemart_category_id="'.$this->categoryId.'" and';
}
$q2 = 'GROUP BY `customfield_value` ';*/
$db->setQuery( $q2 );
$Opts = $db->loadObjectList();
//if((int)VmConfig::get('debug_Sql',0))vmdebug('getSearchCustom my q2 '.str_replace('#__',$db->getPrefix(),$db->getQuery()),$Opts);//,$this->categoryId,$this->selected);
if($Opts){
foreach( $Opts as $k => $v ) {
if(empty($v->customfield_value)){
//vmdebug('getSearchCustom empty value for ',$k,$v);
continue;
}
if(!isset($valueOptions[$v->customfield_value])) {
$valueOptions[$v->customfield_value] = vmText::_($v->customfield_value);
}
}
$valueOptions = array_merge(array($emptyOption), $valueOptions);
$v = '';
if(!empty($this->productModel->searchcustoms) and !empty($this->productModel->searchcustoms[$selected->virtuemart_custom_id])){
$v = $this->productModel->searchcustoms[$selected->virtuemart_custom_id];
}
//$v = $app->getUserStateFromRequest ('com_virtuemart.customfields.'.$selected->virtuemart_custom_id, 'customfields['.$selected->virtuemart_custom_id.']', '', 'string');
//deprecated $this->searchCustomValues
$this->searchCustomValues .= '<div class="vm-search-custom-values-group"><div class="vm-custom-title-select">' . vmText::_( $selected->custom_title ).'</div>'.JHtml::_( 'select.genericlist', $valueOptions, 'customfields['.$selected->virtuemart_custom_id.']', 'class="inputbox vm-chzn-select changeSendForm"', 'virtuemart_custom_id', 'custom_title', $v ) . '</div>';
// Custom Search Values
$selected->value_options = $valueOptions;
$selected->v = $v;
$this->searchCustomValuesAr[] = $selected;
}
//vmdebug('getSearchCustom '.$q2,$Opts,$valueOptions);
/*} else if($selected->is_list == "2" and !empty($selected->custom_value)) {
$valueOptions = array();
$Opts = explode( ';', $selected->custom_value );
foreach( $Opts as $k => $v ) {
$valueOptions[$v] = $v;
}
}*/
} else if($selected->field_type=="P"){
//deprecated $this->searchCustomValues
$v = vRequest::getString('customfields['.$selected->virtuemart_custom_id.']');
$n = 'customfields['.$selected->virtuemart_custom_id.']';
$this->searchCustomValues .= vmText::_( $selected->custom_title ).' <input name="'.$n.'" class="inputbox vm-chzn-select" type="text" size="20" value="'.$v.'"/>';
$this->searchCustomValuesAr[] = $selected;
} else {
//Atm not written for other field types
/* $db->setQuery('SELECT `customfield_value` as virtuemart_custom_id,`custom_value` as custom_title FROM `#__virtuemart_product_customfields` WHERE virtuemart_custom_id='.$selected->virtuemart_custom_id);
$valueOptions= $db->loadAssocList();
$valueOptions = array_merge(array($emptyOption), $valueOptions);
$this->searchCustomValues .= '<div class="vm-search-custom-values-group"><div class="vm-search-title">'. vmText::_($selected->custom_title).'</div> '.JHtml::_('select.genericlist', $valueOptions, 'customfields['.$selected->virtuemart_custom_id.']', 'class="inputbox vm-chzn-select"', 'virtuemart_custom_id', 'custom_title', 0) . '</div>';*/
}
}
$this->combineTags = $app->getUserStateFromRequest('combineTags','combineTags', true,'int');
}
if(VmConfig::get('useCustomSearchTrigger',false)){
// add search for declared plugins
vDispatcher::importVMPlugins('vmcustom');
$plgDisplay = vDispatcher::trigger('plgVmSelectSearchableCustom',array( &$this->options,&$this->searchCustomValuesAr,$this->custom_parent_id ) );
}
//vmTime('getSearchCustom after trigger','getSearchCustom');
vmJsApi::chosenDropDowns();
}
public function handle404($cat = false){
if ((int)VmConfig::get('handle_404',1)) {
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
$redirect=false;
if((int)VmConfig::get('redirect_404',false)){
$jLangTag = vmText::$language->getTag();
$db = JFactory::getDbo();
$q = 'SELECT `id` FROM `#__menu` WHERE `home`="1" and (language="*" or language = "'.$jLangTag.'" ) ORDER BY `language` DESC';
$db->setQuery($q);
$this->Itemid = $db->loadResult();
$this->app->redirect( JRoute::_('index.php?Itemid=' . $this->Itemid . '&error=404', FALSE) );
} else {
//Fallback
$catLink = '';
if ($cat and !empty($cat->category_parent_id) and $this->categoryId != $cat->category_parent_id) {
$catLink = '&view=category&virtuemart_category_id=' .$cat->category_parent_id;
} else {
$last_category_id = shopFunctionsF::getLastVisitedCategoryId();
if (!$last_category_id or $this->categoryId == $last_category_id) {
$last_category_id = vRequest::getInt('virtuemart_category_id', false);
}
/*if ($last_category_id and $this->categoryId != $last_category_id) {
$catLink = '&view=category&virtuemart_category_id=' . $last_category_id;
}*/
}
$cat = VmModel::getModel('category')->getCategory($last_category_id, false, true);
if(empty($cat->virtuemart_category_id) or !$cat->published){
$last_category_id = 0;
}
vRequest::setVar('virtuemart_category_id', $last_category_id);
vRequest::setVar('virtuemart_manufacturer_id', 0);
if(!$cat or empty($cat->slug)){
vmInfo(vmText::_('COM_VIRTUEMART_CAT_NOT_FOUND'));
} else {
if($cat->virtuemart_category_id>0 and !$cat->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$cat->category_name,$this->categoryId);
}
}
$this->display();
}
} else {
throw new RuntimeException('VirtueMart category not found.', 404);
}
return;
}
}
//no closing tag
tmpl/default_children.php 0000644 00000003372 15234555323 0011541 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$class = ' class="first"';
if ($this->maxLevel != 0 && count($this->children[$this->category->id]) > 0) :
?>
<ul class="list-striped list-condensed">
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
<?php
if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) :
if (!isset($this->children[$this->category->id][$id + 1]))
{
$class = ' class="last"';
}
?>
<li<?php echo $class; ?>>
<?php $class = ''; ?>
<h4 class="item-title">
<a href="<?php echo JRoute::_(ContactHelperRoute::getCategoryRoute($child->id)); ?>">
<?php echo $this->escape($child->title); ?>
</a>
<?php if ($this->params->get('show_cat_items') == 1) : ?>
<span class="badge badge-info pull-right" title="<?php echo JText::_('COM_CONTACT_CAT_NUM'); ?>"><?php echo $child->numitems; ?></span>
<?php endif; ?>
</h4>
<?php if ($this->params->get('show_subcat_desc') == 1) : ?>
<?php if ($child->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare', $child->description, '', 'com_contact.category'); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if (count($child->getChildren()) > 0 ) :
$this->children[$child->id] = $child->getChildren();
$this->category = $child;
$this->maxLevel--;
echo $this->loadTemplate('children');
$this->category = $child->getParent();
$this->maxLevel++;
endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
tmpl/default_items.php 0000644 00000012672 15234555323 0011075 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.core');
?>
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
<?php if ($this->params->get('filter_field') || $this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters btn-toolbar">
<?php if ($this->params->get('filter_field')) : ?>
<div class="btn-group">
<label class="filter-search-lbl element-invisible" for="filter-search">
<span class="label label-warning">
<?php echo JText::_('JUNPUBLISHED'); ?>
</span>
<?php echo JText::_('COM_CONTACT_FILTER_LABEL') . ' '; ?>
</label>
<input
type="text"
name="filter-search"
id="filter-search"
value="<?php echo $this->escape($this->state->get('list.filter')); ?>"
class="inputbox"
onchange="document.adminForm.submit();"
title="<?php echo JText::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>"
placeholder="<?php echo JText::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>"
/>
</div>
<?php endif; ?>
<?php if ($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
<label for="limit" class="element-invisible">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
</fieldset>
<?php endif; ?>
<?php if (empty($this->items)) : ?>
<p>
<?php echo JText::_('COM_CONTACT_NO_CONTACTS'); ?>
</p>
<?php else : ?>
<ul class="category row-striped">
<?php foreach ($this->items as $i => $item) : ?>
<?php if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
<?php if ($this->items[$i]->published == 0) : ?>
<li class="row-fluid system-unpublished cat-list-row<?php echo $i % 2; ?>">
<?php else : ?>
<li class="row-fluid cat-list-row<?php echo $i % 2; ?>" >
<?php endif; ?>
<?php if ($this->params->get('show_image_heading')) : ?>
<?php $contactWidth = 7; ?>
<div class="span2 col-md-2">
<?php if ($this->items[$i]->image) : ?>
<a href="<?php echo JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid)); ?>">
<?php echo JHtml::_(
'image',
$this->items[$i]->image,
JText::_('COM_CONTACT_IMAGE_DETAILS'),
array('class' => 'contact-thumbnail img-thumbnail')
); ?>
</a>
<?php endif; ?>
</div>
<?php else : ?>
<?php $contactWidth = 9; ?>
<?php endif; ?>
<div class="list-title span<?php echo $contactWidth; ?> col-md-<?php echo $contactWidth; ?>">
<a href="<?php echo JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid)); ?>">
<?php echo $item->name; ?>
</a>
<?php if ($this->items[$i]->published == 0) : ?>
<span class="label label-warning">
<?php echo JText::_('JUNPUBLISHED'); ?>
</span>
<?php endif; ?>
<?php echo $item->event->afterDisplayTitle; ?>
<?php echo $item->event->beforeDisplayContent; ?>
<?php if ($this->params->get('show_position_headings')) : ?>
<?php echo $item->con_position; ?><br />
<?php endif; ?>
<?php if ($this->params->get('show_email_headings')) : ?>
<?php echo $item->email_to; ?><br />
<?php endif; ?>
<?php $location = array(); ?>
<?php if ($this->params->get('show_suburb_headings') && !empty($item->suburb)) : ?>
<?php $location[] = $item->suburb; ?>
<?php endif; ?>
<?php if ($this->params->get('show_state_headings') && !empty($item->state)) : ?>
<?php $location[] = $item->state; ?>
<?php endif; ?>
<?php if ($this->params->get('show_country_headings') && !empty($item->country)) : ?>
<?php $location[] = $item->country; ?>
<?php endif; ?>
<?php echo implode(', ', $location); ?>
</div>
<div class="span3 col-md-3">
<?php if ($this->params->get('show_telephone_headings') && !empty($item->telephone)) : ?>
<?php echo JText::sprintf('COM_CONTACT_TELEPHONE_NUMBER', $item->telephone); ?><br />
<?php endif; ?>
<?php if ($this->params->get('show_mobile_headings') && !empty ($item->mobile)) : ?>
<?php echo JText::sprintf('COM_CONTACT_MOBILE_NUMBER', $item->mobile); ?><br />
<?php endif; ?>
<?php if ($this->params->get('show_fax_headings') && !empty($item->fax)) : ?>
<?php echo JText::sprintf('COM_CONTACT_FAX_NUMBER', $item->fax); ?><br />
<?php endif; ?>
</div>
<?php echo $item->event->afterDisplayContent; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if ($this->params->get('show_pagination', 2)) : ?>
<div class="pagination">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<div>
<input type="hidden" name="filter_order" value="<?php echo $this->escape($this->state->get('list.ordering')); ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->escape($this->state->get('list.direction')); ?>" />
</div>
</form>
metadata.xml 0000644 00000000221 15234555323 0007050 0 ustar 00 <?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="Category">
<message><![CDATA[TYPECATEGORYDESC]]></message>
</view>
</metadata>