本文整理汇总了PHP中CitruscartHelperBase类的典型用法代码示例。如果您正苦于以下问题:PHP CitruscartHelperBase类的具体用法?PHP CitruscartHelperBase怎么用?PHP CitruscartHelperBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CitruscartHelperBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: downloadFile
/**
* downloads a file
*
* @return void
*/
function downloadFile()
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
$productfile_id = $app->input->getInt('id', 0);
//$productfile_id = intval( JRequest::getvar( 'id', '', 'request', 'int' ) );
$product_id = $app->input->getInt('product_id', 0);
$link = 'index.php?option=com_citruscart&view=products&task=edit&id=' . $product_id;
Citruscart::load('CitruscartHelperBase', 'helpers._base');
$helper = CitruscartHelperBase::getInstance('ProductDownload', 'CitruscartHelper');
JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_citruscart' . DS . 'tables');
$productfile = JTable::getInstance('ProductFiles', 'CitruscartTable');
$productfile->load($productfile_id);
if (empty($productfile->productfile_id)) {
$this->messagetype = 'notice';
$this->message = JText::_('COM_CITRUSCART_INVALID FILE');
$this->setRedirect($link, $this->message, $this->messagetype);
return false;
}
// log and download
Citruscart::load('CitruscartFile', 'library.file');
// geting the ProductDownloadId to updated for which productdownload_max is greater then 0
$productToDownload = $helper->getProductDownloadInfo($productfile->productfile_id, $user->id);
if ($downloadFile = CitruscartFile::download($productfile)) {
$link = JRoute::_($link, false);
$this->setRedirect($link);
}
}
示例2: check
/**
* Checks row for data integrity.
* Assumes working dates have been converted to local time for display,
* so will always convert working dates to GMT
*
* @return unknown_type
*/
function check()
{
if (empty($this->product_id)) {
$this->setError(JText::_('COM_CITRUSCART_PRODUCT_ASSOCIATION_REQUIRED'));
return false;
}
$offset = JFactory::getConfig()->getValue('config.offset');
if (isset($this->publishing_date)) {
$this->publishing_date = date('Y-m-d H:i:s', strtotime(CitruscartHelperBase::getOffsetDate($this->publishing_date, -$offset)));
}
$nullDate = $this->_db->getNullDate();
Citruscart::load('CitruscartHelperBase', 'helpers._base');
if (empty($this->created_date) || $this->created_date == $nullDate) {
$date = JFactory::getDate();
$this->created_date = $date->toSql();
}
$date = JFactory::getDate();
$this->modified_date = $date->toSql();
$act = strtotime(Date('Y-m-d', strtotime($this->publishing_date)));
$db = $this->_db;
if (empty($this->product_issue_id)) {
$q = 'SELECT `publishing_date` FROM `#__citruscart_productissues` WHERE `product_id`=' . $this->product_id . ' ORDER BY `publishing_date` DESC LIMIT 1';
$db->setQuery($q);
$next = $db->loadResult();
if ($next === null) {
return true;
}
$next = strtotime($next);
if ($act <= $next) {
$this->setError(JText::_('COM_CITRUSCART_PUBLISHING_DATE_IS_NOT_PRESERVING_ISSUE_ORDER') . ' - ' . $this->publishing_date);
return false;
}
} else {
$q = 'SELECT `publishing_date` FROM `#__citruscart_productissues` WHERE `product_issue_id`=' . $this->product_issue_id;
$db->setQuery($q);
$original = $db->loadResult();
if ($act == strtotime(Date('Y-m-d', strtotime($original)))) {
return true;
}
$q = 'SELECT `publishing_date` FROM `#__citruscart_productissues` WHERE `product_id`=' . $this->product_id . ' AND `publishing_date` < \'' . $original . '\' ORDER BY `publishing_date` DESC LIMIT 1';
$db->setQuery($q);
$prev = $db->loadResult();
$q = 'SELECT `publishing_date` FROM `#__citruscart_productissues` WHERE `product_id`=' . $this->product_id . ' AND `publishing_date` > \'' . $original . '\' ORDER BY `publishing_date` ASC LIMIT 1';
$db->setQuery($q);
$next = $db->loadResult();
if ($prev === null) {
$prev = 0;
} else {
$prev = strtotime($prev);
}
if ($next) {
$next = strtotime($next);
}
if ($prev >= $act || $next && $next <= $act) {
$this->setError(JText::_('COM_CITRUSCART_PUBLISHING_DATE_IS_NOT_PRESERVING_ISSUE_ORDER') . ' - ' . $this->publishing_date);
return false;
}
}
return true;
}
示例3: save
/**
* Run function after saving
*/
function save($src = '', $orderingFilter = '', $ignore = '')
{
if ($return = parent::save($src, $orderingFilter, $ignore)) {
Citruscart::load("CitruscartHelperProduct", 'helpers.product');
$helper = CitruscartHelperBase::getInstance('product');
$helper->doProductQuantitiesReconciliation($this->product_id, '0');
}
return $return;
}
示例4: check
/**
* Checks row for data integrity.
* Assumes working dates have been converted to local time for display,
* so will always convert working dates to GMT
*
* @return unknown_type
*/
function check()
{
if (empty($this->product_id)) {
$this->setError(JText::_('COM_CITRUSCART_PRODUCT_ASSOCIATION_REQUIRED'));
return false;
}
$nullDate = $this->_db->getNullDate();
Citruscart::load('CitruscartHelperBase', 'helpers._base');
$CitruscartHelperBase = new CitruscartHelperBase();
$this->product_price_startdate = $this->product_price_startdate != $nullDate ? $CitruscartHelperBase->getOffsetDate($this->product_price_startdate) : $this->product_price_startdate;
$this->product_price_enddate = $this->product_price_enddate != $nullDate ? $CitruscartHelperBase->getOffsetDate($this->product_price_enddate) : $this->product_price_enddate;
if (empty($this->created_date) || $this->created_date == $nullDate) {
$date = JFactory::getDate();
$this->created_date = $date->toSql();
}
$date = JFactory::getDate();
$this->modified_date = $date->toSql();
return true;
}
示例5: getList
/**
* Method to get content article data for the frontpage
*
* @since 1.5
*/
function getList()
{
$where = array();
$mainframe = JFactory::getApplication();
if (!empty($this->_list)) {
return $this->_list;
}
// Initialize variables
$db = $this->getDBO();
$filter = null;
// Get some variables from the request
// $sectionid = JRequest::getVar( 'sectionid', -1, '', 'int' );
// $redirect = $sectionid;
// $option = JRequest::get( 'option' );
$filter_order = $mainframe->getUserStateFromRequest('userelement.filter_order', 'filter_order', '', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest('userelement.filter_order_Dir', 'filter_order_Dir', '', 'word');
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest('userelement.limitstart', 'limitstart', 0, 'int');
$search = $mainframe->getUserStateFromRequest('userelement.search', 'search', '', 'string');
$search = JString::strtolower($search);
if (!$filter_order) {
$filter_order = 'tbl.product_id';
}
$order = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;
$all = 1;
// Keyword filter
if ($search) {
$where[] = 'LOWER( tbl.product_id ) LIKE ' . $db->q('%' . $db->escape($search, true) . '%', false);
$where[] = 'LOWER( tbl.product_name ) LIKE ' . $db->q('%' . $db->escape($search, true) . '%', false);
}
// Build the where clause of the query
$where = count($where) ? ' WHERE ' . implode(' OR ', $where) : '';
// Get the total number of records
$query = 'SELECT COUNT(tbl.product_id)' . ' FROM #__citruscart_products AS tbl' . $where;
$db->setQuery($query);
$total = $db->loadResult();
// Create the pagination object
jimport('joomla.html.pagination');
$this->_page = new JPagination($total, $limitstart, $limit);
// Get the products
$query = 'SELECT tbl.*, pp.* ' . ' FROM #__citruscart_products AS tbl' . ' LEFT JOIN #__citruscart_productprices pp ON pp.product_id = tbl.product_id ' . $where . $order;
$db->setQuery($query, $this->_page->limitstart, $this->_page->limit);
$this->_list = $db->loadObjectList();
//currency formatting
Citruscart::load('CitruscartHelperBase', 'helpers._base');
foreach ($this->_list as $item) {
$item->product_price = CitruscartHelperBase::currency($item->product_price);
}
// If there is a db query error, throw a HTTP 500 and exit
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
return false;
}
return $this->_list;
}
示例6: save
/**
* Run function when saving
* @see Citruscart/admin/tables/CitruscartTable#save()
*/
function save($src = '', $orderingFilter = '', $ignore = '')
{
if ($return = parent::save($src, $orderingFilter, $ignore)) {
$pa = JTable::getInstance('ProductAttributes', 'CitruscartTable');
$pa->load($this->productattribute_id);
Citruscart::load("CitruscartHelperProduct", 'helpers.product');
$helper = CitruscartHelperBase::getInstance('product');
$helper->doProductQuantitiesReconciliation($pa->product_id);
}
return $return;
}
示例7: store
/**
*
* @param unknown_type $updateNulls
* @return unknown_type
*/
function store($updateNulls = false)
{
if ($return = parent::store($updateNulls)) {
if ($this->notify_customer == '1') {
Citruscart::load("CitruscartHelperBase", 'helpers._base');
$helper = CitruscartHelperBase::getInstance('Email');
$model = Citruscart::getClass("CitruscartModelSubscriptions", "models.subscriptions");
$model->setId($this->subscription_id);
$subscription = $model->getItem();
$helper->sendEmailNotices($subscription, 'subscription');
}
}
return $return;
}
示例8: store
/**
*
* @param unknown_type $updateNulls
* @return unknown_type
*/
function store($updateNulls = false)
{
if ($return = parent::store($updateNulls)) {
if ($this->notify_customer == '1') {
Citruscart::load("CitruscartHelperBase", 'helpers._base');
$helper = CitruscartHelperBase::getInstance('Email');
$model = Citruscart::getClass("CitruscartModelOrders", "models.orders");
$model->setId($this->order_id);
// this isn't necessary because you specify the requested PK id as a getItem() argument
$order = $model->getItem($this->order_id, true);
$helper->sendEmailNotices($order, 'order');
}
}
return $return;
}
示例9: display
function display($cachable = false, $urlparams = false)
{
$uri = JURI::getInstance();
$view = $this->getView($this->get('suffix'), JFactory::getDocument()->getType());
$view->set('hidemenu', false);
$view->set('_doTask', true);
$view->setLayout('default');
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$url = "index.php?option=com_users&view=user&task=user.edit";
} else {
$url = "index.php?option=com_user&view=user&task=edit";
}
Citruscart::load("CitruscartHelperBase", 'helpers._base');
$helper = CitruscartHelperBase::getInstance('Ambra');
if ($helper->isInstalled()) {
$url = "index.php?option=com_ambra&view=users&task=edit&return=" . base64_encode($uri->__toString());
}
$view->assign('url_profile', $url);
parent::display($cachable, $urlparams);
}
示例10: store
public function store($updateNulls = false)
{
// Check the table activation status first
if (!$this->active) {
// Activate it with a default value
$this->setType('');
}
if ($this->getType() == 'datetime') {
if (isset($this->eavvalue_value)) {
$null_date = JFactory::getDbo()->getNullDate();
if ($this->eavvalue_value == $null_date || $this->eavvalue_value == '') {
$this->eavvalue_value = $null_date;
} else {
$offset = JFactory::getConfig()->getValue('config.offset');
$this->eavvalue_value = date('Y-m-d H:i:s', strtotime(CitruscartHelperBase::getOffsetDate($this->eavvalue_value, -$offset)));
}
}
}
return parent::store($updateNulls);
}
示例11: _buildQueryFields
protected function _buildQueryFields(&$query)
{
Citruscart::load('CitruscartHelperUser', 'helpers.user');
$date = JFactory::getDate()->toSql();
$filter_product = $this->getState('filter_product');
$user = CitruscartHelperBase::getInstance('user');
if (strlen($filter_product)) {
$default_group = $user->getUserGroup(JFactory::getUser()->id, (int) $filter_product);
} else {
$default_group = Citruscart::getInstance()->get('default_user_group', '1');
}
$fields = array();
$fields[] = " p_from.product_name as product_name_from ";
$fields[] = " p_from.product_sku as product_sku_from ";
$fields[] = " p_from.product_model as product_model_from ";
$fields[] = "\n (\n SELECT\n prices.product_price\n FROM\n #__citruscart_productprices AS prices\n WHERE\n prices.product_id = tbl.product_id_from\n AND prices.group_id = '{$default_group}'\n AND prices.product_price_startdate <= '{$date}'\n AND (prices.product_price_enddate >= '{$date}' OR prices.product_price_enddate = '0000-00-00 00:00:00' )\n ORDER BY prices.price_quantity_start ASC\n LIMIT 1\n )\n AS product_price_from ";
$fields[] = " p_to.product_name as product_name_to ";
$fields[] = " p_to.product_sku as product_sku_to ";
$fields[] = " p_to.product_model as product_model_to ";
$fields[] = "\n (\n SELECT\n prices.product_price\n FROM\n #__citruscart_productprices AS prices\n WHERE\n prices.product_id = tbl.product_id_to\n AND prices.group_id = '{$default_group}'\n AND prices.product_price_startdate <= '{$date}'\n AND (prices.product_price_enddate >= '{$date}' OR prices.product_price_enddate = '0000-00-00 00:00:00' )\n ORDER BY prices.price_quantity_start ASC\n LIMIT 1\n )\n AS product_price_to ";
$query->select($this->getState('select', 'tbl.*'));
$query->select($fields);
}
示例12:
echo $item->shipping_address_2 ? $item->shipping_address_2 . ", " : "";
echo $item->shipping_city . ", ";
echo $item->shipping_zone_name . " ";
echo $item->shipping_postal_code . " ";
echo $item->shipping_country_name;
}
?>
<?php
if (!empty($item->order_number)) {
echo "<br/><b>" . JText::_('COM_CITRUSCART_ORDER_NUMBER') . "</b>: " . $item->order_number;
}
?>
</td>
<td style="text-align: center;">
<label class="label label-warning"><?php
echo CitruscartHelperBase::currency($item->order_total, $item->currency);
?>
</label>
<?php
if (!empty($item->commissions)) {
?>
<br/>
<?php
JHTML::_('behavior.tooltip');
?>
<a href="index.php?option=com_amigos&view=commissions&filter_orderid=<?php
echo $item->order_id;
?>
" target="_blank">
<img src='<?php
echo JURI::root(true);
示例13:
<div class='onDisplayProductAttributeOptions_wrapper'>
<?php
echo $this->onDisplayProductAttributeOptions;
?>
</div>
<?php
}
?>
<?php
echo JText::_('COM_CITRUSCART_QUANTITY');
?>
<input type="text" name="quantity" value="1" size="10" />
<br/>
<?php
echo JText::_('COM_CITRUSCART_BASE_PRICE');
?>
: <?php
echo CitruscartHelperBase::currency($row->price);
?>
<br/>
<input type="submit" name="add_to_cart" value="<?php
echo JText::_('COM_CITRUSCART_ADD_TO_ORDER');
?>
" class="btn btn-success" />
<input type="hidden" name="task" id="task" value="addtocart" />
<input type="hidden" name="product_id" value="<?php
echo $row->product_id;
?>
" />
示例14:
<td colspan="2">
<input style="float: right;" type="submit" class="btn btn-success" value="<?php
echo JText::_('COM_CITRUSCART_UPDATE_QUANTITIES');
?>
" name="update" />
</td>
</tr>
<tr>
<td colspan="4" style="font-weight: bold;">
<?php
echo JText::_('COM_CITRUSCART_SUBTOTAL');
?>
</td>
<td style="text-align: right;">
<span id="totalAmountDue"><?php
echo CitruscartHelperBase::currency($subtotal);
?>
</span>
</td>
</tr>
<tr>
<td colspan="5" style="white-space: nowrap;">
<b><?php
echo JText::_('COM_CITRUSCART_TAX_AND_SHIPPING_TOTALS');
?>
</b>
<br/>
<?php
echo JText::_('COM_CITRUSCART_CALCULATED_DURING_CHECKOUT_PROCESS');
?>
</td>
示例15: Copyright
<?php
/*------------------------------------------------------------------------
# com_citruscart - citruscart
# ------------------------------------------------------------------------
# author Citruscart Team - Citruscart http://www.citruscart.com
# copyright Copyright (C) 2014 - 2019 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
-------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');
/*Layout for displaying refreshed total amount.*/
JHTML::_('stylesheet', 'menu.css', 'media/citruscart/css/');
JHtml::_('script', 'media/citruscart/js/citruscart.js', false, false);
JHTML::_('script', 'joomla.javascript.js', 'includes/js/');
Citruscart::load('CitruscartGrid', 'library.grid');
$state = $this->state;
$order = $this->order;
$items = $this->orderitems;
echo CitruscartHelperBase::currency($items);