本文整理汇总了PHP中Tienda::getGuestIdStart方法的典型用法代码示例。如果您正苦于以下问题:PHP Tienda::getGuestIdStart方法的具体用法?PHP Tienda::getGuestIdStart怎么用?PHP Tienda::getGuestIdStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tienda
的用法示例。
在下文中一共展示了Tienda::getGuestIdStart方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processOrder
/**
* Processes a new order
*
* @param $order_id
* @return unknown_type
*/
public function processOrder($order_id)
{
// get the order
$model = JModel::getInstance('Orders', 'TiendaModel');
$model->setId($order_id);
$order = $model->getItem();
$this->_orderFromModel = $order;
$orderTable = $model->getTable();
$orderTable->load($order_id);
$this->_order = $orderTable;
$this->_date = JFactory::getDate();
if ($order->user_id < Tienda::getGuestIdStart()) {
$this->_user = $order->user_id;
} else {
$this->_user = JFactory::getUser($order->user_id);
}
// find the products in the order that are integrated
foreach ($order->orderitems as $orderitem) {
$model = JModel::getInstance('Products', 'TiendaModel');
$product = $model->getTable();
$product->load($orderitem->product_id);
$this->_product = $product;
$this->_orderitem = $orderitem;
if (!empty($product->product_sql)) {
$this->processSQL($product->product_sql);
}
}
}
示例2: processStringForOrder
/**
* Processes a new order
*
* @param $order_id
* @return unknown_type
*/
public function processStringForOrder($order_id, &$string)
{
// get the order
$model = JModel::getInstance('Orders', 'TiendaModel');
$model->setId($order_id);
$order = $model->getItem();
$this->_orderFromModel = $order;
$orderTable = $model->getTable();
$orderTable->load($order_id);
$this->_order = $orderTable;
$this->_date = JFactory::getDate();
if ($order->user_id < Tienda::getGuestIdStart()) {
$this->_user = $order->user_id;
} else {
$this->_user = JFactory::getUser($order->user_id);
}
$this->products_model = Tienda::getClass('TiendaModelProducts', 'models.products');
return $this->processString($string);
}
示例3: store
function store($updateNulls = false)
{
// add hash to orders which are placed by guests
if (!$this->order_id && !strlen($this->order_hash) && $this->user_id < Tienda::getGuestIdStart()) {
Tienda::load('TiendaHelperOrder', 'helpers.order');
$this->order_hash = TiendaHelperOrder::getHashInvoice($this);
}
return parent::store($updateNulls);
}
示例4: checkEmail
/**
* Checks that an email is valid
* @return unknown_type
*/
function checkEmail()
{
Tienda::load('TiendaHelperUser', 'helpers.user');
$checker = TiendaHelperUser::getInstance('User', 'TiendaHelper');
Tienda::load('TiendaHelperBase', 'helpers._base');
$helper = TiendaHelperBase::getInstance();
$response = array();
$response['msg'] = '';
$response['error'] = '0';
// get elements from post
$elements = json_decode(preg_replace('/[\\n\\r]+/', '\\n', JRequest::getVar('elements', '', 'post', 'string', 'string')));
// convert elements to array that can be binded
$values = $helper->elementsToArray($elements);
$email = $values['email_address'];
if (empty($email)) {
$response['msg'] = $helper->validationMessage("COM_TIENDA_EMAIL_CANNOT_BE_EMPTY", 'fail');
$response['error'] = '1';
echo json_encode($response);
return;
}
$message = "";
if (!$checker->isEmailAddress($email)) {
$message .= $helper->validationMessage("COM_TIENDA_EMAIL_INVALID", 'fail');
$response['error'] = '1';
}
if ($checker->emailExists($email)) {
$user_id = $this->user->id;
$user_email = $checker->getBasicInfo($user_id)->email;
if ($user_id && $user_id > Tienda::getGuestIdStart()) {
if ($user_email != $email) {
$message .= $helper->validationMessage("COM_TIENDA_EMAIL_ALREADY_REGISTERED", 'fail');
$response['error'] = '1';
}
} else {
$message .= $helper->validationMessage("COM_TIENDA_EMAIL_ALREADY_REGISTERED", 'fail');
$response['error'] = '1';
}
}
if ($response['error'] == '0') {
// no error
$message .= $helper->validationMessage('COM_TIENDA_VALID_EMAIL', 'success');
}
$response['msg'] = $message;
echo json_encode($response);
return;
}
示例5: defined
<?php
defined('_JEXEC') or die('Restricted access');
JHTML::_('script', 'tienda.js', 'media/com_tienda/js/');
$form = @$this->form;
$row = @$this->row;
$order = @$this->order;
$items = @$order->getItems();
$histories = @$row->orderhistory ? @$row->orderhistory : array();
$config = Tienda::getInstance();
$guest = $row->user_id < Tienda::getGuestIdStart();
?>
<form action="<?php
echo JRoute::_(@$form['action']);
?>
" method="post" class="adminform" name="adminForm" enctype="multipart/form-data" >
<?php
// fire plugin event here to enable extending the form
JDispatcher::getInstance()->trigger('onBeforeDisplayOrderPrint', array($row));
?>
<table style="width: 100%;">
<tr>
<td colspan="2" style="vertical-align:top;">
<fieldset>
<legend><?php
echo JText::_('COM_TIENDA_SHOP_INFORMATION');
示例6: getNextGuestUserId
/**
* Method which returns the next guest user account ID in the system
* (starts off with -11 => reserve 0 ... -10 for later use)
*
* @return Guest user account ID
*/
public function getNextGuestUserId()
{
$db = JFactory::getDbo();
Tienda::load('TiendaQuery', 'library.query');
$q = new TiendaQuery();
$start_id = Tienda::getGuestIdStart();
$q->select('min( tbl.user_id)');
$q->from('#__tienda_userinfo tbl');
$q->where('tbl.user_id < ' . $start_id);
$db->setQuery((string) $q);
$res = $db->loadResult();
if ($res === null) {
// no guest account in system
return $start_id - 1;
} else {
return $res - 1;
}
// the last guest account id -1
}
示例7: getEmailContent
/**
* Returns
*
* @param object
* @param mixed Boolean
* @param mixed Boolean
* @return array
*/
private function getEmailContent($data, $type = 'order')
{
$mainframe = JFactory::getApplication();
$type = strtolower($type);
$lang = JFactory::getLanguage();
$lang->load('com_tienda', JPATH_ADMINISTRATOR);
$return = new stdClass();
$return->body = '';
$return->subject = '';
// get config settings
$config = TiendaConfig::getInstance();
$sitename = $config->get('sitename', $mainframe->getCfg('sitename'));
$siteurl = $config->get('siteurl', JURI::root());
// get the placeholders array here so the switch statement can add to it
$placeholders = $this->getPlaceholderDefaults();
switch ($type) {
case "subscription_expiring":
$return->subject = JText::_('COM_TIENDA_EMAIL_EXPIRING_SUBSCRIPTION_SUBJECT');
$return->body = JText::_('COM_TIENDA_EMAIL_EXPIRING_SUBSCRIPTION_BODY');
if ($this->use_html) {
$return->body = nl2br($return->body);
}
$placeholders['user.name'] = $data->user_name;
$placeholders['product.name'] = $data->product_name;
break;
case "subscription_expired":
$return->subject = JText::_('COM_TIENDA_EMAIL_EXPIRED_SUBSCRIPTION_SUBJECT');
$return->body = JText::_('COM_TIENDA_EMAIL_EXPIRED_SUBSCRIPTION_BODY');
if ($this->use_html) {
$return->body = nl2br($return->body);
}
$placeholders['user.name'] = $data->user_name;
$placeholders['product.name'] = $data->product_name;
break;
case "subscription_new":
case "new_subscription":
case "subscription":
$user_name = JText::_('COM_TIENDA_GUEST');
if ($data->user_id > 0) {
$user = JUser::getInstance($data->user_id);
$user_name = $user->name;
}
if ($data->user_id < Tienda::getGuestIdStart()) {
$link = JURI::root() . "index.php?option=com_tienda&view=orders&task=view&id=" . $data->order_id . '&h=' . $data->order_hash;
} else {
$link = JURI::root() . "index.php?option=com_tienda&view=orders&task=view&id=" . $data->order_id;
}
$link = JRoute::_($link, false);
$link = "<a href='{$link}'>" . $link . "</a>";
if (count($data->history) == 1) {
// new order
$return->subject = sprintf(JText::_('COM_TIENDA_EMAIL_NEW_ORDER_SUBJECT'), $data->order_id);
// set the email body
$text = sprintf(JText::_('COM_TIENDA_EMAIL_DEAR'), $user_name) . ",\n\n";
$text .= JText::_('COM_TIENDA_EMAIL_THANKS_NEW_SUBSCRIPTION') . "\n\n";
$text .= sprintf(JText::_('COM_TIENDA_EMAIL_CHECK'), $link) . "\n\n";
$text .= JText::_('COM_TIENDA_EMAIL_RECEIPT_FOLLOWS') . "\n\n";
if ($this->use_html) {
$text = nl2br($text);
}
// get the order body
Tienda::load('TiendaHelperOrder', 'helpers.order');
$text .= TiendaHelperOrder::getOrderHtmlForEmail($data->order_id);
} else {
// Status Change
$return->subject = JText::_('COM_TIENDA_EMAIL_SUBSCRIPTION_STATUS_CHANGE');
$last_history = count($data->history) - 1;
$text = sprintf(JText::_('COM_TIENDA_EMAIL_DEAR'), $user_name) . ",\n\n";
$text .= sprintf(JText::_('COM_TIENDA_EMAIL_ORDER_UPDATED'), $data->order_id);
if (!empty($data->history[$last_history]->comments)) {
$text .= sprintf(JText::_('COM_TIENDA_EMAIL_ADDITIONAL_COMMENTS'), $data->history[$last_history]->comments);
}
$text .= sprintf(JText::_('COM_TIENDA_EMAIL_CHECK'), $link) . "\n\n";
if ($this->use_html) {
$text = nl2br($text);
}
}
$return->body = $text;
$placeholders['user.name'] = $user_name;
break;
case "new_order":
case "order":
default:
$user_name = JText::_('COM_TIENDA_GUEST');
if ($data->user_id > 0) {
$user = JUser::getInstance($data->user_id);
$user_name = $user->name;
}
if ($data->user_id < Tienda::getGuestIdStart()) {
$link = JURI::root() . "index.php?option=com_tienda&view=orders&task=view&id=" . $data->order_id . '&h=' . $data->order_hash;
} else {
$link = JURI::root() . "index.php?option=com_tienda&view=orders&task=view&id=" . $data->order_id;
//.........这里部分代码省略.........
示例8: getList
public function getList($refresh = false)
{
if (empty($this->_list)) {
Tienda::load('TiendaHelperBase', 'helpers._base');
$list = parent::getList($refresh);
// If no item in the list, return an array()
if (empty($list)) {
return array();
}
$amigos = TiendaHelperBase::getInstance('Amigos');
$currency_helper = TiendaHelperBase::getInstance('Currency');
foreach (@$list as $item) {
if ($item->user_id < Tienda::getGuestIdStart()) {
if (strlen($item->billing_first_name) || strlen($item->billing_last_name)) {
$item->user_name = JText::_('COM_TIENDA_GUEST') . ' - ' . $item->billing_first_name . ' ' . $item->billing_last_name;
} else {
$item->user_name = JText::_('COM_TIENDA_GUEST') . ' - ' . $item->userinfo_email;
}
}
$item->link = 'index.php?option=com_tienda&controller=orders&view=orders&task=edit&id=' . $item->order_id;
$item->link_view = 'index.php?option=com_tienda&view=orders&task=view&id=' . $item->order_id;
// retrieve the order's currency
// this loads the currency, using the FK is it is the same of the
// currency used in the order, or the DSCParameter currency of the order otherwise
$order_currency = new DSCParameter($item->order_currency);
$order_currency = $order_currency->toArray();
//JModel::addIncludePath( JPATH_ADMINISTRATOR.'/components/com_tienda/models' );
//$cmodel = JModel::getInstance( 'Currencies', 'TiendaModel' );
//$cmodel->setId($item->currency_id);
$item->currency = $currency_helper->load($item->currency_id);
// if the order currency is not the same as it was during the order
if (!empty($item->currency) && !empty($order_currency['currency_code']) && $item->currency->currency_code != $order_currency['currency_code']) {
// overwrite it with the original one
foreach (@$order_currency as $k => $v) {
$item->currency->{$k} = $v;
}
}
// has a commission?
if ($amigos->isInstalled()) {
$item->commissions = $amigos->getCommissions($item->order_id);
}
}
$this->_list = $list;
}
return $this->_list;
}
示例9: foreach
?>
</div>
<?php
echo @$this->pagination->getPagesLinks();
?>
</td>
</tr>
</tfoot>
<tbody>
<?php
$i = 0;
$k = 0;
?>
<?php
foreach (@$items as $item) {
$guest = $item->user_id < Tienda::getGuestIdStart();
?>
<tr class='row<?php
echo $k;
?>
'>
<td align="center">
<?php
echo $i + 1;
?>
</td>
<td style="text-align: center;">
<?php
echo TiendaGrid::checkedout($item, $i, 'order_id');
?>
</td>