本文整理汇总了PHP中ShopFunctions::getValidProductFilterArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ShopFunctions::getValidProductFilterArray方法的具体用法?PHP ShopFunctions::getValidProductFilterArray怎么用?PHP ShopFunctions::getValidProductFilterArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShopFunctions
的用法示例。
在下文中一共展示了ShopFunctions::getValidProductFilterArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* constructs a VmModel
* setMainTable defines the maintable of the model
*
* @author Max Milbers
*/
function __construct()
{
parent::__construct('virtuemart_product_id');
$this->setMainTable('products');
$this->starttime = microtime(TRUE);
$this->maxScriptTime = VmConfig::getExecutionTime() * 0.95 - 1;
$this->memory_limit = VmConfig::getMemoryLimit() - 4;
// $this->addvalidOrderingFieldName(array('m.mf_name','pp.product_price'));
$app = JFactory::getApplication();
if ($app->isSite()) {
$this->_validOrderingFieldName = array();
$browseOrderByFields = VmConfig::get('browse_orderby_fields', array('product_sku', 'category_name', 'mf_name', 'product_name'));
} else {
if (!class_exists('shopFunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
$browseOrderByFields = ShopFunctions::getValidProductFilterArray();
$this->addvalidOrderingFieldName(array('product_price', 'product_sales'));
//$this->addvalidOrderingFieldName (array('product_price'));
// vmdebug('$browseOrderByFields',$browseOrderByFields);
}
$this->addvalidOrderingFieldName((array) $browseOrderByFields);
$this->removevalidOrderingFieldName('virtuemart_product_id');
//$this->removevalidOrderingFieldName ('product_sales');
//unset($this->_validOrderingFieldName[0]);//virtuemart_product_id
array_unshift($this->_validOrderingFieldName, 'p.virtuemart_product_id');
$this->_selectedOrdering = VmConfig::get('browse_orderby_field', '`p`.virtuemart_product_id');
$this->setToggleName('product_special');
$this->initialiseRequests();
//This is just done now for the moment for developing, the idea is of course todo this only when needed.
$this->updateRequests();
}
示例2: __construct
/**
* constructs a VmModel
* setMainTable defines the maintable of the model
*
* @author Max Milbers
*/
function __construct()
{
parent::__construct('virtuemart_product_id');
$this->setMainTable('products');
$this->starttime = microtime(TRUE);
$this->maxScriptTime = ini_get('max_execution_time') * 0.95 - 1;
// $this->addvalidOrderingFieldName(array('m.mf_name','pp.product_price'));
$view = JRequest::getVar('view');
$isSite = JFactory::getApplication()->isSite() && $view !== 'product' && $view !== 'inventory';
if ($isSite) {
$browseOrderByFields = VmConfig::get('browse_orderby_fields', array('product_sku', 'category_name', 'mf_name', 'product_name'));
} else {
JLoader::register('shopFunctions', JPATH_VM_ADMINISTRATOR . 'helpers/shopfunctions.php');
$browseOrderByFields = ShopFunctions::getValidProductFilterArray();
$this->addvalidOrderingFieldName(array('product_price', 'p.`product_sales`'));
//$this->addvalidOrderingFieldName (array('product_price'));
// vmdebug('$browseOrderByFields',$browseOrderByFields);
}
$this->addvalidOrderingFieldName((array) $browseOrderByFields);
$this->removevalidOrderingFieldName('virtuemart_product_id');
$this->removevalidOrderingFieldName('product_sales');
//unset($this->_validOrderingFieldName[0]);//virtuemart_product_id
array_unshift($this->_validOrderingFieldName, 'p.virtuemart_product_id');
$this->_selectedOrdering = VmConfig::get('browse_orderby_field', '`p`.virtuemart_product_id');
$this->setToggleName('product_special');
$this->initialiseRequests();
//This is just done now for the moment for developing, the idea is of course todo this only when needed.
$this->updateRequests();
}
示例3: getProductFilterFields
/**
* Retrieve a list of preselected and existing search or order By Fields
* $type = 'browse_search_fields' or 'browse_orderby_fields'
* @author Kohl Patrick
* @return array of order list
*/
function getProductFilterFields($type)
{
$searchChecked = VmConfig::get($type);
if (!is_array($searchChecked)) {
$searchChecked = (array) $searchChecked;
}
$searchFieldsArray = ShopFunctions::getValidProductFilterArray();
// if ($type !== 'browse_orderby_fields' ) array_shift($searchFieldsArray);
$searchFields = new stdClass();
$searchFields->checkbox = '<div class="threecols"><ul>';
foreach ($searchFieldsArray as $key => $field) {
if (in_array($field, $searchChecked)) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
$fieldWithoutPrefix = $field;
$dotps = strrpos($fieldWithoutPrefix, '.');
if ($dotps !== false) {
$prefix = substr($field, 0, $dotps + 1);
$fieldWithoutPrefix = substr($field, $dotps + 1);
}
$text = JText::_('COM_VIRTUEMART_' . strtoupper($fieldWithoutPrefix));
if ($type == 'browse_orderby_fields') {
$searchFields->select[] = JHTML::_('select.option', $field, $text);
}
$searchFields->checkbox .= '<li><input type="checkbox" id="' . $type . $fieldWithoutPrefix . $key . '" name="' . $type . '[]" value="' . $field . '" ' . $checked . ' /><label for="' . $type . $fieldWithoutPrefix . $key . '">' . $text . '</label></li>';
}
$searchFields->checkbox .= '</ul></div>';
return $searchFields;
}
示例4: getProductFilterFields
/**
* Retrieve a list of preselected and existing search or order By Fields
* $type = 'browse_search_fields' or 'browse_orderby_fields'
* @author Kohl Patrick
* @return array of order list
*/
function getProductFilterFields($type)
{
$searchChecked = VmConfig::get($type);
if (!is_array($searchChecked)) {
$searchChecked = (array) $searchChecked;
}
if ($type != 'browse_cat_orderby_field') {
$searchFieldsArray = ShopFunctions::getValidProductFilterArray();
if ($type == 'browse_search_fields') {
if ($key = array_search('pc.ordering', $searchFieldsArray)) {
unset($searchFieldsArray[$key]);
}
} else {
if ($type == 'browse_orderby_fields') {
array_unshift($searchFieldsArray, 'pc.ordering,product_name');
}
}
} else {
$searchFieldsArray = array('category_name', 'category_description', 'cx.ordering', 'c.published');
}
$searchFields = new stdClass();
$searchFields->checkbox = '<div class="threecols"><ul>';
foreach ($searchFieldsArray as $key => $field) {
if (in_array($field, $searchChecked)) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
$fieldWithoutPrefix = $field;
$dotps = strrpos($fieldWithoutPrefix, '.');
if ($dotps !== false) {
$prefix = substr($field, 0, $dotps + 1);
$fieldWithoutPrefix = substr($field, $dotps + 1);
}
$text = vmText::_('COM_VIRTUEMART_' . strtoupper(str_replace(array(',', ' '), array('_', ''), $fieldWithoutPrefix)));
if ($type == 'browse_orderby_fields' or $type == 'browse_cat_orderby_field') {
$searchFields->select[] = JHtml::_('select.option', $field, $text);
}
$searchFields->checkbox .= '<li><input type="checkbox" id="' . $type . $fieldWithoutPrefix . $key . '" name="' . $type . '[]" value="' . $field . '" ' . $checked . ' /><label for="' . $type . $fieldWithoutPrefix . $key . '">' . $text . '</label></li>';
}
$searchFields->checkbox .= '</ul></div>';
return $searchFields;
}