本文整理汇总了PHP中Citruscart::getGuestIdStart方法的典型用法代码示例。如果您正苦于以下问题:PHP Citruscart::getGuestIdStart方法的具体用法?PHP Citruscart::getGuestIdStart怎么用?PHP Citruscart::getGuestIdStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Citruscart
的用法示例。
在下文中一共展示了Citruscart::getGuestIdStart方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processOrder
/**
* Processes a new order
*
* @param $order_id
* @return unknown_type
*/
public function processOrder($order_id)
{
// get the order
$model = JModelLegacy::getInstance('Orders', 'CitruscartModel');
$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 < Citruscart::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 = JModelLegacy::getInstance('Products', 'CitruscartModel');
$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 = JModelLegacy::getInstance('Orders', 'CitruscartModel');
$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 < Citruscart::getGuestIdStart()) {
$this->_user = $order->user_id;
} else {
$this->_user = JFactory::getUser($order->user_id);
}
$this->products_model = Citruscart::getClass('CitruscartModelProducts', 'models.products');
return $this->processString($string);
}
示例3: 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();
Citruscart::load('CitruscartQuery', 'library.query');
$q = new CitruscartQuery();
$start_id = Citruscart::getGuestIdStart();
$q->select('min( tbl.user_id)');
$q->from('#__citruscart_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
}
示例4: checkEmail
/**
* Checks that an email is valid
* return unknown_type
*/
function checkEmail()
{
$app = JFactory::getApplication();
$input = JFactory::getApplication()->input;
Citruscart::load('CitruscartHelperUser', 'helpers.user');
$checker = CitruscartHelperUser::getInstance('User', 'CitruscartHelper');
Citruscart::load('CitruscartHelperBase', 'helpers._base');
$helper = CitruscartHelperBase::getInstance();
$response = array();
$response['msg'] = '';
$response['error'] = '0';
// get elements from post
$elements = json_decode(preg_replace('/[\\n\\r]+/', '\\n', $input->getString('elements')));
// convert elements to array that can be binded
$values = $helper->elementsToArray($elements);
$email = $values['email_address'];
if (empty($email)) {
$response['msg'] = $helper->validationMessage("COM_CITRUSCART_EMAIL_CANNOT_BE_EMPTY", 'fail');
$response['error'] = '1';
echo json_encode($response);
return;
}
$message = "";
if (!$checker->isEmailAddress($email)) {
$message .= $helper->validationMessage("COM_CITRUSCART_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 > Citruscart::getGuestIdStart()) {
if ($user_email != $email) {
$message .= $helper->validationMessage("COM_CITRUSCART_EMAIL_ALREADY_REGISTERED", 'fail');
$response['error'] = '1';
}
} else {
$message .= $helper->validationMessage("COM_CITRUSCART_EMAIL_ALREADY_REGISTERED", 'fail');
$response['error'] = '1';
}
}
if ($response['error'] == '0') {
// no error
$message .= $helper->validationMessage('COM_CITRUSCART_VALID_EMAIL', 'success');
}
$response['msg'] = $message;
echo json_encode($response);
return;
}
示例5: foreach
<?php
echo $this->pagination->getPagesLinks();
?>
</div>
</td>
</tr>
</tfoot>
<tbody>
<?php
$i = 0;
$k = 0;
?>
<?php
foreach ($items as $item) {
$guest = $item->user_id < Citruscart::getGuestIdStart();
?>
<tr class='row<?php
echo $k;
?>
'>
<td align="center">
<?php
echo $i + 1;
?>
</td>
<td style="text-align: center;">
<?php
echo CitruscartGrid::checkedout($item, $i, 'order_id');
?>
</td>
示例6: 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_citruscart', JPATH_ADMINISTRATOR);
$return = new stdClass();
$return->body = '';
$return->subject = '';
// get config settings
$config = CitruscartConfig::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_CITRUSCART_EMAIL_EXPIRING_SUBSCRIPTION_SUBJECT');
$return->body = JText::_('COM_CITRUSCART_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_CITRUSCART_EMAIL_EXPIRED_SUBSCRIPTION_SUBJECT');
$return->body = JText::_('COM_CITRUSCART_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_CITRUSCART_GUEST');
if ($data->user_id > 0) {
$user = JUser::getInstance($data->user_id);
$user_name = $user->name;
}
if ($data->user_id < Citruscart::getGuestIdStart()) {
$link = JURI::root() . "index.php?option=com_citruscart&view=orders&task=view&id=" . $data->order_id . '&h=' . $data->order_hash;
} else {
$link = JURI::root() . "index.php?option=com_citruscart&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_CITRUSCART_EMAIL_NEW_ORDER_SUBJECT'), $data->order_id);
// set the email body
$text = sprintf(JText::_('COM_CITRUSCART_EMAIL_DEAR'), $user_name) . ",\n\n";
$text .= JText::_('COM_CITRUSCART_EMAIL_THANKS_NEW_SUBSCRIPTION') . "\n\n";
$text .= sprintf(JText::_('COM_CITRUSCART_EMAIL_CHECK'), $link) . "\n\n";
$text .= JText::_('COM_CITRUSCART_EMAIL_RECEIPT_FOLLOWS') . "\n\n";
if ($this->use_html) {
$text = nl2br($text);
}
// get the order body
Citruscart::load('CitruscartHelperOrder', 'helpers.order');
$text .= CitruscartHelperOrder::getOrderHtmlForEmail($data->order_id);
} else {
// Status Change
$return->subject = JText::_('COM_CITRUSCART_EMAIL_SUBSCRIPTION_STATUS_CHANGE');
$last_history = count($data->history) - 1;
$text = sprintf(JText::_('COM_CITRUSCART_EMAIL_DEAR'), $user_name) . ",\n\n";
$text .= sprintf(JText::_('COM_CITRUSCART_EMAIL_ORDER_UPDATED'), $data->order_id);
if (!empty($data->history[$last_history]->comments)) {
$text .= sprintf(JText::_('COM_CITRUSCART_EMAIL_ADDITIONAL_COMMENTS'), $data->history[$last_history]->comments);
}
$text .= sprintf(JText::_('COM_CITRUSCART_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_CITRUSCART_GUEST');
if ($data->user_id > 0) {
$user = JUser::getInstance($data->user_id);
$user_name = $user->name;
}
if ($data->user_id < Citruscart::getGuestIdStart()) {
$link = JURI::root() . "index.php?option=com_citruscart&view=orders&task=view&id=" . $data->order_id . '&h=' . $data->order_hash;
} else {
$link = JURI::root() . "index.php?option=com_citruscart&view=orders&task=view&id=" . $data->order_id;
//.........这里部分代码省略.........
示例7: Copyright
# author Citruscart Team - Citruscart http://www.citruscart.com
# copyright Copyright (C) 2014 Citruscart.com All Rights Reserved.
# license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://citruscart.com
# Technical Support: Forum - http://citruscart.com/forum/index.html
-------------------------------------------------------------------------*/
/** ensure this file is being included by a parent file */
defined('_JEXEC') or die('Restricted access');
JHtml::_('script', 'media/citruscart/js/citruscart.js', false, false);
$form = $this->form;
$row = $this->row;
$order = $this->order;
$items = $order->getItems();
$surrounding = $this->surrounding;
$histories = $row->orderhistory ? $row->orderhistory : array();
$guest = $row->user_id < Citruscart::getGuestIdStart();
?>
<form action="<?php
echo JRoute::_($form['action']);
?>
" method="post" class="adminform" name="adminForm" id="adminForm" enctype="multipart/form-data" >
<table class="table table-striped table-bordered">
<tr>
<td align="left" width="100%">
<?php
echo "<a class=\"btn\" href='" . JRoute::_("index.php?option=com_citruscart&view=orders") . "'>" . JText::_('COM_CITRUSCART_RETURN_TO_LIST') . "</a>";
?>
</td>
<td nowrap="nowrap" style="text-align: right; padding: 0px 5px;">
示例8: getList
public function getList($refresh = false)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query = $this->_buildQuery();
$db->setQuery($query);
//$list = $db->loadObjectList();
$list = $this->_getList((string) $query, $this->getState('limitstart'), $this->getState('limit'));
$this->_list = $list;
if ($this->_list) {
Citruscart::load('CitruscartHelperBase', 'helpers._base');
//$list = parent::getList($refresh);
// If no item in the list, return an array()
/* if( empty( $list ) ){
return array();
} */
$amigos = CitruscartHelperBase::getInstance('Amigos');
$currency_helper = CitruscartHelperBase::getInstance('Currency');
foreach ($list as &$item) {
if ($item->user_id < Citruscart::getGuestIdStart()) {
if (strlen($item->billing_first_name) || strlen($item->billing_last_name)) {
$item->user_name = JText::_('COM_CITRUSCART_GUEST') . ' - ' . $item->billing_first_name . ' ' . $item->billing_last_name;
} else {
$item->user_name = JText::_('COM_CITRUSCART_GUEST') . ' - ' . $item->userinfo_email;
}
}
$item->link = 'index.php?option=com_citruscart&controller=orders&view=orders&task=edit&id=' . $item->order_id;
$item->link_view = 'index.php?option=com_citruscart&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
require_once JPATH_SITE . '/libraries/dioscouri/library/parameter.php';
$order_currency = new DSCParameter($item->order_currency);
$order_currency = $order_currency->toArray();
//JModelLegacy::addIncludePath( JPATH_ADMINISTRATOR.'/components/com_citruscart/models' );
//$cmodel = JModelLegacy::getInstance( 'Currencies', 'CitruscartModel' );
//$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: 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 < Citruscart::getGuestIdStart()) {
Citruscart::load('CitruscartHelperOrder', 'helpers.order');
$this->order_hash = CitruscartHelperOrder::getHashInvoice($this);
}
return parent::store($updateNulls);
}