本文整理汇总了PHP中ShopFunctionsF类的典型用法代码示例。如果您正苦于以下问题:PHP ShopFunctionsF类的具体用法?PHP ShopFunctionsF怎么用?PHP ShopFunctionsF使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ShopFunctionsF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
?>
<div class="category_description">
<?php
//echo $this->category->images;
?>
<?php
echo $this->category->category_description;
?>
</div>
<?php
}
// Show child categories
if (VmConfig::get('showCategory', 1) and empty($this->keyword)) {
if (!empty($this->category->haschildren)) {
echo ShopFunctionsF::renderVmSubLayout('categories', array('categories' => $this->category->children));
}
}
if ($this->showproducts) {
?>
<div class="browse-view">
<?php
if (!empty($this->keyword)) {
//id taken in the view.html.php could be modified
$category_id = vRequest::getInt('virtuemart_category_id', 0);
?>
<form action="<?php
echo JRoute::_('index.php?option=com_virtuemart&view=category&search=false&limitstart=0');
?>
" method="get">
示例2: 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) {
//.........这里部分代码省略.........
示例3: getUserFieldsFilled
//.........这里部分代码省略.........
,'value' => (($_userData == null || !array_key_exists($_fld->name, $_userData))
? $_fld->default
: $_userData[$_fld->name])
,'title' => vmText::_($_fld->title)
,'type' => $_fld->type
,'required' => $_fld->required
,'hidden' => false
,'formcode' => ''
,'description' => vmText::_($_fld->description)
);
$readonly = '';
if(!$admin){
if($_fld->readonly ){
$readonly = ' readonly="readonly" ';
}
}
//vmdebug ('getUserFieldsFilled',$_fld->name,$_return['fields'][$_fld->name]['value']);
// if($_fld->name==='email') vmdebug('user data email getuserfieldbyuser',$_userData);
// First, see if there are predefined fields by checking the name
switch( $_fld->name ) {
// case 'email':
// $_return['fields'][$_fld->name]['formcode'] = $_userData->email;
// break;
case 'virtuemart_country_id':
if(!class_exists('shopFunctionsF'))require(VMPATH_SITE.DS.'helpers'.DS.'shopfunctionsf.php');
$attrib = array();
if ($_fld->size) {
$attrib = array('style'=>"width: ".$_fld->size."px");
}
$_return['fields'][$_fld->name]['formcode'] =
ShopFunctionsF::renderCountryList($_return['fields'][$_fld->name]['value'], false, $attrib , $_prefix, $_fld->required);
if(!empty($_return['fields'][$_fld->name]['value'])){
// Translate the value from ID to name
$_return['fields'][$_fld->name]['virtuemart_country_id'] = (int)$_return['fields'][$_fld->name]['value'];
$db = JFactory::getDBO ();
$q = 'SELECT * FROM `#__virtuemart_countries` WHERE virtuemart_country_id = "' . (int)$_return['fields'][$_fld->name]['value'] . '"';
$db->setQuery ($q);
$r = $db->loadAssoc();
if($r){
$_return['fields'][$_fld->name]['value'] = !empty($r['country_name'])? $r['country_name']:'' ;
$_return['fields'][$_fld->name]['country_2_code'] = !empty($r['country_2_code'])? $r['country_2_code']:'' ;
$_return['fields'][$_fld->name]['country_3_code'] = !empty($r['country_3_code'])? $r['country_3_code']:'' ;
} else {
vmError('Model Userfields, country with id '.$_return['fields'][$_fld->name]['value'].' not found');
}
} else {
$_return['fields'][$_fld->name]['value'] = '' ;
$_return['fields'][$_fld->name]['country_2_code'] = '' ;
$_return['fields'][$_fld->name]['country_3_code'] = '' ;
}
//$_return['fields'][$_fld->name]['value'] = vmText::_(shopFunctions::getCountryByID($_return['fields'][$_fld->name]['value']));
//$_return['fields'][$_fld->name]['state_2_code'] = vmText::_(shopFunctions::getCountryByID($_return['fields'][$_fld->name]['value']));
break;
case 'virtuemart_state_id':
if (!class_exists ('shopFunctionsF'))
require(VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php');
$attrib = array();
if ($_fld->size) {
$attrib = array('style'=>"width: ".$_fld->size."px");
}
示例4: 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);
//.........这里部分代码省略.........
示例5:
?>
</a>
</td>
<td align="left">
<?php
echo JHtml::_('date', $row->created_on);
?>
</td>
<td align="left">
<?php
echo JHtml::_('date', $row->modified_on);
?>
</td>
<td align="left">
<?php
echo ShopFunctionsF::getOrderStatusName($row->order_status);
?>
</td>
<td align="left">
<?php
echo $this->currency->priceDisplay($row->order_total);
?>
</td>
</tr>
<?php
$k = 1 - $k;
}
?>
</table>
</div>
示例6: 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();
//.........这里部分代码省略.........
示例7: setPaginationLimits
/**
* Override
*
* @see VmModel::setPaginationLimits()
*/
public function setPaginationLimits()
{
$app = JFactory::getApplication();
$view = JRequest::getWord('view', 'virtuemart');
$cateid = JRequest::getInt('virtuemart_category_id', -1);
$manid = JRequest::getInt('virtuemart_manufacturer_id', 0);
$limitString = 'com_virtuemart.' . $view . 'c' . $cateid . '.limit';
$limit = (int) $app->getUserStateFromRequest($limitString, 'limit');
$limitStartString = 'com_virtuemart.' . $view . '.limitstart';
if ($app->isSite() and ($cateid != -1 or $manid != 0)) {
$lastCatId = ShopFunctionsF::getLastVisitedCategoryId();
$lastManId = ShopFunctionsF::getLastVisitedManuId();
//vmdebug('setPaginationLimits is site and $cateid,$manid ',$cateid,$lastCatId,$manid);
if (!empty($cateid) and $cateid != -1) {
$gCatId = $cateid;
} else {
if (!empty($lastCatId)) {
$gCatId = $lastCatId;
}
}
if (!empty($gCatId)) {
$catModel = VmModel::getModel('category');
$category = $catModel->getCategory($gCatId);
} else {
$category = new stdClass();
}
if (!empty($lastCatId) and $lastCatId != $cateid or !empty($manid) and $lastManId != $manid) {
//We are in a new category or another manufacturer, so we start at page 1
$limitStart = JRequest::getInt('limitstart', 0);
} else {
//We were already in the category/manufacturer, so we take the value stored in the session
$limitStartString = 'com_virtuemart.' . $view . 'c' . $cateid . 'm' . $manid . '.limitstart';
$limitStart = $app->getUserStateFromRequest($limitStartString, 'limitstart', JRequest::getInt('limitstart', 0), 'int');
}
if (empty($limit) and !empty($category->limit_list_initial)) {
$suglimit = $category->limit_list_initial;
} else {
if (!empty($limit)) {
$suglimit = $limit;
} else {
$suglimit = VmConfig::get('llimit_init_FE', 20);
}
}
if (empty($category->products_per_row)) {
$category->products_per_row = VmConfig::get('products_per_row', 3);
}
$rest = $suglimit % $category->products_per_row;
$limit = $suglimit - $rest;
if (!empty($category->limit_list_step)) {
$prod_per_page = explode(",", $category->limit_list_step);
} else {
//fix by hjet
$prod_per_page = explode(",", VmConfig::get('pagseq_' . $category->products_per_row));
}
if ($limit <= $prod_per_page['0'] && array_key_exists('0', $prod_per_page)) {
$limit = $prod_per_page['0'];
}
//vmdebug('Calculated $limit ',$limit,$suglimit);
} else {
$limitStart = $app->getUserStateFromRequest('com_virtuemart.' . $view . '.limitstart', 'limitstart', JRequest::getInt('limitstart', 0), 'int');
}
if (empty($limit)) {
if ($app->isSite()) {
$limit = VmConfig::get('llimit_init_FE');
} else {
$limit = VmConfig::get('llimit_init_BE');
}
if (empty($limit)) {
$limit = 30;
}
}
$this->setState('limit', $limit);
$this->setState($limitString, $limit);
$this->_limit = $limit;
//There is a strange error in the frontend giving back 9 instead of 10, or 24 instead of 25
//This functions assures that the steps of limitstart fit with the limit
$limitStart = ceil((double) $limitStart / (double) $limit) * $limit;
$this->setState('limitstart', $limitStart);
$this->setState($limitStartString, $limitStart);
$this->_limitStart = $limitStart;
return array($this->_limitStart, $this->_limit);
}
示例8: getProductSingle
public function getProductSingle($virtuemart_product_id = NULL, $front = TRUE, $quantity = 1, $withParent = false, $virtuemart_shoppergroup_ids = 0)
{
if (!empty($virtuemart_product_id)) {
$virtuemart_product_id = $this->setId($virtuemart_product_id);
}
if ($virtuemart_shoppergroup_ids === 0) {
$usermodel = VmModel::getModel('user');
$currentVMuser = $usermodel->getCurrentUser();
if (!is_array($currentVMuser->shopper_groups)) {
$virtuemart_shoppergroup_ids = (array) $currentVMuser->shopper_groups;
} else {
$virtuemart_shoppergroup_ids = $currentVMuser->shopper_groups;
}
}
$virtuemart_shoppergroup_idsString = 0;
if (!empty($virtuemart_shoppergroup_ids) and is_array($virtuemart_shoppergroup_ids)) {
$virtuemart_shoppergroup_idsString = implode('.', $virtuemart_shoppergroup_ids);
} else {
if (!empty($virtuemart_shoppergroup_ids)) {
$virtuemart_shoppergroup_idsString = $virtuemart_shoppergroup_ids;
}
}
$front = $front ? TRUE : 0;
$productKey = $virtuemart_product_id . ':' . $virtuemart_shoppergroup_idsString . ':' . $quantity . ':' . $front;
if (array_key_exists($productKey, self::$_productsSingle)) {
return clone self::$_productsSingle[$productKey];
}
if (!empty($this->_id)) {
$product = $this->getTable('products');
$product->load($this->_id, 0, 0);
$product->allIds = array();
$xrefTable = $this->getTable('product_medias');
$product->virtuemart_media_id = $xrefTable->load((int) $this->_id);
// Load the shoppers the product is available to for Custom Shopper Visibility
$product->shoppergroups = $this->getTable('product_shoppergroups')->load($this->_id);
if (!empty($product->shoppergroups) and $front) {
if (!class_exists('VirtueMartModelUser')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'user.php';
}
$commonShpgrps = array_intersect($virtuemart_shoppergroup_ids, $product->shoppergroups);
if (empty($commonShpgrps)) {
return $this->fillVoidProduct($front);
}
}
$this->getRawProductPrices($product, $quantity, $virtuemart_shoppergroup_ids, $front, $withParent);
$xrefTable = $this->getTable('product_manufacturers');
$product->virtuemart_manufacturer_id = $xrefTable->load((int) $this->_id);
if (!empty($product->virtuemart_manufacturer_id[0])) {
//This is a fallback
$mfTable = $this->getTable('manufacturers');
$mfTable->load((int) $product->virtuemart_manufacturer_id[0]);
$product = (object) array_merge((array) $mfTable, (array) $product);
} else {
$product->virtuemart_manufacturer_id = array();
$product->mf_name = '';
$product->mf_desc = '';
$product->mf_url = '';
}
// Load the categories the product is in
$product->categoryItem = $this->getProductCategories($this->_id);
//We need also the unpublished categories, else the calculation rules do not work
$product->canonCatId = false;
$public_cats = array();
if (!empty($product->categoryItem)) {
$tmp = array();
foreach ($product->categoryItem as $category) {
if ($category['published']) {
if (!$product->canonCatId) {
$product->canonCatId = $category['virtuemart_category_id'];
}
$public_cats[] = $category['virtuemart_category_id'];
}
$tmp[] = $category['virtuemart_category_id'];
}
$product->categories = $tmp;
}
if (!empty($product->categories) and is_array($product->categories)) {
if ($front) {
if (!class_exists('shopFunctionsF')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
//We must first check if we come from another category, due the canoncial link we would have always the same catgory id for a product
//But then we would have wrong neighbored products / category and product layouts
if (!isset($this->categoryId)) {
static $menu = null;
if (!isset($menu)) {
$app = JFactory::getApplication();
$menus = $app->getMenu();
$menu = $menus->getActive();
}
$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) {
$this->categoryId = ShopFunctionsF::getLastVisitedCategoryId();
}
}
//$last_category_id = shopFunctionsF::getLastVisitedCategoryId ();
//.........这里部分代码省略.........
示例9: 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) {
//.........这里部分代码省略.........
示例10: customFieldDisplay
/**
* There are too many functions doing almost the same for my taste
* the results are sometimes slighty different and makes it hard to work with it, therefore here the function for future proxy use
*
*/
public function customFieldDisplay($product, $variantmods, $html, $trigger)
{
//vmdebug('customFieldDisplay $variantmods',$variantmods);
$row = 0;
if (!class_exists('shopFunctionsF')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
foreach ($variantmods as $selected => $variant) {
if ($selected) {
$productCustom = self::getProductCustomFieldCart($selected);
if (!empty($productCustom)) {
$html .= ' <span class="product-field-type-' . $productCustom->field_type . '">';
if ($productCustom->field_type == "E") {
$product = self::addParam($product);
$product->productCustom = $productCustom;
//vmdebug('CustomsFieldCartDisplay $productCustom',$productCustom);
// vmdebug('customFieldDisplay $product->param selected '.$selected,$product->param);
if (!class_exists('vmCustomPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php';
}
JPluginHelper::importPlugin('vmcustom');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger($trigger, array($product, $row, &$html));
} else {
$value = '';
if ($productCustom->field_type == "G") {
$child = self::getChild($productCustom->custom_value);
// $html .= $productCustom->custom_title.' '.$child->product_name;
$value = $child->product_name;
} elseif ($productCustom->field_type == "M") {
// $html .= $productCustom->custom_title.' '.self::displayCustomMedia($productCustom->custom_value);
$value = self::displayCustomMedia($productCustom->custom_value);
} elseif ($productCustom->field_type == "S") {
// q $html .= $productCustom->custom_title.' '.JText::_($productCustom->custom_value);
$value = $productCustom->custom_value;
} else {
// $html .= $productCustom->custom_title.' '.$productCustom->custom_value;
$value = $productCustom->custom_value;
}
$html .= ShopFunctionsF::translateTwoLangKeys($productCustom->custom_title, $value);
}
$html .= '</span><br />';
} else {
// falldown method if customfield are deleted
foreach ((array) $selected as $key => $value) {
$html .= '<br/ >' . ($key ? '<span>' . $key . ' </span>' : '') . $value;
}
vmdebug('CustomsFieldOrderDisplay, $item->productCustom empty? ' . $variant);
vmdebug('customFieldDisplay, $productCustom is EMPTY ');
}
}
$row++;
}
vmdebug('customFieldDisplay html begin: ' . $html . ' end');
return $html . '</div>';
}
示例11: display
function display($tpl = null)
{
if (!class_exists('VmHTML')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$model = VmModel::getModel('calc');
//@todo should be depended by loggedVendor
$this->vendorId = vmAccess::getVendorId();
$this->SetViewTitle();
$layoutName = vRequest::getCmd('layout', 'default');
if ($layoutName == 'edit') {
$calc = $model->getCalc();
$this->assignRef('calc', $calc);
$isNew = $calc->virtuemart_calc_id < 1;
if ($isNew) {
$calc->virtuemart_vendor_id = $this->vendorId;
$db = JFactory::getDBO();
//get default currency of the vendor, if not set get default of the shop
$q = 'SELECT `vendor_currency` FROM `#__virtuemart_vendors` WHERE `virtuemart_vendor_id` = "' . $this->vendorId . '"';
$db->setQuery($q);
$currency = $db->loadResult();
if (empty($currency)) {
$q = 'SELECT `vendor_currency` FROM `#__virtuemart_vendors` WHERE `virtuemart_vendor_id` = "1" ';
$db->setQuery($q);
$currency = $db->loadResult();
$calc->calc_currency = $currency;
} else {
$calc->calc_currency = $currency;
}
}
$this->entryPointsList = self::renderEntryPointsList($calc->calc_kind);
$this->mathOpList = self::renderMathOpList($calc->calc_value_mathop);
if (empty($calc->calc_categories)) {
$calc->calc_categories = array();
} else {
if (!is_array($calc->calc_categories)) {
$calc->calc_categories = array($calc->calc_categories);
}
}
$calc_categories = $calc->calc_categories;
$this->categoryTree = ShopFunctions::categoryListTree($calc_categories);
$currencyModel = VmModel::getModel('currency');
$this->currencies = $currencyModel->getCurrencies();
$this->shopperGroupList = ShopFunctions::renderShopperGroupList($calc->virtuemart_shoppergroup_ids, True);
if (!class_exists('ShopFunctionsF')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
$this->countriesList = ShopFunctionsF::renderCountryList($calc->calc_countries, True);
$this->statesList = ShopFunctionsF::renderStateList($calc->virtuemart_state_ids, '', True);
$this->manufacturerList = ShopFunctions::renderManufacturerList($calc->virtuemart_manufacturers, true);
if ($this->showVendors()) {
$this->vendorList = ShopFunctions::renderVendorList($calc->virtuemart_vendor_id);
}
$this->addStandardEditViewCommands();
} else {
if ($this->showVendors()) {
JToolBarHelper::custom('toggle.shared.1', 'publish', 'yes', vmText::_('COM_VIRTUEMART_SHARED_TOGGLE_ON'), true);
JToolBarHelper::custom('toggle.shared.0', 'unpublish', 'no', vmText::_('COM_VIRTUEMART_SHARED_TOGGLE_OFF'), true);
}
$this->addStandardDefaultViewCommands();
$this->addStandardDefaultViewLists($model);
$search = vRequest::getCmd('search', false);
$this->calcs = $model->getCalcs(false, false, $search);
VmConfig::loadJLang('com_virtuemart_shoppers', true);
foreach ($this->calcs as &$data) {
$data->calcCategoriesList = shopfunctions::renderGuiList($data->virtuemart_calc_id, 'categories', 'category_name', 'category', 'calc_categories', 'virtuemart_calc_id');
$data->calcShoppersList = shopfunctions::renderGuiList($data->virtuemart_calc_id, 'shoppergroups', 'shopper_group_name', 'shoppergroup', 'calc_shoppergroups', 'virtuemart_calc_id');
$data->calcCountriesList = shopfunctions::renderGuiList($data->virtuemart_calc_id, 'countries', 'country_name', 'country', 'calc_countries', 'virtuemart_calc_id');
$data->calcStatesList = shopfunctions::renderGuiList($data->virtuemart_calc_id, 'states', 'state_name', 'states', 'calc_states', 'virtuemart_calc_id');
$data->calcManufacturersList = shopfunctions::renderGuiList($data->virtuemart_calc_id, 'manufacturers', 'mf_name', 'manufacturer', 'calc_manufacturers', 'virtuemart_calc_id');
}
$this->pagination = $model->getPagination();
}
parent::display($tpl);
}
示例12: display
public 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);
// add javascript for price and cart, need even for quantity buttons, so we need it almost anywhere
vmJsApi::jPrice();
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$pathway = $app->getPathway();
if (!class_exists('VmImage')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
}
$categoryModel = VmModel::getModel('category');
$productModel = VmModel::getModel('product');
// set search and keyword
if ($keyword = vmRequest::uword('keyword', false, ' ,-,+,.,_')) {
$pathway->addItem($keyword);
//$title .=' ('.$keyword.')';
}
//$search = VmRequest::uword('keyword', null);
$this->searchcustom = '';
$this->searchcustomvalues = '';
if (!empty($keyword)) {
$this->searchcustom = $this->getSearchCustom();
$search = $keyword;
} else {
$keyword = '';
$search = NULL;
}
$this->assignRef('search', $search);
$this->assignRef('keyword', $keyword);
$categoryId = JRequest::getInt('virtuemart_category_id', false);
$virtuemart_manufacturer_id = JRequest::getInt('virtuemart_manufacturer_id', false);
if ($categoryId === false and $virtuemart_manufacturer_id === false) {
$categoryId = ShopFunctionsF::getLastVisitedCategoryId();
$catType = 'category';
$this->setCanonicalLink($tpl, $document, $categoryId, $catType);
} else {
if ($categoryId === false and $virtuemart_manufacturer_id) {
$catType = 'manufacturer';
$this->setCanonicalLink($tpl, $document, $virtuemart_manufacturer_id, $catType);
} else {
$catType = 'category';
$this->setCanonicalLink($tpl, $document, $categoryId, $catType);
}
}
if ($categoryId !== -1) {
$vendorId = 1;
$category = $categoryModel->getCategory($categoryId);
}
if (!empty($category)) {
if (empty($category->category_layout) or $category->category_layout != 'category') {
// Load the products in the given category
$ids = $productModel->sortSearchListQuery(TRUE, $categoryId);
$perRow = empty($category->products_per_row) ? VmConfig::get('products_per_row', 3) : $category->products_per_row;
$this->assignRef('perRow', $perRow);
$pagination = $productModel->getPagination($perRow);
$this->assignRef('vmPagination', $pagination);
$products = $productModel->getProducts($ids);
//$products = $productModel->getProductsInCategory($categoryId);
$productModel->addImages($products, 1);
$this->assignRef('products', $products);
if ($products) {
$currency = CurrencyDisplay::getInstance();
$this->assignRef('currency', $currency);
foreach ($products as $product) {
$product->stock = $productModel->getStockIndicator($product);
}
}
$ratingModel = VmModel::getModel('ratings');
$showRating = $ratingModel->showRating();
$this->assignRef('showRating', $showRating);
$orderByList = $productModel->getOrderByList($categoryId);
$this->assignRef('orderByList', $orderByList);
// Add feed links
if ($products && VmConfig::get('feed_cat_published', 0) == 1) {
$link = '&format=feed&limitstart=';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link . '&type=rss', FALSE), 'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link . '&type=atom', FALSE), 'alternate', 'rel', $attribs);
}
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) {
//.........这里部分代码省略.........
示例13: display
public function display($tpl = null)
{
$show_prices = VmConfig::get('show_prices', 1);
if ($show_prices == '1') {
JLoader::register('calculationHelper', JPATH_VM_ADMINISTRATOR . '/helpers/calculationh.php');
}
$this->assignRef('show_prices', $show_prices);
// add javascript for price and cart, need even for quantity buttons, so we need it almost anywhere
vmJsApi::jPrice();
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$pathway = $app->getPathway();
JLoader::register('VmImage', JPATH_VM_ADMINISTRATOR . '/helpers/image.php');
$categoryModel = VmModel::getModel('category');
$productModel = VmModel::getModel('product');
$search = JRequest::getvar('keyword', null);
if ($search !== null) {
$searchcustom = $this->getSearchCustom();
}
$this->assignRef('keyword', $keyword);
$this->assignRef('search', $search);
$categoryId = JRequest::getInt('virtuemart_category_id', ShopFunctionsF::getLastVisitedCategoryId());
$virtuemart_manufacturer_id = JRequest::getInt('virtuemart_manufacturer_id', 0);
$this->setCanonicalLink($tpl, $document, $categoryId);
// $vendorId = JRequest::getInt('virtuemart_vendor_id', 1);
$vendorId = JRequest::getInt('virtuemart_vendor_id', null);
// Load the products in the given category
$products = $productModel->getProductsInCategory($categoryId, $vendorId);
$productModel->addImages($products, 1);
$this->assignRef('products', $products);
if ($products) {
$currency = CurrencyDisplay::getInstance();
$this->assignRef('currency', $currency);
foreach ($products as $product) {
$product->stock = $productModel->getStockIndicator($product);
}
}
$ratingModel = VmModel::getModel('ratings');
$showRating = $ratingModel->showRating();
$this->assignRef('showRating', $showRating);
$orderByList = $productModel->getOrderByList($categoryId);
$this->assignRef('orderByList', $orderByList);
// Add feed links
if ($products && VmConfig::get('feed_cat_published', 0) == 1) {
$link = '&format=feed&limitstart=';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link . '&type=rss', FALSE), 'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link . '&type=atom', FALSE), 'alternate', 'rel', $attribs);
}
JLoader::register('Permissions', JPATH_VM_ADMINISTRATOR . '/helpers/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, FALSE);
$this->assignRef('paginationAction', $paginationAction);
shopFunctionsF::setLastVisitedCategoryId($categoryId);
shopFunctionsF::setLastVisitedManuId($virtuemart_manufacturer_id);
if ($categoryId !== -1) {
$vendorId = JRequest::getInt('virtuemart_vendor_id', 1);
$category = $categoryModel->getCategory($categoryId);
}
$perRow = empty($category->products_per_row) ? VmConfig::get('products_per_row', 3) : $category->products_per_row;
$this->assignRef('perRow', $perRow);
$pagination = $productModel->getPagination($perRow);
$this->assignRef('vmPagination', $pagination);
if (!empty($category)) {
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);
//return false;
}
}
$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;
}
//No redirect here, category id = 0 means show ALL categories! note by Max Milbers
/* if(empty($category->virtuemart_vendor_id) && $search == null ) {
$app -> enqueueMessage(JText::_('COM_VIRTUEMART_CATEGORY_NOT_FOUND'));
$app -> redirect( 'index.php');
}*/
// Add the category name to the pathway
if ($category->parents) {
foreach ($category->parents as $c) {
//.........这里部分代码省略.........
示例14: getInvoiceFolderName
static function getInvoiceFolderName()
{
if (!class_exists('ShopFunctionsF')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
return ShopFunctionsF::getInvoiceFolderName();
}
示例15: truncate
protected function truncate($string, $length)
{
if (!class_exists('shopFunctionsF')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
return ShopFunctionsF::vmSubstr($string, 0, $length);
}