Answer the question
In order to leave comments, you need to log in
[Virtuemart] How to get custom field parameter?
There is a filter through VirtueMart custom fields. How can I get the "Hidden" parameter of a custom field in the filter view?
I found a file where I get an array of filters for output (maybe not right)
\modules\mod_virtuemart_param_filter\mod_virtuemart_param_filter.php
Corrected by past developers.
<?php
defined('_JEXEC') or die('Restricted access');
/**
* Param Filter: VirtueMart 2 search module
* Version: 1.0.0 (2012.04.23)
* Author: Usov Dima
* Copyright: Copyright (C) 2012 usovdm
* License GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* http://myext.eu
**/
require_once('helper.php');
vmJsApi::jQuery();
vmJsApi::cssSite();
$customfieldsModel = new VirtueMartModelCustomfields();
$cache = JFactory::getCache('com_virtuemart','callback');
$doc = JFactory::getDocument();
$param_search_ids = isset($doc->param_search_ids)? $doc->param_search_ids : null;
$multiple = $chosen = $slider = false;
/* ===== + Params ===== */
$class_sfx = $params->get('class_sfx', '');
$moduleclass_sfx = $params->get('moduleclass_sfx','');
$module_id = $module->id;
$method = $params->get('method','get');
$layout = $params->get('layout','default');
//$limit = $params->get('limit',12); /// посмотреть
$stock = $params->get('stock',false);
$count_show = $params->get('count_show',false);
$count_zero_show = $params->get('count_zero_show','disable');
$count_zero_show_txt = $count_zero_show == 'disable' ? ' disabled="disabled"' : '';
$mcf_mod_ajax = $params->get('mod_ajax',true);
$mcf_mod_ajax_css = $mcf_mod_ajax ? ' mcf_mod_ajax' : '';
$mcf_view_assign = $params->get('view_assign',array(-1));
$mcf_category_assign = $params->get('category_assign',array(0));
$parent_id = $params->get('Parent_Category_id',null);
$parent_auto = $params->get('parent_auto',false);
$categories_show = $params->get('categories_show',true);
$mcf_category_heading = $params->get('categories_heading','');
$mcf_category_select_heading = $params->get('categories_select_heading','');
$categories_layout = $params->get('categories_layout','checkbox');
$manufacturers_show = $params->get('manufacturers_show',true);
$mcf_manufacturers_heading = $params->get('manufacturers_heading','');
$mcf_manufacturers_select_heading = $params->get('manufacturers_select_heading','');
$manufacturers_layout = $params->get('manufacturers_layout','checkbox');
$price_show = $params->get('price_show',true);
$mcf_price_heading = $params->get('price_heading','');
$price_discount = $params->get('price_discount',0);
$price_layout = $params->get('price_layout','input');
$customfields_show = $params->get('customfields_show',true);
$mcf_customfields_select_heading = $params->get('customfields_select_heading','');
$customfields_layout = $params->get('customfields_layout','auto');
/* ===== - Params ===== */
$mcf_tmpl_option = JRequest::getVar('option');
$mcf_tmpl_view = JRequest::getVar('view');
$mcf_module_id = JRequest::getVar('mcf_id');
$active_category_id = JRequest::getInt('virtuemart_category_id', 0);
if($active_category_id<1)
$active_category_id = JRequest::getInt('preload_virtuemart_category_id', 0);
$mcf_search = JRequest::getBool('search', false);
$mcf_ajax = JRequest::getVar('mcf_ajax',0);
if($mcf_ajax){
$cids = JRequest::getVar('cids',array());
}else{
$cids = JRequest::getVar('cids',array($active_category_id));
}
$show_assing_filter = true;
$show_filter = false;
if($mcf_view_assign[0] != '-1' && $mcf_tmpl_option == 'com_virtuemart'){
if(!in_array($mcf_tmpl_view,$mcf_view_assign)){
$show_assing_filter = false;
}
}
if($mcf_category_assign[0] == 0)
unset($mcf_category_assign[0]);
if(count($mcf_category_assign) > 0){
if(!in_array($active_category_id,$mcf_category_assign)){
$show_assing_filter = false;
}
}
if($mcf_search && $mcf_module_id == $module_id){
$show_assing_filter = true;
}
if($show_assing_filter){
/* ===== + Categories load -> tmpl ===== */
$categories='';
if($categories_show){
$show_filter = true;
$categories = getCategories();
//print_r($categories );
$html = '';
require(JModuleHelper::getLayoutPath('mod_virtuemart_param_filter','categories'.DS.$categories_layout.DS.'default')); // Generate HTML
$categories_html = $html;
}elseif($parent_auto && $active_category_id > 0){
$categories_html = '<input type="hidden" name="virtuemart_category_id" value="'.$active_category_id.'" />';
}
//if($active_category_id > 0 && !$mcf_search)
{
$categories_html .= '
<input type="hidden" name="virtuemart_category_id" value="'.$active_category_id.'" />
<input type="hidden" name="preload_virtuemart_category_id" value="'.$active_category_id.'" />';
}
/* ===== - Categories load -> tmpl ===== */
/* ===== + Manufacturer load -> tmpl ===== */
$manufacturers='';
if($manufacturers_show){
$show_filter = true;
$manufacturers = getManufacturers();
$manufacturers_count = getCountManufacturers($cids,$param_search_ids);//$param_search_ids);
$mids = JRequest::getVar('mids');
$html = '';
require(JModuleHelper::getLayoutPath('mod_virtuemart_param_filter','manufacturers'.DS.$manufacturers_layout)); // Generate HTML
$manufacturers_html = $html;
}
/* ===== - Manufacturer load -> tmpl ===== */
/* ===== + Price load -> tmpl ===== */
$price_html='';
if($price_show){
$show_filter = true;
$price_left = JRequest::getVar('pl','');
$price_right = JRequest::getVar('pr','');
if($parent_auto){
$price_limits = getPriceLimits($price_discount,$cids);
}else{
$price_limits = getPriceLimits($price_discount);
}
$html = '';
require(JModuleHelper::getLayoutPath('mod_virtuemart_param_filter','price'.DS.$price_layout)); // Generate HTML
if($price_discount){
$html .= '<input type="hidden" name="d" value="1" />';
}
$price_html = $html;
}
/* ===== - Price load -> tmpl ===== */
/* ===== Customfields load -> preload ===== */
if(count($cids)<1)
{
$catstr=getAllCatChild($active_category_id,$catstr );
}
else
{
$catstr=getAllCatChild(implode(',',$cids),$catstr );
$catstr=$catstr.','.implode(',',$cids);
}
$catstr=substr($catstr,1);
$types = array();
if($customfields_show){
// print_r($_REQUEST);
//echo $active_category_id;
$custom_ids = JRequest::getVar('cpi', array()); // Собираем переданные поля
if($parent_auto && count($cids) && $mcf_mod_ajax){//die('1');
// Автоматическая подборка полей + АЯКС = подгружать поля только из товаров отмеченных категорий
$types = $cache->call('getCategoryCustomfields',$cids,$custom_ids);
}elseif($parent_auto && $active_category_id > 0){// die('2');
// Автоматическая подборка полей - АЯКС + открыта категория = подгружать поля только из товаров открытой категории
$types = $cache->call('getCategoryCustomfields',$active_category_id,$custom_ids);
}elseif($parent_id != null){//die('3');
$types = getCustomfields($parent_id,array()); // поля указанных родитей
}elseif(count($custom_ids) > 0){
$types = getCustomfields($parent_id,$custom_ids); // все передаваемые поля
}
if(count($types) > 0){
$pre_int_values = $cache->call('getCustomIntValues'); // инициализация всех ручных числовых полей
$pre_text_values = $cache->call('getCustomTextValues',$active_category_id); // инициализация всех ручных текстовых полей
// print_R($pre_text_values);
$type_req = $types[0];
}
}
if(count($types) == 0){
$type_req = getCustomfields('',array(),1);
$type_req = @$type_req[0];
}else{
$show_filter = true;
}
/* ===== Module tmpl ===== */
require(JModuleHelper::getLayoutPath('mod_virtuemart_param_filter',$layout));
//if($chosen){
$doc->addStyleSheet($doc->baseurl."/components/com_virtuemart/assets/css/chosen.css");
$doc->addScript($doc->baseurl."/components/com_virtuemart/assets/js/chosen.jquery.min.js");
//}
if($slider){
// load jQuery ui script
}
//if($mcf_ajax)
$doc->addScript($doc->baseurl."/modules/mod_virtuemart_param_filter/assets/js.js");
$doc->addStyleSheet($doc->baseurl."/modules/mod_virtuemart_param_filter/assets/style.css");
}
$types = $cache->call('getCategoryCustomfields',$active_category_id,$custom_ids);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question