本文整理汇总了PHP中shopFunctionsF::setLastVisitedCategoryId方法的典型用法代码示例。如果您正苦于以下问题:PHP shopFunctionsF::setLastVisitedCategoryId方法的具体用法?PHP shopFunctionsF::setLastVisitedCategoryId怎么用?PHP shopFunctionsF::setLastVisitedCategoryId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shopFunctionsF
的用法示例。
在下文中一共展示了shopFunctionsF::setLastVisitedCategoryId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Function Description
*
* @author RolandD
* @author George
* @access public
*/
public function display($cachable = false, $urlparams = false)
{
if (JRequest::getvar('search')) {
$view = $this->getView('category', 'html');
$view->display();
} else {
// Display it all
$safeurlparams = array('virtuemart_category_id' => 'INT', 'virtuemart_manufacturer_id' => 'INT', 'virtuemart_currency_id' => 'INT', 'return' => 'BASE64', 'lang' => 'CMD', 'orderby' => 'CMD', 'limitstart' => 'CMD', 'order' => 'CMD', 'limit' => 'CMD');
parent::display(true, $safeurlparams);
}
if ($categoryId = JRequest::getInt('virtuemart_category_id', 0)) {
shopFunctionsF::setLastVisitedCategoryId($categoryId);
}
}
示例2: display
/**
* Function Description
*
* @author RolandD
* @author George
* @access public
*/
public function display($cachable = false, $urlparams = false)
{
if (JRequest::getvar('search')) {
$view = $this->getView('category', 'html');
$view->display();
} else {
// Display it all
$document = JFactory::getDocument();
$viewType = $document->getType();
$viewName = JRequest::getCmd('view', $this->default_view);
$viewLayout = JRequest::getCmd('layout', 'default');
$view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout));
$view->assignRef('document', $document);
$view->display();
}
if ($categoryId = JRequest::getInt('virtuemart_category_id', 0)) {
shopFunctionsF::setLastVisitedCategoryId($categoryId);
}
return $this;
}
示例3: display
/**
* Collect all data to show on the template
*
* @author Max Milbers
*/
function display($tpl = NULL)
{
$app = JFactory::getApplication();
if (!VmConfig::get('ask_question', false) and !VmConfig::get('askprice', false)) {
$app->redirect(JRoute::_('index.php?option=com_virtuemart', 'Disabled function'));
}
if (!VmConfig::get('recommend_unauth', false)) {
$user = JFactory::getUser();
if ($user->guest) {
$app->redirect(JRoute::_('index.php?option=com_virtuemart', 'JGLOBAL_YOU_MUST_LOGIN_FIRST'));
}
}
$show_prices = VmConfig::get('show_prices', 1);
if ($show_prices == '1') {
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
}
$this->assignRef('show_prices', $show_prices);
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$task = JRequest::getCmd('task');
if (!class_exists('VmImage')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
}
// Load the product
$product_model = VmModel::getModel('product');
$category_model = VmModel::getModel('Category');
$virtuemart_product_idArray = JRequest::getInt('virtuemart_product_id', 0);
if (is_array($virtuemart_product_idArray)) {
$virtuemart_product_id = $virtuemart_product_idArray[0];
} else {
$virtuemart_product_id = $virtuemart_product_idArray;
}
if (empty($virtuemart_product_id)) {
self::showLastCategory($tpl);
return;
}
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$product = $product_model->getProduct($virtuemart_product_id);
// Set Canonic link
$format = JRequest::getWord('format', 'html');
if ($format == 'html') {
$document->addHeadLink($product->canonical, 'canonical', 'rel', '');
}
// Set the titles
$document->setTitle(JText::sprintf('COM_VIRTUEMART_PRODUCT_DETAILS_TITLE', $product->product_name . ' - ' . JText::_('COM_VIRTUEMART_PRODUCT_ASK_QUESTION')));
$this->assignRef('product', $product);
if (empty($product)) {
self::showLastCategory($tpl);
return;
}
$product_model->addImages($product, 1);
/* Get the category ID */
$virtuemart_category_id = JRequest::getInt('virtuemart_category_id');
if ($virtuemart_category_id == 0 && !empty($product)) {
if (array_key_exists('0', $product->categories)) {
$virtuemart_category_id = $product->categories[0];
}
}
shopFunctionsF::setLastVisitedCategoryId($virtuemart_category_id);
if ($category_model) {
$category = $category_model->getCategory($virtuemart_category_id);
$this->assignRef('category', $category);
$pathway->addItem($category->category_name, JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $virtuemart_category_id, FALSE));
}
//$pathway->addItem(JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), $uri->toString(array('path', 'query', 'fragment')));
$pathway->addItem($product->product_name, JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $product->virtuemart_product_id, FALSE));
// for askquestion
$pathway->addItem(JText::_('COM_VIRTUEMART_PRODUCT_ASK_QUESTION'));
$this->assignRef('user', JFactory::getUser());
if ($product->metadesc) {
$document->setDescription($product->metadesc);
}
if ($product->metakey) {
$document->setMetaData('keywords', $product->metakey);
}
//We never want that ask a question is indexed
$document->setMetaData('robots', 'NOINDEX, NOFOLLOW, NOARCHIVE, NOSNIPPET');
if ($mainframe->getCfg('MetaTitle') == '1') {
$document->setMetaData('title', $product->product_s_desc);
//Maybe better product_name
}
if ($mainframe->getCfg('MetaAuthor') == '1') {
$document->setMetaData('author', $product->metaauthor);
}
parent::display($tpl);
}
示例4: display
//.........这里部分代码省略.........
}
$user = JFactory::getUser();
$this->showBasePrice = (vmAccess::manager() or vmAccess::isSuperVendor());
}
//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($category->slug) or !$category->published)) {
if (empty($category->slug)) {
vmInfo(vmText::_('COM_VIRTUEMART_CAT_NOT_FOUND'));
} else {
if ($category->virtuemart_id !== 0 and !$category->published) {
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL', $category->category_name, $this->categoryId);
}
}
//Fallback
$categoryLink = '';
if ($category->category_parent_id) {
$categoryLink = '&view=category&virtuemart_category_id=' . $category->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) {
$categoryLink = '&view=category&virtuemart_category_id=' . $last_category_id;
}
}
if (VmConfig::get('handle_404', 1)) {
$app->redirect(JRoute::_('index.php?option=com_virtuemart' . $categoryLink . '&error=404', FALSE));
} else {
JError::raise(E_ERROR, '404', 'Not found');
}
return;
}
shopFunctionsF::setLastVisitedCategoryId($this->categoryId);
shopFunctionsF::setLastVisitedManuId($virtuemart_manufacturer_id);
// Add the category name to the pathway
if ($category->parents) {
foreach ($category->parents as $c) {
$pathway->addItem(strip_tags(vmText::_($c->category_name)), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
}
}
$catImgAmount = VmConfig::get('catimg_browse', 1);
$categoryModel->addImages($category, $catImgAmount);
if (!isset($menu->query['showcategory'])) {
$menu->query['showcategory'] = 1;
}
$this->showcategory = vRequest::getInt('showcategory', $menu->query['showcategory']);
//$this->showcategory = vRequest::getInt('showcategory',true);
if ($this->showcategory) {
//if($category->category_layout == 'categories' or ($this->categoryId >0 and $virtuemart_manufacturer_id <1)){
$category->children = $categoryModel->getChildCategoryList($vendorId, $this->categoryId, $categoryModel->getDefaultOrdering(), $categoryModel->_selectedOrderingDir);
$categoryModel->addImages($category->children, $catImgAmount);
} else {
$category->children = false;
}
if (VmConfig::get('enable_content_plugin', 0)) {
shopFunctionsF::triggerContentPlugin($category, 'category', 'category_description');
}
$metadesc = '';
$metakey = '';
$metarobot = '';
if (isset($menu->params)) {
$metadesc = $menu->params->get('menu-meta_description');
$metakey = $menu->params->get('menu-meta_keywords');
$metarobot = $menu->params->get('robots');
}
示例5: display
//.........这里部分代码省略.........
$product->product_desc = $product->text;
}
$product_model->addImages($product);
$this->assignRef('product', $product);
if (isset($product->min_order_level) && (int) $product->min_order_level > 0) {
$min_order_level = $product->min_order_level;
} else {
$min_order_level = 1;
}
$this->assignRef('min_order_level', $min_order_level);
// Load the neighbours
$product->neighbours = $product_model->getNeighborProducts($product);
// if(!empty($product->neighbours) && is_array($product->neighbours) && !empty($product->neighbours[0]))$product_model->addImages($product->neighbours);
// $product->related = $product_model->getRelatedProducts($virtuemart_product_id);
// if(!empty($product->related) && is_array($product->related) && !empty($product->related[0]))$product_model->addImages($product->related);
// Load the category
$category_model = VmModel::getModel('category');
// Get the category ID
if (is_array($product->categories)) {
if (in_array($last_category_id, $product->categories)) {
$virtuemart_category_id = $last_category_id;
} else {
$virtuemart_category_id = JRequest::getInt('virtuemart_category_id', 0);
}
if ($virtuemart_category_id == 0) {
if (array_key_exists('0', $product->categories)) {
$virtuemart_category_id = $product->categories[0];
}
}
} else {
$virtuemart_category_id = JRequest::getInt('virtuemart_category_id', 0);
}
$product->virtuemart_category_id = $virtuemart_category_id;
shopFunctionsF::setLastVisitedCategoryId($virtuemart_category_id);
if ($category_model) {
$category = $category_model->getCategory($virtuemart_category_id);
$category_model->addImages($category, 1);
$this->assignRef('category', $category);
if ($category->parents) {
foreach ($category->parents as $c) {
$pathway->addItem(strip_tags($c->category_name), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id));
}
}
$vendorId = 1;
$category->children = $category_model->getChildCategoryList($vendorId, $virtuemart_category_id);
$category_model->addImages($category->children, 1);
}
if (!empty($tpl)) {
$format = $tpl;
} else {
$format = JRequest::getWord('format', 'html');
}
if ($format == 'html') {
// Set Canonic link
$document->addHeadLink(JRoute::_($product->canonical, true, -1), 'canonical', 'rel', '');
}
$uri = JURI::getInstance();
//$pathway->addItem(JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), $uri->toString(array('path', 'query', 'fragment')));
$pathway->addItem(strip_tags($product->product_name));
// Set the titles
// $document->setTitle should be after the additem pathway
if ($product->customtitle) {
$document->setTitle(strip_tags($product->customtitle));
} else {
$document->setTitle(strip_tags(($category->category_name ? $category->category_name . ' : ' : '') . $product->product_name));
}
示例6: display
/**
* Collect all data to show on the template
*
* @author RolandD, Max Milbers
*/
function display($tpl = null) {
$show_prices = VmConfig::get('show_prices',1);
if($show_prices == '1'){
if(!class_exists('calculationHelper')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'calculationh.php');
}
$this->assignRef('show_prices', $show_prices);
$document = JFactory::getDocument();
/* add javascript for price and cart */
vmJsApi::jPrice();
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$task = JRequest::getCmd('task');
/* Set the helper path */
$this->addHelperPath(JPATH_VM_ADMINISTRATOR.DS.'helpers');
//Load helpers
$this->loadHelper('image');
$this->loadHelper('addtocart');
// Load the product
$product_model = VmModel::getModel('product');
$virtuemart_product_idArray = JRequest::getInt('virtuemart_product_id',0);
if(is_array($virtuemart_product_idArray)){
$virtuemart_product_id=(int)$virtuemart_product_idArray[0];
} else {
$virtuemart_product_id=(int)$virtuemart_product_idArray;
}
if(empty($virtuemart_product_id)){
self::showLastCategory($tpl);
return;
}
if(!class_exists('VirtueMartModelVendor')) require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'vendor.php');
$product = $product_model->getProduct($virtuemart_product_id);
/* Set Canonic link */
$format = JRequest::getWord('format', 'html');
if ($format == 'html') {
$document->addHeadLink( $product->link , 'canonical', 'rel', '' );
}
/* Set the titles */
$document->setTitle(JText::sprintf('COM_VIRTUEMART_PRODUCT_DETAILS_TITLE',$product->product_name.' - '.JText::_('COM_VIRTUEMART_PRODUCT_RECOMMEND')));
$uri = JURI::getInstance();
$this->assignRef('product', $product);
if(empty($product)){
self::showLastCategory($tpl);
return;
}
$product_model->addImages($product,1);
/* Load the category */
$category_model = VmModel::getModel('category');
/* Get the category ID */
$virtuemart_category_id = JRequest::getInt('virtuemart_category_id');
if ($virtuemart_category_id == 0 && !empty($product)) {
if (array_key_exists('0', $product->categories)) $virtuemart_category_id = $product->categories[0];
}
shopFunctionsF::setLastVisitedCategoryId($virtuemart_category_id);
if($category_model){
$category = $category_model->getCategory($virtuemart_category_id);
$this->assignRef('category', $category);
$pathway->addItem($category->category_name,JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$virtuemart_category_id));
}
//$pathway->addItem(JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), $uri->toString(array('path', 'query', 'fragment')));
$pathway->addItem($product->product_name,JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id='.$virtuemart_category_id.'&virtuemart_product_id='.$product->virtuemart_product_id));
// for askquestion
$pathway->addItem( JText::_('COM_VIRTUEMART_PRODUCT_ASK_QUESTION'));
/* Check for editing access */
/** @todo build edit page */
/* Load the user details */
$this->assignRef('user', JFactory::getUser());
if ($product->metadesc) {
$document->setDescription( $product->metadesc );
}
if ($product->metakey) {
$document->setMetaData('keywords', $product->metakey);
}
//.........这里部分代码省略.........
示例7: display
//.........这里部分代码省略.........
unset($product->customfields[$k]);
}
}
$product->customfieldsSorted['normal'] = $product->customfields;
unset($product->customfields);
}
$product->event = new stdClass();
$product->event->afterDisplayTitle = '';
$product->event->beforeDisplayContent = '';
$product->event->afterDisplayContent = '';
if (VmConfig::get('enable_content_plugin', 0)) {
shopFunctionsF::triggerContentPlugin($product, 'productdetails', 'product_desc');
}
$product_model->addImages($product);
$this->assignRef('product', $product);
if (isset($product->min_order_level) && (int) $product->min_order_level > 0) {
$min_order_level = $product->min_order_level;
} else {
$min_order_level = 1;
}
$this->assignRef('min_order_level', $min_order_level);
if (isset($product->step_order_level) && (int) $product->step_order_level > 0) {
$step_order_level = $product->step_order_level;
} else {
$step_order_level = 1;
}
$this->assignRef('step_order_level', $step_order_level);
// Load the neighbours
if (VmConfig::get('product_navigation', 1)) {
$product->neighbours = $product_model->getNeighborProducts($product);
}
// Load the category
$category_model = VmModel::getModel('category');
shopFunctionsF::setLastVisitedCategoryId($product->virtuemart_category_id);
if ($category_model) {
$category = $category_model->getCategory($product->virtuemart_category_id);
$category_model->addImages($category, 1);
$this->assignRef('category', $category);
//Seems we dont need this anylonger, destroyed the breadcrumb
if ($category->parents) {
foreach ($category->parents as $c) {
if (is_object($c) and isset($c->category_name)) {
$pathway->addItem(strip_tags($c->category_name), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
} else {
vmdebug('Error, parent category has no name, breadcrumb maybe broken, category', $c);
}
}
}
$category->children = $category_model->getChildCategoryList($product->virtuemart_vendor_id, $product->virtuemart_category_id);
$category_model->addImages($category->children, 1);
}
if (!empty($tpl)) {
$format = $tpl;
} else {
$format = JRequest::getWord('format', 'html');
}
if ($format == 'html') {
// Set Canonic link
$document->addHeadLink($product->canonical, 'canonical', 'rel', '');
}
$pathway->addItem(strip_tags($product->product_name));
// Set the titles
// $document->setTitle should be after the additem pathway
if ($product->customtitle) {
$document->setTitle(strip_tags($product->customtitle));
} else {
示例8: display
/**
* Collect all data to show on the template
*
* @author Max Milbers
*/
function display($tpl = null)
{
$app = JFactory::getApplication();
if (!VmConfig::get('show_emailfriend', false)) {
$app->redirect(JRoute::_('index.php?option=com_virtuemart'));
}
$this->login = '';
if (!VmConfig::get('recommend_unauth', false)) {
$user = JFactory::getUser();
if ($user->guest) {
$this->login = shopFunctionsF::getLoginForm(false);
//$app->redirect(JRoute::_('index.php?option=com_virtuemart','JGLOBAL_YOU_MUST_LOGIN_FIRST'));
}
}
// Load the product
$productModel = VmModel::getModel('product');
$virtuemart_product_id = vRequest::getInt('virtuemart_product_id', 0);
$this->product = $productModel->getProduct($virtuemart_product_id);
$layout = $this->getLayout();
if ($layout != 'form' and $layout != 'mail_confirmed') {
$this->renderMailLayout('', '');
return true;
}
$show_prices = VmConfig::get('show_prices', 1);
if ($show_prices == '1') {
if (!class_exists('calculationHelper')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
}
}
$this->assignRef('show_prices', $show_prices);
$document = JFactory::getDocument();
$document->setMetaData('robots', 'NOINDEX, NOFOLLOW, NOARCHIVE, NOSNIPPET');
/* add javascript for price and cart */
//vmJsApi::jPrice();
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$task = vRequest::getCmd('task');
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
if (empty($virtuemart_product_id)) {
self::showLastCategory($tpl);
return;
}
//$product = $productModel->getProduct($virtuemart_product_id);
/* Set Canonic link */
$format = vRequest::getCmd('format', 'html');
if ($format == 'html') {
$document->addHeadLink($this->product->link, 'canonical', 'rel', '');
}
/* Set the titles */
$document->setTitle(vmText::sprintf('COM_VIRTUEMART_PRODUCT_DETAILS_TITLE', $this->product->product_name . ' - ' . vmText::_('COM_VIRTUEMART_PRODUCT_RECOMMEND')));
if (empty($this->product)) {
self::showLastCategory($tpl);
return;
}
$productModel->addImages($this->product, 1);
/* Load the category */
$category_model = VmModel::getModel('category');
/* Get the category ID */
$virtuemart_category_id = vRequest::getInt('virtuemart_category_id');
if ($virtuemart_category_id == 0 && !empty($this->product)) {
if (array_key_exists('0', $this->product->categories)) {
$virtuemart_category_id = $this->product->categories[0];
}
}
if (!class_exists('shopFunctionsF')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
shopFunctionsF::setLastVisitedCategoryId($virtuemart_category_id);
if ($category_model) {
$category = $category_model->getCategory($virtuemart_category_id);
$this->assignRef('category', $category);
$pathway->addItem($category->category_name, JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $virtuemart_category_id, FALSE));
}
//$pathway->addItem(vmText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), $uri->toString(array('path', 'query', 'fragment')));
$pathway->addItem($this->product->product_name, JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $this->product->virtuemart_product_id, FALSE));
// for askquestion
$pathway->addItem(vmText::_('COM_VIRTUEMART_PRODUCT_ASK_QUESTION'));
/* Check for editing access */
/** @todo build edit page */
/* Load the user details */
$this->assignRef('user', JFactory::getUser());
if ($this->product->metadesc) {
$document->setDescription($this->product->metadesc);
}
if ($this->product->metakey) {
$document->setMetaData('keywords', $this->product->metakey);
}
if ($mainframe->getCfg('MetaTitle') == '1') {
$document->setMetaData('title', $this->product->product_s_desc);
//Maybe better product_name
}
if ($mainframe->getCfg('MetaAuthor') == '1') {
$document->setMetaData('author', $this->product->metaauthor);
//.........这里部分代码省略.........
示例9: display
//.........这里部分代码省略.........
$product->event->afterDisplayContent = '';
if (VmConfig::get('enable_content_plugin', 0)) {
shopFunctionsF::triggerContentPlugin($product, 'productdetails', 'product_desc');
}
$product_model->addImages($product);
if (isset($product->min_order_level) && (int) $product->min_order_level > 0) {
$this->min_order_level = $product->min_order_level;
} else {
$this->min_order_level = 1;
}
if (isset($product->step_order_level) && (int) $product->step_order_level > 0) {
$this->step_order_level = $product->step_order_level;
} else {
$this->step_order_level = 1;
}
// Load the neighbours
if (VmConfig::get('product_navigation', 1)) {
$product->neighbours = $product_model->getNeighborProducts($product);
}
$this->assignRef('product', $product);
if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
$manModel = VmModel::getModel('manufacturer');
$mans = array();
// Gebe die Hersteller aus
foreach ($this->product->virtuemart_manufacturer_id as $manufacturer_id) {
$manufacturer = $manModel->getManufacturer($manufacturer_id);
$manModel->addImages($manufacturer, 1);
$mans[] = $manufacturer;
}
$this->product->manufacturers = $mans;
}
// Load the category
$category_model = VmModel::getModel('category');
shopFunctionsF::setLastVisitedCategoryId($product->virtuemart_category_id);
if ($category_model) {
$category = $category_model->getCategory($product->virtuemart_category_id);
$category_model->addImages($category, 1);
$this->assignRef('category', $category);
//Seems we dont need this anylonger, destroyed the breadcrumb
if ($category->parents) {
foreach ($category->parents as $c) {
if (is_object($c) and isset($c->category_name)) {
$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('Error, parent category has no name, breadcrumb maybe broken, category', $c);
}
}
}
$category->children = $category_model->getChildCategoryList($product->virtuemart_vendor_id, $product->virtuemart_category_id);
$category_model->addImages($category->children, 1);
}
$pathway->addItem(strip_tags(html_entity_decode($product->product_name, ENT_QUOTES)));
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;
}
}
// Set Canonic link
示例10: display
//.........这里部分代码省略.........
$document->addHeadLink(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $categoryId), 'canonical', 'rel', '');
}
// Set the titles
if ($category->customtitle) {
$title = strip_tags($category->customtitle);
} elseif ($category->category_name) {
$title = strip_tags($category->category_name);
} else {
$menus = $app->getMenu();
$menu = $menus->getActive();
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 = $app->getCfg('sitename');
} elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
}
}
if (JRequest::getInt('error')) {
$title .= ' ' . JText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
}
// set search and keyword
if ($keyword = vmRequest::uword('keyword', '', ' ')) {
$pathway->addItem($keyword);
$title .= ' (' . $keyword . ')';
}
$search = JRequest::getvar('keyword', null);
if ($search !== null) {
$searchcustom = $this->getSearchCustom();
}
$this->assignRef('keyword', $keyword);
$this->assignRef('search', $search);
// Load the products in the given category
$products = $productModel->getProductsInCategory($categoryId);
$productModel->addImages($products, 1);
$this->assignRef('products', $products);
foreach ($products as $product) {
$product->stock = $productModel->getStockIndicator($product);
}
$ratingModel = VmModel::getModel('ratings');
$showRating = $ratingModel->showRating();
$this->assignRef('showRating', $showRating);
$virtuemart_manufacturer_id = JRequest::getInt('virtuemart_manufacturer_id', 0);
if ($virtuemart_manufacturer_id and !empty($products[0])) {
$title .= ' ' . $products[0]->mf_name;
}
$document->setTitle($title);
// Override Category name when viewing manufacturers products !IMPORTANT AFTER page title.
if (JRequest::getInt('virtuemart_manufacturer_id') and !empty($products[0])) {
$category->category_name = $products[0]->mf_name;
}
$pagination = $productModel->getPagination($perRow);
$this->assignRef('vmPagination', $pagination);
$orderByList = $productModel->getOrderByList($categoryId);
$this->assignRef('orderByList', $orderByList);
// $productRelatedManufacturerList = $productModel->getProductRelatedManufacturerList($categoryId);
// $this->assignRef('productRelatedManufacturerList', $productRelatedManufacturerList);
//$sortOrderButton = $productModel->getsortOrderButton();
//$this->assignRef('sortOrder', $sortOrderButton);
if ($category->metadesc) {
$document->setDescription($category->metadesc);
}
if ($category->metakey) {
$document->setMetaData('keywords', $category->metakey);
}
if ($category->metarobot) {
$document->setMetaData('robots', $category->metarobot);
}
if ($app->getCfg('MetaTitle') == '1') {
$document->setMetaData('title', $title);
}
if ($app->getCfg('MetaAuthor') == '1') {
$document->setMetaData('author', $category->metaauthor);
}
if ($products) {
$currency = CurrencyDisplay::getInstance();
$this->assignRef('currency', $currency);
}
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
$showBasePrice = Permissions::getInstance()->check('admin');
//todo add config settings
$this->assignRef('showBasePrice', $showBasePrice);
//set this after the $categoryId definition
$paginationAction = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $categoryId);
$this->assignRef('paginationAction', $paginationAction);
shopFunctionsF::setLastVisitedCategoryId($categoryId);
shopFunctionsF::setLastVisitedManuId($virtuemart_manufacturer_id);
if (empty($category->category_template)) {
$category->category_template = VmConfig::get('categorytemplate');
}
shopFunctionsF::setVmTemplate($this, $category->category_template, 0, $category->category_layout);
parent::display($tpl);
}
示例11: display
//.........这里部分代码省略.........
}
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
$showBasePrice = Permissions::getInstance()->check('admin');
//todo add config settings
$this->assignRef('showBasePrice', $showBasePrice);
}
//No redirect here, for category id = 0 means show ALL categories! note by Max Milbers
if (!empty($categoryId) and $categoryId !== -1 and (empty($category->slug) or !$category->published)) {
if (empty($category->slug)) {
vmInfo(JText::_('COM_VIRTUEMART_CAT_NOT_FOUND'));
} else {
if ($category->virtuemart_id !== 0 and !$category->published) {
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL', $category->category_name, $categoryId);
}
}
//Fallback
$categoryLink = '';
if ($category->category_parent_id) {
$categoryLink = '&view=category&virtuemart_category_id=' . $category->category_parent_id;
} else {
$last_category_id = shopFunctionsF::getLastVisitedCategoryId();
if (!$last_category_id or $categoryId == $last_category_id) {
$last_category_id = JRequest::getInt('virtuemart_category_id', false);
}
if ($last_category_id and $categoryId != $last_category_id) {
$categoryLink = '&view=category&virtuemart_category_id=' . $last_category_id;
}
}
$app->redirect(JRoute::_('index.php?option=com_virtuemart' . $categoryLink . '&error=404', FALSE));
return;
}
shopFunctionsF::setLastVisitedCategoryId($categoryId);
shopFunctionsF::setLastVisitedManuId($virtuemart_manufacturer_id);
// Add the category name to the pathway
if ($category->parents) {
foreach ($category->parents as $c) {
$pathway->addItem(strip_tags($c->category_name), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
}
}
$categoryModel->addImages($category, 1);
$cache = JFactory::getCache('com_virtuemart', 'callback');
$category->children = $cache->call(array('VirtueMartModelCategory', 'getChildCategoryList'), $vendorId, $categoryId, $categoryModel->getDefaultOrdering(), $categoryModel->_selectedOrderingDir);
$categoryModel->addImages($category->children, 1);
if (VmConfig::get('enable_content_plugin', 0)) {
shopFunctionsF::triggerContentPlugin($category, 'category', 'category_description');
}
if ($category->metadesc) {
$document->setDescription($category->metadesc);
}
if ($category->metakey) {
$document->setMetaData('keywords', $category->metakey);
}
if ($category->metarobot) {
$document->setMetaData('robots', $category->metarobot);
}
if ($app->getCfg('MetaAuthor') == '1') {
$document->setMetaData('author', $category->metaauthor);
}
if (empty($category->category_template)) {
$category->category_template = VmConfig::get('categorytemplate');
}
shopFunctionsF::setVmTemplate($this, $category->category_template, 0, $category->category_layout);
} else {
//Backward compatibility
示例12: display
//.........这里部分代码省略.........
$res = $dispatcher->trigger('onContentAfterTitle', array('com_virtuemart.productdetails', &$product, &$params, 0));
$product->event->afterDisplayTitle = trim(implode("\n", $res));
$res = $dispatcher->trigger('onContentBeforeDisplay', array('com_virtuemart.productdetails', &$product, &$params, 0));
$product->event->beforeDisplayContent = trim(implode("\n", $res));
$res = $dispatcher->trigger('onContentAfterDisplay', array('com_virtuemart.productdetails', &$product, &$params, 0));
$product->event->afterDisplayContent = trim(implode("\n", $res));
$product->product_desc = $product->text;
}
$this->product_model->addImages($product);
if (isset($product->min_order_level) && (int) $product->min_order_level > 0) {
$this->min_order_level = $product->min_order_level;
} else {
$this->min_order_level = 1;
}
if (isset($product->step_order_level) && (int) $product->step_order_level > 0) {
$this->step_order_level = $product->step_order_level;
} else {
$this->step_order_level = 1;
}
// Load the neighbours
if (VmConfig::get('product_navigation', 1)) {
$product->neighbours = $this->product_model->getNeighborProducts($product);
}
// Product vendor multiX
if ($multix = Vmconfig::get('multix', 'none') === 'admin') {
$vendor_model = VmModel::getModel('vendor');
$this->vendor = $vendor_model->getVendor($product->virtuemart_vendor_id);
} else {
$this->vendor = null;
}
// echo 'multi'.$multix;
// Load the category
$category_model = VmModel::getModel('category');
shopFunctionsF::setLastVisitedCategoryId($product->virtuemart_category_id);
$catTitle = array();
if ($category_model) {
$category = $category_model->getCategory($product->virtuemart_category_id);
$category_model->addImages($category, 1);
$this->assignRef('category', $category);
//Seems we dont need this anylonger, destroyed the breadcrumb
if ($category->parents) {
foreach ($category->parents as $c) {
if (is_object($c) and isset($c->category_name)) {
$pathway->addItem(strip_tags($c->category_name), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
$catTitle[] = $c->category_name;
} else {
vmdebug('Error, parent category has no name, breadcrumb maybe broken, category', $c);
}
}
}
$vendorId = JRequest::getInt('virtuemart_vendor_id', null);
$category->children = $category_model->getChildCategoryList($vendorId, $product->virtuemart_category_id);
$category_model->addImages($category->children, 1);
}
if (!empty($tpl)) {
$format = $tpl;
} else {
$format = JRequest::getWord('format', 'html');
}
if ($format == 'html') {
// Set Canonic link
$document->addHeadLink($product->canonical, 'canonical', 'rel', '');
}
$uri = JURI::getInstance();
//$pathway->addItem(JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), $uri->toString(array('path', 'query', 'fragment')));
$pathway->addItem(strip_tags($product->product_name));
示例13: display
//.........这里部分代码省略.........
$this->products = $productModel->getItemList();
//$products = $productModel->getProductsInCategory($this->categoryId);
$productModel->addImages($this->products, tsmConfig::get('prodimg_browse', 1));
}
//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($category->slug) or !$category->published)) {
if (empty($category->slug)) {
vmInfo(tsmText::_('COM_VIRTUEMART_CAT_NOT_FOUND'));
} else {
if ($category->virtuemart_id !== 0 and !$category->published) {
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL', $category->category_name, $this->categoryId);
}
}
//Fallback
$categoryLink = '';
if ($category->category_parent_id) {
$categoryLink = '&view=category&virtuemart_category_id=' . $category->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) {
$categoryLink = '&view=category&virtuemart_category_id=' . $last_category_id;
}
}
if (tsmConfig::get('handle_404', 1)) {
$app->redirect(JRoute::_('index.php?option=com_virtuemart' . $categoryLink . '&error=404', FALSE));
} else {
JError::raise(E_ERROR, '404', 'Not found');
}
return;
}
shopFunctionsF::setLastVisitedCategoryId($this->categoryId);
shopFunctionsF::setLastVisitedManuId($virtuemart_manufacturer_id);
// Add the category name to the pathway
if ($category->parents) {
foreach ($category->parents as $c) {
$pathway->addItem(strip_tags(tsmText::_($c->category_name)), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
}
}
$categoryModel->addImages($category, 1);
if (!isset($menu->query['showcategory'])) {
$menu->query['showcategory'] = 1;
}
$this->showcategory = vRequest::getInt('showcategory', $menu->query['showcategory']);
//$this->showcategory = vRequest::getInt('showcategory',true);
if ($this->showcategory) {
//if($category->category_layout == 'categories' or ($this->categoryId >0 and $virtuemart_manufacturer_id <1)){
$category->children = $categoryModel->getChildCategoryList($vendorId, $this->categoryId, $categoryModel->getDefaultOrdering(), $categoryModel->_selectedOrderingDir);
$categoryModel->addImages($category->children, 1);
} else {
$category->children = false;
}
if (tsmConfig::get('enable_content_plugin', 0)) {
shopFunctionsF::triggerContentPlugin($category, 'category', 'category_description');
}
if ($category->metadesc) {
$document->setDescription($category->metadesc);
}
if ($category->metakey) {
$document->setMetaData('keywords', $category->metakey);
}
if ($category->metarobot) {
$document->setMetaData('robots', $category->metarobot);
}