本文整理汇总了PHP中Citruscart类的典型用法代码示例。如果您正苦于以下问题:PHP Citruscart类的具体用法?PHP Citruscart怎么用?PHP Citruscart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Citruscart类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _setModelState
/**
* Sets the model's state
*
* @return array()
*/
function _setModelState()
{
$state = parent::_setModelState();
$app = JFactory::getApplication();
$model = $this->getModel($this->get('suffix'));
$ns = $this->getNamespace();
$state['order'] = $app->getUserStateFromRequest($ns . '.filter_order', 'filter_order', 'tbl.created_datetime', 'cmd');
$state['direction'] = $app->getUserStateFromRequest($ns . '.filter_direction', 'filter_direction', 'DESC', 'word');
$state['filter_orderid'] = $app->getUserStateFromRequest($ns . 'filter_orderid', 'filter_orderid', '', '');
$state['filter_type'] = $app->getUserStateFromRequest($ns . 'filter_type', 'filter_type', '', '');
$state['filter_transactionid'] = $app->getUserStateFromRequest($ns . 'filter_transactionid', 'filter_transactionid', '', '');
$state['filter_user'] = $app->getUserStateFromRequest($ns . 'filter_user', 'filter_user', '', '');
$state['filter_userid'] = $app->getUserStateFromRequest($ns . 'filter_userid', 'filter_userid', '', '');
$state['filter_id_from'] = $app->getUserStateFromRequest($ns . 'id_from', 'filter_id_from', '', '');
$state['filter_id_to'] = $app->getUserStateFromRequest($ns . 'id_to', 'filter_id_to', '', '');
$state['filter_date_from'] = $app->getUserStateFromRequest($ns . 'date_from', 'filter_date_from', '', '');
$state['filter_date_from_expires'] = $app->getUserStateFromRequest($ns . 'date_from_expires', 'filter_date_from_expires', '', '');
$state['filter_date_to_expires'] = $app->getUserStateFromRequest($ns . 'date_to_expires', 'filter_date_to_expires', '', '');
$state['filter_date_to'] = $app->getUserStateFromRequest($ns . 'date_to', 'filter_date_to', '', '');
$state['filter_datetype'] = 'created';
$state['filter_total_from'] = $app->getUserStateFromRequest($ns . 'filter_total_from', 'filter_total_from', '', '');
$state['filter_total_to'] = $app->getUserStateFromRequest($ns . 'filter_total_to', 'filter_total_to', '', '');
$state['filter_enabled'] = $app->getUserStateFromRequest($ns . 'filter_enabled', 'filter_enabled', '', '');
$state['filter_lifetime'] = $app->getUserStateFromRequest($ns . 'filter_lifetime', 'filter_lifetime', '', '');
if (Citruscart::getInstance()->get('display_subnum', 0)) {
$state['filter_subnum'] = $app->getUserStateFromRequest($ns . 'filter_subnum', 'filter_subnum', '', '');
}
foreach ($state as $key => $value) {
$model->setState($key, $value);
}
return $state;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:37,代码来源:subscriptions.php
示例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;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:67,代码来源:productissues.php
示例3: getItems
/**
*
* @return unknown_type
*/
function getItems()
{
// Check the registry to see if our Citruscart class has been overridden
if (!class_exists('Citruscart')) {
JLoader::register("Citruscart", JPATH_ADMINISTRATOR . "/components/com_citruscart/defines.php");
}
// load the config class
Citruscart::load('Citruscart', 'defines');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
// get the model
Citruscart::load('CitruscartModelCategories', 'models.categories');
$model = new CitruscartModelCategories(array());
// $model = JModelLegacy::getInstance( 'Categories', 'CitruscartModel' ); doesnt work sometimes without no apparent reason
// TODO Make this depend on the current filter_category?
// setting the model's state tells it what items to return
$model->setState('filter_enabled', '1');
$model->setState('order', 'tbl.lft');
// set the states based on the parameters
// using the set filters, get a list
$items = $model->getList();
if (!empty($items)) {
foreach ($items as $item) {
Citruscart::load('CitruscartHelperRoute', 'helpers.route');
$item->itemid = CitruscartHelperRoute::category($item->category_id, true);
if (empty($item->itemid)) {
$item->itemid = $this->params->get('itemid');
}
}
}
return $items;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:35,代码来源:helper.php
示例4: 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);
}
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:33,代码来源:productfiles.php
示例5: filterZones
/**
*
* @return unknown_type
*/
function filterZones()
{
$app = JFactory::getApplication();
JLoader::import('com_citruscart.library.json', JPATH_ADMINISTRATOR . '/components');
Citruscart::load('CitruscartSelect', 'library.select');
$idtag = 'zone_id';
$countryid = $app->input->getInt('countryid', 0);
$idprefix = $app->input->getInt('idprefix', 0);
/*
$countryid = JRequest::getVar( 'countryid', '', 'request', 'int' );
$idprefix = JRequest::getVar( 'idprefix', '', 'request');
*/
if (count($idprefix) > 0) {
$idtag = $idprefix . $idtag;
}
$url = "index.php?option=com_citruscart&format=raw&controller=zones&task=addZone&geozoneid=";
$attribs = array('class' => 'inputbox', 'size' => '1');
$hookgeozone = $app->input->get('hookgeozone', TRUE);
//$hookgeozone = JRequest::getVar( 'hookgeozone', TRUE, 'request', 'boolean' );
if ($hookgeozone) {
$attribs['onchange'] = 'citruscartDoTask( \'' . $url . '\'+document.getElementById(\'geozone_id\').value+\'&zoneid=\'+this.options[this.selectedIndex].value, \'current_zones_wrapper\', \'\');';
}
$html = CitruscartSelect::zone('', $idtag, $countryid, $attribs, $idtag, true);
// set response array
$response = array();
$response['msg'] = $html;
// encode and echo (need to echo to send back to browser)
echo json_encode($response);
return;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:34,代码来源:zones.php
示例6: calculateStatsOrder
/**
* Method to calculate statistics about manufacturers in an order
*
* @param $items Array of order items
*
* @return Array with list of manufacturers and their stats
*/
function calculateStatsOrder($items)
{
$db = JFactory::getDbo();
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
Citruscart::load('CitruscartQuery', 'library.query');
$q = new CitruscartQuery();
$q->select('manufacturer_id');
$q->from('`#__citruscart_products`');
$result = array();
foreach ($items as $item) {
$q->where('product_id = ' . (int) $item->product_id);
$db->setQuery($q);
$res = $db->loadObject();
if ($res == null) {
$man_id = 0;
} else {
$man_id = $res->manufacturer_id;
}
if (!isset($result[$man_id])) {
$model = JModelLegacy::getInstance('Manufacturers', 'CitruscartModel');
$model->setId($man_id);
if (!($man_item = $model->getItem())) {
$man_item = new stdClass();
}
$result[$man_id] = $man_item;
$result[$man_id]->subtotal = 0;
$result[$man_id]->total_tax = 0;
}
$result[$man_id]->subtotal += $item->orderitem_final_price;
$result[$man_id]->total_tax += $item->orderitem_tax;
}
return $result;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:40,代码来源:manufacturer.php
示例7: _getData
/**
* Override parent::_getData()
*
* @return unknown_type
*/
function _getData()
{
$app = JFactory::getApplication();
Citruscart::load('CitruscartQuery', 'library.query');
// just in case
$db = JFactory::getDbo();
$state = $this->_getState();
$model = $this->_getModel();
// filter only complete orders ( 3 - Shipped, 5 - Complete, 17 - Payment Received )
$order_states = array('3', '5', '17');
$model->setState('filter_orderstates', $order_states);
$model->setState('order', '`price_total`');
$model->setState('direction', 'DESC');
$query = $model->getQuery(true);
$query->group('p.manufacturer_id');
$field[] = " SUM(tbl.orderitem_final_price) AS `price_total` ";
$field[] = " SUM(tbl.orderitem_quantity) AS `count_items` ";
$query->select($field);
$model->setQuery($query);
$list = $model->getList();
if (!count($list)) {
return $list;
}
return $list;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:30,代码来源:report_salesbymanufacturer.php
示例8: renderSubmenu
public function renderSubmenu()
{
require_once JPATH_ADMINISTRATOR . '/components/com_citruscart/helpers/toolbar.php';
$toolbar = new CitruscartToolBar();
Citruscart::load('CitruscartToolbar', 'helpers.toolbar.php');
$toolbar->renderLinkbar();
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:7,代码来源:view.html.php
示例9: 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);
}
}
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:34,代码来源:sql.php
示例10: insertCategories
/**
* Adds items to the pathway if they aren't already present
*
* @param array $items A full pathway to the category, an array of pathway objects
* @param int $item_id A default Itemid to use if none is found
*/
function insertCategories($items, $item_id = '')
{
$app = JFactory::getApplication();
$pathway = $app->getPathway();
$pathway_values = $pathway->getPathway();
// find the array_key of the first item in items that is in pathway
$found = false;
$found_key = 0;
$new_pathway = array();
foreach ($items as $item) {
if (!$found) {
foreach ($pathway_values as $key => $object) {
if (!$found) {
if ($object->name == $item->name) {
$found = true;
$found_key = $key;
}
}
}
}
}
foreach ($pathway_values as $key => $object) {
if ($key < $found_key || !$found) {
$new_pathway[] = $object;
}
}
// $new_pathway now has the pathway UP TO where we should inject the category pathway
foreach ($items as $item) {
$category_itemid = !empty($item_id) ? $item_id : Citruscart::getClass("CitruscartHelperRoute", 'helpers.route')->category($item->id, true);
$item->link .= "&Itemid=" . $category_itemid;
$new_pathway[] = $item;
}
$pathway->setPathway($new_pathway);
return $new_pathway;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:41,代码来源:pathway.php
示例11: _default
/**
*
* @return void
**/
function _default($tpl = null)
{
Citruscart::load('CitruscartSelect', 'library.select');
Citruscart::load('CitruscartGrid', 'library.grid');
Citruscart::load('CitruscartTools', 'library.tools');
/* Get the application */
$app = JFactory::getApplication();
// check config
$row = Citruscart::getInstance();
$this->assign('row', $row);
// add toolbar buttons
JToolBarHelper::apply('save');
JToolBarHelper::cancel('close', 'COM_CITRUSCART_CLOSE');
// plugins
$filtered = array();
$items = CitruscartTools::getPlugins();
for ($i = 0; $i < count($items); $i++) {
$item = $items[$i];
// Check if they have an event
if ($hasEvent = CitruscartTools::hasEvent($item, 'onListConfigCitruscart')) {
// add item to filtered array
$filtered[] = $item;
}
}
$items = $filtered;
$this->assign('items_sliders', $items);
// Add pane
jimport('joomla.html.pane');
//$sliders = JPane::getInstance( 'sliders' );
//$this->assign('sliders', $sliders);
// form
//$validate = JSession::getFormToken();
$validate = JSession::getFormToken();
$form = array();
$view = strtolower($app->input->get('view'));
//$view = strtolower( JRequest::getVar('view') );
$form['action'] = "index.php?option=com_citruscart&controller={$view}&view={$view}";
$form['validate'] = "<input type='hidden' name='{$validate}' value='1' />";
$this->assign('form', $form);
// set the required image
// TODO Fix this to use defines
$required = new stdClass();
$required->text = JText::_('COM_CITRUSCART_REQUIRED');
$required->image = "<img src='" . JURI::root() . "/media/citruscart/images/required_16.png' alt='{$required->text}'>";
$this->assign('required', $required);
// Elements
$elementArticleModel = JModelLegacy::getInstance('ElementArticle', 'CitruscartModel');
$this->assign('elementArticleModel', $elementArticleModel);
// terms
$elementArticle_terms = $elementArticleModel->fetchElement('article_terms', $row->get('article_terms'));
$resetArticle_terms = $elementArticleModel->clearElement('article_terms', '0');
$this->assign('elementArticle_terms', $elementArticle_terms);
$this->assign('resetArticle_terms', $resetArticle_terms);
// shipping
$elementArticle_shipping = $elementArticleModel->fetchElement('article_shipping', $row->get('article_shipping'));
$resetArticle_shipping = $elementArticleModel->clearElement('article_shipping', '0');
$this->assign('elementArticle_shipping', $elementArticle_shipping);
$this->assign('resetArticle_shipping', $resetArticle_shipping);
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:63,代码来源:view.html.php
示例12: __construct
function __construct($config = array())
{
parent::__construct($config);
$this->defines = Citruscart::getInstance();
Citruscart::load("CitruscartHelperRoute", 'helpers.route');
$this->router = new CitruscartHelperRoute();
$this->user = JFactory::getUser();
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:8,代码来源:controller.php
示例13: __construct
public function __construct($config = array())
{
parent::__construct($config);
$this->defines = Citruscart::getInstance();
if (JDEBUG) {
$this->cache_enabled = false;
}
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:8,代码来源:_base.php
示例14: includeCitruscartModel
/**
* Include a particular Citruscart Model
* @param $name the name of the mode (ex: products)
*/
protected function includeCitruscartModel($name)
{
if (strtolower($name) != 'base') {
Citruscart::load('CitruscartModel' . ucfirst(strtolower($name)), 'models.' . strtolower($name));
} else {
Citruscart::load('CitruscartModelBase', 'models._base');
}
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:12,代码来源:_base.php
示例15: __construct
function __construct($config = array())
{
parent::__construct($config);
if (empty($this->helpers)) {
$this->helpers = array();
}
Citruscart::load("CitruscartHelperProduct", 'helpers.product');
$this->helpers['product'] = new CitruscartHelperProduct();
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:9,代码来源:view.html.php
示例16: pathway
/**
* Method to build the pathway/breadcrumbs
* return string
*/
function pathway()
{
$input = JFactory::getApplication()->input;
$pathway = '';
$catid = $input->getInt('filter_category');
if ($this->params->get('showhome')) {
$homeText = $this->params->get('hometext');
$homeText = empty($homeText) ? JText::_('COM_CITRUSCART_HOME') : $homeText;
$pathway .= " <a href='index.php'>" . $homeText . '</a> ';
}
// get the root category
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
$root = JTable::getInstance('Categories', 'CitruscartTable')->getRoot();
$root_itemid = Citruscart::getClass("CitruscartHelperRoute", 'helpers.route')->category($root->category_id, true);
$catRoot = $this->params->get('showcatroot', '1');
if ($catRoot && $catid != $root->category_id) {
$pathway .= $this->getSeparator();
$link = JRoute::_("index.php?option=com_citruscart&view=products&filter_category=" . $root->category_id . "&Itemid=" . $root_itemid, false);
$rootText = $this->params->get('roottext');
$rootText = empty($rootText) ? JText::_('COM_CITRUSCART_ALL_CATEGORIES') : $rootText;
$pathway .= " <a href='{$link}'>" . $rootText . '</a> ';
}
$table = JTable::getInstance('Categories', 'CitruscartTable');
$table->load($catid);
if (empty($table->category_id)) {
return $pathway;
}
$path = $table->getPath();
foreach ($path as $cat) {
if (!$cat->isroot) {
if (!($itemid = Citruscart::getClass("CitruscartHelperRoute", 'helpers.route')->category($cat->category_id, true))) {
$itemid = $root_itemid;
}
$slug = $cat->category_alias ? ":{$cat->category_alias}" : "";
$link = JRoute::_("index.php?option=com_citruscart&view=products&filter_category=" . $cat->category_id . $slug . "&Itemid=" . $itemid, false);
if (!empty($pathway)) {
$pathway .= $this->getSeparator();
}
$pathway .= " <a href='{$link}'>" . JText::_($cat->category_name) . '</a> ';
}
}
if (!empty($pathway)) {
$pathway .= $this->getSeparator();
}
if ($linkSelf = $this->params->get('linkself')) {
if (!($itemid = Citruscart::getClass("CitruscartHelperRoute", 'helpers.route')->category($table->category_id, true))) {
$itemid = $root_itemid;
}
$slug = $table->category_alias ? ":{$table->category_alias}" : "";
$link = JRoute::_("index.php?option=com_citruscart&view=products&filter_category=" . $table->category_id . $slug . "&Itemid=" . $itemid, false);
$pathway .= " <a href='{$link}'>" . JText::_($table->category_name) . '</a> ';
} else {
$pathway .= JText::_($table->category_name);
}
return $pathway;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:60,代码来源:helper.php
示例17: 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;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:60,代码来源:elementproductmultiple.php
示例18: save
/**
* save a record
* @return void
*/
function save()
{
$app = JFactory::getApplication();
$error = false;
$errorMsg = "";
$model = $this->getModel($this->get('suffix'));
$config = Citruscart::getInstance();
$properties = $config->getProperties();
foreach ($properties as $key => $value) {
unset($row);
$row = $model->getTable('config');
$newvalue = $app->input->getHtml($key);
$value_exists = array_key_exists($key, $_POST);
if ($value_exists && !empty($key)) {
// proceed if newvalue present in request. prevents overwriting for non-existent values.
$row->load(array('config_name' => $key));
$row->config_name = $key;
$row->value = $newvalue;
if (!$row->save()) {
$error = true;
$errorMsg .= JText::_('COM_CITRUSCART_COULD_NOT_STORE') . " {$key} :: " . $row->getError() . " - ";
}
}
}
$model->clearCache();
if (!$error) {
$this->messagetype = 'message';
$this->message = JText::_('COM_CITRUSCART_SAVED');
JFactory::getApplication()->triggerEvent('onAfterSave' . $this->get('suffix'), array($row));
} else {
$this->messagetype = 'notice';
$this->message = JText::_('COM_CITRUSCART_SAVE_FAILED') . " - " . $errorMsg;
}
$redirect = "index.php?option=com_citruscart&view=" . $this->get('suffix');
$group = $app->input->get('group');
switch ($group) {
default:
if ($group) {
$redirect .= "&task=" . $group;
}
break;
}
//$format = JRequest::getVar('format');
$format = $app->input->get('format');
if ($format == 'raw') {
$response = array();
$response['error'] = $error;
$response['msg'] = $this->message;
echo json_encode($response);
return;
}
$redirect = JRoute::_($redirect, false);
$this->setRedirect($redirect, $this->message, $this->messagetype);
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:58,代码来源:config.php
示例19: getAddressElementsData
/**
* Gets data about which address fields should be visible and validable on a form
*
* @params $address_type Address type
*
* @return 2-dimensional associative array with data
*/
public static function getAddressElementsData($address_type)
{
$config = Citruscart::getInstance();
$address_fields = array('address_name', 'title', 'name', 'middle', 'last', 'address1', 'address2', 'country', 'city', 'zip', 'zone', 'phone', 'company', 'tax_number');
$elements = array();
for ($i = 0, $c = count($address_fields); $i < $c; $i++) {
$f = $address_fields[$i];
$show = $config->get('show_field_' . $f, '3');
$valid = $config->get('validate_field_' . $f, '3');
$elements[$f] = array($show == '3' || $show == $address_type, $valid == '3' || $valid == $address_type);
}
return $elements;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:20,代码来源:addresses.php
示例20: 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;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:19,代码来源:subscriptionhistory.php
注:本文中的Citruscart类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论