本文整理汇总了PHP中Citruscart::getClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Citruscart::getClass方法的具体用法?PHP Citruscart::getClass怎么用?PHP Citruscart::getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Citruscart
的用法示例。
在下文中一共展示了Citruscart::getClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
// get the model
$model = JModelLegacy::getInstance('Manufacturers', 'CitruscartModel');
// 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.manufacturer_name');
// set the states based on the parameters
// using the set filters, get a list
$items = $model->getList();
if (!empty($items)) {
foreach ($items as $item) {
// this gives error
$item->itemid = Citruscart::getClass("CitruscartHelperRoute", 'helpers.route')->manufacturer($item->manufacturer_id, false);
if (empty($item->itemid)) {
$item->itemid = $this->params->get('itemid');
}
}
}
return $items;
}
示例2: 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;
}
示例3: getPAOCategories
public function getPAOCategories($category_ids)
{
$model = Citruscart::getClass('CitruscartModelProducts', 'models.products');
$model->setState('filter_published_date', $this->state['filter_published_date']);
$return = $model->getPAOCategories($category_ids);
return $return;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: set
function set()
{
$currency_id = JRequest::getVar('currency_id', 0);
if ($currency_id) {
$helper = Citruscart::getClass('CitruscartHelperBase', 'helpers._base');
$helper->setSessionVariable('currency_id', $currency_id);
}
$return = JRequest::getVar('return', '');
if ($return) {
$url = base64_decode($return);
} else {
$url = 'index.php?option=com_citruscart&view=products';
}
$this->setRedirect(JRoute::_($url));
$this->redirect();
return;
}
示例8: 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);
}
示例9: display
/**
* Displays search results
*
* (non-PHPdoc)
* @see Citruscart/admin/CitruscartController#display($cachable)
*/
function display($cachable = false, $urlparams = false)
{
$input = JFactory::getApplication()->input;
$input->set('view', $this->get('suffix'));
$view = $this->getView($this->get('suffix'), JFactory::getDocument()->getType());
$model = $this->getModel($this->get('suffix'));
$this->_setModelState();
if ($items = $model->getList()) {
foreach ($items as $row) {
$row->category_id = 0;
$categories = Citruscart::getClass('CitruscartHelperProduct', 'helpers.product')->getCategories($row->product_id);
if (!empty($categories)) {
$row->category_id = $categories[0];
}
$itemid = Citruscart::getClass("CitruscartHelperRoute", 'helpers.route')->product($row->product_id, $row->category_id, true);
$row->itemid = empty($itemid) ? $input->getInt('Itemid') : $itemid;
}
}
parent::display($cachable, $urlparams);
}
示例10: getProducts
/**
* Sample use of the products model for getting products with certain properties
* See admin/models/products.php for all the filters currently built into the model
*
* @param $parameters
* @return unknown_type
*/
function getProducts()
{
// 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');
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
$user = JFactory::getUser();
// get the model
$model = JModelLegacy::getInstance('OrderItems', 'CitruscartModel');
$model->setState('limit', $this->params->get('max_number', '5'));
$model->setState('filter_userid', $user->id);
$model->setState('order', 'created_date');
$model->setState('direction', 'DESC');
$query = $model->getQuery();
$query->select("MAX(o.order_id) AS order_id");
$query->select("MAX(o.created_date) AS created_date");
if ($this->params->get('display_downloads_only')) {
$query->join('LEFT', '#__citruscart_productfiles AS files ON tbl.product_id = files.product_id');
$query->where("files.productfile_id IS NOT NULL");
}
$query->group('tbl.product_id');
$model->setQuery($query);
$router = Citruscart::getClass('CitruscartHelperRoute', 'helpers.route');
$product = Citruscart::getClass('CitruscartHelperProduct', 'helpers.product');
if ($items = $model->getList()) {
foreach ($items as $item) {
$category = null;
if ($categories = $product->getCategories($item->product_id)) {
$category = $categories[0];
}
$item->link = $router->product($item->product_id, $category);
}
}
return $items;
}
示例11: getEmailRecipients
/**
* Returns an array of user objects
* of all users who should receive this email
*
* @param $data Object
* @return array
*/
private function getEmailRecipients($id, $type = 'order')
{
$recipients = array();
switch ($type) {
case 'subscription_expiring':
case 'subscription_expired':
case 'subscription_new':
case 'new_subscription':
case 'subscription':
$model = Citruscart::getClass('CitruscartModelSubscriptions', 'models.subscriptions');
$model->setId($id);
$subscription = $model->getItem();
$model_order = Citruscart::getClass('CitruscartModelOrders', 'models.orders');
$model_order->setId($subscription->order_id);
$order = $model_order->getItem();
if ($subscription->user_id > 0) {
$user = JUser::getInstance($subscription->user_id);
// string needle NOT found in haystack
if (!in_array($user->email, $recipients) && JMailHelper::isEmailAddress($user->email)) {
$recipients[] = $user->email;
}
} else {
// add the userinfo email to the list of recipients
if (!in_array($order->userinfo_email, $recipients) && JMailHelper::isEmailAddress($order->userinfo_email)) {
$recipients[] = $order->userinfo_email;
}
}
// add the order user_email to the list of recipients
if (!in_array($order->user_email, $recipients) && JMailHelper::isEmailAddress($order->user_email)) {
$recipients[] = $order->user_email;
}
break;
case "new_order":
$system_recipients = $this->getSystemEmailRecipients();
foreach ($system_recipients as $r) {
if (!in_array($r->email, $recipients)) {
$recipients[] = $r->email;
}
}
$additional_recipients = $this->getAdditionalEmailRecipients();
foreach ($additional_recipients as $r) {
if (!in_array($r, $recipients)) {
$recipients[] = $r;
}
}
$model = Citruscart::getClass('CitruscartModelOrders', 'models.orders');
$model->setId($id);
$order = $model->getItem();
jimport('joomla.mail.helper');
// add the userinfo user_email to the list of recipients
if (!in_array($order->userinfo_email, $recipients) && JMailHelper::isEmailAddress($order->userinfo_email)) {
$recipients[] = $order->userinfo_email;
}
// add the order user_email to the list of recipients
if (!in_array($order->user_email, $recipients) && JMailHelper::isEmailAddress($order->user_email)) {
$recipients[] = $order->user_email;
}
case 'order':
default:
$model = Citruscart::getClass('CitruscartModelOrders', 'models.orders');
$model->setId($id);
$order = $model->getItem();
if ($order->user_id > 0) {
$user = JUser::getInstance($order->user_id);
// string needle NOT found in haystack
if (!in_array($user->email, $recipients)) {
$recipients[] = $user->email;
}
} else {
// add the userinfo email to the list of recipients
if (!in_array($order->userinfo_email, $recipients) && JMailHelper::isEmailAddress($order->userinfo_email)) {
$recipients[] = $order->userinfo_email;
}
}
// add the order user_email to the list of recipients
if (!in_array($order->user_email, $recipients) && JMailHelper::isEmailAddress($order->user_email)) {
$recipients[] = $order->user_email;
}
break;
}
// allow plugins to modify the order email recipient list
JFactory::getApplication()->triggerEvent('onGetEmailRecipients', array($id, $type, &$recipients));
return $recipients;
}
示例12: getAddToCart
/**
* Gets a product's add to cart section
* formatted for display
*
* @param int $address_id
* @return string html
*/
private function getAddToCart($product_id, $values = array(), $params = array())
{
$input = JFactory::getApplication()->input;
$html = '';
Citruscart::load('CitruscartModelProducts', 'models.products');
$model = JModelLegacy::getInstance('Products', 'CitruscartModel');
$user = JFactory::getUser();
Citruscart::load('CitruscartHelperUser', 'helpers.user');
$filter_group = CitruscartHelperUser::getUserGroup($user->id, $product_id);
$model->setState('filter_group', $filter_group);
$model->setId($product_id);
$row = $model->getItem(false);
$vars = new JObject();
if ($row->product_notforsale || Citruscart::getInstance()->get('shop_enabled') == '0') {
return $html;
}
$vars->item = $row;
$vars->product_id = $product_id;
$vars->values = $values;
$vars->validation = "index.php?option=com_citruscart&view=products&task=validate&format=raw";
$vars->params = $params;
$config = Citruscart::getInstance();
$show_tax = $config->get('display_prices_with_tax');
$vars->show_tax = $show_tax;
$vars->tax = 0;
$vars->taxtotal = '';
$vars->shipping_cost_link = '';
if ($show_tax) {
// finish CitruscartHelperUser::getGeoZone -- that's why this isn't working
Citruscart::load('CitruscartHelperUser', 'helpers.user');
$geozones = CitruscartHelperUser::getGeoZones(JFactory::getUser()->id);
if (empty($geozones)) {
// use the default
$table = JTable::getInstance('Geozones', 'CsitruscartTable');
$table->load(array('geozone_id' => Citruscart::getInstance()->get('default_tax_geozone')));
$geozones = array($table);
}
$taxtotal = CitruscartHelperProduct::getTaxTotal($product_id, $geozones);
$tax = $taxtotal->tax_total;
$vars->taxtotal = $taxtotal;
$vars->tax = $tax;
}
// TODO What about this??
$show_shipping = $config->get('display_prices_with_shipping');
if ($show_shipping) {
$article_link = $config->get('article_shipping', '');
$shipping_cost_link = JRoute::_('index.php?option=com_content&view=article&id=' . $article_link);
$vars->shipping_cost_link = $shipping_cost_link;
}
$invalidQuantity = '0';
if (empty($values)) {
$product_qty = '1';
// get the default set of attribute_csv
$default_attributes = CitruscartHelperProduct::getDefaultAttributes($product_id);
sort($default_attributes);
$attributes_csv = implode(',', $default_attributes);
$availableQuantity = Citruscart::getClass('CitruscartHelperProduct', 'helpers.product')->getAvailableQuantity($product_id, $attributes_csv);
if ($availableQuantity->product_check_inventory && $product_qty > $availableQuantity->quantity) {
$invalidQuantity = '1';
}
}
if (!empty($values)) {
$product_id = !empty($values['product_id']) ? (int) $values['product_id'] : $input->getInt('product_id');
$product_qty = !empty($values['product_qty']) ? (int) $values['product_qty'] : '1';
// TODO only display attributes available based on the first selected attribute?
$attributes = array();
foreach ($values as $key => $value) {
if (substr($key, 0, 10) == 'attribute_') {
$attributes[] = $value;
}
}
sort($attributes);
$attributes_csv = implode(',', $attributes);
// Integrity checks on quantity being added
if ($product_qty < 0) {
$product_qty = '1';
}
// using a helper file to determine the product's information related to inventory
$availableQuantity = Citruscart::getClass('CitruscartHelperProduct', 'helpers.product')->getAvailableQuantity($product_id, $attributes_csv);
if ($availableQuantity->product_check_inventory && $product_qty > $availableQuantity->quantity) {
$invalidQuantity = '1';
}
}
$vars->availableQuantity = $availableQuantity;
$vars->invalidQuantity = $invalidQuantity;
JPluginHelper::importPlugin('Citruscart');
ob_start();
JFactory::getApplication()->triggerEvent('onDisplayProductAttributeOptions', array($product_id));
$vars->onDisplayProductAttributeOptions = ob_get_contents();
ob_end_clean();
ob_start();
echo $this->_getLayout('product_buy', $vars);
$html = ob_get_contents();
//.........这里部分代码省略.........
示例13: Copyright
<?php
/*------------------------------------------------------------------------
# com_citruscart
# ------------------------------------------------------------------------
# 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);
$items = $this->product_relations_data->items;
$products_model = Citruscart::getClass('CitruscartModelProducts', 'models.products');
?>
<div id="product_relations">
<h4><?php
echo JText::_('COM_CITRUSCART_YOU_MAY_ALSO_BE_INTERESTED_IN');
?>
</h4>
<?php
$k = 0;
?>
<ul class="citruscart_products_containers">
<?php
foreach ($items as $item) {
?>
<li class="citruscart_product_relation_lists">
示例14: Copyright
/*------------------------------------------------------------------------
# com_citruscart
# ------------------------------------------------------------------------
# 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');
$form = $this->form;
$row = $this->row;
JFilterOutput::objectHTMLSafe($row);
$histories = Citruscart::getClass('CitruscartHelperSubscription', 'helpers.subscription')->getHistory($row->subscription_id);
Citruscart::load('CitruscartGrid', 'library.grid');
$menu = CitruscartMenu::getInstance();
?>
<div class='componentheading'>
<span><?php
echo JText::_('COM_CITRUSCART_SUBSCRIPTION_DETAILS');
?>
</span>
</div>
<?php
if ($menu) {
$menu->display();
}
示例15: foreach
<th class="subcategory_name" style="background-color: #DDDDDD;">
<?php
echo $this->cat->category_name;
?>
</th>
<th class="subcategory_price" style="background-color: #DDDDDD;">
<?php
echo JText::_('COM_CITRUSCART_PRICE');
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($items as $item) {
$itemid = Citruscart::getClass("CitruscartHelperRoute", 'helpers.route')->category($this->cat->category_id, true);
$item->itemid = !empty($itemid) ? $itemid : $app->input->getInt('Itemid', $itemid);
?>
<tr>
<td>
<a href="<?php
echo JRoute::_($item->link . "&filter_category=" . $this->cat->category_id . "&Itemid=" . $item->itemid);
?>
">
<?php
echo $item->product_name;
?>
</a>
</td>
<td class="subcategory_price">
<?php