本文整理汇总了PHP中VmConfig::isSuperVendor方法的典型用法代码示例。如果您正苦于以下问题:PHP VmConfig::isSuperVendor方法的具体用法?PHP VmConfig::isSuperVendor怎么用?PHP VmConfig::isSuperVendor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VmConfig
的用法示例。
在下文中一共展示了VmConfig::isSuperVendor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
if (!class_exists('VmHTML')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$this->vendorId = VmConfig::isSuperVendor();
// TODO add icon for media view
$this->SetViewTitle();
$model = VmModel::getModel('media');
$layoutName = vRequest::getCmd('layout', 'default');
if ($layoutName == 'edit') {
$this->media = $model->getFile();
$this->addStandardEditViewCommands();
} else {
$virtuemart_product_id = vRequest::getInt('virtuemart_product_id');
if (is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0) {
$virtuemart_product_id = (int) $virtuemart_product_id[0];
} else {
$virtuemart_product_id = (int) $virtuemart_product_id;
}
$cat_id = vRequest::getInt('virtuemart_category_id', 0);
JToolBarHelper::custom('synchronizeMedia', 'new', 'new', vmText::_('COM_VIRTUEMART_TOOLS_SYNC_MEDIA_FILES'), false);
$this->addStandardDefaultViewCommands();
$this->addStandardDefaultViewLists($model, null, null, 'searchMedia');
$options = array('' => vmText::_('COM_VIRTUEMART_LIST_ALL_TYPES'), 'product' => vmText::_('COM_VIRTUEMART_PRODUCT'), 'category' => vmText::_('COM_VIRTUEMART_CATEGORY'), 'manufacturer' => vmText::_('COM_VIRTUEMART_MANUFACTURER'), 'vendor' => vmText::_('COM_VIRTUEMART_VENDOR'));
$this->lists['search_type'] = VmHTML::selectList('search_type', vRequest::getVar('search_type'), $options, 1, '', 'onchange="this.form.submit();"');
$options = array('' => vmText::_('COM_VIRTUEMART_LIST_ALL_ROLES'), 'file_is_displayable' => vmText::_('COM_VIRTUEMART_FORM_MEDIA_DISPLAYABLE'), 'file_is_downloadable' => vmText::_('COM_VIRTUEMART_FORM_MEDIA_DOWNLOADABLE'), 'file_is_forSale' => vmText::_('COM_VIRTUEMART_FORM_MEDIA_SET_FORSALE'));
$this->lists['search_role'] = VmHTML::selectList('search_role', vRequest::getVar('search_role'), $options, 1, '', 'onchange="this.form.submit();"');
$this->files = $model->getFiles(false, false, $virtuemart_product_id, $cat_id);
$this->pagination = $model->getPagination();
}
parent::display($tpl);
}
示例2: isSuperVendor
public static function isSuperVendor()
{
if (JVM_VERSION <= 2) {
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
if (Permissions::getInstance()->check("admin,storeadmin")) {
return true;
}
} else {
$text = '';
$user = JFactory::getUser();
if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart') or VmConfig::isSuperVendor()) {
return true;
}
}
return false;
}
示例3: display
//.........这里部分代码省略.........
unset($document->_links[$k]);
break;
}
}
// Set Canonic link
if ($isCustomVariant !== false and !empty($isCustomVariant->usecanonical) and !empty($product->product_parent_id)) {
$parent = $product_model->getProduct($product->product_parent_id);
$document->addHeadLink($parent->canonical, 'canonical', 'rel', '');
} else {
$document->addHeadLink($product->canonical, 'canonical', 'rel', '');
}
} else {
if ($format == 'pdf') {
defined('K_PATH_IMAGES') or define('K_PATH_IMAGES', VMPATH_ROOT);
}
}
// Set the titles
// $document->setTitle should be after the additem pathway
if ($product->customtitle) {
$document->setTitle(strip_tags(html_entity_decode($product->customtitle, ENT_QUOTES)));
} else {
$document->setTitle(strip_tags(html_entity_decode(($category->category_name ? $category->category_name . ' : ' : '') . $product->product_name, ENT_QUOTES)));
}
$this->allowReview = $ratingModel->allowReview($product->virtuemart_product_id);
$this->showReview = $ratingModel->showReview($product->virtuemart_product_id);
if ($this->showReview) {
$this->review = $ratingModel->getReviewByProduct($product->virtuemart_product_id);
$this->rating_reviews = $ratingModel->getReviews($product->virtuemart_product_id);
}
if ($this->showRating) {
$this->vote = $ratingModel->getVoteByProduct($product->virtuemart_product_id);
}
$this->allowRating = $ratingModel->allowRating($product->virtuemart_product_id);
$superVendor = VmConfig::isSuperVendor();
if ($superVendor == 1 or $superVendor == $product->virtuemart_vendor_id or $superVendor) {
$edit_link = JURI::root() . 'index.php?option=com_virtuemart&tmpl=component&manage=1&view=product&task=edit&virtuemart_product_id=' . $product->virtuemart_product_id;
$this->edit_link = $this->linkIcon($edit_link, 'COM_VIRTUEMART_PRODUCT_FORM_EDIT_PRODUCT', 'edit', false, false);
} else {
$this->edit_link = "";
}
// Load the user details
$this->user = JFactory::getUser();
// More reviews link
$uri = JURI::getInstance();
$uri->setVar('showall', 1);
$uristring = vmURI::getCleanUrl();
$this->assignRef('more_reviews', $uristring);
if ($product->metadesc) {
$document->setDescription(strip_tags(html_entity_decode($product->metadesc, ENT_QUOTES)));
} else {
$document->setDescription(strip_tags(html_entity_decode($product->product_name, ENT_QUOTES)) . " " . $category->category_name . " " . strip_tags(html_entity_decode($product->product_s_desc, ENT_QUOTES)));
}
if ($product->metakey) {
$document->setMetaData('keywords', $product->metakey);
}
if ($product->metarobot) {
$document->setMetaData('robots', $product->metarobot);
}
if ($mainframe->getCfg('MetaTitle') == '1') {
$document->setMetaData('title', $product->product_name);
//Maybe better product_name
}
if ($mainframe->getCfg('MetaAuthor') == '1') {
$document->setMetaData('author', $product->metaauthor);
}
$user = JFactory::getUser();
示例4: getUserList
/**
* Retrieve a list of users from the database.
*
* @author Max Milbers
* @return object List of user objects
*/
function getUserList()
{
//$select = ' * ';
//$joinedTables = ' FROM #__users AS ju LEFT JOIN #__virtuemart_vmusers AS vmu ON ju.id = vmu.virtuemart_user_id';
$search = vRequest::getString('search', false);
$tableToUse = vRequest::getString('searchTable', 'juser');
$where = array();
if ($search) {
$where = ' WHERE ';
$db = JFactory::getDbo();
$searchArray = array('ju.name', 'username', 'email', 'shopper_group_name');
// removed ,'usertype' should be handled by extra dropdown
if ($tableToUse != 'juser') {
if (!class_exists('TableUserinfos')) {
require VMPATH_ADMIN . DS . 'tables' . DS . 'userinfos.php';
}
$userfieldTable = new TableUserinfos($db);
$userfieldFields = get_object_vars($userfieldTable);
$userFieldSearchArray = array('company', 'first_name', 'last_name');
//We must validate if the userfields actually exists, they could be removed
$userFieldsValid = array();
foreach ($userFieldSearchArray as $ufield) {
if (array_key_exists($ufield, $userfieldFields)) {
$userFieldsValid[] = $ufield;
}
}
$searchArray = array_merge($userFieldsValid, $searchArray);
}
$search = str_replace(' ', '%', $db->escape($search, true));
foreach ($searchArray as $field) {
$whereOr[] = ' ' . $field . ' LIKE "%' . $search . '%" ';
}
//$where = substr($where,0,-3);
}
$select = ' ju.id AS id
, ju.name AS name
, ju.username AS username
, ju.email AS email
, IFNULL(vmu.user_is_vendor,"0") AS is_vendor
, IFNULL(sg.shopper_group_name, "") AS shopper_group_name ';
if ($search) {
if ($tableToUse != 'juser') {
$select .= ' , ui.name as uiname ';
}
foreach ($searchArray as $ufield) {
$select .= ' , ' . $ufield;
}
}
$joinedTables = ' FROM #__users AS ju
LEFT JOIN #__virtuemart_vmusers AS vmu ON ju.id = vmu.virtuemart_user_id
LEFT JOIN #__virtuemart_vmuser_shoppergroups AS vx ON ju.id = vx.virtuemart_user_id
LEFT JOIN #__virtuemart_shoppergroups AS sg ON vx.virtuemart_shoppergroup_id = sg.virtuemart_shoppergroup_id ';
if ($search and $tableToUse != 'juser') {
$joinedTables .= ' LEFT JOIN #__virtuemart_userinfos AS ui ON ui.virtuemart_user_id = vmu.virtuemart_user_id';
}
$whereAnd = array();
if (VmConfig::get('multixcart', 0) == 'byvendor') {
$superVendor = VmConfig::isSuperVendor();
if ($superVendor > 1) {
$joinedTables .= ' LEFT JOIN #__virtuemart_vendor_users AS vu ON ju.id = vmu.virtuemart_user_id';
$whereAnd[] = ' vu.virtuemart_vendor_id = ' . $superVendor . ' ';
}
}
$where = '';
$whereStr = ' WHERE ';
if (!empty($whereOr)) {
$where = $whereStr . implode(' OR ', $whereOr);
$whereStr = 'AND';
}
if (!empty($whereAnd)) {
$where .= $whereStr . ' (' . implode(' OR ', $whereAnd) . ')';
}
return $this->_data = $this->exeSortSearchListQuery(0, $select, $joinedTables, $where, ' GROUP BY ju.id', $this->_getOrdering());
}
示例5: display
//.........这里部分代码省略.........
$this->cart->prepareAddressFieldsInCart();
$userFields = $this->cart->{$fieldtype};
} else {
if ($task == 'addST') {
$this->address_type = 'ST';
}
if (!$new and empty($virtuemart_userinfo_id)) {
$virtuemart_userinfo_id = $this->_model->getBTuserinfo_id();
vmdebug('Try to get $virtuemart_userinfo_id by type BT', $virtuemart_userinfo_id);
}
$userFields = $this->_model->getUserInfoInUserFields($layoutName, $this->address_type, $virtuemart_userinfo_id, false);
if (!$new && empty($userFields[$virtuemart_userinfo_id])) {
$virtuemart_userinfo_id = $this->_model->getBTuserinfo_id();
vmdebug('$userFields by getBTuserinfo_id', $userFields);
}
$userFields = $userFields[$virtuemart_userinfo_id];
}
$this->virtuemart_userinfo_id = $virtuemart_userinfo_id;
$this->assignRef('userFields', $userFields);
if ($layoutName == 'edit') {
if ($this->_model->getId() == 0 && $this->_cuid == 0) {
$button_lbl = vmText::_('COM_VIRTUEMART_REGISTER');
} else {
$button_lbl = vmText::_('COM_VIRTUEMART_SAVE');
}
$this->assignRef('button_lbl', $button_lbl);
$this->lUser();
$this->shopper($userFields);
$this->payment();
$this->lOrderlist();
$this->lVendor();
}
$stTask = 'addST';
if ($task == 'editaddresscart') {
$stTask = 'editaddresscart';
}
$this->_lists['shipTo'] = ShopFunctionsF::generateStAddressList($this, $this->_model, $stTask);
$this->assignRef('lists', $this->_lists);
$this->assignRef('editor', $editor);
if ($layoutName == 'mailregisteruser') {
$vendorModel = VmModel::getModel('vendor');
// $vendorModel->setId($this->_userDetails->virtuemart_vendor_id);
$vendor = $vendorModel->getVendor();
$this->assignRef('vendor', $vendor);
}
if ($layoutName == 'editaddress') {
$layoutName = 'edit_address';
$this->setLayout($layoutName);
}
if (!$this->userDetails->JUser->get('id')) {
$corefield_title = vmText::_('COM_VIRTUEMART_USER_CART_INFO_CREATE_ACCOUNT');
} else {
$corefield_title = vmText::_('COM_VIRTUEMART_YOUR_ACCOUNT_DETAILS');
}
if ($this->cart->_fromCart or $this->cart->getInCheckOut()) {
$pathway->addItem(vmText::_('COM_VIRTUEMART_CART_OVERVIEW'), JRoute::_('index.php?option=com_virtuemart&view=cart', FALSE));
} else {
//$pathway->addItem(vmText::_('COM_VIRTUEMART_YOUR_ACCOUNT_DETAILS'), JRoute::_('index.php?option=com_virtuemart&view=user&&layout=edit'));
}
$pathway_text = vmText::_('COM_VIRTUEMART_YOUR_ACCOUNT_DETAILS');
if (!$this->userDetails->JUser->get('id')) {
if ($this->cart->_fromCart or $this->cart->getInCheckOut()) {
if ($this->address_type == 'BT') {
$vmfield_title = vmText::_('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_LBL');
} else {
$vmfield_title = vmText::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL');
}
} else {
if ($this->address_type == 'BT') {
$vmfield_title = vmText::_('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_LBL');
$title = vmText::_('COM_VIRTUEMART_REGISTER');
} else {
$vmfield_title = vmText::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL');
}
}
} else {
if ($this->address_type == 'BT') {
$vmfield_title = vmText::_('COM_VIRTUEMART_USER_FORM_BILLTO_LBL');
} else {
$vmfield_title = vmText::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL');
}
}
$this->add_product_link = "";
$this->manage_link = "";
if (VmConfig::isSuperVendor()) {
$manage_link = JRoute::_('index.php?option=com_virtuemart&tmpl=component&manage=1');
$this->manage_link = $this->linkIcon($manage_link, 'JACTION_MANAGE', 'new', false, false, true, true);
$add_product_link = JRoute::_('index.php?option=com_virtuemart&tmpl=component&view=product&view=product&task=edit&virtuemart_product_id=0&manage=1');
$this->add_product_link = $this->linkIcon($add_product_link, 'COM_VIRTUEMART_PRODUCT_ADD_PRODUCT', 'new', false, false, true, true);
}
$document = JFactory::getDocument();
$document->setTitle($pathway_text);
$pathway->additem($pathway_text);
$document->setMetaData('robots', 'NOINDEX, NOFOLLOW, NOARCHIVE, NOSNIPPET');
$this->assignRef('page_title', $pathway_text);
$this->assignRef('corefield_title', $corefield_title);
$this->assignRef('vmfield_title', $vmfield_title);
shopFunctionsF::setVmTemplate($this, 0, 0, $layoutName);
parent::display($tpl);
}
示例6: categoryListTree
public static function categoryListTree($selectedCategories = array(), $cid = 0, $level = 0, $disabledFields = array())
{
$hash = crc32(implode('.', $selectedCategories) . ':' . $cid . ':' . $level . implode('.', $disabledFields));
if (empty(self::$categoryTree[$hash])) {
$cache = JFactory::getCache('com_virtuemart_cats');
$cache->setCaching(1);
$app = JFactory::getApplication();
$vendorId = VmConfig::isSuperVendor();
self::$categoryTree[$hash] = $cache->call(array('ShopFunctions', 'categoryListTreeLoop'), $selectedCategories, $cid, $level, $disabledFields, $app->isSite(), $vendorId, VmConfig::$vmlang);
}
return self::$categoryTree[$hash];
}
示例7: getOrdersList
/**
* Select the products to list on the product list page
* @param $uid integer Optional user ID to get the orders of a single user
* @param $_ignorePagination boolean If true, ignore the Joomla pagination (for embedded use, default false)
*/
public function getOrdersList($uid = 0, $noLimit = false)
{
// vmdebug('getOrdersList');
$this->_noLimit = $noLimit;
$select = " o.*, CONCAT_WS(' ',u.first_name,u.middle_name,u.last_name) AS order_name "
.',u.email as order_email,pm.payment_name AS payment_method ';
$from = $this->getOrdersListQuery();
$where = array();
$user = JFactory::getUser();
$virtuemart_vendor_id = vRequest::get('virtuemart_vendor_id',false);
if($user->authorise('core.admin','com_virtuemart')){
vmdebug('Vendor is core.admin and should see all');
if($virtuemart_vendor_id){
$where[]= ' o.virtuemart_vendor_id = "'.$virtuemart_vendor_id.'" ';
}
if(!empty($uid)){
$where[]= ' u.virtuemart_user_id = ' . (int)$uid.' ';
}
}
else if( $user->authorise('core.manage','com_virtuemart') or $user->authorise('vm.orders','com_virtuemart')){
$virtuemart_vendor_id = VmConfig::isSuperVendor();
vmdebug('Vendor is manager and should only see its own orders venodorId '.$virtuemart_vendor_id);
if(!empty($virtuemart_vendor_id)){
$where[]= ' (o.virtuemart_vendor_id = '.$virtuemart_vendor_id.' OR u.virtuemart_user_id = ' . (int)$uid.') ';
$uid = 0;
} else {
//We map here as fallback to vendor 1.
$where[]= ' u.virtuemart_user_id = ' . (int)$uid;
}
} else {
//A normal user is only allowed to see its own orders, we map $uid to the user id
$uid = (int)$user->id;
$where = array();
}
if(!empty($uid)){
$where[]= ' u.virtuemart_user_id = ' . (int)$uid.' ';
}
if ($search = vRequest::getString('search', false)){
$db = JFactory::getDBO();
$search = '"%' . $db->escape( $search, true ) . '%"' ;
$search = str_replace(' ','%',$search);
$searchFields = array();
$searchFields[] = 'u.first_name';
$searchFields[] = 'u.middle_name';
$searchFields[] = 'u.last_name';
$searchFields[] = 'o.order_number';
$searchFields[] = 'u.company';
$searchFields[] = 'u.email';
$searchFields[] = 'u.phone_1';
$searchFields[] = 'u.address_1';
$searchFields[] = 'u.zip';
$where[] = implode (' LIKE '.$search.' OR ', $searchFields) . ' LIKE '.$search.' ';
//$where[] = ' ( u.first_name LIKE '.$search.' OR u.middle_name LIKE '.$search.' OR u.last_name LIKE '.$search.' OR `order_number` LIKE '.$search.')';
}
$order_status_code = vRequest::getString('order_status_code', false);
if ($order_status_code and $order_status_code!=-1){
$where[] = ' o.order_status = "'.$order_status_code.'" ';
}
if (count ($where) > 0) {
$whereString = ' WHERE (' . implode (' AND ', $where) . ') ';
}
else {
$whereString = '';
}
if ( vRequest::getCmd('view') == 'orders') {
$ordering = $this->_getOrdering();
} else {
$ordering = ' order by o.modified_on DESC';
}
$this->_data = $this->exeSortSearchListQuery(0,$select,$from,$whereString,'',$ordering);
return $this->_data ;
}
示例8: getFiles
/**
* Retrieve a list of files from the database. This is meant only for backend use
*
* @author Max Milbers
* @param boolean $onlyPublished True to only retrieve the published files, false otherwise
* @param boolean $noLimit True if no record count limit is used, false otherwise
* @return object List of media objects
*/
function getFiles($onlyPublished = false, $noLimit = false, $virtuemart_product_id = null, $cat_id = null, $where = array(), $nbr = false)
{
$this->_noLimit = $noLimit;
if (empty($db)) {
$db = JFactory::getDBO();
}
$query = '';
$selectFields = array();
$joinTables = array();
$joinedTables = '';
$whereItems = array();
$groupBy = '';
$orderByTable = '';
if (!empty($virtuemart_product_id)) {
$mainTable = '`#__virtuemart_product_medias`';
$selectFields[] = ' `#__virtuemart_medias`.`virtuemart_media_id` as virtuemart_media_id ';
$joinTables[] = ' LEFT JOIN `#__virtuemart_medias` ON `#__virtuemart_medias`.`virtuemart_media_id`=`#__virtuemart_product_medias`.`virtuemart_media_id` and `virtuemart_product_id` = "' . $virtuemart_product_id . '"';
$whereItems[] = '`virtuemart_product_id` = "' . $virtuemart_product_id . '"';
if ($this->_selectedOrdering == 'ordering') {
$orderByTable = '`#__virtuemart_product_medias`.';
} else {
$orderByTable = '`#__virtuemart_medias`.';
}
} else {
if (!empty($cat_id)) {
$mainTable = '`#__virtuemart_category_medias`';
$selectFields[] = ' `#__virtuemart_medias`.`virtuemart_media_id` as virtuemart_media_id';
$joinTables[] = ' LEFT JOIN `#__virtuemart_medias` ON `#__virtuemart_medias`.`virtuemart_media_id`=`#__virtuemart_category_medias`.`virtuemart_media_id` and `virtuemart_category_id` = "' . $cat_id . '"';
$whereItems[] = '`virtuemart_category_id` = "' . $cat_id . '"';
if ($this->_selectedOrdering == 'ordering') {
$orderByTable = '`#__virtuemart_category_medias`.';
} else {
$orderByTable = '`#__virtuemart_medias`.';
}
} else {
$mainTable = '`#__virtuemart_medias`';
$selectFields[] = ' `virtuemart_media_id` ';
$user = JFactory::getUser();
if (!$user->authorise('core.admin', 'com_virtuemart') and !$user->authorise('core.manager', 'com_virtuemart')) {
$vendorId = VmConfig::isSuperVendor();
$whereItems[] = '(`virtuemart_vendor_id` = "' . $vendorId . '" OR `shared`="1")';
}
}
}
if ($onlyPublished) {
$whereItems[] = '`#__virtuemart_medias`.`published` = 1';
}
if ($search = vRequest::getString('searchMedia', false)) {
$search = '"%' . $db->escape($search, true) . '%"';
$where[] = ' (`file_title` LIKE ' . $search . '
OR `file_description` LIKE ' . $search . '
OR `file_meta` LIKE ' . $search . '
OR `file_url` LIKE ' . $search . '
OR `file_url_thumb` LIKE ' . $search . '
) ';
}
if ($type = vRequest::getCmd('search_type')) {
$where[] = 'file_type = "' . $type . '" ';
}
if ($role = vRequest::getCmd('search_role')) {
if ($role == "file_is_downloadable") {
$where[] = '`file_is_downloadable` = 1';
$where[] = '`file_is_forSale` = 0';
} elseif ($role == "file_is_forSale") {
$where[] = '`file_is_downloadable` = 0';
$where[] = '`file_is_forSale` = 1';
} else {
$where[] = '`file_is_downloadable` = 0';
$where[] = '`file_is_forSale` = 0';
}
}
if (!empty($where)) {
$whereItems = array_merge($whereItems, $where);
}
if (count($whereItems) > 0) {
$whereString = ' WHERE ' . implode(' AND ', $whereItems);
} else {
$whereString = ' ';
}
$orderBy = $this->_getOrdering($orderByTable);
#
if (count($selectFields) > 0) {
$select = implode(', ', $selectFields) . ' FROM ' . $mainTable;
//$selectFindRows = 'SELECT COUNT(*) FROM '.$mainTable;
if (count($joinTables) > 0) {
foreach ($joinTables as $table) {
$joinedTables .= $table;
}
}
} else {
vmError('No select fields given in getFiles', 'No select fields given');
return false;
//.........这里部分代码省略.........
示例9: display
//.........这里部分代码省略.........
foreach ($productItem->customfields as $cu) {
$customfields[] = clone $cu;
}
$customfieldsSorted = array();
$customfieldsModel->displayProductCustomfieldFE($product, $customfields);
$product->stock = $productModel->getStockIndicator($product);
foreach ($customfields as $k => $custom) {
if (!empty($custom->layout_pos)) {
$customfieldsSorted[$custom->layout_pos][] = $custom;
unset($customfields[$k]);
}
}
$customfieldsSorted['normal'] = $customfields;
$product->customfieldsSorted = $customfieldsSorted;
unset($product->customfields);
$this->products[$i] = $product;
} else {
$productItem->stock = $productModel->getStockIndicator($productItem);
$this->products[$i] = $productItem;
}
}
}
}
}
// Add feed links
if ($this->showproducts and $this->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);
}
$user = JFactory::getUser();
$this->showBasePrice = ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart') or VmConfig::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);
示例10: display
function display($tpl = null) {
// Get the task
$task = vRequest::getCmd('task',$this->getLayout());
$this->assignRef('task', $task);
// Load helpers
if (!class_exists('CurrencyDisplay'))
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php');
if (!class_exists('VmHTML'))
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php');
if (!class_exists('VmImage'))
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php');
$model = VmModel::getModel();
// Handle any publish/unpublish
switch ($task) {
case 'add':
case 'edit':
//this was in the controller for the edit tasks, we need this for the access by FE
//$this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'product'.DS.'tmpl');
VmConfig::loadJLang('com_virtuemart_orders',TRUE);
VmConfig::loadJLang('com_virtuemart_shoppers',TRUE);
$virtuemart_product_id = vRequest::getInt('virtuemart_product_id');
if(is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0){
$virtuemart_product_id = (int)$virtuemart_product_id[0];
} else {
$virtuemart_product_id = (int)$virtuemart_product_id;
}
$product = $model->getProductSingle($virtuemart_product_id,false);
//$user = JFactory::getUser();
$superVendor = VmConfig::isSuperVendor();
if( $superVendor !=1 and $superVendor!=$product->virtuemart_vendor_id){
JFactory::getApplication()->redirect( 'index.php?option=com_virtuemart', vmText::_('JERROR_ALERTNOAUTHOR'), 'error');
}
if(!empty($product->product_parent_id)){
$product_parent= $model->getProductSingle($product->product_parent_id,false);
}
$customfields = VmModel::getModel ('Customfields');
$product->allIds[] = $product->virtuemart_product_id;
if(!empty($product->product_parent_id)) $product->allIds[] = $product->product_parent_id;
$product->customfields = $customfields->getCustomEmbeddedProductCustomFields ($product->allIds);
//vmdebug('my customfields',$product->customfields);
// Get the category tree
if (isset($product->categories)) $this->category_tree = ShopFunctions::categoryListTree($product->categories);
else $this->category_tree = ShopFunctions::categoryListTree();
//Fallback for categories inherited by parent to correctly calculate the prices
if(empty($product->categories) and !empty($product_parent->categories)){
$product->categories = $product_parent->categories;
}
//Get the shoppergoup list - Cleanshooter Custom Shopper Visibility
if (!isset($product->shoppergroups)) $product->shoppergroups = 0;
$this->shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups);
//$this->assignRef('shoppergroupList', $shoppergroupList);
// Load the product price
if(!class_exists('calculationHelper')) require(VMPATH_ADMIN.DS.'helpers'.DS.'calculationh.php');
$product_childIds = $model->getProductChildIds($virtuemart_product_id);
$product_childs = array();
$childs = 0;
$maxChilds = 50;
foreach($product_childIds as $id){
if($childs++>$maxChilds) break;
$product_childs[] = $model->getProductSingle($id,false);
}
$this->product_childs = $product_childs;
if(!class_exists('VirtueMartModelConfig')) require(VMPATH_ADMIN .'/models/config.php');
$productLayouts = VirtueMartModelConfig::getLayoutList('productdetails');
$this->productLayouts = $productLayouts;
// Load Images
$model->addImages($product);
if(!class_exists('VmTemplate')) require(VMPATH_SITE.DS.'helpers'.DS.'vmtemplate.php');
$vmtemplate = VmTemplate::loadVmTemplateStyle();
$this->imagePath = shopFunctions::getAvailabilityIconUrl($vmtemplate);
// Load the vendors
$vendor_model = VmModel::getModel('vendor');
if(Vmconfig::get('multix','none')!=='none'){
$lists['vendors'] = Shopfunctions::renderVendorList($product->virtuemart_vendor_id);
}
// Load the currencies
//.........这里部分代码省略.........
示例11: getUserList
/**
* Todo, works only for small stores, we need a new solution there with a bit filtering
* For example by time, if already shopper, and a simple search
* @return object list of users
*/
function getUserList()
{
$cart = $this->cart;
$result = false;
if ($this->allowChangeShopper) {
$this->adminID = JFactory::getSession()->get('vmAdminID', false);
if ($this->adminID) {
if (!class_exists('vmCrypt')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
}
$this->adminID = vmCrypt::decrypt($this->adminID);
}
$superVendor = VmConfig::isSuperVendor($this->adminID);
if ($superVendor) {
$uModel = VmModel::getModel('user');
$result = $uModel->getSwitchUserList($superVendor, $this->adminID);
}
}
//vmdebug('my user list ',$result);
if (!$result) {
$this->allowChangeShopper = false;
}
return $result;
}
示例12: store
/**
* Store a product
*
* @author Max Milbers
* @param $product given as reference
* @param bool $isChild Means not that the product is child or not. It means if the product should be threated as child
* @return bool
*/
public function store(&$product)
{
vRequest::vmCheckToken();
if ($product) {
$data = (array) $product;
}
$isChild = FALSE;
if (!empty($data['isChild'])) {
$isChild = $data['isChild'];
}
$superVendor = VmConfig::isSuperVendor();
if (empty($superVendor)) {
vmError('You are not a vendor or administrator, storing of product cancelled');
return FALSE;
}
if (isset($data['intnotes'])) {
$data['intnotes'] = trim($data['intnotes']);
}
// Setup some place holders
$product_data = $this->getTable('products');
if (!empty($data['virtuemart_product_id'])) {
$product_data->load($data['virtuemart_product_id']);
}
//Set the decimals like product packaging
//$decimals = array('product_length','product_width','product_height','product_weight','product_packaging');
foreach ($this->decimals as $decimal) {
if (array_key_exists($decimal, $data)) {
if (!empty($data[$decimal])) {
$data[$decimal] = str_replace(',', '.', $data[$decimal]);
} else {
$data[$decimal] = null;
$product_data->{$decimal} = null;
//vmdebug('Store product, set $decimal '.$decimal.' = null');
}
}
}
//with the true, we do preloading and preserve so old values note by Max Milbers
// $product_data->bindChecknStore ($data, $isChild);
//We prevent with this line, that someone is storing a product as its own parent
if (!empty($product_data->product_parent_id) and $product_data->product_parent_id == $data['virtuemart_product_id']) {
$product_data->product_parent_id = 0;
}
$stored = $product_data->bindChecknStore($data, false);
$errors = $product_data->getErrors();
if (!$stored or count($errors) > 0) {
foreach ($errors as $error) {
vmError('Product store ' . $error);
}
if (!$stored) {
vmError('You are not an administrator or the correct vendor, storing of product cancelled');
}
return FALSE;
}
$this->_id = $data['virtuemart_product_id'] = (int) $product_data->virtuemart_product_id;
if (empty($this->_id)) {
vmError('Product not stored, no id');
return FALSE;
}
//We may need to change this, the reason it is not in the other list of commands for parents
if (!$isChild) {
$modelCustomfields = VmModel::getModel('Customfields');
$modelCustomfields->storeProductCustomfields('product', $data, $product_data->virtuemart_product_id);
}
// Get old IDS
$old_price_ids = $this->loadProductPrices($this->_id, 0, false);
//vmdebug('$old_price_ids ',$old_price_ids);
if (isset($data['mprices']['product_price']) and count($data['mprices']['product_price']) > 0) {
foreach ($data['mprices']['product_price'] as $k => $product_price) {
$pricesToStore = array();
$pricesToStore['virtuemart_product_id'] = $this->_id;
$pricesToStore['virtuemart_product_price_id'] = (int) $data['mprices']['virtuemart_product_price_id'][$k];
if (!$isChild) {
//$pricesToStore['basePrice'] = $data['mprices']['basePrice'][$k];
$pricesToStore['product_override_price'] = $data['mprices']['product_override_price'][$k];
$pricesToStore['override'] = (int) $data['mprices']['override'][$k];
$pricesToStore['virtuemart_shoppergroup_id'] = (int) $data['mprices']['virtuemart_shoppergroup_id'][$k];
$pricesToStore['product_tax_id'] = (int) $data['mprices']['product_tax_id'][$k];
$pricesToStore['product_discount_id'] = (int) $data['mprices']['product_discount_id'][$k];
$pricesToStore['product_currency'] = (int) $data['mprices']['product_currency'][$k];
$pricesToStore['product_price_publish_up'] = $data['mprices']['product_price_publish_up'][$k];
$pricesToStore['product_price_publish_down'] = $data['mprices']['product_price_publish_down'][$k];
$pricesToStore['price_quantity_start'] = (int) $data['mprices']['price_quantity_start'][$k];
$pricesToStore['price_quantity_end'] = (int) $data['mprices']['price_quantity_end'][$k];
}
if (!$isChild and isset($data['mprices']['use_desired_price'][$k]) and $data['mprices']['use_desired_price'][$k] == "1") {
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
$calculator = calculationHelper::getInstance();
$pricesToStore['salesPrice'] = $data['mprices']['salesPrice'][$k];
$pricesToStore['product_price'] = $data['mprices']['product_price'][$k] = $calculator->calculateCostprice($this->_id, $pricesToStore);
unset($data['mprices']['use_desired_price'][$k]);
//.........这里部分代码省略.........
示例13: checkShipmentMethodsConfigured
private function checkShipmentMethodsConfigured()
{
//For the selection of the shipment method we need the total amount to pay.
$shipmentModel = VmModel::getModel('Shipmentmethod');
$shipments = $shipmentModel->getShipments();
if (empty($shipments)) {
$text = '';
$user = JFactory::getUser();
if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart') or VmConfig::isSuperVendor()) {
$uri = JFactory::getURI();
$link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=shipmentmethod';
$text = vmText::sprintf('COM_VIRTUEMART_NO_SHIPPING_METHODS_CONFIGURED_LINK', '<a href="' . $link . '" rel="nofollow">' . $link . '</a>');
}
vmInfo('COM_VIRTUEMART_NO_SHIPPING_METHODS_CONFIGURED', $text);
$tmp = 0;
$this->assignRef('found_shipment_method', $tmp);
$this->cart->virtuemart_shipmentmethod_id = 0;
return false;
}
return true;
}
示例14: display
//.........这里部分代码省略.........
}
$allowReview = $ratingModel->allowReview($product->virtuemart_product_id);
$this->assignRef('allowReview', $allowReview);
$showReview = $ratingModel->showReview($product->virtuemart_product_id);
$this->assignRef('showReview', $showReview);
if ($showReview) {
$review = $ratingModel->getReviewByProduct($product->virtuemart_product_id);
$this->assignRef('review', $review);
$rating_reviews = $ratingModel->getReviews($product->virtuemart_product_id);
$this->assignRef('rating_reviews', $rating_reviews);
}
if ($this->showRating) {
$vote = $ratingModel->getVoteByProduct($product->virtuemart_product_id);
$this->assignRef('vote', $vote);
//$rating = $ratingModel->getRatingByProduct($product->virtuemart_product_id);
//$this->assignRef('rating', $rating);
//vmdebug('Should show rating vote and rating',$vote,$rating);
}
$allowRating = $ratingModel->allowRating($product->virtuemart_product_id);
$this->assignRef('allowRating', $allowRating);
// Check for editing access
// @todo build edit page
$user = JFactory::getUser();
$superVendor = VmConfig::isSuperVendor();
if($superVendor == 1 or $superVendor==$product->virtuemart_vendor_id or ($superVendor)){
$edit_link = JURI::root() . 'index.php?option=com_virtuemart&tmpl=component&manage=1&view=product&task=edit&virtuemart_product_id=' . $product->virtuemart_product_id;
$edit_link = $this->linkIcon($edit_link, 'COM_VIRTUEMART_PRODUCT_FORM_EDIT_PRODUCT', 'edit', false, false);
} else {
$edit_link = "";
}
$this->assignRef('edit_link', $edit_link);
// Load the user details
$user = JFactory::getUser();
$this->assignRef('user',$user);
// More reviews link
$uri = JURI::getInstance();
$uri->setVar('showall', 1);
$uristring = vmURI::getCleanUrl();
$this->assignRef('more_reviews', $uristring);
if ($product->metadesc) {
$document->setDescription($product->metadesc);
} else {
$document->setDescription( $product->product_name . " " . $category->category_name . " " . $product->product_s_desc );
}
if ($product->metakey) {
$document->setMetaData('keywords', $product->metakey);
}
if ($product->metarobot) {
$document->setMetaData('robots', $product->metarobot);
示例15: array
}
//dont remove that file it is actually in every view
$_controller = vRequest::getCmd('view', vRequest::getCmd('controller', 'virtuemart'));
$trigger = 'onVmSiteController';
// $task = vRequest::getCmd('task',vRequest::getCmd('layout',$_controller) ); $this makes trouble!
$task = vRequest::getCmd('task', '');
$session = JFactory::getSession();
$manage = vRequest::getCmd('manage', $session->get('manage', false, 'vm'));
if (!$manage) {
$session->set('manage', 0, 'vm');
}
$feViews = array('askquestion', 'cart', 'invoice', 'pdf', 'pluginresponse', 'productdetails', 'recommend', 'vendor');
if ($manage and !in_array($_controller, $feViews)) {
$app = JFactory::getApplication();
$user = JFactory::getUser();
$vendorIdUser = VmConfig::isSuperVendor();
if ($vendorIdUser) {
VmConfig::loadJLang('com_virtuemart');
$jlang = JFactory::getLanguage();
$tag = $jlang->getTag();
$jlang->load('', JPATH_ADMINISTRATOR, $tag, true);
VmConfig::loadJLang('com_virtuemart');
$basePath = VMPATH_ADMIN;
$trigger = 'onVmAdminController';
vmdebug('$vendorIdUser use FE managing ' . $vendorIdUser);
$session->set('manage', 1, 'vm');
vRequest::setVar('manage', '1');
vmJsApi::jQuery(false);
vmJsApi::loadBECSS();
$app = JFactory::getApplication();
$router = $app->getRouter();