本文整理汇总了PHP中addLinkToProducts函数的典型用法代码示例。如果您正苦于以下问题:PHP addLinkToProducts函数的具体用法?PHP addLinkToProducts怎么用?PHP addLinkToProducts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addLinkToProducts函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProducts
function getProducts($filters, $order = null, $orderby = null, $limitstart = 0, $limit = 0)
{
$db = JFactory::getDBO();
$this->buildAdvQuery($filters, $order, $orderby);
$query = "SELECT " . $this->adv_result . " FROM `#__jshopping_products` AS prod\n LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id\n LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id \n " . $this->adv_from . "\n WHERE prod.product_publish = '1' AND cat.category_publish='1'\n " . $this->adv_query . "\n GROUP BY prod.product_id " . $this->order_query;
$db->setQuery($query, $limitstart, $limit);
$rows = $db->loadObjectList();
$rows = listProductUpdateData($rows);
addLinkToProducts($rows, 0, 1);
return $rows;
}
示例2: addItemsFromOtherSection
public function addItemsFromOtherSection(&$view)
{
//echo'<pre>';print_r($view);echo'</pre>';
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$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']);
$category_id = JRequest::getInt('category_id');
if ($category_id == 1) {
$cat_id = 2;
} elseif ($category_id == 2) {
$cat_id = 1;
}
$category = JSFactory::getTable('category', 'jshop');
$category->load($cat_id);
$category->getDescription();
$jshopConfig->count_products_to_page = $category->products_page;
$context = "jshoping.list.front.product";
$contextfilter = "jshoping.list.front.product.cat." . $category_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', $category->products_page, 'int');
if (!$limit) {
$limit = $category->products_page;
}
$limitstart = JRequest::getInt('limitstart');
$orderbyq = getQuerySortDirection($order, $orderby);
$image_sort_dir = getImgSortDirection($order, $orderby);
$field_order = $jshopConfig->sorting_products_field_select[$order];
$filters = getBuildFilterListProduct($contextfilter, array("categorys"));
$orderfield = $jshopConfig->category_sorting == 1 ? "ordering" : "name";
$sub_categories = $category->getChildCategories($orderfield, 'asc', $publish = 1);
//echo'<pre>';print_r($category);echo'</pre>';die;
$total = $category->getCountProducts($filters);
//echo'<pre>';print_r($total);echo'</pre>';die;
if ($limitstart >= $total) {
$limitstart = 0;
}
$products = $category->getProducts($filters, $field_order, $orderbyq, $limitstart, $limit);
addLinkToProducts($products, $category_id);
//echo'<pre>';print_r($products);echo'</pre>';
$view->assign('another_products', $products);
$view->assign('another_category', $category);
}
示例3: 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);
//.........这里部分代码省略.........
示例4: listProductUpdateData
//.........这里部分代码省略.........
$products[$key]->_original_product_price = $products[$key]->product_price;
$products[$key]->product_price_wp = $products[$key]->product_price;
$products[$key]->product_price_default = 0;
if ($jshopConfig->product_list_show_min_price) {
if ($products[$key]->min_price > 0) {
$products[$key]->product_price = $products[$key]->min_price;
}
}
$products[$key]->show_price_from = 0;
if ($jshopConfig->product_list_show_min_price && $value->different_prices) {
$products[$key]->show_price_from = 1;
}
$products[$key]->product_price = getPriceFromCurrency($products[$key]->product_price, $products[$key]->currency_id);
$products[$key]->product_old_price = getPriceFromCurrency($products[$key]->product_old_price, $products[$key]->currency_id);
$products[$key]->product_price_wp = getPriceFromCurrency($products[$key]->product_price_wp, $products[$key]->currency_id);
$products[$key]->product_price = getPriceCalcParamsTax($products[$key]->product_price, $products[$key]->tax_id);
$products[$key]->product_old_price = getPriceCalcParamsTax($products[$key]->product_old_price, $products[$key]->tax_id);
$products[$key]->product_price_wp = getPriceCalcParamsTax($products[$key]->product_price_wp, $products[$key]->tax_id);
if ($userShop->percent_discount && $use_userdiscount) {
$products[$key]->product_price_default = $products[$key]->_original_product_price;
$products[$key]->product_price_default = getPriceFromCurrency($products[$key]->product_price_default, $products[$key]->currency_id);
$products[$key]->product_price_default = getPriceCalcParamsTax($products[$key]->product_price_default, $products[$key]->tax_id);
$products[$key]->product_price = getPriceDiscount($products[$key]->product_price, $userShop->percent_discount);
$products[$key]->product_old_price = getPriceDiscount($products[$key]->product_old_price, $userShop->percent_discount);
$products[$key]->product_price_wp = getPriceDiscount($products[$key]->product_price_wp, $userShop->percent_discount);
}
if ($jshopConfig->list_products_calc_basic_price_from_product_price) {
$products[$key]->basic_price_info = getProductBasicPriceInfo($value, $products[$key]->product_price_wp);
} else {
$products[$key]->basic_price_info = getProductBasicPriceInfo($value, $products[$key]->product_price);
}
if ($value->tax_id) {
$products[$key]->tax = $taxes[$value->tax_id];
}
if ($jshopConfig->product_list_show_manufacturer && $value->product_manufacturer_id && isset($manufacturers[$value->product_manufacturer_id])) {
$products[$key]->manufacturer = $manufacturers[$value->product_manufacturer_id];
} else {
$products[$key]->manufacturer = new stdClass();
$products[$key]->manufacturer->name = '';
}
if ($jshopConfig->admin_show_product_extra_field) {
$products[$key]->extra_field = getProductExtraFieldForProduct($value);
} else {
$products[$key]->extra_field = '';
}
if ($jshopConfig->product_list_show_vendor) {
$vendordata = $vendors[$value->vendor_id];
$vendordata->products = SEFLink("index.php?option=com_jshopping&controller=vendor&task=products&vendor_id=" . $vendordata->id, 1);
$products[$key]->vendor = $vendordata;
} else {
$products[$key]->vendor = '';
}
if ($jshopConfig->hide_delivery_time_out_of_stock && $products[$key]->product_quantity <= 0) {
$products[$key]->delivery_times_id = 0;
$value->delivery_times_id = 0;
}
if ($jshopConfig->show_delivery_time && $value->delivery_times_id) {
$products[$key]->delivery_time = $deliverytimes[$value->delivery_times_id];
} else {
$products[$key]->delivery_time = '';
}
$products[$key]->_display_price = getDisplayPriceForProduct($products[$key]->product_price);
if (!$products[$key]->_display_price) {
$products[$key]->product_old_price = 0;
$products[$key]->product_price_default = 0;
$products[$key]->basic_price_info['price_show'] = 0;
$products[$key]->tax = 0;
$jshopConfig->show_plus_shipping_in_product = 0;
}
if ($jshopConfig->product_list_show_qty_stock) {
$products[$key]->qty_in_stock = getDataProductQtyInStock($products[$key]);
}
$image = getPatchProductImage($products[$key]->image, 'thumb');
$products[$key]->product_name_image = $products[$key]->image;
$products[$key]->product_thumb_image = $image;
if (!$image) {
$image = $noimage;
}
$products[$key]->image = $image_path . "/" . $image;
$products[$key]->template_block_product = "product.php";
if (!$jshopConfig->admin_show_product_labels) {
$products[$key]->label_id = null;
}
if ($products[$key]->label_id) {
$image = getNameImageLabel($products[$key]->label_id);
if ($image) {
$products[$key]->_label_image = $jshopConfig->image_labels_live_path . "/" . $image;
}
$products[$key]->_label_name = getNameImageLabel($products[$key]->label_id, 2);
}
if ($jshopConfig->display_short_descr_multiline) {
$products[$key]->short_description = nl2br($products[$key]->short_description);
}
}
if ($setUrl) {
addLinkToProducts($products, 0, 1);
}
$dispatcher->trigger('onListProductUpdateData', array(&$products));
return $products;
}
示例5: array
if (is_array($cat_str)) {
$cat_arr = array();
foreach ($cat_str as $key => $curr) {
if (intval($curr)) {
$cat_arr[$key] = intval($curr);
}
}
} else {
$cat_arr = array();
if (intval($cat_str)) {
$cat_arr[] = intval($cat_str);
}
}
$rows = $product->getLastProducts($params->get('count_products', 4), $cat_arr);
//echo'<pre>';print_r($rows[0]);echo'</pre>';
addLinkToProducts($rows, 0, 1);
if ($enable_addon) {
$dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
$view = new stdClass();
$view->rows = $rows;
$dispatcher->trigger('onBeforeDisplayProductListView', array(&$view));
$rows = $view->rows;
}
$noimage = $jshopConfig->image_product_live_path . "/noimage.gif";
$shippinginfo = SEFLink($jshopConfig->shippinginfourl, 1);
// config modul
$show_image = $params->get('show_image', 1);
$show_image_label = $params->get('show_image_label', 0);
$allow_review = $params->get('allow_review', 0);
$short_description = $params->get('short_description', 0);
$manufacturer_name = $params->get('manufacturer_name', 0);
示例6: result
//.........这里部分代码省略.........
if ($date_from && checkMyDate($date_from)) {
$adv_query .= " AND prod.product_date_added >= '" . $db->escape($date_from) . "'";
}
$where_search = "";
if ($search_type == "exact") {
$word = addcslashes($db->escape($search), "_%");
$tmp = array();
foreach ($jshopConfig->product_search_fields as $field) {
$tmp[] = "LOWER(" . getDBFieldNameFromConfig($field) . ") LIKE '%" . $word . "%'";
}
$where_search = implode(' OR ', $tmp);
} else {
$words = explode(" ", $search);
$search_word = array();
foreach ($words as $word) {
$word = addcslashes($db->escape($word), "_%");
$tmp = array();
foreach ($jshopConfig->product_search_fields as $field) {
$tmp[] = "LOWER(" . getDBFieldNameFromConfig($field) . ") LIKE '%" . $word . "%'";
}
$where_search_block = implode(' OR ', $tmp);
$search_word[] = "(" . $where_search_block . ")";
}
if ($search_type == "any") {
$where_search = implode(" OR ", $search_word);
} else {
$where_search = implode(" AND ", $search_word);
}
}
if ($where_search) {
$adv_query .= " AND ({$where_search})";
}
$orderbyf = $jshopConfig->sorting_products_field_s_select[$order];
$order_query = $product->getBuildQueryOrderListProduct($orderbyf, $orderbyq, $adv_from);
$dispatcher->trigger('onBeforeQueryGetProductList', array("search", &$adv_result, &$adv_from, &$adv_query, &$order_query, &$filters));
$query = "SELECT count(distinct prod.product_id) FROM `#__jshopping_products` AS prod\n LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id\n LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id \n {$adv_from}\n WHERE prod.product_publish = '1' AND cat.category_publish='1'\n {$adv_query}";
$db->setQuery($query);
$total = $db->loadResult();
if (!$total) {
$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("noresult");
$view->assign('search', $search);
$view->display();
return 0;
}
$dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'search'));
if ($limitstart >= $total) {
$limitstart = 0;
}
$query = "SELECT {$adv_result} FROM `#__jshopping_products` AS prod\n LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id\n LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id \n {$adv_from}\n WHERE prod.product_publish = '1' AND cat.category_publish='1'\n {$adv_query}\n GROUP BY prod.product_id " . $order_query;
$db->setQuery($query, $limitstart, $limit);
$rows = $db->loadObjectList();
$rows = listProductUpdateData($rows);
addLinkToProducts($rows, 0, 1);
jimport('joomla.html.pagination');
$pagination = new JPagination($total, $limitstart, $limit);
$pagenav = $pagination->getPagesLinks();
foreach ($jshopConfig->sorting_products_name_s_select as $key => $value) {
$sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value');
}
insertValueInArray($jshopConfig->count_products_to_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();
$action = xhtmlUrl($_SERVER['REQUEST_URI']);
$dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
$view_name = "search";
$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('search', $search);
$view->assign('total', $total);
$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', 0);
$view->assign('filter_show_category', 0);
$view->assign('filter_show_manufacturer', 0);
$view->assign('pagination', $pagenav);
$view->assign('pagination_obj', $pagination);
$view->assign('display_pagination', $pagenav != "");
$view->assign('product_count', $product_count_sel);
$view->assign('sorting', $sorting_sel);
$view->assign('action', $action);
$view->assign('orderby', $orderby);
$view->assign('count_product_to_row', $jshopConfig->count_products_to_row);
$view->assign('rows', $rows);
$view->assign('allow_review', $allow_review);
$view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1));
$dispatcher->trigger('onBeforeDisplayProductListView', array(&$view));
$view->display();
}
示例7: view
function view()
{
$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());
$manufacturer_id = JRequest::getInt('manufacturer_id');
$category_id = JRequest::getInt('category_id');
$label_id = JRequest::getInt('label_id');
$vendor_id = JRequest::getInt('vendor_id');
$manufacturer = JTable::getInstance('manufacturer', 'jshop');
$manufacturer->load($manufacturer_id);
$manufacturer->getDescription();
JPluginHelper::importPlugin('jshopping');
$dispatcher->trigger('onBeforeDisplayManufacturer', array(&$manufacturer));
if ($manufacturer->manufacturer_publish == 0) {
JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
return;
}
if (getShopManufacturerPageItemid() == JRequest::getInt('Itemid')) {
appendPathWay($manufacturer->name);
}
if ($manufacturer->meta_title == "") {
$manufacturer->meta_title = $manufacturer->name;
}
setMetaData($manufacturer->meta_title, $manufacturer->meta_keyword, $manufacturer->meta_description);
$action = xhtmlUrl($_SERVER['REQUEST_URI']);
if (!$manufacturer->products_page) {
$manufacturer->products_page = $jshopConfig->count_products_to_page;
}
$count_product_to_row = $manufacturer->products_row;
if (!$count_product_to_row) {
$count_product_to_row = $jshopConfig->count_products_to_row;
}
$context = "jshoping.manufacturlist.front.product";
$contextfilter = "jshoping.list.front.product.manf." . $manufacturer_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', $manufacturer->products_page, 'int');
if (!$limit) {
$limit = $manufacturer->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("manufacturers"));
$total = $manufacturer->getCountProducts($filters);
jimport('joomla.html.pagination');
$pagination = new JPagination($total, $limitstart, $limit);
$pagenav = $pagination->getPagesLinks();
$dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'manufacturer'));
if ($limitstart >= $total) {
$limitstart = 0;
}
$rows = $manufacturer->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($manufacturer->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) {
$filter_categorys = $manufacturer->getCategorys();
$first_category = array();
$first_category[] = JHTML::_('select.option', 0, _JSHOP_ALL, 'id', 'name');
if (isset($filters['categorys'][0])) {
$active_category = $filters['categorys'][0];
} else {
$active_category = 0;
}
$categorys_sel = JHTML::_('select.genericlist', array_merge($first_category, $filter_categorys), 'categorys[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'id', 'name', $active_category);
} else {
$categorys_sel = '';
}
if ($jshopConfig->use_plugin_content) {
changeDataUsePluginContent($manufacturer, "manufacturer");
}
$display_list_products = count($rows) > 0 || willBeUseFilter($filters);
$dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
$view_name = "manufacturer";
$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);
//.........这里部分代码省略.........
示例8: getProducts
function getProducts($filters, $order = null, $orderby = null, $limitstart = 0, $limit = 0)
{
$adv_query = "";
$adv_from = "";
$adv_result = $this->getBuildQueryListProductDefaultResult();
$this->getBuildQueryListProduct("category", "list", $filters, $adv_query, $adv_from, $adv_result);
$order_query = $this->getBuildQueryOrderListProduct($order, $orderby, $adv_from);
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeQueryGetProductList', array("category", &$adv_result, &$adv_from, &$adv_query, &$order_query, &$filters));
$query = "SELECT {$adv_result} FROM `#__jshopping_products` AS prod\n LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat USING (product_id)\n {$adv_from}\n WHERE pr_cat.category_id = '" . $this->_db->escape($this->category_id) . "' AND prod.product_publish = '1' " . $adv_query . " " . $order_query;
if ($limit) {
$this->_db->setQuery($query, $limitstart, $limit);
} else {
$this->_db->setQuery($query);
}
$products = $this->_db->loadObjectList();
$products = listProductUpdateData($products);
addLinkToProducts($products, $this->category_id);
return $products;
}
示例9: last
function last()
{
$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());
$product = JSFactory::getTable('product', 'jshop');
$params = $mainframe->getParams();
$header = getPageHeaderOfParams($params);
$prefix = $params->get('pageclass_sfx');
$seo = JSFactory::getTable("seo", "jshop");
$seodata = $seo->loadData("lastproducts");
setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params);
$count_product_to_row = $jshopConfig->count_products_to_row_last;
$contextfilter = "jshoping.list.front.product.last";
$filters = getBuildFilterListProduct($contextfilter, array());
$rows = $product->getLastProducts($jshopConfig->count_products_to_page_last, null, $filters);
addLinkToProducts($rows, 0, 1);
$_review = JSFactory::getTable('review', 'jshop');
$allow_review = $_review->getAllowReview();
$display_list_products = count($rows) > 0;
$jshopConfig->show_sort_product = 0;
$jshopConfig->show_count_select_products = 0;
$jshopConfig->show_product_list_filters = 0;
$dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
$view_name = "products";
$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_block_form_filter', "list_products/form_filters.php");
$view->assign('template_block_pagination', "list_products/block_pagination.php");
$view->assign("header", $header);
$view->assign("prefix", $prefix);
$view->assign("rows", $rows);
$view->assign("count_product_to_row", $count_product_to_row);
$view->assign('allow_review', $allow_review);
$view->assign('display_list_products', $display_list_products);
$view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1));
$dispatcher->trigger('onBeforeDisplayProductListView', array(&$view));
$view->display();
}
示例10: view
function view()
{
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$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());
$category_id = JRequest::getInt('category_id');
$category = JSFactory::getTable('category', 'jshop');
$category->load($category_id);
$category->getDescription();
$dispatcher->trigger('onAfterLoadCategory', array(&$category, &$user));
if (!$category->category_id || $category->category_publish == 0 || !in_array($category->access, $user->getAuthorisedViewLevels())) {
JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
return;
}
$manufacturer_id = JRequest::getInt('manufacturer_id');
$label_id = JRequest::getInt('label_id');
$vendor_id = JRequest::getInt('vendor_id');
$view_name = "category";
$view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
$view = $this->getView($view_name, getDocumentType(), '', $view_config);
if ($category->category_template == "") {
$category->category_template = "default";
}
$view->setLayout("category_" . $category->category_template);
$jshopConfig->count_products_to_page = $category->products_page;
$context = "jshoping.list.front.product";
$contextfilter = "jshoping.list.front.product.cat." . $category_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', $category->products_page, 'int');
if (!$limit) {
$limit = $category->products_page;
}
$limitstart = JRequest::getInt('limitstart');
$orderbyq = getQuerySortDirection($order, $orderby);
$image_sort_dir = getImgSortDirection($order, $orderby);
$field_order = $jshopConfig->sorting_products_field_select[$order];
$filters = getBuildFilterListProduct($contextfilter, array("categorys"));
if (getShopMainPageItemid() == JRequest::getInt('Itemid')) {
appendExtendPathWay($category->getTreeChild(), 'category');
}
$orderfield = $jshopConfig->category_sorting == 1 ? "ordering" : "name";
$sub_categories = $category->getChildCategories($orderfield, 'asc', $publish = 1);
$dispatcher->trigger('onBeforeDisplayCategory', array(&$category, &$sub_categories));
if ($category->meta_title == "") {
$category->meta_title = $category->name;
}
setMetaData($category->meta_title, $category->meta_keyword, $category->meta_description);
$total = $category->getCountProducts($filters);
$action = xhtmlUrl($_SERVER['REQUEST_URI']);
$dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'category'));
if ($limitstart >= $total) {
$limitstart = 0;
}
$products = $category->getProducts($filters, $field_order, $orderbyq, $limitstart, $limit);
addLinkToProducts($products, $category_id);
jimport('joomla.html.pagination');
$pagination = new JPagination($total, $limitstart, $limit);
$pagenav = $pagination->getPagesLinks();
foreach ($jshopConfig->sorting_products_name_select as $key => $value) {
$sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value');
}
insertValueInArray($category->products_page, $jshopConfig->count_product_select);
//insert category 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 = JSFactory::getTable('review', 'jshop');
$allow_review = $_review->getAllowReview();
if (!$category->category_ordertype) {
$category->category_ordertype = 1;
}
$manufacuturers_sel = '';
if ($jshopConfig->show_product_list_filters) {
$filter_manufactures = $category->getManufacturers();
$first_manufacturer = array();
$first_manufacturer[] = JHTML::_('select.option', 0, _JSHOP_ALL, 'id', 'name');
$manufacuturers_sel = JHTML::_('select.genericlist', array_merge($first_manufacturer, $filter_manufactures), 'manufacturers[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'id', 'name', $filters['manufacturers'][0]);
}
if ($jshopConfig->use_plugin_content) {
changeDataUsePluginContent($category, "category");
}
$willBeUseFilter = willBeUseFilter($filters);
$display_list_products = count($products) > 0 || $willBeUseFilter;
$dispatcher->trigger('onBeforeDisplayProductList', array(&$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);
$view->assign('filter_show', 1);
//.........这里部分代码省略.........
示例11: onBeforeDisplayProductList
function onBeforeDisplayProductList(&$products)
{
addLinkToProducts($products);
}