本文整理汇总了PHP中shopFunctions类的典型用法代码示例。如果您正苦于以下问题:PHP shopFunctions类的具体用法?PHP shopFunctions怎么用?PHP shopFunctions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了shopFunctions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mailRecommend
/**
* Send the Recommend to a friend email.
*
* @author Kohl Patrick,
*/
public function mailRecommend () {
JRequest::checkToken () or jexit ('Invalid Token');
// Display it all
$view = $this->getView ('recommend', 'html');
if(!VmConfig::get('show_emailfriend',false)){
$view->display ();
}
if (!class_exists ('shopFunctionsF')) {
require(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php');
}
if(!class_exists('ShopFunctions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'shopfunctions.php');
$mainframe = JFactory::getApplication ();
$vars = array();
$virtuemart_product_idArray = JRequest::getInt ('virtuemart_product_id', 0);
if (is_array ($virtuemart_product_idArray)) {
$virtuemart_product_id = (int)$virtuemart_product_idArray[0];
} else {
$virtuemart_product_id = (int)$virtuemart_product_idArray;
}
$productModel = VmModel::getModel ('product');
$vars['product'] = $productModel->getProduct ($virtuemart_product_id);
$user = JFactory::getUser ();
$vars['user'] = array('name' => $user->name, 'email' => $user->email);
$vars['vendorEmail'] = $user->email;
$vendorModel = VmModel::getModel ('vendor');
$vendor = $vendorModel->getVendor ($vars['product']->virtuemart_vendor_id);
$vendorModel->addImages ($vars['vendor']);
$vendor->vendorFields = $vendorModel->getVendorAddressFields();
$vars['vendor'] = $vendor;
$vars['vendorAddress']= shopFunctions::renderVendorAddress($vars['product']->virtuemart_vendor_id);
$vars['vendorEmail']= $user->email;
$vars['vendor']->vendor_name =$user->name;
$toMail = JRequest::getVar ('email'); //is sanitized then
$toMail = str_replace (array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $toMail);
if (shopFunctionsF::renderMail ('recommend', $toMail, $vars, 'productdetails', TRUE)) {
$string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
} else {
$string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
}
$mainframe->enqueueMessage (JText::_ ($string));
// vmdebug('my email vars ',$vars,$TOMail);
$view->setLayout ('mail_confirmed');
$view->display ();
}
示例2: 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);
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . 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);
$html = '<table class="vmorder-done">' . "\n";
$html .= $this->getHtmlRow('STANDARD_PAYMENT_INFO', $dbValues['payment_name'], 'class="vmorder-done-payinfo"');
if (!empty($payment_info)) {
$lang = JFactory::getLanguage();
if ($lang->hasKey($method->payment_info)) {
$payment_info = vmText::_($method->payment_info);
} else {
$payment_info = $method->payment_info;
}
$html .= $this->getHtmlRow('STANDARD_PAYMENTINFO', $payment_info, 'class="vmorder-done-payinfo"');
}
if (!class_exists('VirtueMartModelCurrency')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
}
$currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
$html .= $this->getHtmlRow('STANDARD_ORDER_NUMBER', $order['details']['BT']->order_number, 'class="vmorder-done-nr"');
$html .= $this->getHtmlRow('STANDARD_AMOUNT', $currency->priceDisplay($order['details']['BT']->order_total), 'class="vmorder-done-amount"');
if ($method->payment_currency != $order['details']['BT']->order_currency) {
$html .= $this->getHtmlRow('COM_VIRTUEMART_CART_TOTAL_PAYMENT', $totalInPaymentCurrency['display'], 'class="vmorder-done-amount"');
}
//$html .= $this->getHtmlRow('STANDARD_INFO', $method->payment_info);
//$html .= $this->getHtmlRow('STANDARD_AMOUNT', $totalInPaymentCurrency.' '.$currency_code_3);
$html .= '</table>' . "\n";
$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;
}
示例3: plgVmConfirmedOrder
/**
*
* тут выводится форма для перехода на сайт оплаты
* @author Alexius
*/
function plgVmConfirmedOrder($cart, $order)
{
//echo'<pre>salt = ';print_r($this);echo'</pre>';
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);
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$this->getPaymentCurrency($method);
$currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
$email_currency = $this->getEmailCurrency($method);
$new_status = $method->status_pending;
$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);
/*
$order1 = $this->getDataByOrderNumber('1419045');
$orderModel = VmModel::getModel('orders');
$order = $orderModel->getOrder($order1->virtuemart_order_id);
echo'<pre>';var_dump($order1);echo'</pre>';//die;
//echo'<pre>';var_dump($order);echo'</pre>';
die;
*/
//echo'<pre>';print_r($order['items']);echo'</pre>';
//die;
$session = JFactory::getSession();
$session->set('virtuemart_order_number', $order['details']['BT']->order_number);
//Формирование POST заголовка для отправки на Ipay
$post_variables = array('srv_no' => $method->srv_no, 'pers_acc' => $order['details']['BT']->order_number, 'amount' => (int) $order['details']['BT']->order_total, 'amount_editable' => 'N', 'provider_url' => $method->provider_url);
$url = $method->server;
//$url = 'https://stand.besmart.by:4443/pls/ipay/!iSOU.Login';
$html = '';
$html = '<div class="erip-ipay-frm">';
$html .= '<p>Номер вашего заказа: ' . $order['details']['BT']->order_number . '.</p>';
$html .= '<p>Для оплаты через систему ЕРИП запишите данный номер заказа.</p><br><br>';
$html .= '<p>Для оплаты через систему iPay - нажмите на кнопку ниже.</p>';
$html .= '<form action="' . $url . '" method="post" name="ipay-frm">';
foreach ($post_variables as $name => $value) {
$html .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
}
$html .= '<button type="submit" class="button">Оплатить через iPay</button>';
$html .= '</form>';
$html .= '</div>';
//return $html;
return $this->processConfirmedOrderPaymentResponse(2, $cart, $order, $html, $method->payment_name, $new_status);
}
示例4: 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_min_transaction'] = $method->cost_min_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;
}
示例5: display
function display($tpl = null)
{
$this->loadHelper('image');
$this->loadHelper('html');
$model = VmModel::getModel();
$usermodel = VmModel::getModel('user');
JToolBarHelper::title(JText::_('COM_VIRTUEMART_CONFIG'), 'head vm_config_48');
$this->addStandardEditViewCommands();
$config = VmConfig::loadConfig();
if (!empty($config->_params)) {
unset($config->_params['pdf_invoice']);
// parameter remove and replaced by inv_os
}
$this->config = $config;
$this->userparams = JComponentHelper::getParams('com_users');
$this->jTemplateList = ShopFunctions::renderTemplateList(JText::_('COM_VIRTUEMART_ADMIN_CFG_JOOMLA_TEMPLATE_DEFAULT'));
$this->vmLayoutList = $model->getLayoutList('virtuemart', VmConfig::get('vmlayout', 0), 'vmlayout');
$this->categoryLayoutList = $model->getLayoutList('category', VmConfig::get('categorylayout', 0), 'categorylayout');
$this->productLayoutList = $model->getLayoutList('productdetails', VmConfig::get('productlayout', 0), 'productlayout');
$this->noimagelist = $model->getNoImageList();
$this->orderStatusModel = VmModel::getModel('orderstatus');
$this->currConverterList = $model->getCurrencyConverterList();
$this->moduleList = $model->getModuleList();
$this->activeLanguages = $model->getActiveLanguages(VmConfig::get('active_languages'));
$this->orderByFields = $model->getProductFilterFields('browse_orderby_fields');
$this->searchFields = $model->getProductFilterFields('browse_search_fields');
$this->aclGroups = $usermodel->getAclGroupIndentedTree();
if (is_Dir(VmConfig::get('vmtemplate') . DS . 'images' . DS . 'availability' . DS)) {
$imagePath = VmConfig::get('vmtemplate') . '/images/availability/';
} else {
$imagePath = '/components/com_virtuemart/assets/images/availability/';
}
$this->imagePath = $imagePath;
shopFunctions::checkSafePath();
$this->checkVmUserVendor();
parent::display($tpl);
}
示例6: plgVmOnShowOrderBEPayment
/**
* Display stored payment data for an order
* @param int $virtuemart_order_id
* @param int $payment_method_id
* @see components/com_virtuemart/helpers/vmPSPlugin::plgVmOnShowOrderBEPayment()
*/
function plgVmOnShowOrderBEPayment($virtuemart_order_id, $payment_method_id)
{
if (!$this->selectedThisByMethodId($payment_method_id)) {
return NULL;
// Another method was selected, do nothing
}
if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) {
// JError::raiseWarning(500, $db->getErrorMsg());
return '';
}
$html = '<table class="adminlist table">' . "\n";
$html .= $this->getHtmlHeaderBE();
$code = "sofort_response_";
$first = TRUE;
foreach ($payments as $payment) {
$html .= '<tr class="row1"><th>' . vmText::_('COM_VIRTUEMART_DATE') . '</th><th align="left">' . $payment->created_on . '</th></tr>';
// Now only the first entry has this data when creating the order
if ($first) {
$html .= $this->getHtmlRowBE('SOFORT_PAYMENT_NAME', $payment->payment_name);
// keep that test to have it backwards compatible. Old version was deleting that column when receiving an IPN notification
if ($payment->payment_order_total and $payment->payment_order_total != 0.0) {
$html .= $this->getHtmlRowBE('SOFORT_PAYMENT_ORDER_TOTAL', $payment->payment_order_total . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
}
if ($payment->email_currency and $payment->email_currency != 0) {
$html .= $this->getHtmlRowBE('SOFORT_PAYMENT_EMAIL_CURRENCY', shopFunctions::getCurrencyByID($payment->email_currency, 'currency_code_3'));
}
if ($payment->email_currency and $payment->email_currency != 0) {
$html .= $this->getHtmlRowBE('SOFORT_RESPONSE_TRANSACTION', $payment->sofort_response_transaction);
}
$first = FALSE;
} else {
foreach ($payment as $key => $value) {
// only displays if there is a value or the value is different from 0.00 and the value
if ($value) {
if (substr($key, 0, strlen($code)) == $code) {
$html .= $this->getHtmlRowBE($key, $value);
}
}
}
}
}
$html .= '</table>' . "\n";
return $html;
}
示例7: checkSafePath
static function checkSafePath($safePath = 0)
{
if ($safePath == 0) {
$safePath = VmConfig::get('forSale_path', 0);
if (self::$tested) {
return $safePath;
}
}
$warn = FALSE;
$uri = JFactory::getURI();
$configlink = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=config';
VmConfig::loadJLang('com_virtuemart');
if (empty($safePath)) {
$warn = 'COM_VIRTUEMART_WARN_NO_SAFE_PATH_SET';
} else {
//jimport('joomla.filesystem.folder');
if (!class_exists('JFolder')) {
require_once JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'filesystem' . DS . 'folder.php';
}
$exists = JFolder::exists($safePath);
if (!$exists) {
$warn = 'COM_VIRTUEMART_WARN_SAFE_PATH_WRONG';
} else {
if (!is_writable($safePath)) {
VmConfig::loadJLang('com_virtuemart_config');
VmError('COM_VIRTUEMART_WARN_SAFE_PATH_NOT_WRITEABLE', vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $safePath, $configlink);
} else {
if (!is_writable(self::getInvoicePath($safePath))) {
VmConfig::loadJLang('com_virtuemart_config');
VmError('COM_VIRTUEMART_WARN_SAFE_PATH_INV_NOT_WRITEABLE', vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $safePath, $configlink);
}
}
}
}
if ($warn) {
$suggestedPath = shopFunctions::getSuggestedSafePath();
VmConfig::loadJLang('com_virtuemart_config');
VmWarn($warn, vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $suggestedPath, $configlink);
return FALSE;
}
return $safePath;
}
示例8: if
?>
<div class="vendor-image">
<?php
echo $this->vendor->images[0]->displayMediaThumb('', false);
?>
</div>
<?php
}
?>
</h1>
<?php
if (!class_exists('ShopFunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
echo shopFunctions::renderVendorAddress($this->vendor->virtuemart_vendor_id);
/* foreach($this->userFields as $userfields){
foreach($userfields['fields'] as $item){
if(!empty($item['value'])){
if($item['name']==='agreed'){
$item['value'] = ($item['value']===0) ? vmText::_('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_NO'):vmText::_('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_YES');
}
?><!-- span class="titles"><?php echo $item['title'] ?></span -->
<span class="values vm2<?php echo '-'.$item['name'] ?>" ><?php echo $this->escape($item['value']) ?></span>
<?php if ($item['name'] != 'title' and $item['name'] != 'first_name' and $item['name'] != 'middle_name' and $item['name'] != 'zip') { ?>
<br class="clear" />
<?php
}
}
}
示例9: setFileInfo
/**
* Sets the file information and paths/urls and so on.
*
* @author Max Milbers
* @param unknown_type $filename
* @param unknown_type $url
* @param unknown_type $path
*/
function setFileInfo($type = 0)
{
$this->file_url_folder = '';
$this->file_path_folder = '';
$this->file_url_folder_thumb = '';
if ($this->file_is_forSale == 0 and $type != 'forSale') {
$this->file_url_folder = $this->getMediaUrlByView($type);
$this->file_url_folder_thumb = $this->file_url_folder . 'resized/';
$this->file_path_folder = str_replace('/', DS, $this->file_url_folder);
} else {
if (!class_exists('shopFunctions')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctions.php';
}
$safePath = shopFunctions::checkSafePath();
if (!$safePath) {
return FALSE;
}
$this->file_path_folder = $safePath;
$this->file_url_folder = $this->file_path_folder;
//str_replace(DS,'/',$this->file_path_folder);
$this->file_url_folder_thumb = VmConfig::get('forSale_path_thumb');
}
//Clean from possible injection
while (strpos($this->file_path_folder, '..') !== false) {
$this->file_path_folder = str_replace('..', '', $this->file_path_folder);
}
$this->file_path_folder = preg_replace('#[/\\\\]+#', DS, $this->file_path_folder);
if (empty($this->file_url)) {
$this->file_url = $this->file_url_folder;
$this->file_name = '';
$this->file_extension = '';
} else {
if (!class_exists('JFile')) {
require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php';
}
if ($this->file_is_forSale == 1) {
$rdspos = strrpos($this->file_url, DS);
if ($rdspos !== false) {
$name = substr($this->file_url, $rdspos + 1);
} else {
vmdebug('$name', $this->file_url, $rdspos);
}
} else {
//This construction is only valid for the images, it is for own structuring using folders
$name = str_replace($this->file_url_folder, '', $this->file_url);
}
if (!empty($name) && $name !== '/') {
$this->file_name = JFile::stripExt($name);
//$this->file_extension = strtolower(JFile::getExt($name));
$this->file_extension = strtolower(JFile::getExt($name));
//Ensure using right directory
$file_url = $this->getMediaUrlByView($type) . $name;
if ($this->file_is_forSale == 1) {
if (JFile::exists($file_url)) {
$this->file_url = $file_url;
} else {
// vmdebug('MediaHandler, file does not exist in safepath '.$file_url);
}
} else {
$pathToTest = VMPATH_ROOT . DS . str_replace('/', DS, $file_url);
if (JFile::exists($pathToTest)) {
$this->file_url = $file_url;
} else {
// vmdebug('MediaHandler, file does not exist in '.$pathToTest);
}
}
}
}
if ($this->file_is_downloadable) {
$this->media_role = 'file_is_downloadable';
}
if ($this->file_is_forSale) {
$this->media_role = 'file_is_forSale';
}
if (empty($this->media_role)) {
$this->media_role = 'file_is_displayable';
}
// vmdebug('$this->media_role',$this->media_role);
$this->determineFoldersToTest();
if (!empty($this->file_url) && empty($this->file_url_thumb)) {
$this->displayMediaThumb('', true, '', false);
}
}
示例10: plgVmOnShowOrderBEPayment
/**
* Display stored payment data for an order
*
* @see components/com_virtuemart/helpers/vmPSPlugin::plgVmOnShowOrderBEPayment()
*/
function plgVmOnShowOrderBEPayment($virtuemart_order_id, $payment_method_id) {
if (!$this->selectedThisByMethodId($payment_method_id)) {
return NULL; // Another method was selected, do nothing
}
if (!($this->_currentMethod = $this->getVmPluginMethod($payment_method_id))) {
return FALSE;
}
if (!($payments = $this->_getPaypalInternalData($virtuemart_order_id))) {
// JError::raiseWarning(500, $db->getErrorMsg());
return '';
}
//$html = $this->renderByLayout('orderbepayment', array($payments, $this->_psType));
$html = '<table class="adminlist" width="50%">' . "\n";
$html .= $this->getHtmlHeaderBE();
$code = "paypal_response_";
$first = TRUE;
foreach ($payments as $payment) {
$html .= '<tr class="row1"><td>' . JText::_('VMPAYMENT_PAYPAL_DATE') . '</td><td align="left">' . $payment->created_on . '</td></tr>';
// Now only the first entry has this data when creating the order
if ($first) {
$html .= $this->getHtmlRowBE('COM_VIRTUEMART_PAYMENT_NAME', $payment->payment_name);
// keep that test to have it backwards compatible. Old version was deleting that column when receiving an IPN notification
if ($payment->payment_order_total and $payment->payment_order_total != 0.00) {
$html .= $this->getHtmlRowBE('COM_VIRTUEMART_TOTAL', $payment->payment_order_total . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
}
$first = FALSE;
} else {
$paypalInterface = $this->_loadPayPalInterface();
if (isset($payment->paypal_fullresponse) and !empty($payment->paypal_fullresponse)) {
$paypal_data = json_decode($payment->paypal_fullresponse);
$paypalInterface = $this->_loadPayPalInterface();
$html .= $paypalInterface->onShowOrderBEPayment($paypal_data);
$html .= '<tr><td></td><td>
<a href="#" class="PayPalLogOpener" rel="' . $payment->id . '" >
<div style="background-color: white; z-index: 100; right:0; display: none; border:solid 2px; padding:10px;" class="vm-absolute" id="PayPalLog_' . $payment->id . '">';
foreach ($paypal_data as $key => $value) {
$html .= ' <b>' . $key . '</b>: ' . $value . '<br />';
}
$html .= ' </div>
<span class="icon-nofloat vmicon vmicon-16-xml"></span> ';
$html .= JText::_('VMPAYMENT_PAYPAL_VIEW_TRANSACTION_LOG');
$html .= ' </a>';
$html .= ' </td></tr>';
} else {
$html .= $paypalInterface->onShowOrderBEPaymentByFields($payment);
}
}
}
$html .= '</table>' . "\n";
$doc = JFactory::getDocument();
$js = "
jQuery().ready(function($) {
$('.PayPalLogOpener').click(function() {
var logId = $(this).attr('rel');
$('#PayPalLog_'+logId).toggle();
return false;
});
});";
$doc->addScriptDeclaration($js);
return $html;
}
示例11: getInvoicePDF
function getInvoicePDF($orderDetails = 0, $viewName = 'invoice', $layout = 'invoice', $format = 'html', $force = false)
{
// $force = true;
$path = VmConfig::get('forSale_path', 0);
if (empty($path)) {
vmError('No path set to store invoices');
return false;
} else {
$path .= shopFunctions::getInvoiceFolderName() . DS;
if (!file_exists($path)) {
vmError('Path wrong to store invoices, folder invoices does not exist ' . $path);
return false;
} else {
if (!is_writable($path)) {
vmError('Cannot store pdf, directory not writeable ' . $path);
return false;
}
}
}
$orderModel = VmModel::getModel('orders');
$invoiceNumberDate = array();
if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
return 0;
}
if (!empty($invoiceNumberDate[0])) {
$invoiceNumber = $invoiceNumberDate[0];
} else {
$invoiceNumber = FALSE;
}
if (!$invoiceNumber or empty($invoiceNumber)) {
vmError('Cant create pdf, createInvoiceNumber failed');
return 0;
}
if (shopFunctions::InvoiceNumberReserved($invoiceNumber)) {
return 0;
}
$path .= preg_replace('/[^A-Za-z0-9_\\-\\.]/', '_', 'vm' . $layout . '_' . $invoiceNumber . '.pdf');
if (file_exists($path) and !$force) {
return $path;
}
//We come from the be, so we need to load the FE langauge
VmConfig::loadJLang('com_virtuemart', true);
$this->addViewPath(JPATH_VM_SITE . DS . 'views');
$view = $this->getView($viewName, $format);
$this->writeJs = false;
$view->addTemplatePath(JPATH_VM_SITE . DS . 'views' . DS . $viewName . DS . 'tmpl');
$vmtemplate = VmConfig::get('vmtemplate', 0);
if (!empty($vmtemplate) and $vmtemplate == 'default') {
if (JVM_VERSION == 2) {
$q = 'SELECT `template` FROM `#__template_styles` WHERE `client_id`="0" AND `home`="1"';
} else {
$q = 'SELECT `template` FROM `#__templates_menu` WHERE `client_id`="0" AND `menuid`="0"';
}
$db = JFactory::getDbo();
$db->setQuery($q);
$templateName = $db->loadResult();
} else {
$templateName = shopFunctionsF::setTemplate($vmtemplate);
}
if (!empty($templateName)) {
$TemplateOverrideFolder = JPATH_SITE . DS . "templates" . DS . $templateName . DS . "html" . DS . "com_virtuemart" . DS . "invoice";
if (file_exists($TemplateOverrideFolder)) {
$view->addTemplatePath($TemplateOverrideFolder);
}
}
$view->invoiceNumber = $invoiceNumberDate[0];
$view->invoiceDate = $invoiceNumberDate[1];
$view->orderDetails = $orderDetails;
$view->uselayout = $layout;
$view->showHeaderFooter = false;
$vendorModel = VmModel::getModel('vendor');
$virtuemart_vendor_id = 1;
//We could set this automatically by the vendorId stored in the order.
$vendor = $vendorModel->getVendor($virtuemart_vendor_id);
$metadata = array('title' => JText::sprintf('COM_VIRTUEMART_INVOICE_TITLE', $vendor->vendor_store_name, $view->invoiceNumber, $orderDetails['details']['BT']->order_number), 'keywords' => JText::_('COM_VIRTUEMART_INVOICE_CREATOR'));
return VmPdf::createVmPdf($view, $path, 'F', $metadata);
}
示例12: displayKlarnaLogos
function displayKlarnaLogos($method, $virtuemart_country_id, $shipTo, $total)
{
$session = JFactory::getSession();
$sessionKlarna = $session->get('Klarna', 0, 'vm');
if (empty($sessionKlarna)) {
return '';
}
$sessionKlarnaData = unserialize($sessionKlarna);
$address['virtuemart_country_id'] = $virtuemart_country_id;
$cData = KlarnaHandler::getcData($method, $address);
$country2 = strtolower(shopFunctions::getCountryByID($virtuemart_country_id, 'country_2_code'));
switch ($sessionKlarnaData->klarna_option) {
case 'invoice':
$image = '/klarna_invoice_' . $country2 . '.png';
$klarna_invoice_fee = KlarnaHandler::getInvoiceFeeInclTax($method, $cData['country_code_3']);
$currency = CurrencyDisplay::getInstance();
$display_fee = $currency->priceDisplay($klarna_invoice_fee);
$text = JText::sprintf('VMPAYMENT_KLARNA_INVOICE_TITLE_NO_PRICE', $display_fee);
break;
case 'partpayment':
case 'part':
$image = '/klarna_part_' . $country2 . '.png';
$address['virtuemart_country_id'] = $virtuemart_country_id;
$pclasses = KlarnaHandler::getPClasses(NULL, $country2, KlarnaHandler::getKlarnaMode($method), $cData);
if (!class_exists('Klarna_payments')) {
require JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'klarna_payments.php';
}
if (!class_exists('KlarnaVm2API')) {
require JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'klarna_vm2api.php';
}
$payments = new klarna_payments($cData, $shipTo);
//vmdebug('displaylogos',$cart_prices);
$totalInPaymentCurrency = KlarnaHandler::convertPrice($total, $cData['currency_code']);
$text = $payments->displayPclass($sessionKlarnaData->KLARNA_DATA['pclass'], $totalInPaymentCurrency);
// .' '.$total;
break;
case 'speccamp':
$image = 'klarna_logo.png';
$text = JText::_('VMPAYMENT_KLARNA_SPEC_TITLE');
break;
default:
$image = '';
$text = '';
break;
}
$html = $this->renderByLayout('payment_cart', array('logo' => $image, 'description' => $text));
return $html;
}
示例13: display
//.........这里部分代码省略.........
/* Data for the Edit Status form popup */
$_currentOrderStat = $order['details']['BT']->order_status;
// used to update all item status in one time
$_orderStatusSelect = JHtml::_('select.genericlist', $orderStates, 'order_status', 'style="width:100px;"', 'order_status_code', 'order_status_name', $_currentOrderStat, 'order_items_status', true);
$this->assignRef('orderStatSelect', $_orderStatusSelect);
$this->assignRef('currentOrderStat', $_currentOrderStat);
/* Toolbar */
if (JVM_VERSION < 3) {
$backward = "back";
$list = 'back';
} else {
$backward = 'backward';
$list = 'list';
}
JToolBarHelper::custom('prevItem', $backward, '', 'com_tsmart_ITEM_PREVIOUS', false);
JToolBarHelper::custom('nextItem', 'forward', '', 'com_tsmart_ITEM_NEXT', false);
JToolBarHelper::divider();
JToolBarHelper::custom('cancel', $list, '', 'com_tsmart_ORDER_LIST_LBL', false, false);
} else {
if ($curTask == 'editOrderItem') {
if (!class_exists('calculationHelper')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
}
$this->assignRef('orderstatuses', $orderStates);
$model = tmsModel::getModel();
$orderId = vRequest::getString('orderId', '');
$orderLineItem = vRequest::getVar('orderLineId', '');
$this->assignRef('tsmart_order_id', $orderId);
$this->assignRef('tsmart_order_item_id', $orderLineItem);
$orderItem = $model->getOrderLineDetails($orderId, $orderLineItem);
$this->assignRef('orderitem', $orderItem);
} else {
$this->setLayout('orders');
$model = tmsModel::getModel();
$this->addStandardDefaultViewLists($model, 'created_on');
$orderStatusModel = tmsModel::getModel('orderstatus');
$orderstates = vRequest::getCmd('order_status_code', '');
$this->lists['state_list'] = $orderStatusModel->renderOSList($orderstates, 'order_status_code', FALSE, ' onchange="this.form.submit();" ');
$orderslist = $model->getOrdersList();
$this->assignRef('orderstatuses', $orderStates);
if (!class_exists('CurrencyDisplay')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
/* Apply currency This must be done per order since it's vendor specific */
$_currencies = array();
// Save the currency data during this loop for performance reasons
if ($orderslist) {
foreach ($orderslist as $tsmart_order_id => $order) {
if (!empty($order->order_currency)) {
$currency = $order->order_currency;
} else {
if ($order->tsmart_vendor_id) {
if (!class_exists('tsmartModelVendor')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
}
$currObj = tsmartModelVendor::getVendorCurrency($order->tsmart_vendor_id);
$currency = $currObj->tsmart_currency_id;
}
}
//This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
if (!array_key_exists('curr' . $currency, $_currencies)) {
$_currencies['curr' . $currency] = CurrencyDisplay::getInstance($currency, $order->tsmart_vendor_id);
}
$order->order_total = $_currencies['curr' . $currency]->priceDisplay($order->order_total);
$order->invoiceNumber = $model->getInvoiceNumber($order->tsmart_order_id);
}
}
//update order items button
/*$q = 'SELECT * FROM #__tsmart_order_items WHERE `product_discountedPriceWithoutTax` IS NULL ';
$db = JFactory::getDBO();
$db->setQuery($q);
//$res = $db->loadRow();
if(true) {
JToolBarHelper::custom('updateCustomsOrderItems', 'new', 'new', vmText::_('com_tsmart_REPORT_UPDATEORDERITEMS'),false);
vmError('com_tsmart_UPDATEORDERITEMS_WARN');
}*/
/*
* UpdateStatus removed from the toolbar; don't understand how this was intented to work but
* the order ID's aren't properly passed. Might be readded later; the controller needs to handle
* the arguments.
*/
/* Toolbar */
//JToolBarHelper::customX( 'CreateOrderHead', 'new','new','New',false);
JToolBarHelper::save('updatestatus', tsmText::_('com_tsmart_UPDATE_STATUS'));
if (vmAccess::manager('orders.delete')) {
JToolBarHelper::spacer('80');
JToolBarHelper::deleteList();
}
/* Assign the data */
$this->assignRef('orderslist', $orderslist);
$this->pagination = $model->getPagination();
}
}
if (JFactory::getApplication()->isSite()) {
$bar = JToolBar::getInstance('toolbar');
$bar->appendButton('Link', 'back', 'com_tsmart_LEAVE', 'index.php?option=com_tsmart&manage=0');
}
shopFunctions::checkSafePath();
parent::display($tpl);
}
示例14: foreach
<?php
echo shopFunctionsF::getLoginForm($this->cart, FALSE);
// This displays the form to change the current shopper
$adminID = JFactory::getSession()->get('vmAdminID');
if ((JFactory::getUser()->authorise('core.admin', 'com_virtuemart') || JFactory::getUser($adminID)->authorise('core.admin', 'com_virtuemart')) && VmConfig::get('oncheckout_change_shopper', 0)) {
echo $this->loadTemplate('shopperform');
}
$taskRoute = '';
?>
<form method="post" id="checkoutForm" name="checkoutForm" action="<?php
echo JRoute::_('index.php?option=com_virtuemart&view=cart' . $taskRoute, $this->useXHTML, $this->useSSL);
?>
">
<?php
if (VmConfig::get('multixcart') == 'byselection') {
echo shopFunctions::renderVendorFullVendorList($this->cart->vendorId);
}
echo $this->loadTemplate('address');
// This displays the pricelist MUST be done with tables, because it is also used for the emails
echo $this->loadTemplate('pricelist');
if (!empty($this->checkoutAdvertise)) {
?>
<div id="checkout-advertise-box"> <?php
foreach ($this->checkoutAdvertise as $checkoutAdvertise) {
?>
<div class="checkout-advertise">
<?php
echo $checkoutAdvertise;
?>
</div>
<?php
示例15: checkStoreInvoice
function checkStoreInvoice($orderDetails = 0)
{
JRequest::setVar('task', 'checkStoreInvoice');
$force = true;
// @ini_set( 'max_execution_time', 5 );
$path = VmConfig::get('forSale_path', 0);
if ($path === 0) {
vmError('No path set to store invoices');
return false;
} else {
$path .= 'invoices' . DS;
if (!file_exists($path)) {
vmError('Path wrong to store invoices, folder invoices does not exist ' . $path);
return false;
} else {
if (!is_writable($path)) {
vmError('Cannot store pdf, directory not writeable ' . $path);
return false;
}
}
}
$orderModel = VmModel::getModel('orders');
$invoiceNumberDate = array();
if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
return 0;
}
if (!empty($invoiceNumberDate[0])) {
$invoiceNumber = $invoiceNumberDate[0];
} else {
$invoiceNumber = FALSE;
}
if (!$invoiceNumber or empty($invoiceNumber)) {
vmError('Cant create pdf, createInvoiceNumber failed');
return 0;
}
if (shopFunctions::InvoiceNumberReserved($invoiceNumber)) {
return 0;
}
$path .= 'vminvoice_' . $invoiceNumber . '.pdf';
if (file_exists($path) and !$force) {
return $path;
}
// $app = JFactory::getApplication('site');
//We come from the be, so we need to load the FE langauge
$jlang = JFactory::getLanguage();
$jlang->load('com_virtuemart', JPATH_SITE, 'en-GB', true);
$jlang->load('com_virtuemart', JPATH_SITE, $jlang->getDefault(), true);
$jlang->load('com_virtuemart', JPATH_SITE, null, true);
$this->addViewPath(JPATH_VM_SITE . DS . 'views');
$format = 'html';
$viewName = 'invoice';
$view = $this->getView($viewName, $format);
$view->addTemplatePath(JPATH_VM_SITE . DS . 'views' . DS . 'invoice' . DS . 'tmpl');
$view->invoiceNumber = $invoiceNumberDate[0];
$view->invoiceDate = $invoiceNumberDate[1];
$view->orderDetails = $orderDetails;
$view->uselayout = 'invoice';
ob_start();
$view->display();
$html = ob_get_contents();
ob_end_clean();
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator('Invoice by VirtueMart 2, used library tcpdf');
$pdf->SetAuthor($view->vendor->vendor_name);
$pdf->SetTitle(JText::_('COM_VIRTUEMART_INVOICE_TITLE'));
$pdf->SetSubject(JText::sprintf('COM_VIRTUEMART_INVOICE_SUBJ', $view->vendor->vendor_store_name));
$pdf->SetKeywords('Invoice by VirtueMart 2');
//virtuemart.cloudaccess.net/index.php?option=com_virtuemart&view=invoice&layout=details&virtuemart_order_id=18&order_number=6e074d9b&order_pass=p_9cb9e2&task=checkStoreInvoice
if (empty($view->vendor->images[0])) {
vmError('Vendor image given path empty ');
} else {
if (empty($view->vendor->images[0]->file_url_folder) or empty($view->vendor->images[0]->file_name) or empty($view->vendor->images[0]->file_extension)) {
vmError('Vendor image given image is not complete ' . $view->vendor->images[0]->file_url_folder . $view->vendor->images[0]->file_name . '.' . $view->vendor->images[0]->file_extension);
vmdebug('Vendor image given image is not complete, the given media', $view->vendor->images[0]);
} else {
if (!empty($view->vendor->images[0]->file_extension) and strtolower($view->vendor->images[0]->file_extension) == 'png') {
vmError('Warning extension of the image is a png, tpcdf has problems with that in the header, choose a jpg or gif');
} else {
$imagePath = DS . str_replace('/', DS, $view->vendor->images[0]->file_url_folder . $view->vendor->images[0]->file_name . '.' . $view->vendor->images[0]->file_extension);
if (!file_exists(JPATH_ROOT . $imagePath)) {
vmError('Vendor image missing ' . $imagePath);
} else {
$pdf->SetHeaderData($imagePath, 60, $view->vendor->vendor_store_name, $view->vendorAddress);
}
}
}
}
// set header and footer fonts
$pdf->setHeaderFont(array('helvetica', '', 8));
$pdf->setFooterFont(array('helvetica', '', 10));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//.........这里部分代码省略.........