本文整理汇总了PHP中vRequest::setVar方法的典型用法代码示例。如果您正苦于以下问题:PHP vRequest::setVar方法的具体用法?PHP vRequest::setVar怎么用?PHP vRequest::setVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vRequest
的用法示例。
在下文中一共展示了vRequest::setVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editshop
function editshop()
{
$user = JFactory::getUser();
//the virtuemart_user_id var gets overriden in the edit function, when not set. So we must set it here
vRequest::setVar('virtuemart_user_id', (int) $user->id);
$this->edit();
}
示例2: checkForLatestVersion
/**
* Install sample data into the database
*
* @author RickG
*/
function checkForLatestVersion()
{
$model = $this->getModel('updatesMigration');
vRequest::setVar('latestverison', $model->getLatestVersion());
vRequest::setVar('view', 'updatesMigration');
parent::display();
}
示例3: __construct
function __construct()
{
parent::__construct();
if (VmConfig::get('shop_is_offline') == '1') {
vRequest::setVar('layout', 'off_line');
} else {
vRequest::setVar('layout', 'default');
}
}
示例4: edit_review
/**
* Generic edit task
*/
function edit_review()
{
vRequest::setVar('controller', $this->_cname);
vRequest::setVar('view', $this->_cname);
vRequest::setVar('layout', 'edit_review');
if (empty($view)) {
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView($this->_cname, $viewType);
}
parent::display();
}
示例5: _createOrder
//.........这里部分代码省略.........
$_orderData->coupon_discount = $_prices['salesPriceCoupon'];
}
$_orderData->order_discount = $_prices['discountAmount']; // discount order_items
$_orderData->order_status = 'P';
$_orderData->order_currency = $this->getVendorCurrencyId($_orderData->virtuemart_vendor_id);
if (!class_exists('CurrencyDisplay')) {
require(VMPATH_ADMIN . '/helpers/currencydisplay.php');
}
if (isset($_cart->pricesCurrency)) {
$_orderData->user_currency_id = $_cart->paymentCurrency ;//$this->getCurrencyIsoCode($_cart->pricesCurrency);
$currency = CurrencyDisplay::getInstance($_orderData->user_currency_id);
if($_orderData->user_currency_id != $_orderData->order_currency){
$_orderData->user_currency_rate = $currency->convertCurrencyTo($_orderData->user_currency_id ,1.0,false);
} else {
$_orderData->user_currency_rate=1.0;
}
}
$_orderData->virtuemart_paymentmethod_id = $_cart->virtuemart_paymentmethod_id;
$_orderData->virtuemart_shipmentmethod_id = $_cart->virtuemart_shipmentmethod_id;
//Some payment plugins need a new order_number for any try
$_orderData->order_number = '';
$_orderData->order_pass = '';
$_orderData->order_language = $_cart->order_language;
$_orderData->ip_address = $_SERVER['REMOTE_ADDR'];
$maskIP = VmConfig::get('maskIP','last');
if($maskIP=='last'){
$rpos = strrpos($_orderData->ip_address,'.');
$_orderData->ip_address = substr($_orderData->ip_address,0,($rpos+1)).'xx';
}
if($_cart->_inConfirm){
$order = false;
$db = JFactory::getDbo();
$q = 'SELECT * FROM `#__virtuemart_orders` ';
if(!empty($_cart->virtuemart_order_id)){
$db->setQuery($q . ' WHERE `order_number`= "'.$_cart->virtuemart_order_id.'" AND `order_status` = "P" ');
$order = $db->loadAssoc();
if(!$order){
vmdebug('This should not happen, there is a cart with order_number, but not order stored '.$_cart->virtuemart_order_id);
}
}
if(VmConfig::get('reuseorders',true) and !$order){
$jnow = JFactory::getDate();
$jnow->sub(new DateInterval('PT1H'));
$minushour = $jnow->toSQL();
$q .= ' WHERE `customer_number`= "'.$_orderData->customer_number.'" ';
$q .= ' AND `order_status` = "P"
AND `created_on` > "'.$minushour.'" ';
$db->setQuery($q);
$order = $db->loadAssoc();
}
if($order){
if(!empty($order['virtuemart_order_id'])){
$_orderData->virtuemart_order_id = $order['virtuemart_order_id'];
}
//Dirty hack
$this->removeOrderItems($order['virtuemart_order_id']);
}
}
JPluginHelper::importPlugin('vmshopper');
$dispatcher = JDispatcher::getInstance();
$plg_datas = $dispatcher->trigger('plgVmOnUserOrder',array(&$_orderData));
foreach($plg_datas as $plg_data){
// $data = array_merge($plg_data,$data);
}
if(empty($_orderData->order_number)){
$_orderData->order_number = $this->generateOrderNumber($_usr->get('id'),4,$_orderData->virtuemart_vendor_id);
}
if(empty($_orderData->order_pass)){
$_orderData->order_pass = 'p_'.substr( md5((string)time().rand(1,1000).$_orderData->order_number ), 0, 5);
}
$orderTable = $this->getTable('orders');
$orderTable -> bindChecknStore($_orderData);
$db = JFactory::getDBO();
if (!empty($_cart->couponCode)) {
//set the virtuemart_order_id in the Request for 3rd party coupon components (by Seyi and Max)
vRequest::setVar ( 'virtuemart_order_id', $orderTable->virtuemart_order_id );
// If a gift coupon was used, remove it now
CouponHelper::setInUseCoupon($_cart->couponCode, true);
}
// the order number is saved into the session to make sure that the correct cart is emptied with the payment notification
$_cart->order_number = $orderTable->order_number;
$_cart->virtuemart_order_id = $orderTable->virtuemart_order_id;
$_cart->setCartIntoSession ();
return $orderTable->virtuemart_order_id;
}
示例6: portMedia
public function portMedia()
{
$ok = true;
vRequest::setVar('synchronise', true);
//Prevents search field from interfering with syncronization
vRequest::setVar('searchMedia', '');
//$imageExtensions = array('jpg','jpeg','gif','png');
if (!class_exists('VirtueMartModelMedia')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'media.php';
}
$this->mediaModel = VmModel::getModel('Media');
//First lets read which files are already stored
$this->storedMedias = $this->mediaModel->getFiles(false, true);
//check for entries without file
foreach ($this->storedMedias as $media) {
if ($media->file_is_forSale != 1) {
$media_path = VMPATH_ROOT . DS . str_replace('/', DS, $media->file_url);
} else {
$media_path = $media->file_url;
}
if (!file_exists($media_path)) {
vmInfo('File for ' . $media_path . ' is missing');
//The idea is here to test if the media with missing data is used somewhere and to display it
//When it not used, the entry should be deleted then.
/* $q = 'SELECT * FROM `#__virtuemart_category_medias` as cm,
`#__virtuemart_product_medias` as pm,
`#__virtuemart_manufacturer_medias` as mm,
`#__virtuemart_vendor_medias` as vm
WHERE cm.`virtuemart_media_id` = "'.$media->virtuemart_media_id.'"
OR pm.`virtuemart_media_id` = "'.$media->virtuemart_media_id.'"
OR mm.`virtuemart_media_id` = "'.$media->virtuemart_media_id.'"
OR vm.`virtuemart_media_id` = "'.$media->virtuemart_media_id.'" ';
$this->_db->setQuery($q);
$res = $this->_db->loadColumn();
vmdebug('so',$res);
if(count($res)>0){
vmInfo('File for '.$media->file_url.' is missing, but used ');
}
*/
}
}
$countTotal = 0;
//We do it per type
$url = VmConfig::get('media_product_path');
$type = 'product';
$count = $this->_portMediaByType($url, $type);
$countTotal += $count;
$this->_app->enqueueMessage(vmText::sprintf('COM_VIRTUEMART_UPDATE_PORT_MEDIA_RESULT', $count, $type, $url));
if (microtime(true) - $this->starttime >= $this->maxScriptTime) {
return $msg = vmText::sprintf('COM_VIRTUEMART_UPDATE_PORT_MEDIA_RESULT_NOT_FINISH', $countTotal);
}
$url = VmConfig::get('media_category_path');
$type = 'category';
$count = $this->_portMediaByType($url, $type);
$countTotal += $count;
$this->_app->enqueueMessage(vmText::sprintf('COM_VIRTUEMART_UPDATE_PORT_MEDIA_RESULT', $count, $type, $url));
if (microtime(true) - $this->starttime >= $this->maxScriptTime) {
return $msg = vmText::sprintf('COM_VIRTUEMART_UPDATE_PORT_MEDIA_RESULT_NOT_FINISH', $countTotal);
}
$url = VmConfig::get('media_manufacturer_path');
$type = 'manufacturer';
$count = $this->_portMediaByType($url, $type);
$countTotal += $count;
$this->_app->enqueueMessage(vmText::sprintf('COM_VIRTUEMART_UPDATE_PORT_MEDIA_RESULT', $count, $type, $url));
if (microtime(true) - $this->starttime >= $this->maxScriptTime) {
return $msg = vmText::sprintf('COM_VIRTUEMART_UPDATE_PORT_MEDIA_RESULT_NOT_FINISH', $countTotal);
}
$url = VmConfig::get('media_vendor_path');
$type = 'vendor';
$count = $this->_portMediaByType($url, $type);
$countTotal += $count;
$this->_app->enqueueMessage(vmText::sprintf('COM_VIRTUEMART_UPDATE_PORT_MEDIA_RESULT', $count, $type, $url));
$url = VmConfig::get('forSale_path');
$type = 'forSale';
$count = $this->_portMediaByType($url, $type);
$countTotal += $count;
$this->_app->enqueueMessage(vmText::sprintf('COM_VIRTUEMART_UPDATE_PORT_MEDIA_RESULT', $count, $type, $url));
return $msg = vmText::sprintf('COM_VIRTUEMART_UPDATE_PORT_MEDIA_RESULT_FINISH', $countTotal);
}
示例7: confirmedOrder
/**
* @param $cart
* @param $order
* @return bool
*/
function confirmedOrder($cart, $order)
{
if (!class_exists('VirtueMartModelOrders')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
}
if (!class_exists('VirtueMartModelCurrency')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'currency.php';
}
$this->plugin->getPaymentCurrency($this->_method);
$q = 'SELECT `currency_numeric_code` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $this->_method->payment_currency . '" ';
$db = JFactory::getDBO();
$db->setQuery($q);
$currency_numeric_code = $db->loadResult();
$totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $this->_method->payment_currency);
$orderTotalVendorCurrency = $order['details']['BT']->order_total;
$pbxOrderTotalInPaymentCurrency = $this->getPbxAmount($totalInPaymentCurrency['value']);
$email_currency = $this->plugin->getEmailCurrency($this->_method);
// If the file is not there anylonger, just create it
//$this->plugin->createRootFile($this->_method->virtuemart_paymentmethod_id);
if (!$this->getPayboxServerUrl()) {
$this->redirectToCart();
return false;
}
if (!($payboxReturnUrls = $this->getPayboxReturnUrls())) {
$this->redirectToCart();
return false;
}
$post_variables = array("PBX_SITE" => $this->_method->site_id, "PBX_RANG" => $this->_method->rang, "PBX_IDENTIFIANT" => $this->_method->identifiant, "PBX_TOTAL" => $this->getPbxTotal($pbxOrderTotalInPaymentCurrency), "PBX_DEVISE" => $currency_numeric_code, "PBX_CMD" => $order['details']['BT']->order_number, "PBX_PORTEUR" => $order['details']['BT']->email, "PBX_RETOUR" => $this->getReturn(), "PBX_HASH" => $this->getHashAlgo(), "PBX_TIME" => $this->getTime(), "PBX_LANGUE" => $this->getLangue(), "PBX_EFFECTUE" => $payboxReturnUrls['url_effectue'], "PBX_ANNULE" => $payboxReturnUrls['url_annule'], "PBX_REFUSE" => $payboxReturnUrls['url_refuse'], "PBX_ERREUR" => $payboxReturnUrls['url_erreur'], "PBX_REPONDRE_A" => $payboxReturnUrls['url_notification'], "PBX_RUF1" => 'POST');
if ($this->_method->debit_type == 'authorization_only') {
$post_variables["PBX_DIFF"] = str_pad($this->_method->diff, 2, '0', STR_PAD_LEFT);
}
// min_amount_3dsecure is in vendor currency
if (!$this->isActivate3ds($orderTotalVendorCurrency)) {
$post_variables["PBX_3DS"] = 'N';
}
jimport('joomla.environment.browser');
$browser = JBrowser::getInstance();
if ($browser->isMobile()) {
$post_variables["PBX_SOURCE"] = 'XHTML';
}
$subscribe = array();
$recurring = array();
$post_variables["PBX_CMD"] = $order['details']['BT']->order_number;
if ($this->_method->integration == "recurring" and $orderTotalVendorCurrency > $this->_method->recurring_min_amount) {
$recurring = $this->getRecurringPayments($pbxOrderTotalInPaymentCurrency);
// PBX_TOTAL will be replaced in the array_merge.
$post_variables = array_merge($post_variables, $recurring);
} else {
if ($this->_method->integration == "subscribe") {
$subscribe_data = $this->getSubscribePayments($cart, $this->getPbxAmount($orderTotalVendorCurrency));
if ($subscribe_data) {
// PBX_TOTAL is the order total in this case
$post_variables["PBX_TOTAL"] = $subscribe_data["PBX_TOTAL"];
$post_variables["PBX_CMD"] .= $subscribe_data['PBX_CMD'];
}
}
}
$post_variables["PBX_HMAC"] = $this->getHmac($post_variables, $this->_method->key);
// Prepare data that should be stored in the database
$dbValues['order_number'] = $order['details']['BT']->order_number;
$dbValues['virtuemart_order_id'] = $order['details']['BT']->virtuemart_order_id;
$dbValues['payment_name'] = $this->plugin->renderPluginName($this->_method);
$dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id;
$dbValues['paybox_custom'] = $this->getContext();
$dbValues['cost_per_transaction'] = $this->_method->cost_per_transaction;
$dbValues['cost_percent_total'] = $this->_method->cost_percent_total;
$dbValues['payment_currency'] = $this->_method->payment_currency;
$dbValues['email_currency'] = $email_currency;
$dbValues['payment_order_total'] = $post_variables["PBX_TOTAL"];
if (!empty($recurring)) {
$dbValues['recurring'] = json_encode($recurring);
$dbValues['recurring_number'] = $this->_method->recurring_number;
$dbValues['recurring_periodicity'] = $this->_method->recurring_periodicity;
} else {
$dbValues['recurring'] = NULL;
}
if (!empty($subscribe)) {
$dbValues['subscribe'] = json_encode($subscribe);
//$dbValues['recurring_number'] = $this->_method->recurring_number;
//$dbValues['recurring_periodicity'] = $this->_method->recurring_periodicity;
} else {
$dbValues['subscribe'] = NULL;
}
$dbValues['tax_id'] = $this->_method->tax_id;
$this->plugin->storePSPluginInternalData($dbValues);
$html = $this->getConfirmedHtml($post_variables, $this);
// 2 = don't delete the cart, don't send email and don't redirect
$cart->_confirmDone = FALSE;
$cart->_dataValidated = FALSE;
$cart->setCartIntoSession();
vRequest::setVar('display_title', false);
vRequest::setVar('html', $html);
return;
}
示例8: plgVmConfirmedOrder
//.........这里部分代码省略.........
// Another method was selected, do nothing
if (!$this->selectedThisElement($method->payment_element)) {
return FALSE;
}
$session = JFactory::getSession();
$return_context = $session->getId();
$this->logInfo('plgVmConfirmedOrder order number: ' . $order['details']['BT']->order_number, 'message');
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
if (!class_exists('VirtueMartModelCurrency')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
}
$usrBT = $order['details']['BT'];
$address = isset($order['details']['ST']) ? $order['details']['ST'] : $order['details']['BT'];
if (!class_exists('TableVendors')) {
require JPATH_VM_ADMINISTRATOR . DS . 'tables' . DS . 'vendors.php';
}
$vendorModel = VmModel::getModel('Vendor');
$vendorModel->setId(1);
$vendor = $vendorModel->getVendor();
$vendorModel->addImages($vendor, 1);
$this->getPaymentCurrency($method);
$q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
$db = JFactory::getDBO();
$db->setQuery($q);
$currency_code_3 = $db->loadResult();
$totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $method->payment_currency);
$cartCurrency = CurrencyDisplay::getInstance($cart->pricesCurrency);
if ($totalInPaymentCurrency['value'] <= 0) {
vmInfo(vmText::_('VMPAYMENT_MONEYBOOKERS_PAYMENT_AMOUNT_INCORRECT'));
return FALSE;
}
$merchant_email = $method->pay_to_email;
if (empty($merchant_email)) {
vmInfo(vmText::_('VMPAYMENT_MONEYBOOKERS_MERCHANT_EMAIL_NOT_SET'));
return FALSE;
}
$lang = JFactory::getLanguage();
$tag = substr($lang->get('tag'), 0, 2);
$post_variables = array('pay_to_email' => $merchant_email, 'pay_from_email' => $address->email, 'payment_methods' => $payment_method, 'recipient_description' => $vendorModel->getVendorName(), 'transaction_id' => $order['details']['BT']->order_number, 'return_url' => JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', ''), 'cancel_url' => JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginUserPaymentCancel&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', ''), 'status_url' => JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component&lang=' . vRequest::getCmd('lang', ''), 'platform' => '21477272', 'hide_login' => $method->hide_login, 'prepare_only' => 1, 'logo_url' => $method->logourl, 'language' => strtoupper($tag), "firstname" => $address->first_name, "lastname" => $address->last_name, "address" => $address->address_1, "address2" => isset($address->address_2) ? $address->address_2 : '', "phone_number" => $address->phone_1, "postal_code" => $address->zip, "city" => $address->city, "state" => isset($address->virtuemart_state_id) ? ShopFunctions::getStateByID($address->virtuemart_state_id, 'state_2_code') : '', "country" => ShopFunctions::getCountryByID($address->virtuemart_country_id, 'country_3_code'), 'amount' => $totalInPaymentCurrency['value'], 'currency' => $currency_code_3, 'detail1_description' => vmText::_('VMPAYMENT_MONEYBOOKERS_ORDER_NUMBER') . ': ', 'detail1_text' => $order['details']['BT']->order_number);
// Prepare data that should be stored in the database
$dbValues['user_session'] = $return_context;
$dbValues['order_number'] = $order['details']['BT']->order_number;
$dbValues['payment_name'] = $this->renderPluginName($method, $order);
$dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id;
$dbValues['cost_per_transaction'] = $method->cost_per_transaction;
$dbValues['cost_percent_total'] = $method->cost_percent_total;
$dbValues['payment_currency'] = $method->payment_currency;
$dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
$dbValues['tax_id'] = $method->tax_id;
$this->storePSPluginInternalData($dbValues);
$content = http_build_query($post_variables);
$url = $this->_getMoneybookersURL($method);
$header = "POST /app/payment.pl HTTP/1.1\r\n";
$header .= "Host: {$url}\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($content) . "\r\n\r\n";
$fps = fsockopen('ssl://' . $url, 443, $errno, $errstr, 10);
// timeout applies only to connecting not for I/O
$sid = '';
if (!$fps || !stream_set_blocking($fps, 0)) {
$this->sendEmailToVendorAndAdmins("Error with Moneybookers: ", vmText::sprintf('VMPAYMENT_MONEYBOOKERS_ERROR_POSTING_IPN', $errstr, $errno));
$this->logInfo('Process IPN ' . vmText::sprintf('VMPAYMENT_MONEYBOOKERS_ERROR_POSTING_IPN', $errstr, $errno), 'message');
vmInfo(vmText::_('VMPAYMENT_MONEYBOOKERS_DISPLAY_GWERROR'));
return NULL;
} else {
fwrite($fps, $header);
fwrite($fps, $content);
stream_set_timeout($fps, 10);
$read = array($fps);
$write = $except = NULL;
$msg = $rbuff = '';
if (stream_select($read, $write, $except, 10)) {
$rbuff = fread($fps, 2048);
$msg .= $rbuff;
}
$response = $this->_parse_response($msg);
if (!count($response)) {
$this->logInfo('Process IPN (empty or bad response) ' . $msg, 'message');
vmInfo(vmText::_('VMPAYMENT_MONEYBOOKERS_DISPLAY_GWERROR'));
return NULL;
}
$sid = $response[0];
$this->logInfo($response[0], 'message');
}
fclose($fps);
$height = $method->hide_login ? 720 : 500;
$html = '<html><head><title></title><script type="text/javascript">
jQuery(document).ready(function () {
jQuery(\'#main h3\').css("display", "none");
});
</script></head><body>';
$html .= '<iframe src="https://' . $this->_getMoneybookersURL($method) . '/app/payment.pl?sid=' . $sid . '" scrolling="yes" style="x-overflow: none;"
frameborder="0" height="' . (string) $height . 'px" width="650px"></iframe>';
$cart->_confirmDone = FALSE;
$cart->_dataValidated = FALSE;
$cart->setCartIntoSession();
vRequest::setVar('html', $html);
}
示例9: processConfirmedOrderPaymentResponse
public function processConfirmedOrderPaymentResponse($returnValue, $cart, $order, $html, $payment_name, $new_status = '')
{
if ($returnValue == 1) {
//We delete the old stuff
// send the email only if payment has been accepted
// update status
$modelOrder = VmModel::getModel('orders');
$order['order_status'] = $new_status;
$order['customer_notified'] = 1;
$order['comments'] = '';
$modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);
$order['paymentName'] = $payment_name;
//if(!class_exists('shopFunctionsF')) require(VMPATH_SITE.DS.'helpers'.DS.'shopfunctionsf.php');
//shopFunctionsF::sentOrderConfirmedEmail($order);
//We delete the old stuff
$cart->emptyCart();
vRequest::setVar('html', $html);
// payment echos form, but cart should not be emptied, data is valid
} elseif ($returnValue == 2) {
$cart->_confirmDone = false;
$cart->_dataValidated = false;
$cart->_inConfirm = false;
$cart->setCartIntoSession(false, true);
vRequest::setVar('html', $html);
} elseif ($returnValue == 0) {
// error while processing the payment
$mainframe = JFactory::getApplication();
$mainframe->enqueueMessage($html);
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart', FALSE), vmText::_('COM_VIRTUEMART_CART_ORDERDONE_DATA_NOT_VALID'));
}
}
示例10: display
//.........这里部分代码省略.........
case 'massxref_sgrps':
case 'massxref_sgrps_exe':
$sgrpmodel = tmsModel::getModel('shoppergroup');
$this->addStandardDefaultViewLists($sgrpmodel);
$shoppergroups = $sgrpmodel->getShopperGroups(false, true);
$this->assignRef('shoppergroups', $shoppergroups);
$sgrppagination = $sgrpmodel->getPagination();
$this->assignRef('sgrppagination', $sgrppagination);
$this->setLayout('massxref');
JToolBarHelper::custom('massxref_sgrps_exe', 'new', 'new', tsmText::_('com_tsmart_PRODUCT_XREF_SGRPS_EXE'), false);
break;
default:
if ($product_parent_id = vRequest::getInt('product_parent_id', false)) {
$product_parent = $model->getProductSingle($product_parent_id, false);
if ($product_parent) {
$title = 'PRODUCT_CHILDREN_LIST';
$link_to_parent = JHtml::_('link', JRoute::_('index.php?view=product&task=edit&tsmart_product_id=' . $product_parent->tsmart_product_id . '&option=com_tsmart'), $product_parent->product_name, array('title' => tsmText::_('com_tsmart_EDIT_PARENT') . ' ' . $product_parent->product_name));
$msg = tsmText::_('com_tsmart_PRODUCT_OF') . " " . $link_to_parent;
} else {
$title = 'PRODUCT_CHILDREN_LIST';
$msg = 'Parent with product_parent_id ' . $product_parent_id . ' not found';
}
} else {
$title = 'PRODUCT';
$msg = "";
}
$this->SetViewTitle($title, $msg);
$this->addStandardDefaultViewLists($model, 'created_on');
if ($cI = vRequest::getInt('tsmart_category_id', false)) {
$app = JFactory::getApplication();
//$old_state = $app->getUserState('tsmart_category_id');
$old_state = $app->getUserState('tsmart_category_id');
if (empty($old_state) or $old_state != $cI) {
vRequest::setVar('com_tsmart.product.filter_order', 'pc.ordering');
$model->filter_order = 'pc.ordering';
$old_state = $app->setUserState('tsmart_category_id', $cI);
}
}
//Get the list of products
$productlist = $model->getItemList();
//The pagination must now always set AFTER the model load the listing
$this->pagination = $model->getPagination();
//Get the category tree
$categoryId = $model->tsmart_category_id;
//OSP switched to filter in model, was vRequest::getInt('tsmart_category_id');
$category_tree = ShopFunctions::categoryListTree(array($categoryId));
$this->assignRef('category_tree', $category_tree);
//load service class
//Load the product price
if (!class_exists('calculationHelper')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
}
$vendor_model = tmsModel::getModel('vendor');
$productreviews = tmsModel::getModel('ratings');
$this->mfTable = $model->getTable('manufacturers');
$this->catTable = $model->getTable('categories');
$this->lists['vendors'] = '';
if ($this->showVendors()) {
$this->lists['vendors'] = Shopfunctions::renderVendorList(vmAccess::getVendorId());
}
foreach ($productlist as $tsmart_product_id => $product) {
$product->mediaitems = count($product->tsmart_media_id);
$product->reviews = $productreviews->countReviewsForProduct($product->tsmart_product_id);
$vendor_model->setId($product->tsmart_vendor_id);
$vendor = $vendor_model->getVendor();
$currencyDisplay = CurrencyDisplay::getInstance($vendor->vendor_currency, $vendor->tsmart_vendor_id);
示例11: plgVmOnPaymentResponseReceived
public function plgVmOnPaymentResponseReceived(&$html)
{
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
if (!class_exists('shopFunctionsF')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
VmConfig::loadJLang('com_virtuemart_orders', TRUE);
// the payment itself should send the parameter needed.
$virtuemart_paymentmethod_id = vRequest::getInt('pm', 0);
$order_number = vRequest::getString('on', 0);
if (!($this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
return NULL;
// Another method was selected, do nothing
}
if (!$this->selectedThisElement($this->_currentMethod->payment_element)) {
return NULL;
}
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) {
return NULL;
}
$payments = $this->getDatasByOrderId($virtuemart_order_id);
VmConfig::loadJLang('com_virtuemart');
$orderModel = VmModel::getModel('orders');
$order = $orderModel->getOrder($virtuemart_order_id);
$realexInterface = $this->_loadRealexInterface();
$realexInterface->loadCustomerData();
$realexInterface->setOrder($order);
$html = $realexInterface->getResponseHTML($payments);
$this->customerData->clear();
$cart = VirtueMartCart::getCart();
$cart->emptyCart();
vRequest::setVar('display_title', false);
vRequest::setVar('html', $html);
return TRUE;
}
示例12: postflight
/**
* Post-process method (e.g. footer HTML, redirect, etc)
*
* @param string Process type (i.e. install, uninstall, update)
* @param object JInstallerComponent parent
*/
public function postflight($type, $parent = null)
{
$_REQUEST['install'] = 0;
if ($type != 'uninstall') {
$this->loadVm();
//fix joomla BE menu
$model = VmModel::getModel('updatesmigration');
// VmConfig::loadConfig(true);
if (!class_exists('VirtueMartModelConfig')) {
require VMPATH_ADMIN . '/models/config.php';
}
$res = VirtueMartModelConfig::checkConfigTableExists();
if (!empty($res)) {
vRequest::setVar(JSession::getFormToken(), '1');
$config = VmModel::getModel('config');
$config->setDangerousToolsOff();
}
}
return true;
}
示例13: updatecart
public function updatecart($html = true)
{
$cart = VirtueMartCart::getCart();
$cart->_fromCart = true;
$cart->_redirected = false;
if (vRequest::get('cancel', 0)) {
$cart->_inConfirm = false;
}
if ($cart->getInCheckOut()) {
vRequest::setVar('checkout', true);
}
$cart->saveCartFieldsInCart();
if ($cart->updateProductCart()) {
vmInfo('COM_VIRTUEMART_PRODUCT_UPDATED_SUCCESSFULLY');
}
$cart->STsameAsBT = vRequest::getInt('STsameAsBT', vRequest::getInt('STsameAsBTjs', 0));
$cart->selected_shipto = vRequest::getVar('shipto', -1);
$currentUser = JFactory::getUser();
if (empty($cart->selected_shipto) or $cart->selected_shipto < 1) {
$cart->STsameAsBT = 1;
$cart->selected_shipto = 0;
} else {
if ($cart->selected_shipto > 0) {
$userModel = VmModel::getModel('user');
$stData = $userModel->getUserAddressList($currentUser->id, 'ST', $cart->selected_shipto);
if (isset($stData[0]) and is_object($stData[0])) {
$stData = get_object_vars($stData[0]);
//if($cart->validateUserData('ST', $stData)>0){
$cart->ST = $stData;
//}
} else {
$cart->selected_shipto = 0;
$cart->ST = $cart->BT;
}
}
}
if (!empty($cart->STsameAsBT) or empty($cart->selected_shipto)) {
//Guest
$cart->ST = $cart->BT;
}
$cart->prepareCartData();
$coupon_code = trim(vRequest::getString('coupon_code', ''));
if (!empty($coupon_code)) {
$msg = $cart->setCouponCode($coupon_code);
if ($msg) {
vmInfo($msg);
}
}
$cart->setShipmentMethod(true, !$html);
$cart->setPaymentMethod(true, !$html);
if ($html) {
$this->display();
} else {
$json = new stdClass();
ob_start();
$this->display();
$json->msg = ob_get_clean();
echo json_encode($json);
jExit();
}
}
示例14: plgVmOnPaymentResponseReceived
function plgVmOnPaymentResponseReceived(&$html)
{
if (!class_exists('VirtueMartCart')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
}
if (!class_exists('shopFunctionsF')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
if (!class_exists('VirtueMartModelOrders')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
}
VmConfig::loadJLang('com_virtuemart_orders', TRUE);
$po = vRequest::getString('po', '');
if (!$po) {
return NULL;
}
$klikandpayData = $this->getRetourParams($po);
$virtuemart_paymentmethod_id = $klikandpayData['virtuemart_paymentmethod_id'];
$order_number = $klikandpayData['order_number'];
$context = $klikandpayData['context'];
if (!$this->isValidContext($context)) {
return NULL;
}
if (!($this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
return NULL;
// Another method was selected, do nothing
}
if (!$this->selectedThisElement($this->_currentMethod->payment_element)) {
return NULL;
}
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) {
return FALSE;
}
if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) {
$this->debugLog('no payments found', 'getDatasByOrderId', 'debug', false);
return FALSE;
}
$orderModel = VmModel::getModel('orders');
$order = $orderModel->getOrder($virtuemart_order_id);
$html = $this->getResponseHTML($order, $payments);
//$cart = VirtueMartCart::getCart();
//$cart->emptyCart();
vRequest::setVar('display_title', false);
vRequest::setVar('html', $html);
return TRUE;
}
示例15: plgVmConfirmedOrder
/**
*
*
* @author Valérie Isaksen
*/
function plgVmConfirmedOrder($cart, $order)
{
if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
return NULL;
// Another method was selected, do nothing
}
if (!$this->selectedThisElement($method->payment_element)) {
return FALSE;
}
VmConfig::loadJLang('com_virtuemart', true);
VmConfig::loadJLang('com_virtuemart_orders', TRUE);
if (!class_exists('VirtueMartModelOrders')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
}
$this->getPaymentCurrency($method);
$currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
$email_currency = $this->getEmailCurrency($method);
$totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $method->payment_currency);
$dbValues['payment_name'] = $this->renderPluginName($method) . '<br />' . $method->payment_info;
$dbValues['order_number'] = $order['details']['BT']->order_number;
$dbValues['virtuemart_paymentmethod_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
$dbValues['cost_per_transaction'] = $method->cost_per_transaction;
$dbValues['cost_percent_total'] = $method->cost_percent_total;
$dbValues['payment_currency'] = $currency_code_3;
$dbValues['email_currency'] = $email_currency;
$dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
$dbValues['tax_id'] = $method->tax_id;
$this->storePSPluginInternalData($dbValues);
$payment_info = '';
if (!empty($method->payment_info)) {
$lang = JFactory::getLanguage();
if ($lang->hasKey($method->payment_info)) {
$payment_info = vmText::_($method->payment_info);
} else {
$payment_info = $method->payment_info;
}
}
if (!class_exists('VirtueMartModelCurrency')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'currency.php';
}
$currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
$html = $this->renderByLayout('post_payment', array('order_number' => $order['details']['BT']->order_number, 'order_pass' => $order['details']['BT']->order_pass, 'payment_name' => $dbValues['payment_name'], 'displayTotalInPaymentCurrency' => $totalInPaymentCurrency['display']));
$modelOrder = VmModel::getModel('orders');
$order['order_status'] = $this->getNewStatus($method);
$order['customer_notified'] = 1;
$order['comments'] = '';
$modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);
//We delete the old stuff
$cart->emptyCart();
vRequest::setVar('html', $html);
return TRUE;
}