本文整理汇总了PHP中buildTreeCategory函数的典型用法代码示例。如果您正苦于以下问题:PHP buildTreeCategory函数的具体用法?PHP buildTreeCategory怎么用?PHP buildTreeCategory使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了buildTreeCategory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCategory
public static function getCategory($selected = null, $attribs = null, $name = 'category_id')
{
$options = buildTreeCategory(1);
$first = JHTML::_('select.option', 0, _JSHOP_SEARCH_ALL_CATEGORIES, 'category_id', 'name');
array_unshift($options, $first);
if (is_null($attribs)) {
$attribs = self::getDataultAttribs('');
}
return JHTML::_('select.genericlist', $options, $name, $attribs, 'category_id', 'name', $selected);
}
示例2: display
function display($cachable = false, $urlparams = false)
{
$mainframe = JFactory::getApplication();
$id_vendor_cuser = getIdVendorForCUser();
$reviews_model = $this->getModel("reviews");
$products_model = $this->getModel("products");
$context = "jshoping.list.admin.reviews";
$limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
$category_id = $mainframe->getUserStateFromRequest($context . 'category_id', 'category_id', 0, 'int');
$text_search = $mainframe->getUserStateFromRequest($context . 'text_search', 'text_search', '');
$filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', "pr_rew.review_id", 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', "desc", 'cmd');
if ($category_id) {
$product_id = $mainframe->getUserStateFromRequest($context . 'product_id', 'product_id', 0, 'int');
} else {
$product_id = null;
}
$products_select = "";
if ($category_id) {
$prod_filter = array("category_id" => $category_id);
if ($id_vendor_cuser) {
$prod_filter['vendor_id'] = $id_vendor_cuser;
}
$products = $products_model->getAllProducts($prod_filter, 0, 100);
if (count($products)) {
$start_pr_option = JHTML::_('select.option', '0', _JSHOP_SELECT_PRODUCT, 'product_id', 'name');
array_unshift($products, $start_pr_option);
$products_select = JHTML::_('select.genericlist', $products, 'product_id', 'class = "inputbox" onchange="document.adminForm.submit();" size = "1" ', 'product_id', 'name', $product_id);
}
}
$total = $reviews_model->getAllReviews($category_id, $product_id, NULL, NULL, $text_search, "count", $id_vendor_cuser, $filter_order, $filter_order_Dir);
jimport('joomla.html.pagination');
$pagination = new JPagination($total, $limitstart, $limit);
$reviews = $reviews_model->getAllReviews($category_id, $product_id, $pagination->limitstart, $pagination->limit, $text_search, "list", $id_vendor_cuser, $filter_order, $filter_order_Dir);
$start_option = JHTML::_('select.option', '0', _JSHOP_SELECT_CATEGORY, 'category_id', 'name');
$categories_select = buildTreeCategory(0, 1, 0);
array_unshift($categories_select, $start_option);
$categories = JHTML::_('select.genericlist', $categories_select, 'category_id', 'class = "inputbox" onchange="document.adminForm.submit();" size = "1" ', 'category_id', 'name', $category_id);
$view = $this->getView("comments", 'html');
$view->setLayout("list");
$view->assign('categories', $categories);
$view->assign('reviews', $reviews);
$view->assign('limit', $limit);
$view->assign('limitstart', $limitstart);
$view->assign('text_search', $text_search);
$view->assign('pagination', $pagination);
$view->assign('products_select', $products_select);
$view->assign('filter_order', $filter_order);
$view->assign('filter_order_Dir', $filter_order_Dir);
JPluginHelper::importPlugin('jshoppingadmin');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeDisplayReviews', array(&$view));
$view->displayList();
}
示例3: getInput
protected function getInput()
{
require_once JPATH_SITE . '/modules/mod_jshopping_search/helper.php';
$tmp = new stdClass();
$tmp->category_id = "";
$tmp->name = JText::_('JALL');
$categories_1 = array($tmp);
$categories_select = array_merge($categories_1, buildTreeCategory(0));
$ctrl = $this->name;
$value = empty($this->value) ? '' : $this->value;
return JHTML::_('select.genericlist', $categories_select, $ctrl, 'class="inputbox" id = "category_ordering"', 'category_id', 'name', $value);
}
示例4: getInput
protected function getInput()
{
require_once JPATH_SITE . '/modules/mod_jshopping_latest_products/helper.php';
$tmp = new stdClass();
$tmp->category_id = "";
$tmp->name = JText::_('JALL');
$categories_1 = array($tmp);
$categories_select = array_merge($categories_1, buildTreeCategory(0));
$ctrl = $this->name;
//$ctrl = $this->control_name .'['. $this->name .']';
//$ctrl = 'jform[params][catids]';
$ctrl .= '[]';
$value = empty($this->value) ? '' : $this->value;
return JHTML::_('select.genericlist', $categories_select, $ctrl, 'class="inputbox" id = "category_ordering" multiple="multiple"', 'category_id', 'name', $value);
}
示例5: edit
function edit()
{
$jshopConfig = JSFactory::getConfig();
$db = JFactory::getDBO();
$attr_id = JRequest::getInt("attr_id");
$attribut = JSFactory::getTable('attribut', 'jshop');
$attribut->load($attr_id);
if (!$attribut->independent) {
$attribut->independent = 0;
}
$_lang = JSFactory::getModel("languages");
$languages = $_lang->getAllLanguages(1);
$multilang = count($languages) > 1;
$types[] = JHTML::_('select.option', '1', 'Select', 'attr_type_id', 'attr_type');
$types[] = JHTML::_('select.option', '2', 'Radio', 'attr_type_id', 'attr_type');
$type_attribut = JHTML::_('select.genericlist', $types, 'attr_type', 'class = "inputbox" size = "1"', 'attr_type_id', 'attr_type', $attribut->attr_type);
$dependent[] = JHTML::_('select.option', '0', _JSHOP_YES, 'id', 'name');
$dependent[] = JHTML::_('select.option', '1', _JSHOP_NO, 'id', 'name');
$dependent_attribut = JHTML::_('select.radiolist', $dependent, 'independent', 'class = "inputbox" size = "1"', 'id', 'name', $attribut->independent);
$all = array();
$all[] = JHTML::_('select.option', 1, _JSHOP_ALL, 'id', 'value');
$all[] = JHTML::_('select.option', 0, _JSHOP_SELECTED, 'id', 'value');
if (!isset($attribut->allcats)) {
$attribut->allcats = 1;
}
$lists['allcats'] = JHTML::_('select.radiolist', $all, 'allcats', 'onclick="PFShowHideSelectCats()"', 'id', 'value', $attribut->allcats);
$categories_selected = $attribut->getCategorys();
$categories = buildTreeCategory(0, 1, 0);
$lists['categories'] = JHTML::_('select.genericlist', $categories, 'category_id[]', 'class="inputbox" size="10" multiple = "multiple"', 'category_id', 'name', $categories_selected);
$mgroups = JSFactory::getModel("attributesgroups");
$groups = $mgroups->getList();
$groups0 = array();
$groups0[] = JHTML::_('select.option', 0, "- - -", 'id', 'name');
$lists['group'] = JHTML::_('select.genericlist', array_merge($groups0, $groups), 'group', 'class="inputbox"', 'id', 'name', $attribut->group);
JFilterOutput::objectHTMLSafe($attribut, ENT_QUOTES);
$view = $this->getView("attributes", 'html');
$view->setLayout("edit");
$view->assign('attribut', $attribut);
$view->assign('type_attribut', $type_attribut);
$view->assign('dependent_attribut', $dependent_attribut);
$view->assign('etemplatevar', '');
$view->assign('languages', $languages);
$view->assign('multilang', $multilang);
$view->assign('lists', $lists);
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeEditAtribut', array(&$view, &$attribut));
$view->displayEdit();
}
示例6: getInput
protected function getInput()
{
$tmp = new stdClass();
$tmp->category_id = "";
$tmp->name = JText::_('JALL');
$categories_1 = array($tmp);
//$categories_select =array_merge($categories_1 , buildTreeCategory(0));
$categories_select = buildTreeCategory(0);
$ctrl = $this->name;
//$ctrl = '';
// $ctrl .= '[]';
$value = empty($this->value) ? '' : $this->value;
$_attr = $this->multiple ? ' multiple="multiple" ' : '';
$_attr .= $this->size ? ' size="' . $this->size . '"' : ' size="10" ';
// var_dump($this);
return JHTML::_('select.genericlist', $categories_select, $ctrl, 'class="inputbox" "' . $_attr . '" ', 'category_id', 'name', $value);
}
示例7: edit
function edit()
{
$jshopConfig = JSFactory::getConfig();
$db = JFactory::getDBO();
$cid = JRequest::getInt("category_id");
$category = JTable::getInstance("category", "jshop");
$category->load($cid);
$_lang = $this->getModel("languages");
$languages = $_lang->getAllLanguages(1);
$multilang = count($languages) > 1;
$nofilter = array();
JFilterOutput::objectHTMLSafe($category, ENT_QUOTES, $nofilter);
if ($cid) {
$parentid = $category->category_parent_id;
$rows = $this->_getAllCategoriesLevel($category->category_parent_id, $category->ordering);
} else {
$category->category_publish = 1;
$parentid = JRequest::getInt("catid");
$rows = $this->_getAllCategoriesLevel($parentid);
}
$lists['templates'] = getTemplates('category', $category->category_template);
$lists['onelevel'] = $rows;
$parentTop = new stdClass();
$parentTop->category_id = 0;
$parentTop->name = _JSHOP_TOP_LEVEL;
$categories = buildTreeCategory(0, 1, 0);
array_unshift($categories, $parentTop);
$lists['treecategories'] = JHTML::_('select.genericlist', $categories, 'category_parent_id', 'class="inputbox" size="1" onchange = "changeCategory()"', 'category_id', 'name', $parentid);
$lists['parentid'] = $parentid;
$accessgroups = getAccessGroups();
$lists['access'] = JHTML::_('select.genericlist', $accessgroups, 'access', 'class = "inputbox" size = "1"', 'id', 'title', $category->access);
$view = $this->getView("category", 'html');
$view->setLayout("edit");
$view->assign('category', $category);
$view->assign('lists', $lists);
$view->assign('languages', $languages);
$view->assign('multilang', $multilang);
$view->assign('etemplatevar', '');
JPluginHelper::importPlugin('jshoppingadmin');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeEditCategories', array(&$view));
$view->displayEdit();
}
示例8: getInput
protected function getInput()
{
if (!$this->isJshoppingExisted()) {
return '<div class="ice-message">' . JText::_("JSHOPPING_DONT_INSTALL") . '</div>';
}
$categories = buildTreeCategory(0);
$attributes = "";
$name = $this->name;
if ($this->element["multiple"]) {
$attributes = ' size="10" multiple = "multiple" ';
}
$notAll = isset($this->element["notAll"]) ? $this->element["notAll"] : false;
$class = isset($this->element["class"]) ? "inputbox " . $this->element["class"] : "inputbox";
if (!$notAll) {
array_unshift($categories, JHTML::_('select.option', '', '- ' . JText::_('LOF_SELECT_ALL') . ' -', 'category_id', 'name'));
} else {
array_unshift($categories, JHTML::_('select.option', '', '- ' . JText::_('LOF_SELECT_NONE') . ' -', 'category_id', 'name'));
}
return JHTML::_('select.genericlist', $categories, $name, 'class="' . $class . '" ' . $attributes, 'category_id', 'name', $this->value, $this->id);
}
示例9: products
function products()
{
$mainframe = JFactory::getApplication();
$jshopConfig = JSFactory::getConfig();
$session = JFactory::getSession();
$session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']);
$session->set("jshop_end_page_list_product", $_SERVER['REQUEST_URI']);
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeLoadProductList', array());
$vendor_id = JRequest::getInt("vendor_id");
$vendor = JSFactory::getTable('vendor', 'jshop');
$vendor->load($vendor_id);
$dispatcher->trigger('onBeforeDisplayVendor', array(&$vendor));
appendPathWay($vendor->shop_name);
$seo = JSFactory::getTable("seo", "jshop");
$seodata = $seo->loadData("vendor-product-" . $vendor_id);
if (!isset($seodata->title) || $seodata->title == "") {
$seodata = new stdClass();
$seodata->title = $vendor->shop_name;
$seodata->keyword = $vendor->shop_name;
$seodata->description = $vendor->shop_name;
}
setMetaData($seodata->title, $seodata->keyword, $seodata->description);
$action = xhtmlUrl($_SERVER['REQUEST_URI']);
$products_page = $jshopConfig->count_products_to_page;
$count_product_to_row = $jshopConfig->count_products_to_row;
$context = "jshoping.vendor.front.product";
$contextfilter = "jshoping.list.front.product.vendor." . $vendor_id;
$orderby = $mainframe->getUserStateFromRequest($context . 'orderby', 'orderby', $jshopConfig->product_sorting_direction, 'int');
$order = $mainframe->getUserStateFromRequest($context . 'order', 'order', $jshopConfig->product_sorting, 'int');
$limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $products_page, 'int');
if (!$limit) {
$limit = $products_page;
}
$limitstart = JRequest::getInt('limitstart');
if ($order == 4) {
$order = 1;
}
$orderbyq = getQuerySortDirection($order, $orderby);
$image_sort_dir = getImgSortDirection($order, $orderby);
$field_order = $jshopConfig->sorting_products_field_s_select[$order];
$filters = getBuildFilterListProduct($contextfilter, array("vendors"));
$total = $vendor->getCountProducts($filters);
jimport('joomla.html.pagination');
$pagination = new JPagination($total, $limitstart, $limit);
$pagenav = $pagination->getPagesLinks();
$dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'vendor'));
if ($limitstart >= $total) {
$limitstart = 0;
}
$rows = $vendor->getProducts($filters, $field_order, $orderbyq, $limitstart, $limit);
addLinkToProducts($rows, 0, 1);
foreach ($jshopConfig->sorting_products_name_s_select as $key => $value) {
$sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value');
}
insertValueInArray($products_page, $jshopConfig->count_product_select);
foreach ($jshopConfig->count_product_select as $key => $value) {
$product_count[] = JHTML::_('select.option', $key, $value, 'count_id', 'count_value');
}
$sorting_sel = JHTML::_('select.genericlist', $sorts, 'order', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'sort_id', 'sort_value', $order);
$product_count_sel = JHTML::_('select.genericlist', $product_count, 'limit', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'count_id', 'count_value', $limit);
$_review = JSFactory::getTable('review', 'jshop');
$allow_review = $_review->getAllowReview();
if ($jshopConfig->show_product_list_filters) {
$first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'manufacturer_id', 'name');
$_manufacturers = JSFactory::getTable('manufacturer', 'jshop');
$listmanufacturers = $_manufacturers->getList();
array_unshift($listmanufacturers, $first_el);
if (isset($filters['manufacturers'][0])) {
$active_manufacturer = $filters['manufacturers'][0];
} else {
$active_manufacturer = '';
}
$manufacuturers_sel = JHTML::_('select.genericlist', $listmanufacturers, 'manufacturers[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'manufacturer_id', 'name', $active_manufacturer);
$first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'category_id', 'name');
$categories = buildTreeCategory(1);
array_unshift($categories, $first_el);
if (isset($filters['categorys'][0])) {
$active_category = $filters['categorys'][0];
} else {
$active_category = 0;
}
$categorys_sel = JHTML::_('select.genericlist', $categories, 'categorys[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'category_id', 'name', $active_category);
} else {
$categorys_sel = null;
$manufacuturers_sel = null;
}
$willBeUseFilter = willBeUseFilter($filters);
$display_list_products = count($rows) > 0 || $willBeUseFilter;
$dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
$view_name = "vendor";
$view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
$view = $this->getView($view_name, getDocumentType(), '', $view_config);
$view->setLayout("products");
$view->assign('config', $jshopConfig);
$view->assign('template_block_list_product', "list_products/list_products.php");
$view->assign('template_no_list_product', "list_products/no_products.php");
$view->assign('template_block_form_filter', "list_products/form_filters.php");
$view->assign('template_block_pagination', "list_products/block_pagination.php");
$view->assign('path_image_sorting_dir', $jshopConfig->live_path . 'images/' . $image_sort_dir);
//.........这里部分代码省略.........
示例10: editlist
function editlist()
{
$cid = JRequest::getVar('cid');
if (count($cid) == 1) {
$this->setRedirect("index.php?option=com_jshopping&controller=products&task=edit&product_id=" . $cid[0]);
return 0;
}
$id_vendor_cuser = getIdVendorForCUser();
$jshopConfig = JSFactory::getConfig();
$db = JFactory::getDBO();
JPluginHelper::importPlugin('jshoppingadmin');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onLoadEditListProduct', array());
$products = $this->getModel("products");
$product = JTable::getInstance('product', 'jshop');
$_lang = $this->getModel("languages");
$_tax = $this->getModel("taxes");
$all_taxes = $_tax->getAllTaxes();
$list_tax = array();
$list_tax[] = JHTML::_('select.option', -1, "- - -", 'tax_id', 'tax_name');
foreach ($all_taxes as $tax) {
$list_tax[] = JHTML::_('select.option', $tax->tax_id, $tax->tax_name . ' (' . $tax->tax_value . '%)', 'tax_id', 'tax_name');
}
if (count($all_taxes) == 0) {
$withouttax = 1;
} else {
$withouttax = 0;
}
$categories = buildTreeCategory(0, 1, 0);
$manuf1 = array();
$manuf1[-1] = new stdClass();
$manuf1[-1]->manufacturer_id = '-1';
$manuf1[-1]->name = "- - -";
$manuf1[0] = new stdClass();
$manuf1[0]->manufacturer_id = '0';
$manuf1[0]->name = _JSHOP_NONE;
$_manufacturer = $this->getModel('manufacturers');
$manufs = $_manufacturer->getList();
$manufs = array_merge($manuf1, $manufs);
$price_modification = array();
$price_modification[] = JHTML::_('select.option', '+', '+', 'id', 'name');
$price_modification[] = JHTML::_('select.option', '-', '-', 'id', 'name');
$price_modification[] = JHTML::_('select.option', '*', '*', 'id', 'name');
$price_modification[] = JHTML::_('select.option', '/', '/', 'id', 'name');
$price_modification[] = JHTML::_('select.option', '=', '=', 'id', 'name');
$price_modification[] = JHTML::_('select.option', '%', '%', 'id', 'name');
$lists['price_mod_price'] = JHTML::_('select.genericlist', $price_modification, 'mod_price', '', 'id', 'name');
$lists['price_mod_old_price'] = JHTML::_('select.genericlist', $price_modification, 'mod_old_price', '', 'id', 'name');
if ($jshopConfig->admin_show_delivery_time) {
$_deliveryTimes = $this->getModel("deliveryTimes");
$all_delivery_times = $_deliveryTimes->getDeliveryTimes();
$all_delivery_times0 = array();
$all_delivery_times0[-1] = new stdClass();
$all_delivery_times0[-1]->id = '-1';
$all_delivery_times0[-1]->name = "- - -";
$all_delivery_times0[0] = new stdClass();
$all_delivery_times0[0]->id = '0';
$all_delivery_times0[0]->name = _JSHOP_NONE;
$lists['deliverytimes'] = JHTML::_('select.genericlist', array_merge($all_delivery_times0, $all_delivery_times), 'delivery_times_id', 'class = "inputbox" size = "1"', 'id', 'name');
}
//
// units
$_units = $this->getModel("units");
$allunits = $_units->getUnits();
if ($jshopConfig->admin_show_product_basic_price) {
$lists['basic_price_units'] = JHTML::_('select.genericlist', $allunits, 'basic_price_unit_id', 'class = "inputbox"', 'id', 'name');
}
//
// product labels
if ($jshopConfig->admin_show_product_labels) {
$_labels = $this->getModel("productLabels");
$alllabels = $_labels->getList();
$first = array();
$first[] = JHTML::_('select.option', '-1', "- - -", 'id', 'name');
$first[] = JHTML::_('select.option', '0', _JSHOP_SELECT, 'id', 'name');
$lists['labels'] = JHTML::_('select.genericlist', array_merge($first, $alllabels), 'label_id', 'class = "inputbox"', 'id', 'name');
}
//
// access rights
$accessgroups = getAccessGroups();
$first = array();
$first[] = JHTML::_('select.option', '-1', "- - -", 'id', 'title');
$lists['access'] = JHTML::_('select.genericlist', array_merge($first, $accessgroups), 'access', 'class = "inputbox"', 'id', 'title');
//currency
$current_currency = $product->currency_id;
if (!$current_currency) {
$current_currency = $jshopConfig->mainCurrency;
}
$_currency = $this->getModel("currencies");
$currency_list = $_currency->getAllCurrencies();
$lists['currency'] = JHTML::_('select.genericlist', $currency_list, 'currency_id', 'class = "inputbox"', 'currency_id', 'currency_code', $current_currency);
// vendors
$display_vendor_select = 0;
if ($jshopConfig->admin_show_vendors) {
$_vendors = $this->getModel("vendors");
$listvebdorsnames = $_vendors->getAllVendorsNames(1);
$first = array();
$first[] = JHTML::_('select.option', '-1', "- - -", 'id', 'name');
$lists['vendors'] = JHTML::_('select.genericlist', array_merge($first, $listvebdorsnames), 'vendor_id', 'class = "inputbox" size = "1"', 'id', 'name');
$display_vendor_select = 1;
//.........这里部分代码省略.........
示例11: display
function display($cachable = false, $urlparams = false)
{
checkAccessController("product_list_selectable");
JHTML::_('behavior.framework');
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$jshopConfig = JSFactory::getConfig();
$prodMdl = JSFactory::getModel('Products', 'JShoppingModel');
$context = "jshoping.list.admin.product";
$limit = $app->getUserStateFromRequest($context . 'limit', 'limit', $app->getCfg('list_limit'), 'int');
$limitstart = $app->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
if (isset($_GET['category_id']) && $_GET['category_id'] === "0") {
$app->setUserState($context . 'category_id', 0);
$app->setUserState($context . 'manufacturer_id', 0);
$app->setUserState($context . 'label_id', 0);
$app->setUserState($context . 'publish', 0);
$app->setUserState($context . 'text_search', '');
}
$category_id = $app->getUserStateFromRequest($context . 'category_id', 'category_id', 0, 'int');
$manufacturer_id = $app->getUserStateFromRequest($context . 'manufacturer_id', 'manufacturer_id', 0, 'int');
$label_id = $app->getUserStateFromRequest($context . 'label_id', 'label_id', 0, 'int');
$publish = $app->getUserStateFromRequest($context . 'publish', 'publish', 0, 'int');
$text_search = $app->getUserStateFromRequest($context . 'text_search', 'text_search', '');
$eName = JRequest::getVar('e_name');
$jsfname = JRequest::getVar('jsfname');
$eName = preg_replace('#[^A-Z0-9\\-\\_\\[\\]]#i', '', $eName);
if (!$jsfname) {
$jsfname = 'selectProductBehaviour';
}
$filter = array("category_id" => $category_id, "manufacturer_id" => $manufacturer_id, "label_id" => $label_id, "publish" => $publish, "text_search" => $text_search);
$total = $prodMdl->getCountAllProducts($filter);
$pagination = new JPagination($total, $limitstart, $limit);
$rows = $prodMdl->getAllProducts($filter, $pagination->limitstart, $pagination->limit);
$parentTop = new stdClass();
$parentTop->category_id = 0;
$parentTop->name = " - " . _JSHOP_CATEGORY . " - ";
$categories_select = buildTreeCategory(0, 1, 0);
array_unshift($categories_select, $parentTop);
$lists['treecategories'] = JHTML::_('select.genericlist', $categories_select, 'category_id', 'onchange="document.adminForm.submit();"', 'category_id', 'name', $category_id);
$manuf1 = array();
$manuf1[0] = new stdClass();
$manuf1[0]->manufacturer_id = '0';
$manuf1[0]->name = " - " . _JSHOP_NAME_MANUFACTURER . " - ";
$manufs = JSFactory::getModel('Manufacturers', 'JShoppingModel')->getList();
$manufs = array_merge($manuf1, $manufs);
$lists['manufacturers'] = JHTML::_('select.genericlist', $manufs, 'manufacturer_id', 'onchange="document.adminForm.submit();"', 'manufacturer_id', 'name', $manufacturer_id);
if ($jshopConfig->admin_show_product_labels) {
$alllabels = JSFactory::getModel('ProductLabels', 'JShoppingModel')->getList();
$first = array();
$first[] = JHTML::_('select.option', '0', " - " . _JSHOP_LABEL . " - ", 'id', 'name');
$lists['labels'] = JHTML::_('select.genericlist', array_merge($first, $alllabels), 'label_id', 'onchange="document.adminForm.submit();"', 'id', 'name', $label_id);
}
$f_option = array();
$f_option[] = JHTML::_('select.option', 0, " - " . _JSHOP_SHOW . " - ", 'id', 'name');
$f_option[] = JHTML::_('select.option', 1, _JSHOP_PUBLISH, 'id', 'name');
$f_option[] = JHTML::_('select.option', 2, _JSHOP_UNPUBLISH, 'id', 'name');
$lists['publish'] = JHTML::_('select.genericlist', $f_option, 'publish', 'onchange="document.adminForm.submit();"', 'id', 'name', $publish);
$view = $this->getView('product_list', 'html');
$view->setLayout("selectable");
$view->assign('rows', $rows);
$view->assign('lists', $lists);
$view->assign('category_id', $category_id);
$view->assign('manufacturer_id', $manufacturer_id);
$view->assign('pagination', $pagination);
$view->assign('text_search', $text_search);
$view->assign('config', $jshopConfig);
$view->assign('eName', $eName);
$view->assign('jsfname', $jsfname);
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeDisplayProductListSelectable', array(&$view));
$view->displaySelectable();
}
示例12: display
function display($cachable = false, $urlparams = false)
{
$jshopConfig = JSFactory::getConfig();
JHTML::_('behavior.calendar');
$mainframe = JFactory::getApplication();
$params = $mainframe->getParams();
$Itemid = JRequest::getInt('Itemid');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeLoadSearchForm', array());
$category_id = JRequest::getInt('category_id');
$seo = JSFactory::getTable("seo", "jshop");
$seodata = $seo->loadData("search");
if (getThisURLMainPageShop()) {
appendPathWay(_JSHOP_SEARCH);
if ($seodata->title == "") {
$seodata->title = _JSHOP_SEARCH;
}
setMetaData($seodata->title, $seodata->keyword, $seodata->description);
} else {
setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params);
}
$context = "jshoping.search.front";
if ($jshopConfig->admin_show_product_extra_field) {
$urlsearchcaracters = SEFLink("index.php?option=com_jshopping&controller=search&task=get_html_characteristics&ajax=1", 0, 1);
$change_cat_val = "onchange='updateSearchCharacteristic(\"" . $urlsearchcaracters . "\",this.value);'";
} else {
$change_cat_val = "";
}
$categories = buildTreeCategory(1);
$first = JHTML::_('select.option', 0, _JSHOP_SEARCH_ALL_CATEGORIES, 'category_id', 'name');
array_unshift($categories, $first);
$list_categories = JHTML::_('select.genericlist', $categories, 'category_id', 'class = "inputbox" size = "1" ' . $change_cat_val, 'category_id', 'name');
$first = JHTML::_('select.option', 0, _JSHOP_SEARCH_ALL_MANUFACTURERS, 'manufacturer_id', 'name');
$_manufacturers = JSFactory::getTable('manufacturer', 'jshop');
$manufacturers = $_manufacturers->getList();
array_unshift($manufacturers, $first);
$list_manufacturers = JHTML::_('select.genericlist', $manufacturers, 'manufacturer_id', 'class = "inputbox" size = "1"', 'manufacturer_id', 'name');
if ($jshopConfig->admin_show_product_extra_field) {
$characteristic_fields = JSFactory::getAllProductExtraField();
$characteristic_fieldvalues = JSFactory::getAllProductExtraFieldValueDetail();
$characteristic_displayfields = JSFactory::getDisplayFilterExtraFieldForCategory($category_id);
}
$characteristics = "";
if ($jshopConfig->admin_show_product_extra_field) {
$view_name = "search";
$view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
$view = $this->getView($view_name, "html", '', $view_config);
$view->setLayout("characteristics");
$view->assign('characteristic_fields', $characteristic_fields);
$view->assign('characteristic_fieldvalues', $characteristic_fieldvalues);
$view->assign('characteristic_displayfields', $characteristic_displayfields);
$characteristics = $view->loadTemplate();
}
$view_name = "search";
$view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
$view = $this->getView($view_name, getDocumentType(), '', $view_config);
$view->setLayout("form");
$view->assign('list_categories', $list_categories);
$view->assign('list_manufacturers', $list_manufacturers);
$view->assign('characteristics', $characteristics);
$view->assign('config', $jshopConfig);
$view->assign('Itemid', $Itemid);
$view->assign('action', SEFLink("index.php?option=com_jshopping&controller=search&task=result"));
$dispatcher->trigger('onBeforeDisplaySearchFormView', array(&$view));
$view->display();
}
示例13: edit
function edit()
{
$id = JRequest::getInt("id");
$productfield = JTable::getInstance('productField', 'jshop');
$productfield->load($id);
$_lang = $this->getModel("languages");
$languages = $_lang->getAllLanguages(1);
$multilang = count($languages) > 1;
$all = array();
$all[] = JHTML::_('select.option', 1, _JSHOP_ALL, 'id', 'value');
$all[] = JHTML::_('select.option', 0, _JSHOP_SELECTED, 'id', 'value');
if (!isset($productfield->allcats)) {
$productfield->allcats = 1;
}
$lists['allcats'] = JHTML::_('select.radiolist', $all, 'allcats', 'onclick="PFShowHideSelectCats()"', 'id', 'value', $productfield->allcats);
$categories_selected = $productfield->getCategorys();
$categories = buildTreeCategory(0, 1, 0);
$lists['categories'] = JHTML::_('select.genericlist', $categories, 'category_id[]', 'class="inputbox" size="10" multiple = "multiple"', 'category_id', 'name', $categories_selected);
$type = array();
$type[] = JHTML::_('select.option', 0, _JSHOP_LIST, 'id', 'value');
$type[] = JHTML::_('select.option', -1, _JSHOP_MULTI_LIST, 'id', 'value');
$type[] = JHTML::_('select.option', 1, _JSHOP_TEXT, 'id', 'value');
if (!isset($productfield->type)) {
$productfield->type = 0;
}
if ($productfield->multilist) {
$productfield->type = -1;
}
$lists['type'] = JHTML::_('select.radiolist', $type, 'type', '', 'id', 'value', $productfield->type);
$_productfieldgroups = $this->getModel("productFieldGroups");
$groups = $_productfieldgroups->getList();
$groups0 = array();
$groups0[] = JHTML::_('select.option', 0, "- - -", 'id', 'name');
$lists['group'] = JHTML::_('select.genericlist', array_merge($groups0, $groups), 'group', 'class="inputbox"', 'id', 'name', $productfield->group);
$view = $this->getView("product_fields", 'html');
$view->setLayout("edit");
JFilterOutput::objectHTMLSafe($productfield, ENT_QUOTES);
$view->assign('row', $productfield);
$view->assign('lists', $lists);
$view->assign('languages', $languages);
$view->assign('multilang', $multilang);
$view->assign('etemplatevar', '');
JPluginHelper::importPlugin('jshoppingadmin');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeEditProductFields', array(&$view));
$view->displayEdit();
}
示例14: display
function display($cachable = false, $urlparams = false)
{
$mainframe = JFactory::getApplication();
$jshopConfig = JSFactory::getConfig();
$session = JFactory::getSession();
$session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']);
$session->set("jshop_end_page_list_product", $_SERVER['REQUEST_URI']);
JPluginHelper::importPlugin('jshoppingproducts');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeLoadProductList', array());
$product = JTable::getInstance('product', 'jshop');
$params = $mainframe->getParams();
$header = getPageHeaderOfParams($params);
$prefix = $params->get('pageclass_sfx');
$seo = JTable::getInstance("seo", "jshop");
$seodata = $seo->loadData("all-products");
setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params);
$category_id = JRequest::getInt('category_id');
$manufacturer_id = JRequest::getInt('manufacturer_id');
$label_id = JRequest::getInt('label_id');
$vendor_id = JRequest::getInt('vendor_id');
$action = xhtmlUrl($_SERVER['REQUEST_URI']);
$products_page = $jshopConfig->count_products_to_page;
$count_product_to_row = $jshopConfig->count_products_to_row;
$context = "jshoping.alllist.front.product";
$contextfilter = "jshoping.list.front.product.fulllist";
$orderby = $mainframe->getUserStateFromRequest($context . 'orderby', 'orderby', $jshopConfig->product_sorting_direction, 'int');
$order = $mainframe->getUserStateFromRequest($context . 'order', 'order', $jshopConfig->product_sorting, 'int');
$limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $products_page, 'int');
if (!$limit) {
$limit = $products_page;
}
$limitstart = JRequest::getInt('limitstart');
$orderbyq = getQuerySortDirection($order, $orderby);
$image_sort_dir = getImgSortDirection($order, $orderby);
$field_order = $jshopConfig->sorting_products_field_s_select[$order];
$filters = getBuildFilterListProduct($contextfilter, array());
$total = $product->getCountAllProducts($filters);
jimport('joomla.html.pagination');
$pagination = new JPagination($total, $limitstart, $limit);
$pagenav = $pagination->getPagesLinks();
$dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'products'));
if ($limitstart >= $total) {
$limitstart = 0;
}
$rows = $product->getAllProducts($filters, $field_order, $orderbyq, $limitstart, $limit);
addLinkToProducts($rows, 0, 1);
foreach ($jshopConfig->sorting_products_name_s_select as $key => $value) {
$sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value');
}
insertValueInArray($products_page, $jshopConfig->count_product_select);
//insert products_page count
foreach ($jshopConfig->count_product_select as $key => $value) {
$product_count[] = JHTML::_('select.option', $key, $value, 'count_id', 'count_value');
}
$sorting_sel = JHTML::_('select.genericlist', $sorts, 'order', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'sort_id', 'sort_value', $order);
$product_count_sel = JHTML::_('select.genericlist', $product_count, 'limit', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'count_id', 'count_value', $limit);
$_review = JTable::getInstance('review', 'jshop');
$allow_review = $_review->getAllowReview();
if ($jshopConfig->show_product_list_filters) {
$first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'manufacturer_id', 'name');
$_manufacturers = JTable::getInstance('manufacturer', 'jshop');
if ($jshopConfig->manufacturer_sorting == 2) {
$morder = 'name';
} else {
$morder = 'ordering';
}
$listmanufacturers = $_manufacturers->getList();
array_unshift($listmanufacturers, $first_el);
if (isset($filters['manufacturers'][0])) {
$active_manufacturer = $filters['manufacturers'][0];
} else {
$active_manufacturer = '';
}
$manufacuturers_sel = JHTML::_('select.genericlist', $listmanufacturers, 'manufacturers[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'manufacturer_id', 'name', $active_manufacturer);
$first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'category_id', 'name');
$categories = buildTreeCategory(1);
array_unshift($categories, $first_el);
if (isset($filters['categorys'][0])) {
$active_category = $filters['categorys'][0];
} else {
$active_category = 0;
}
$categorys_sel = JHTML::_('select.genericlist', $categories, 'categorys[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'category_id', 'name', $active_category);
} else {
$manufacuturers_sel = '';
$categorys_sel = '';
}
$display_list_products = count($rows) > 0 || willBeUseFilter($filters);
$dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
$view_name = "products";
$view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
$view = $this->getView($view_name, getDocumentType(), '', $view_config);
$view->setLayout("products");
$view->assign('config', $jshopConfig);
$view->assign('template_block_list_product', "list_products/list_products.php");
$view->assign('template_block_form_filter', "list_products/form_filters.php");
$view->assign('template_block_pagination', "list_products/block_pagination.php");
$view->assign('path_image_sorting_dir', $jshopConfig->live_path . 'images/' . $image_sort_dir);
$view->assign('filter_show', 1);
//.........这里部分代码省略.........
示例15: getHtmlSelectFilterCategory
public function getHtmlSelectFilterCategory($fulllist = 0)
{
if (JSFactory::getConfig()->show_product_list_filters) {
$filters = $this->getFilters();
if (!$fulllist) {
$filter_categorys = $this->getModel()->getCategorys();
} else {
$filter_categorys = buildTreeCategory(1);
}
if (isset($filters['categorys'][0])) {
$active_category = $filters['categorys'][0];
} else {
$active_category = 0;
}
$categorys_sel = JshopHelpersSelects::getFilterCategory($filter_categorys, $active_category);
} else {
$categorys_sel = '';
}
return $categorys_sel;
}