本文整理汇总了PHP中VirtueMartModelVendor::getUserIdByVendorId方法的典型用法代码示例。如果您正苦于以下问题:PHP VirtueMartModelVendor::getUserIdByVendorId方法的具体用法?PHP VirtueMartModelVendor::getUserIdByVendorId怎么用?PHP VirtueMartModelVendor::getUserIdByVendorId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtueMartModelVendor
的用法示例。
在下文中一共展示了VirtueMartModelVendor::getUserIdByVendorId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Displays the view, collects needed data for the different layouts
*
* Okey I try now a completly new idea.
* We make a function for every tab and the display is getting the right tabs by an own function
* putting that in an array and after that we call the preparedataforlayoutBlub
*
* @author Max Milbers
*/
function display($tpl = null)
{
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$layoutName = $this->getLayout();
$model = VmModel::getModel();
$virtuemart_vendor_id = JRequest::getInt('virtuemart_vendor_id');
// if ($layoutName=='default') {
if (empty($virtuemart_vendor_id)) {
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_LIST'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_LIST'));
$vendors = $model->getVendors();
$model->addImages($vendors);
$this->assignRef('vendors', $vendors);
} else {
$vendor = $model->getVendor($virtuemart_vendor_id);
$model->addImages($vendor);
if (VmConfig::get('enable_content_plugin', 0)) {
if (!class_exists('shopFunctionsF')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
shopFunctionsF::triggerContentPlugin($vendor, 'vendor', 'vendor_store_desc');
shopFunctionsF::triggerContentPlugin($vendor, 'vendor', 'vendor_terms_of_service');
}
$this->assignRef('vendor', $vendor);
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id);
//$usermodel = VmModel::getModel('user');
//$virtuemart_userinfo_id = $usermodel->getBTuserinfo_id($userId);
//$usermodel->getVendor($virtuemart_vendor_id);
//$userFields = $usermodel->getUserInfoInUserFields($layoutName, 'BT', $virtuemart_userinfo_id,true,true);
//$this->assignRef('userFields', $userFields);
if ($layoutName == 'tos') {
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_TOS'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_TOS'));
} elseif ($layoutName == 'contact') {
$user = JFactory::getUser();
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_CONTACT'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_CONTACT'));
$this->assignRef('user', $user);
} else {
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_DETAILS'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_DETAILS'));
$this->setLayout('details');
}
$linkdetails = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=details&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE) . '">' . JText::_('COM_VIRTUEMART_VENDOR_DETAILS') . '</a>';
$linkcontact = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE) . '">' . JText::_('COM_VIRTUEMART_VENDOR_CONTACT') . '</a>';
$linktos = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE) . '">' . JText::_('COM_VIRTUEMART_VENDOR_TOS') . '</a>';
//$this->assignRef('lineSeparator', $lineSeparator);
$this->assignRef('linkdetails', $linkdetails);
$this->assignRef('linkcontact', $linkcontact);
$this->assignRef('linktos', $linktos);
}
parent::display($tpl);
}
示例2: mailAskquestion
/**
* Send the ask question email.
* @author Kohl Patrick, Christopher Roussel
*/
public function mailAskquestion()
{
vRequest::vmCheckToken();
if (!class_exists('shopFunctionsF')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
$model = tmsModel::getModel('vendor');
$mainframe = JFactory::getApplication();
$vars = array();
$min = tsmConfig::get('asks_minimum_comment_length', 50) + 1;
$max = tsmConfig::get('asks_maximum_comment_length', 2000) - 1;
$commentSize = vRequest::getString('comment');
if (function_exists('mb_strlen')) {
$commentSize = mb_strlen($commentSize);
} else {
$commentSize = strlen($commentSize);
}
$validMail = filter_var(vRequest::getVar('email'), FILTER_VALIDATE_EMAIL);
$virtuemart_vendor_id = vRequest::getInt('virtuemart_vendor_id', 1);
if (!class_exists('VirtueMartModelVendor')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id);
//$vendorUser = JFactory::getUser($userId);
if ($commentSize < $min || $commentSize > $max || !$validMail) {
$this->setRedirect(JRoute::_('index.php?option=com_virtuemart&view=vendor&task=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE), tsmText::_('COM_VIRTUEMART_COMMENT_NOT_VALID_JS'));
return;
}
$user = JFactory::getUser();
$fromMail = vRequest::getVar('email');
//is sanitized then
$fromName = vRequest::getVar('name', '');
//is sanitized then
$fromMail = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromMail);
$fromName = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromName);
if (!empty($user->id)) {
if (empty($fromMail)) {
$fromMail = $user->email;
}
if (empty($fromName)) {
$fromName = $user->name;
}
}
$vars['user'] = array('name' => $fromName, 'email' => $fromMail);
$VendorEmail = $model->getVendorEmail($virtuemart_vendor_id);
$vars['vendor'] = array('vendor_store_name' => $fromName);
if (shopFunctionsF::renderMail('vendor', $VendorEmail, $vars, 'vendor')) {
$string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
} else {
$string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
}
$mainframe->enqueueMessage(tsmText::_($string));
// Display it all
$view = $this->getView('vendor', 'html');
$view->setLayout('mail_confirmed');
$view->display();
}
示例3: determineStoreOwner
/**
* @author Max Milbers
*/
function determineStoreOwner() {
if(!class_exists('VirtueMartModelVendor')) require(VMPATH_ADMIN.DS.'models'.DS.'vendor.php');
$virtuemart_user_id = VirtueMartModelVendor::getUserIdByVendorId(1);
if (isset($virtuemart_user_id) && $virtuemart_user_id > 0) {
$this->_user = JFactory::getUser($virtuemart_user_id);
}
else {
$this->_user = JFactory::getUser();
}
return $this->_user->id;
}
示例4: getVendor
/**
* Sets the internal user id with given vendor Id
*
* @author Max Milbers
* @param int $vendorId
*/
function getVendor($vendorId = 1, $return = TRUE)
{
$vendorModel = VmModel::getModel('vendor');
$userId = VirtueMartModelVendor::getUserIdByVendorId($vendorId);
if ($userId) {
$this->setUserId($userId);
if ($return) {
return $this->getUser();
}
} else {
return false;
}
}
示例5: display
function display($tpl = null)
{
// Load the helper(s)
$this->loadHelper('html');
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
$perm = Permissions::getInstance();
$this->assignRef('perm', $perm);
$model = VmModel::getModel();
$currentUser = JFactory::getUser();
$task = JRequest::getWord('task', 'edit');
if ($task == 'editshop') {
if (Vmconfig::get('multix', 'none') !== 'none') {
//Maybe we must check here if the user is vendor and if he has an own id and else map to mainvendor.
$userId = 0;
} else {
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId(1);
}
$this->SetViewTitle('STORE');
} else {
if ($task == 'add') {
$userId = 0;
} else {
$userId = JRequest::getVar('virtuemart_user_id', 0);
if (is_array($userId)) {
$userId = $userId[0];
}
$this->SetViewTitle('USER');
}
}
$userId = $model->setId($userId);
$layoutName = JRequest::getWord('layout', 'default');
$layoutName = $this->getLayout();
if ($layoutName == 'edit' || $layoutName == 'edit_shipto') {
$editor = JFactory::getEditor();
// Get the required helpers
$this->loadHelper('shoppergroup');
$this->loadHelper('image');
//$userFieldsModel = VmModel::getModel('userfields');
$userDetails = $model->getUser();
if ($task == 'editshop' && $userDetails->user_is_vendor) {
// $model->setCurrent();
if (!empty($userDetails->vendor->vendor_store_name)) {
$this->SetViewTitle('STORE', $userDetails->vendor->vendor_store_name);
} else {
$this->SetViewTitle('STORE', JText::_('COM_VIRTUEMART_NEW_VENDOR'));
}
$vendorid = $userDetails->virtuemart_vendor_id;
} else {
$vendorid = 0;
$this->SetViewTitle('USER', $userDetails->JUser->get('name'));
}
$_new = $userDetails->JUser->get('id') < 1;
$this->addStandardEditViewCommands($vendorid);
// User details
$_contactDetails = $model->getContactDetails();
$_groupList = $model->getGroupList();
if (!is_array($_groupList)) {
$this->lists['gid'] = '<input type="hidden" name="gid" value="' . $userDetails->JUser->get('gid') . '" /><strong>' . JText::_($_groupList) . '</strong>';
} else {
$this->lists['gid'] = JHTML::_('select.genericlist', $_groupList, 'gid', 'size="10"', 'value', 'text', $userDetails->JUser->get('gid'));
}
$this->lists['canBlock'] = $currentUser->authorize('com_users', 'block user') && $userDetails->JUser->get('id') != $currentUser->get('id');
// Can't block myself
$this->lists['canSetMailopt'] = $currentUser->authorize('workflow', 'email_events');
$this->lists['block'] = JHTML::_('select.booleanlist', 'block', 'class="inputbox"', $userDetails->JUser->get('block'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
$this->lists['sendEmail'] = JHTML::_('select.booleanlist', 'sendEmail', 'class="inputbox"', $userDetails->JUser->get('sendEmail'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
$this->lists['params'] = $userDetails->JUser->getParameters(true);
// Shopper info
$this->lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($userDetails->shopper_groups, true);
$this->lists['vendors'] = ShopFunctions::renderVendorList($userDetails->virtuemart_vendor_id);
$this->lists['custnumber'] = $model->getCustomerNumberById($userDetails->JUser->get('id'));
// Shipment address(es)
$this->lists['shipTo'] = ShopFunctions::generateStAddressList($this, $model, 'addST');
$new = false;
if (JRequest::getInt('new', '0') === 1) {
$new = true;
}
$virtuemart_userinfo_id_BT = $model->getBTuserinfo_id($userId);
$userFieldsArray = $model->getUserInfoInUserFields($layoutName, 'BT', $virtuemart_userinfo_id_BT, false);
$userFieldsBT = $userFieldsArray[$virtuemart_userinfo_id_BT];
//$this->lists['perms'] = JHTML::_('select.genericlist', Permissions::getUserGroups(), 'perms', '', 'group_name', 'group_name', $userDetails->perms);
// Load the required scripts
if (count($userFieldsBT['scripts']) > 0) {
foreach ($userFieldsBT['scripts'] as $_script => $_path) {
JHTML::script($_script, $_path);
}
}
// Load the required stylesheets
if (count($userFieldsBT['links']) > 0) {
foreach ($userFieldsBT['links'] as $_link => $_path) {
JHTML::stylesheet($_link, $_path);
}
}
$this->assignRef('userFieldsBT', $userFieldsBT);
$this->assignRef('userInfoID', $virtuemart_userinfo_id_BT);
//.........这里部分代码省略.........
示例6: createStandardRequest
function createStandardRequest($calc, $products, $sign = 1)
{
if (!class_exists('TaxServiceSoap')) {
require VMAVALARA_CLASS_PATH . DS . 'TaxServiceSoap.class.php';
}
if (!class_exists('DocumentType')) {
require VMAVALARA_CLASS_PATH . DS . 'DocumentType.class.php';
}
if (!class_exists('DetailLevel')) {
require VMAVALARA_CLASS_PATH . DS . 'DetailLevel.class.php';
}
if (!class_exists('Line')) {
require VMAVALARA_CLASS_PATH . DS . 'Line.class.php';
}
if (!class_exists('ServiceMode')) {
require VMAVALARA_CLASS_PATH . DS . 'ServiceMode.class.php';
}
if (!class_exists('Line')) {
require VMAVALARA_CLASS_PATH . DS . 'Line.class.php';
}
if (!class_exists('GetTaxRequest')) {
require VMAVALARA_CLASS_PATH . DS . 'GetTaxRequest.class.php';
}
if (!class_exists('GetTaxResult')) {
require VMAVALARA_CLASS_PATH . DS . 'GetTaxResult.class.php';
}
if (!class_exists('Address')) {
require VMAVALARA_CLASS_PATH . DS . 'Address.class.php';
}
if (is_object($calc)) {
$calc = get_object_vars($calc);
}
$request = new GetTaxRequest();
$origin = new Address();
//In Virtuemart we have not differenct warehouses, but we have a shipment address
//So when the vendor has a shipment address, we assume that it is his warehouse
//Later we can combine products with shipment addresses for different warehouse (yehye, future music)
//But for now we just use the BT address
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($calc['virtuemart_vendor_id']);
$userModel = VmModel::getModel('user');
$virtuemart_userinfo_id = $userModel->getBTuserinfo_id($userId);
// this is needed to set the correct user id for the vendor when the user is logged
$userModel->getVendor($calc['virtuemart_vendor_id']);
$vendorFieldsArray = $userModel->getUserInfoInUserFields('mail', 'BT', $virtuemart_userinfo_id, FALSE, TRUE);
$vendorFields = $vendorFieldsArray[$virtuemart_userinfo_id];
$origin->setLine1($vendorFields['fields']['address_1']['value']);
$origin->setLine2($vendorFields['fields']['address_2']['value']);
$origin->setCity($vendorFields['fields']['city']['value']);
$origin->setCountry($vendorFields['fields']['virtuemart_country_id']['country_2_code']);
$origin->setRegion($vendorFields['fields']['virtuemart_state_id']['state_2_code']);
$origin->setPostalCode($vendorFields['fields']['zip']['value']);
$request->setOriginAddress($origin);
//Address
if (isset($this->addresses[0])) {
$destination = $this->addresses[0];
} else {
return FALSE;
}
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
$calculator = calculationHelper::getInstance();
$request->setCurrencyCode($calculator->_currencyDisplay->_vendorCurrency_code_3);
//CurrencyCode
$request->setDestinationAddress($destination);
//Address
$request->setCompanyCode($calc['company_code']);
// Your Company Code From the Dashboard
$request->setDocDate(date('Y-m-d'));
//date, checked
$request->setCustomerCode(self::$vmadd['customer_number']);
//string Required
if (isset(self::$vmadd['tax_usage_type'])) {
$request->setCustomerUsageType(self::$vmadd['tax_usage_type']);
//string Entity Usage
}
if (isset(self::$vmadd['tax_exemption_number'])) {
$request->setExemptionNo(self::$vmadd['tax_exemption_number']);
//string if not using ECMS which keys on customer code
}
if (isset(self::$vmadd['taxOverride'])) {
$request->setTaxOverride(self::$vmadd['taxOverride']);
avadebug('I set tax override ', self::$vmadd['taxOverride']);
}
$setAllDiscounted = false;
if (isset($products['discountAmount'])) {
if (!empty($products['discountAmount'])) {
//$request->setDiscount($sign * $products['discountAmount'] * (-1)); //decimal
$request->setDiscount($sign * $products['discountAmount']);
//decimal
vmdebug('We sent as discount ' . $request->getDiscount());
$setAllDiscounted = true;
}
unset($products['discountAmount']);
}
$request->setDetailLevel('Tax');
//Summary or Document or Line or Tax or Diagnostic
//.........这里部分代码省略.........
示例7: display
/**
* Displays the view, collects needed data for the different layouts
*
* Okey I try now a completly new idea.
* We make a function for every tab and the display is getting the right tabs by an own function
* putting that in an array and after that we call the preparedataforlayoutBlub
*
* @author Max Milbers
*/
function display($tpl = null)
{
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$layoutName = $this->getLayout();
$model = VmModel::getModel();
$virtuemart_vendor_id = JRequest::getInt('virtuemart_vendor_id');
// if ($layoutName=='default') {
if (empty($virtuemart_vendor_id)) {
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_LIST'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_LIST'));
$this->vendors = $model->getVendors();
$model->addImages($this->vendors);
} else {
$vendor = $model->getVendor($virtuemart_vendor_id);
$model->addImages($vendor);
if (VmConfig::get('enable_content_plugin', 0)) {
// add content plugin //
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$vendor->text = $vendor->vendor_store_desc;
$params = new JRegistry();
if (!isset($vendor->event)) {
$vendor->event = new stdClass();
}
$results = $dispatcher->trigger('onContentPrepare', array('com_virtuemart.vendor', &$vendor, &$params, 0));
// More events for 3rd party content plugins
// This do not disturb actual plugins, because we don't modify $vendor->text
$res = $dispatcher->trigger('onContentAfterTitle', array('com_virtuemart.vendor', &$vendor, &$params, 0));
$vendor->event->afterDisplayTitle = trim(implode("\n", $res));
$res = $dispatcher->trigger('onContentBeforeDisplay', array('com_virtuemart.vendor', &$vendor, &$params, 0));
$vendor->event->beforeDisplayContent = trim(implode("\n", $res));
$res = $dispatcher->trigger('onContentAfterDisplay', array('com_virtuemart.vendor', &$vendor, &$params, 0));
$vendor->event->afterDisplayContent = trim(implode("\n", $res));
$vendor->vendor_store_desc = $vendor->text;
}
$this->vendor = $vendor;
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . '/models/vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id);
//$usermodel = VmModel::getModel('user');
//$virtuemart_userinfo_id = $usermodel->getBTuserinfo_id($userId);
//$usermodel->getVendor($virtuemart_vendor_id);
//$userFields = $usermodel->getUserInfoInUserFields($layoutName, 'BT', $virtuemart_userinfo_id,true,true);
//$this->assignRef('userFields', $userFields);
if ($layoutName == 'tos') {
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_TOS'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_TOS'));
} elseif ($layoutName == 'contact') {
$user = JFactory::getUser();
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_CONTACT'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_CONTACT'));
$this->user = $user;
} else {
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_DETAILS') . ' ' . $this->vendor->vendor_store_name);
$pathway->addItem($this->vendor->vendor_store_name);
//JText::_('COM_VIRTUEMART_VENDOR_DETAILS'));
$this->setLayout('details');
$productModel = VmModel::getModel('product');
$this->products = $productModel->getProductsInCategory(0, $virtuemart_vendor_id);
if ($this->products) {
$productModel->addImages($this->products, 1);
$currency = CurrencyDisplay::getInstance();
$this->currency = $currency;
foreach ($this->products as $product) {
$product->stock = $productModel->getStockIndicator($product);
}
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . '/helpers/permissions.php';
}
$this->showBasePrice = Permissions::getInstance()->check('admin');
//todo add config settings
$this->perRow = VmConfig::get('products_per_row', 3);
$this->pagination = $productModel->getPagination($this->perRow);
}
}
$this->linkdetails = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=details&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE) . '">' . JText::_('COM_VIRTUEMART_VENDOR_DETAILS') . '</a>';
$this->linkcontact = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE) . '">' . JText::_('COM_VIRTUEMART_VENDOR_CONTACT') . '</a>';
$this->linktos = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE) . '">' . JText::_('COM_VIRTUEMART_VENDOR_TOS') . '</a>';
}
parent::display($tpl);
}
示例8: getVendorAddressFields
public function getVendorAddressFields($vendorId = 0)
{
if ($vendorId != 0) {
$this->_id = (int) $vendorId;
}
if (!$this->_vendorFields) {
$userId = VirtueMartModelVendor::getUserIdByVendorId($this->_id);
$userModel = VmModel::getModel('user');
$virtuemart_userinfo_id = $userModel->getBTuserinfo_id($userId);
// this is needed to set the correct user id for the vendor when the user is logged
$userModel->getVendor($this->_id, FALSE);
$vendorFieldsArray = $userModel->getUserInfoInUserFields('mail', 'BT', $virtuemart_userinfo_id, FALSE, TRUE);
$this->_vendorFields = $vendorFieldsArray[$virtuemart_userinfo_id];
}
return $this->_vendorFields;
}
示例9: display
function display($tpl = null)
{
// Load the helper(s)
if (!class_exists('VmHTML')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$model = VmModel::getModel();
$currentUser = JFactory::getUser();
VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
$task = vRequest::getCmd('task', 'edit');
if ($task == 'editshop') {
$isSuperOrVendor = VmConfig::isSuperVendor();
if (empty($isSuperOrVendor)) {
JFactory::getApplication()->redirect('index.php?option=com_virtuemart', vmText::_('JERROR_ALERTNOAUTHOR'), 'error');
} else {
if (!class_exists('VirtueMartModelVendor')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($isSuperOrVendor);
}
$this->SetViewTitle('STORE');
} else {
if ($task == 'add') {
$userId = 0;
} else {
$userId = vRequest::getVar('virtuemart_user_id', 0);
if (is_array($userId)) {
$userId = $userId[0];
}
$this->SetViewTitle('USER');
}
}
$userId = $model->setId($userId);
//$layoutName = vRequest::getCmd('layout', 'default');
$layoutName = $this->getLayout();
if ($layoutName == 'edit' || $layoutName == 'edit_shipto') {
$editor = JFactory::getEditor();
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
$userDetails = $model->getUser();
if ($task == 'editshop' && $userDetails->user_is_vendor) {
// $model->setCurrent();
if (!empty($userDetails->vendor->vendor_store_name)) {
$this->SetViewTitle('STORE', $userDetails->vendor->vendor_store_name, 'shop_mart');
} else {
$this->SetViewTitle('STORE', vmText::_('COM_VIRTUEMART_NEW_VENDOR'), 'shop_mart');
}
$vendorid = $userDetails->virtuemart_vendor_id;
if ($vendorid == 1) {
$this->checkTCPDFinstalled();
}
} else {
$vendorid = 0;
$this->SetViewTitle('USER', $userDetails->JUser->get('name'));
}
$_new = $userDetails->JUser->get('id') < 1;
$this->addStandardEditViewCommands($vendorid);
// User details
$_contactDetails = $model->getContactDetails();
$this->lists['canBlock'] = $currentUser->authorise('com_users', 'block user') && $userDetails->JUser->get('id') != $currentUser->get('id');
// Can't block myself
$this->lists['canSetMailopt'] = $currentUser->authorise('workflow', 'email_events');
$this->lists['block'] = JHtml::_('select.booleanlist', 'block', 'class="inputbox"', $userDetails->JUser->get('block'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
$this->lists['sendEmail'] = JHtml::_('select.booleanlist', 'sendEmail', 'class="inputbox"', $userDetails->JUser->get('sendEmail'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
$this->lists['params'] = $userDetails->JUser->getParameters(true);
// Shopper info
$this->lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($userDetails->shopper_groups, true, 'virtuemart_shoppergroup_id');
$this->lists['vendors'] = ShopFunctions::renderVendorList($userDetails->virtuemart_vendor_id);
$model->setId($userDetails->JUser->get('id'));
$this->lists['custnumber'] = $model->getCustomerNumberById();
// Shipment address(es)
$this->lists['shipTo'] = ShopFunctions::generateStAddressList($this, $model, 'addST');
$new = false;
if (vRequest::getInt('new', '0') === 1) {
$new = true;
}
$virtuemart_userinfo_id_BT = $model->getBTuserinfo_id($userId);
$userFieldsArray = $model->getUserInfoInUserFields($layoutName, 'BT', $virtuemart_userinfo_id_BT, false);
$userFieldsBT = $userFieldsArray[$virtuemart_userinfo_id_BT];
// Load the required scripts
if (count($userFieldsBT['scripts']) > 0) {
foreach ($userFieldsBT['scripts'] as $_script => $_path) {
JHtml::script($_script, $_path);
}
}
// Load the required stylesheets
if (count($userFieldsBT['links']) > 0) {
foreach ($userFieldsBT['links'] as $_link => $_path) {
JHtml::stylesheet($_link, $_path);
}
}
$this->assignRef('userFieldsBT', $userFieldsBT);
$this->assignRef('userInfoID', $virtuemart_userinfo_id_BT);
$addrtype = vRequest::getCmd('addrtype');
$virtuemart_userinfo_id = 0;
if ($layoutName == 'edit_shipto' or $task == 'addST' or $addrtype == 'ST') {
$virtuemart_userinfo_id = vRequest::getString('virtuemart_userinfo_id', '0', '');
$userFieldsArray = $model->getUserInfoInUserFields($layoutName, 'ST', $virtuemart_userinfo_id, false);
if ($new) {
//.........这里部分代码省略.........
示例10: renderVendorAddress
public static function renderVendorAddress($vendorId, $lineSeparator = "<br />", $skips = array('name', 'username', 'email'))
{
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($vendorId);
$userModel = VmModel::getModel('user');
$virtuemart_userinfo_id = $userModel->getBTuserinfo_id($userId);
// this is needed to set the correct user id for the vendor when the user is logged
$userModel->getVendor($vendorId);
$vendorFieldsArray = $userModel->getUserInfoInUserFields('mail', 'BT', $virtuemart_userinfo_id, FALSE, TRUE);
$vendorFields = $vendorFieldsArray[$virtuemart_userinfo_id];
$vendorAddress = '';
foreach ($vendorFields['fields'] as $field) {
if (in_array($field['name'], $skips)) {
continue;
}
if (!empty($field['value'])) {
$vendorAddress .= $field['value'];
if ($field['name'] != 'title' and $field['name'] != 'first_name' and $field['name'] != 'middle_name' and $field['name'] != 'zip') {
$vendorAddress .= $lineSeparator;
} else {
$vendorAddress .= ' ';
}
}
}
return $vendorAddress;
}
示例11: getTax
function getTax($calculationHelper, $calc, $price, $sale = false, $committ = false)
{
if ($calc->activated == 0) {
return false;
}
$shopperData = $this->getShopperData();
if (!$shopperData) {
return false;
}
//if(self::$stop) return self::$stop;
if (!class_exists('TaxServiceSoap')) {
require VMAVALARA_CLASS_PATH . DS . 'TaxServiceSoap.class.php';
}
if (!class_exists('DocumentType')) {
require VMAVALARA_CLASS_PATH . DS . 'DocumentType.class.php';
}
if (!class_exists('DetailLevel')) {
require VMAVALARA_CLASS_PATH . DS . 'DetailLevel.class.php';
}
if (!class_exists('Line')) {
require VMAVALARA_CLASS_PATH . DS . 'Line.class.php';
}
if (!class_exists('ServiceMode')) {
require VMAVALARA_CLASS_PATH . DS . 'ServiceMode.class.php';
}
if (!class_exists('Line')) {
require VMAVALARA_CLASS_PATH . DS . 'Line.class.php';
}
if (!class_exists('GetTaxRequest')) {
require VMAVALARA_CLASS_PATH . DS . 'GetTaxRequest.class.php';
}
if (!class_exists('GetTaxResult')) {
require VMAVALARA_CLASS_PATH . DS . 'GetTaxResult.class.php';
}
$client = new TaxServiceSoap('Development');
$request = new GetTaxRequest();
$origin = new Address();
//$destination = $this->fillValidateAvalaraAddress($calc);
//In Virtuemart we have not differenct warehouses, but we have a shipment address
//So when the vendor has a shipment address, we assume that it is his warehouse
//Later we can combine products with shipment addresses for different warehouse (yehye, future music)
//But for now we just use the BT address
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($calc->virtuemart_vendor_id);
$userModel = VmModel::getModel('user');
$virtuemart_userinfo_id = $userModel->getBTuserinfo_id($userId);
// this is needed to set the correct user id for the vendor when the user is logged
$userModel->getVendor($calc->virtuemart_vendor_id);
$vendorFieldsArray = $userModel->getUserInfoInUserFields('mail', 'BT', $virtuemart_userinfo_id, FALSE, TRUE);
$vendorFields = $vendorFieldsArray[$virtuemart_userinfo_id];
//vmdebug('my vendor fields',$vendorFields);
$origin->setLine1($vendorFields['fields']['address_1']['value']);
$origin->setLine2($vendorFields['fields']['address_2']['value']);
$origin->setCity($vendorFields['fields']['city']['value']);
$origin->setCountry($vendorFields['fields']['virtuemart_country_id']['country_2_code']);
$origin->setRegion($vendorFields['fields']['virtuemart_state_id']['state_2_code']);
$origin->setPostalCode($vendorFields['fields']['zip']['value']);
$request->setOriginAddress($origin);
//Address
if (isset($this->addresses[0])) {
$destination = $this->addresses[0];
} else {
return FALSE;
}
$request->setDestinationAddress($destination);
//Address
//vmdebug('The date',$origin,$destination);
$request->setCompanyCode($calc->company_code);
// Your Company Code From the Dashboard
if ($calc->committ and $sale) {
$request->setDocType(DocumentType::$SalesInvoice);
// Only supported types are SalesInvoice or SalesOrder
$request->setCommit(true);
//invoice number, problem is that the invoice number is at this time not known, but the order_number may reachable
$request->setDocCode($committ);
vmdebug('Request as SalesInvoice with invoiceNumber ' . $committ);
} else {
$request->setDocType(DocumentType::$SalesOrder);
$request->setCommit(false);
//invoice number, problem is that the invoice number is at this time not known, neither the order_number
$request->setDocCode('VM2.0.16_order_request');
vmdebug('Request as SalesOrder');
}
$request->setDocDate(date('Y-m-d'));
//date
//$request->setSalespersonCode(""); // string Optional
$request->setCustomerCode($shopperData['customer_id']);
//string Required
if (isset($shopperData['tax_usage_type'])) {
$request->setCustomerUsageType($shopperData['tax_usage_type']);
//string Entity Usage
}
$cartPrices = $calculationHelper->getCartPrices();
//vmdebug('$cartPrices',$cartPrices);
$request->setDiscount($cartPrices['discountAmount']);
//decimal
//$request->setDiscount(0.0);
// $request->setPurchaseOrderNo(""); //string Optional
//.........这里部分代码省略.........
示例12: display
//.........这里部分代码省略.........
$this->assignRef('orderstatuses', $orderstatuses);
$_itemStatusUpdateFields = array();
$_itemAttributesUpdateFields = array();
foreach ($orderDetails['items'] as $_item) {
// $_itemStatusUpdateFields[$_item->virtuemart_order_item_id] = JHTML::_('select.genericlist', $orderstatuses, "item_id[".$_item->virtuemart_order_item_id."][order_status]", 'class="selectItemStatusCode"', 'order_status_code', 'order_status_name', $_item->order_status, 'order_item_status'.$_item->virtuemart_order_item_id,true);
$_itemStatusUpdateFields[$_item->virtuemart_order_item_id] = $_item->order_status;
}
if (empty($orderDetails['shipmentName'])) {
if (!class_exists('vmPSPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
}
JPluginHelper::importPlugin('vmshipment');
$dispatcher = JDispatcher::getInstance();
$returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_shipmentmethod_id, &$orderDetails['shipmentName']));
}
if (empty($orderDetails['paymentName'])) {
if (!class_exists('vmPSPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
}
JPluginHelper::importPlugin('vmpayment');
$dispatcher = JDispatcher::getInstance();
$returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_paymentmethod_id, &$orderDetails['paymentName']));
if (is_array($returnValues)) {
foreach ($returnValues as $val) {
if ($val == false and $layout != 'mail') {
// don't send the invoice
$app = JFactory::getApplication();
$app->redirect('index.php?option=com_virtuemart&view=orders', 'Klarna is doing the invoice');
}
}
}
}
$virtuemart_vendor_id = 1;
$vendorModel = VmModel::getModel('vendor');
$vendor = $vendorModel->getVendor($virtuemart_vendor_id);
$vendorModel->addImages($vendor);
$this->assignRef('vendor', $vendor);
// vmdebug('vendor', $vendor);
$task = JRequest::getWord('task', 0);
if ($task == 'checkStoreInvoice') {
$headFooter = false;
} else {
$headFooter = true;
}
$this->assignRef('headFooter', $headFooter);
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id);
$usermodel = VmModel::getModel('user');
// $usermodel->setId($userId);
$virtuemart_userinfo_id = $usermodel->getBTuserinfo_id($userId);
$vendorFieldsArray = $usermodel->getUserInfoInUserFields($layout, 'BT', $virtuemart_userinfo_id, false, true);
$vendorFields = $vendorFieldsArray[$virtuemart_userinfo_id];
$vendorAddress = '';
foreach ($vendorFields['fields'] as $field) {
if (!empty($field['value'])) {
$vendorAddress .= $field['value'];
if ($field['name'] != 'title' and $field['name'] != 'first_name' and $field['name'] != 'middle_name' and $field['name'] != 'zip') {
if ($headFooter) {
$vendorAddress .= "<br />";
} else {
$vendorAddress .= "\n";
}
} else {
$vendorAddress .= ' ';
}
}
}
$this->assignRef('vendorAddress', $vendorAddress);
$vendorEmail = $vendorModel->getVendorEmail($virtuemart_vendor_id);
$vars['vendorEmail'] = $vendorEmail;
if (!class_exists('ShopFunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
// this is no setting in BE to change the layout !
//shopFunctionsF::setVmTemplate($this,0,0,$layoutName);
//vmdebug('renderMailLayout invoice '.date('H:i:s'),$this->order);
if (strpos($layout, 'mail') !== false) {
if ($this->doVendor) {
//Old text key COM_VIRTUEMART_MAIL_SUBJ_VENDOR_C
$this->subject = JText::sprintf('COM_VIRTUEMART_MAIL_SUBJ_VENDOR_' . $orderDetails['details']['BT']->order_status, $this->shopperName, strip_tags($currency->priceDisplay($orderDetails['details']['BT']->order_total)), $orderDetails['details']['BT']->order_number);
$recipient = 'vendor';
} else {
$this->subject = JText::sprintf('COM_VIRTUEMART_MAIL_SUBJ_SHOPPER_' . $orderDetails['details']['BT']->order_status, $vendor->vendor_store_name, strip_tags($currency->priceDisplay($orderDetails['details']['BT']->order_total)), $orderDetails['details']['BT']->order_number, $orderDetails['details']['BT']->order_pass);
$recipient = 'shopper';
}
$this->assignRef('recipient', $recipient);
}
$tpl = null;
// vmdebug('my view data',$this->getLayout(),$layout);
// ob_start();
// echo '<pre>';
// echo debug_print_backtrace();
// echo '</pre>';
// $dumptrace = ob_get_contents();
// ob_end_clean();
// return false;
parent::display($tpl);
}
示例13: display
/**
* Displays the view, collects needed data for the different layouts
*
* Okey I try now a completly new idea.
* We make a function for every tab and the display is getting the right tabs by an own function
* putting that in an array and after that we call the preparedataforlayoutBlub
*
* @author Max Milbers
*/
function display($tpl = null)
{
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$layoutName = $this->getLayout();
$model = VmModel::getModel();
$virtuemart_vendor_id = JRequest::getInt('virtuemart_vendor_id');
// if ($layoutName=='default') {
if (empty($virtuemart_vendor_id)) {
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_LIST'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_LIST'));
$vendors = $model->getVendors();
$model->addImages($vendors);
$this->assignRef('vendors', $vendors);
} else {
$vendor = $model->getVendor($virtuemart_vendor_id);
$model->addImages($vendor);
if (VmConfig::get('enable_content_plugin', 0)) {
// add content plugin //
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$vendor->text = $vendor->vendor_store_desc;
jimport('joomla.html.parameter');
$params = new JParameter('');
if (JVM_VERSION === 2) {
$results = $dispatcher->trigger('onContentPrepare', array('com_virtuemart.vendor', &$vendor, &$params, 0));
// More events for 3rd party content plugins
// This do not disturb actual plugins, because we don't modify $vendor->text
$res = $dispatcher->trigger('onContentAfterTitle', array('com_virtuemart.vendor', &$vendor, &$params, 0));
$vendor->event->afterDisplayTitle = trim(implode("\n", $res));
$res = $dispatcher->trigger('onContentBeforeDisplay', array('com_virtuemart.vendor', &$vendor, &$params, 0));
$vendor->event->beforeDisplayContent = trim(implode("\n", $res));
$res = $dispatcher->trigger('onContentAfterDisplay', array('com_virtuemart.vendor', &$vendor, &$params, 0));
$vendor->event->afterDisplayContent = trim(implode("\n", $res));
} else {
$results = $dispatcher->trigger('onPrepareContent', array(&$vendor, &$params, 0));
}
$vendor->vendor_store_desc = $vendor->text;
}
$this->assignRef('vendor', $vendor);
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id);
//$usermodel = VmModel::getModel('user');
//$virtuemart_userinfo_id = $usermodel->getBTuserinfo_id($userId);
//$usermodel->getVendor($virtuemart_vendor_id);
//$userFields = $usermodel->getUserInfoInUserFields($layoutName, 'BT', $virtuemart_userinfo_id,true,true);
//$this->assignRef('userFields', $userFields);
if ($layoutName == 'tos') {
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_TOS'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_TOS'));
} elseif ($layoutName == 'contact') {
$user = JFactory::getUser();
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_CONTACT'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_CONTACT'));
$this->assignRef('user', $user);
} else {
$document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_DETAILS'));
$pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_DETAILS'));
$this->setLayout('details');
}
$linkdetails = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=details&virtuemart_vendor_id=' . $virtuemart_vendor_id) . '">' . JText::_('COM_VIRTUEMART_VENDOR_DETAILS') . '</a>';
$linkcontact = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id) . '">' . JText::_('COM_VIRTUEMART_VENDOR_CONTACT') . '</a>';
$linktos = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=' . $virtuemart_vendor_id) . '">' . JText::_('COM_VIRTUEMART_VENDOR_TOS') . '</a>';
//$this->assignRef('lineSeparator', $lineSeparator);
$this->assignRef('linkdetails', $linkdetails);
$this->assignRef('linkcontact', $linkcontact);
$this->assignRef('linktos', $linktos);
}
parent::display($tpl);
}