本文整理汇总了PHP中ShopFunctionsF::setLastVisitedItemId方法的典型用法代码示例。如果您正苦于以下问题:PHP ShopFunctionsF::setLastVisitedItemId方法的具体用法?PHP ShopFunctionsF::setLastVisitedItemId怎么用?PHP ShopFunctionsF::setLastVisitedItemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShopFunctionsF
的用法示例。
在下文中一共展示了ShopFunctionsF::setLastVisitedItemId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
$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);
if (!class_exists('shopFunctionsF')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$pathway = $app->getPathway();
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
// set search and keyword
if ($keyword = vRequest::getString('keyword', false)) {
//uword('keyword', false, ' ,-,+,.,_')) {
$pathway->addItem($keyword);
//$title .=' ('.$keyword.')';
}
//$search = vRequest::uword('keyword', null);
$this->searchcustom = '';
$this->searchCustomValues = '';
//if (!empty($keyword)) {
$this->getSearchCustom();
$search = $keyword;
/*} else {
$keyword ='';
$search = NULL;
}*/
$this->assignRef('keyword', $keyword);
$this->assignRef('search', $search);
$menus = $app->getMenu();
$menu = $menus->getActive();
if (!empty($menu->id)) {
ShopFunctionsF::setLastVisitedItemId($menu->id);
} else {
if ($itemId = vRequest::getInt('Itemid', false)) {
ShopFunctionsF::setLastVisitedItemId($itemId);
}
}
$virtuemart_manufacturer_id = vRequest::getInt('virtuemart_manufacturer_id', -1);
if ($virtuemart_manufacturer_id === -1 and !empty($menu->query['virtuemart_manufacturer_id'])) {
$virtuemart_manufacturer_id = $menu->query['virtuemart_manufacturer_id'];
vRequest::setVar('virtuemart_manufacturer_id', $virtuemart_manufacturer_id);
}
$this->categoryId = vRequest::getInt('virtuemart_category_id', -1);
if ($this->categoryId === -1 and !empty($menu->query['virtuemart_category_id'])) {
$this->categoryId = $menu->query['virtuemart_category_id'];
vRequest::setVar('virtuemart_category_id', $this->categoryId);
} else {
if ($this->categoryId === -1 and $virtuemart_manufacturer_id === -1) {
$this->categoryId = ShopFunctionsF::getLastVisitedCategoryId();
}
}
$this->setCanonicalLink($tpl, $document, $this->categoryId, $virtuemart_manufacturer_id);
if (($this->categoryId === -1 or $this->categoryId === 0) and $virtuemart_manufacturer_id) {
$this->categoryId = 0;
$catType = 'manufacturer';
$this->setCanonicalLink($tpl, $document, $virtuemart_manufacturer_id, $catType);
}
$categoryModel = VmModel::getModel('category');
$productModel = VmModel::getModel('product');
if ($this->categoryId === -1) {
$this->categoryId = 0;
}
$vendorId = 1;
$category = $categoryModel->getCategory($this->categoryId);
if (!isset($menu->query['showproducts'])) {
$menu->query['showproducts'] = 1;
}
$this->showproducts = vRequest::getInt('showproducts', $menu->query['showproducts']);
if (!empty($category)) {
$vendorId = $category->virtuemart_vendor_id;
if ($this->showproducts) {
//if(empty($category->category_layout) or $category->category_layout != 'categories') {
// Load the products in the given category
$ids = $productModel->sortSearchListQuery(TRUE, $this->categoryId);
$this->perRow = empty($category->products_per_row) ? VmConfig::get('products_per_row', 3) : $category->products_per_row;
$this->vmPagination = $productModel->getPagination($this->perRow);
$ratingModel = VmModel::getModel('ratings');
$this->showRating = $ratingModel->showRating();
$productModel->withRating = $this->showRating;
$this->orderByList = $productModel->getOrderByList($this->categoryId);
$this->products = $productModel->getProducts($ids);
//$products = $productModel->getProductsInCategory($this->categoryId);
$imgAmount = VmConfig::get('prodimg_browse', 1);
$productModel->addImages($this->products, $imgAmount);
if ($this->products) {
$currency = CurrencyDisplay::getInstance();
$this->assignRef('currency', $currency);
$display_stock = VmConfig::get('display_stock', 1);
$showCustoms = VmConfig::get('show_pcustoms', 1);
if ($display_stock or $showCustoms) {
if (!$showCustoms) {
foreach ($this->products as $i => $productItem) {
//.........这里部分代码省略.........
示例2: display
/**
* Collect all data to show on the template
*
* @author RolandD, Max Milbers
*/
function display($tpl = null)
{
$show_prices = VmConfig::get('show_prices', 1);
$this->assignRef('show_prices', $show_prices);
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$menus = $app->getMenu();
$menu = $menus->getActive();
if (!empty($menu->id)) {
ShopFunctionsF::setLastVisitedItemId($menu->id);
} else {
if ($itemId = vRequest::getInt('Itemid', false)) {
ShopFunctionsF::setLastVisitedItemId($itemId);
}
}
$pathway = $app->getPathway();
$task = vRequest::getCmd('task');
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
// Load the product
//$product = $this->get('product'); //Why it is sensefull to use this construction? Imho it makes it just harder
$product_model = VmModel::getModel('product');
$this->assignRef('product_model', $product_model);
$virtuemart_product_idArray = vRequest::getInt('virtuemart_product_id', 0);
if (is_array($virtuemart_product_idArray) and count($virtuemart_product_idArray) > 0) {
$virtuemart_product_id = (int) $virtuemart_product_idArray[0];
} else {
$virtuemart_product_id = (int) $virtuemart_product_idArray;
}
$quantityArray = vRequest::getInt('quantity', array());
//is sanitized then
$quantity = 1;
if (!empty($quantityArray[0])) {
$quantity = $quantityArray[0];
}
$ratingModel = VmModel::getModel('ratings');
$product_model->withRating = $this->showRating = $ratingModel->showRating($virtuemart_product_id);
$product = $product_model->getProduct($virtuemart_product_id, TRUE, TRUE, TRUE, $quantity);
if (!class_exists('shopFunctionsF')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
$last_category_id = shopFunctionsF::getLastVisitedCategoryId();
$customfieldsModel = VmModel::getModel('Customfields');
if ($product->customfields) {
if (!class_exists('vmCustomPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php';
}
$customfieldsModel->displayProductCustomfieldFE($product, $product->customfields);
}
if (empty($product->slug)) {
//Todo this should be redesigned to fit better for SEO
$app->enqueueMessage(vmText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND'));
$categoryLink = '';
if (!$last_category_id) {
$last_category_id = vRequest::getInt('virtuemart_category_id', false);
}
if ($last_category_id) {
$categoryLink = '&virtuemart_category_id=' . $last_category_id;
}
if (VmConfig::get('handle_404', 1)) {
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=category' . $categoryLink . '&error=404', FALSE));
} else {
JError::raise(E_ERROR, '404', 'Not found');
}
return;
}
$isCustomVariant = false;
if (!empty($product->customfields)) {
foreach ($product->customfields as $k => $custom) {
if ($custom->field_type == 'C' and $custom->virtuemart_product_id != $virtuemart_product_id) {
$isCustomVariant = $custom;
}
if (!empty($custom->layout_pos)) {
$product->customfieldsSorted[$custom->layout_pos][] = $custom;
} else {
$product->customfieldsSorted['normal'][] = $custom;
}
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);
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) {
//.........这里部分代码省略.........
示例3: display
public function display($tpl = null) {
$vendorId = vRequest::getInt('vendorid', 1);
$vendorModel = VmModel::getModel('vendor');
$vendorIdUser = VmConfig::isSuperVendor();
$vendorModel->setId($vendorId);
$vendor = $vendorModel->getVendor();
if(!class_exists('shopFunctionsF'))require(VMPATH_SITE.DS.'helpers'.DS.'shopfunctionsf.php');
if (VmConfig::get ('enable_content_plugin', 0)) {
shopFunctionsF::triggerContentPlugin($vendor, 'vendor','vendor_store_desc');
shopFunctionsF::triggerContentPlugin($vendor, 'vendor','vendor_terms_of_service');
}
$app = JFactory::getApplication();
$menus = $app->getMenu();
$menu = $menus->getActive();
if(!empty($menu->id)){
ShopFunctionsF::setLastVisitedItemId($menu->id);
} else if($itemId = vRequest::getInt('Itemid',false)){
ShopFunctionsF::setLastVisitedItemId($itemId);
}
$this->assignRef('vendor',$vendor);
$document = JFactory::getDocument();
if(!VmConfig::get('shop_is_offline',0)){
vmJsApi::jPrice();
//if($vendorIdUser){
//$user = JFactory::getUser();
if( $vendorIdUser ){
$add_product_link = JURI::root() . 'index.php?option=com_virtuemart&tmpl=component&view=product&task=edit&virtuemart_product_id=0&manage=1' ;
$add_product_link = $this->linkIcon($add_product_link, 'COM_VIRTUEMART_PRODUCT_FORM_NEW_PRODUCT', 'edit', false, false);
} else {
$add_product_link = "";
}
$this->assignRef('add_product_link', $add_product_link);
//}
$categoryModel = VmModel::getModel('category');
$productModel = VmModel::getModel('product');
$ratingModel = VmModel::getModel('ratings');
$productModel->withRating = $this->showRating = $ratingModel->showRating();
$this->products = array();
$categoryId = vRequest::getInt('catid', 0);
$categoryChildren = $categoryModel->getChildCategoryList($vendorId, $categoryId);
$categoryModel->addImages($categoryChildren,1);
$this->assignRef('categories', $categoryChildren);
if(!class_exists('CurrencyDisplay'))require(VMPATH_ADMIN.DS.'helpers'.DS.'currencydisplay.php');
$currency = CurrencyDisplay::getInstance( );
$this->assignRef('currency', $currency);
$products_per_row = VmConfig::get('homepage_products_per_row',3);
$featured_products_rows = VmConfig::get('featured_products_rows',1);
$featured_products_count = $products_per_row * $featured_products_rows;
if (!empty($featured_products_count) and VmConfig::get('show_featured', 1)) {
$this->products['featured'] = $productModel->getProductListing('featured', $featured_products_count);
$productModel->addImages($this->products['featured'],1);
}
$latest_products_rows = VmConfig::get('latest_products_rows');
$latest_products_count = $products_per_row * $latest_products_rows;
if (!empty($latest_products_count) and VmConfig::get('show_latest', 1)) {
$this->products['latest']= $productModel->getProductListing('latest', $latest_products_count);
$productModel->addImages($this->products['latest'],1);
}
$topTen_products_rows = VmConfig::get('topTen_products_rows');
$topTen_products_count = $products_per_row * $topTen_products_rows;
if (!empty($topTen_products_count) and VmConfig::get('show_topTen', 1)) {
$this->products['topten']= $productModel->getProductListing('topten', $topTen_products_count);
$productModel->addImages($this->products['topten'],1);
}
$recent_products_rows = VmConfig::get('recent_products_rows');
$recent_products_count = $products_per_row * $recent_products_rows;
$recent_products = $productModel->getProductListing('recent');
if (!empty($recent_products_count) and VmConfig::get('show_recent', 1) and !empty($recent_products)) {
$this->products['recent']= $productModel->getProductListing('recent', $recent_products_count);
$productModel->addImages($this->products['recent'],1);
}
if ($this->products) {
$currency = CurrencyDisplay::getInstance( );
$this->assignRef('currency', $currency);
//.........这里部分代码省略.........
示例4: display
public function display($tpl = null)
{
$show_prices = tsmConfig::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);
if (!class_exists('shopFunctionsF')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$pathway = $app->getPathway();
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
// set search and keyword
if ($keyword = vRequest::getString('keyword', false)) {
//uword('keyword', false, ' ,-,+,.,_')) {
$pathway->addItem($keyword);
//$title .=' ('.$keyword.')';
}
//$search = vRequest::uword('keyword', null);
$this->searchcustom = '';
$this->searchCustomValues = '';
//if (!empty($keyword)) {
$this->getSearchCustom();
$search = $keyword;
/*} else {
$keyword ='';
$search = NULL;
}*/
$this->assignRef('keyword', $keyword);
$this->assignRef('search', $search);
$menus = $app->getMenu();
$menu = $menus->getActive();
if (!empty($menu->id)) {
ShopFunctionsF::setLastVisitedItemId($menu->id);
} else {
if ($itemId = vRequest::getInt('Itemid', false)) {
ShopFunctionsF::setLastVisitedItemId($itemId);
}
}
$virtuemart_manufacturer_id = vRequest::getInt('virtuemart_manufacturer_id', -1);
if ($virtuemart_manufacturer_id === -1 and !empty($menu->query['virtuemart_manufacturer_id'])) {
$virtuemart_manufacturer_id = $menu->query['virtuemart_manufacturer_id'];
vRequest::setVar('virtuemart_manufacturer_id', $virtuemart_manufacturer_id);
}
$this->categoryId = vRequest::getInt('virtuemart_category_id', -1);
if ($this->categoryId === -1 and !empty($menu->query['virtuemart_category_id'])) {
$this->categoryId = $menu->query['virtuemart_category_id'];
vRequest::setVar('virtuemart_category_id', $this->categoryId);
} else {
if ($this->categoryId === -1 and $virtuemart_manufacturer_id === -1) {
$this->categoryId = ShopFunctionsF::getLastVisitedCategoryId();
}
}
$this->setCanonicalLink($tpl, $document, $this->categoryId, $virtuemart_manufacturer_id);
if (($this->categoryId === -1 or $this->categoryId === 0) and $virtuemart_manufacturer_id) {
$this->categoryId = 0;
$catType = 'manufacturer';
$this->setCanonicalLink($tpl, $document, $virtuemart_manufacturer_id, $catType);
}
$categoryModel = tmsModel::getModel('category');
$productModel = tmsModel::getModel('product');
if ($this->categoryId === -1) {
$this->categoryId = 0;
}
$vendorId = 1;
$category = $categoryModel->getCategory($this->categoryId);
if (!isset($menu->query['showproducts'])) {
$menu->query['showproducts'] = 1;
}
$this->showproducts = vRequest::getInt('showproducts', $menu->query['showproducts']);
if (!empty($category)) {
$vendorId = $category->virtuemart_vendor_id;
if ($this->showproducts) {
//if(empty($category->category_layout) or $category->category_layout != 'categories') {
// Load the products in the given category
$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();
//.........这里部分代码省略.........