本文整理汇总了PHP中Citruscart::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Citruscart::getInstance方法的具体用法?PHP Citruscart::getInstance怎么用?PHP Citruscart::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Citruscart
的用法示例。
在下文中一共展示了Citruscart::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildQueryFields
protected function _buildQueryFields(&$query)
{
$field = array();
$field[] = " p.product_name ";
$field[] = " p.product_sku ";
$field[] = " p.product_model ";
$field[] = " p.product_full_image ";
$field[] = " p.product_ships ";
$field[] = " p.product_weight ";
$field[] = " p.product_length ";
$field[] = " p.product_width ";
$field[] = " p.product_height ";
$field[] = " p.product_recurs ";
$field[] = " p.product_enabled ";
$field[] = " p.product_notforsale ";
$field[] = " p.product_rating ";
$field[] = " p.product_comments ";
$field[] = " m.manufacturer_name AS manufacturer_name ";
// This subquery returns the default price for the product and allows for sorting by price
$date = JFactory::getDate()->toSql();
$default_group = Citruscart::getInstance()->get('default_user_group', '1');
$filter_group = (int) $this->getState('filter_group');
if (empty($filter_group)) {
$filter_group = $default_group;
}
$field[] = "\n\t\t\t(\n\t\t\tSELECT\n\t\t\t\tprices.product_price\n\t\t\tFROM\n\t\t\t\t#__citruscart_productprices AS prices\n\t\t\tWHERE\n\t\t\t\tprices.product_id = tbl.product_id\n\t\t\t\tAND prices.group_id = '{$filter_group}'\n\t\t\t\tAND prices.product_price_startdate <= '{$date}'\n\t\t\t\tAND (prices.product_price_enddate >= '{$date}' OR prices.product_price_enddate = '0000-00-00 00:00:00' )\n\t\t\t\tORDER BY prices.price_quantity_start ASC\n\t\t\tLIMIT 1\n\t\t\t)\n\t\tAS product_price ";
$query->select($this->getState('select', 'tbl.*'));
$query->select($field);
}
示例2: _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;
}
示例3: _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);
}
示例4: setStatesCSV
/**
* Set the CSV of states to be reported on
* @param $csv
* @return unknown_type
*/
function setStatesCSV($csv = '')
{
if (empty($csv)) {
$csv = Citruscart::getInstance()->get('orderstates_csv', '2, 3, 5, 17');
}
$array = explode(',', $csv);
$this->_statesCSV = "'" . implode("','", $array) . "'";
}
示例5: __construct
public function __construct($config = array())
{
parent::__construct($config);
$this->defines = Citruscart::getInstance();
if (JDEBUG) {
$this->cache_enabled = false;
}
}
示例6: __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();
}
示例7: 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);
}
示例8: 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;
}
示例9: _isInstalled
/**
* Checks the extension is installed
*
* @return boolean
*/
function _isInstalled()
{
$success = false;
jimport('joomla.filesystem.file');
if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_citruscart/defines.php')) {
$success = true;
if (!class_exists('Citruscart')) {
JLoader::register("Citruscart", JPATH_ADMINISTRATOR . "/components/com_citruscart/defines.php");
}
$this->defines = Citruscart::getInstance();
Citruscart::load('CitruscartHelperProduct', 'helpers.product');
}
return $success;
}
示例10: __construct
/**
* Sets the modules params as a property of the object
* @param unknown_type $params
* @return unknown_type
*/
function __construct($params)
{
$this->params = $params;
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');
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
$this->defines = Citruscart::getInstance();
Citruscart::load("CitruscartHelperRoute", 'helpers.route');
$this->router = new CitruscartHelperRoute();
$this->user = JFactory::getUser();
}
示例11: canRun
/**
* Checks params and lastchecked to see if function should run again today
*
* @return unknown_type
*/
function canRun()
{
$success = false;
// Use config to store & retrieve lastchecked from the __config table
$config = Citruscart::getInstance();
$lastchecked = $config->get('subscriptions_last_checked');
$date = JFactory::getDate();
$today = $date->format("%Y-%m-%d 00:00:00");
if ($lastchecked < $today) {
if (JFactory::getApplication()->isAdmin() && !empty(JFactory::getUser()->id)) {
JError::raiseNotice('plgSystemCitruscart_Subscriptions::canRun', sprintf(JText::_('COM_CITRUSCART_CITRUSCART_MSG_SENDING_SUBSCRIPTION_EMAIL_NOTICES'), $lastchecked, $today));
}
$success = true;
}
return $success;
}
示例12: checkLimit
/**
* Method to check if we can still add a product to compare
* @return boolean
*/
public function checkLimit()
{
$canAdd = true;
$model = JModelLegacy::getInstance('ProductCompare', 'CitruscartModel');
$user = JFactory::getUser();
$model->setState('filter_user', $user->id);
if (empty($user->id)) {
$session = JFactory::getSession();
$model->setState('filter_session', $session->getId());
}
$total = $model->getTotal();
$limit = Citruscart::getInstance()->get('compared_products', '5');
if ($total >= $limit) {
$canAdd = false;
}
return $canAdd;
}
示例13: check
/**
* Checks the entry to maintain DB integrity
* @return unknown_type
*/
function check()
{
$config = Citruscart::getInstance();
if (!$this->addresstype_id) {
$this->addresstype_id = '1';
}
$address_type = $this->addresstype_id;
if (empty($this->user_id)) {
$this->user_id = JFactory::getUser()->id;
if (empty($this->user_id)) {
$this->setError(JText::_('COM_CITRUSCART_USER_REQUIRED'));
}
}
Citruscart::load('CitruscartHelperAddresses', 'helpers.addresses');
$elements = CitruscartHelperAddresses::getAddressElementsData($address_type);
if (empty($this->address_name)) {
$this->address_name = $this->address_1;
}
if (empty($this->address_name) && $elements['address_name'][1]) {
$this->setError(JText::_("COM_CITRUSCART_PLEASE_INCLUDE_AN_ADDRESS_TITLE" . $address_type));
}
$address_checks = array(array('first_name', 'name', "COM_CITRUSCART_FIRST_NAME_REQUIRED"), array('middle_name', 'middle', "COM_CITRUSCART_MIDDLE_NAME_REQUIRED"), array('last_name', 'last', "COM_CITRUSCART_LAST_NAME_REQUIRED"), array('address_1', 'address1', "COM_CITRUSCART_AT_LEAST_ONE_ADDRESS_LINE_IS_REQUIRED"), array('address_2', 'address2', "COM_CITRUSCART_SECOND_ADDRESS_LINE_IS_REQUIRED"), array('company', 'company', "COM_CITRUSCART_COMPANY_REQUIRED"), array('tax_number', 'tax_number', "COM_CITRUSCART_COMPANY_TAX_NUMBER_REQUIRED"), array('city', 'city', "COM_CITRUSCART_CITY_REQUIRED"), array('postal_code', 'zip', "COM_CITRUSCART_POSTAL_CODE_REQUIRED"), array('phone_1', 'phone', "COM_CITRUSCART_PHONE_REQUIRED"));
for ($i = 0, $c = count($address_checks); $i < $c; $i++) {
$current = $address_checks[$i];
if (empty($this->{$current}[0]) && $elements[$current[1]][1]) {
$this->setError(JText::_($current[2]));
}
}
if (empty($this->country_id)) {
if ($elements['country'][1]) {
$this->setError(JText::_('COM_CITRUSCART_COUNTRY_REQUIRED'));
} else {
$this->country_id = 9999;
}
}
$countryA = explode(',', trim($config->get('ignored_countries', '83,188,190')));
if (empty($this->zone_id) && !in_array($this->country_id, $countryA)) {
if (isset($elements['zone'][1])) {
$this->setError(JText::_('COM_CITRUSCART_ZONE_REQUIRED'));
} else {
$this->zone_id = 9999;
}
}
return parent::check();
}
示例14: CitruscartHelperImage
/**
* Protected! Use the getInstance
*/
protected function CitruscartHelperImage()
{
// Parent Helper Construction
parent::__construct();
$config = Citruscart::getInstance();
// Load default Parameters
$this->product_img_height = $config->get('product_img_height');
$this->product_img_width = $config->get('product_img_width');
$this->category_img_height = $config->get('category_img_height');
$this->category_img_width = $config->get('category_img_width');
$this->manufacturer_img_width = $config->get('manufacturer_img_width');
$this->manufacturer_img_height = $config->get('manufacturer_img_height');
$this->product_img_path = Citruscart::getPath('products_images');
$this->category_img_path = Citruscart::getPath('categories_images');
$this->manufacturer_img_path = Citruscart::getPath('manufacturers_images');
$this->product_thumb_path = Citruscart::getPath('products_thumbs');
$this->category_thumb_path = Citruscart::getPath('categories_thumbs');
$this->manufacturer_thumb_path = Citruscart::getPath('manufacturers_thumbs');
}
示例15: _form
/**
* Basic methods for a form
* @param $tpl
* @return unknown_type
*/
function _form($tpl = '')
{
parent::_form($tpl);
$shop_info = array();
// Get the shop country name
$countryModel = JModelLegacy::getInstance('Countries', 'CitruscartModel');
$countryModel->setId(Citruscart::getInstance()->get('shop_country'));
$countryItem = $countryModel->getItem();
if ($countryItem) {
$shop_info['shop_country_name'] = $countryItem->country_name;
}
// Get the shop zone name
$zoneModel = JModelLegacy::getInstance('Zones', 'CitruscartModel');
$zoneModel->setId(Citruscart::getInstance()->get('shop_zone'));
$zoneItem = $zoneModel->getItem();
if ($zoneItem) {
$shop_info['shop_zone_name'] = $zoneItem->zone_name;
}
$this->assign('shop_info', (object) $shop_info);
}