本文整理汇总了PHP中Tienda::getClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Tienda::getClass方法的具体用法?PHP Tienda::getClass怎么用?PHP Tienda::getClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tienda
的用法示例。
在下文中一共展示了Tienda::getClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 : Tienda::getClass("TiendaHelperRoute", 'helpers.route')->category($item->id, true);
$item->link .= "&Itemid=" . $category_itemid;
$new_pathway[] = $item;
}
$pathway->setPathway($new_pathway);
return $new_pathway;
}
示例2: getPAOCategories
public function getPAOCategories($category_ids)
{
$model = Tienda::getClass('TiendaModelProducts', 'models.products');
$model->setState('filter_published_date', $this->state['filter_published_date']);
$return = $model->getPAOCategories($category_ids);
return $return;
}
示例3: getItems
/**
*
* @return unknown_type
*/
function getItems()
{
// Check the registry to see if our Tienda class has been overridden
if (!class_exists('Tienda')) {
JLoader::register("Tienda", JPATH_ADMINISTRATOR . "/components/com_tienda/defines.php");
}
// load the config class
Tienda::load('Tienda', 'defines');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
// get the model
$model = JModel::getInstance('Manufacturers', 'TiendaModel');
// 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 = Tienda::getClass("TiendaHelperRoute", 'helpers.route')->manufacturer($item->manufacturer_id, false);
if (empty($item->itemid)) {
$item->itemid = $this->params->get('itemid');
}
}
}
return $items;
}
示例4: plgTiendaProduct_customfields
function plgTiendaProduct_customfields(&$subject, $config)
{
parent::__construct($subject, $config);
$this->loadLanguage('', JPATH_ADMINISTRATOR);
//Check the installation integrity
$helper = Tienda::getClass('TiendaHelperDiagnosticsProductCustomFields', 'product_customfields.diagnostic', array('site' => 'site', 'type' => 'plugins', 'ext' => 'tienda'));
$helper->checkInstallation();
}
示例5: pathway
/**
* Method to build the pathway/breadcrumbs
* @return string
*/
function pathway()
{
$pathway = '';
$catid = JRequest::getInt('filter_category');
if ($this->params->get('showhome')) {
$homeText = $this->params->get('hometext');
$homeText = empty($homeText) ? JText::_('COM_TIENDA_HOME') : $homeText;
$pathway .= " <a href='index.php'>" . $homeText . '</a> ';
}
// get the root category
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$root = JTable::getInstance('Categories', 'TiendaTable')->getRoot();
$root_itemid = Tienda::getClass("TiendaHelperRoute", '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_tienda&view=products&filter_category=" . $root->category_id . "&Itemid=" . $root_itemid, false);
$rootText = $this->params->get('roottext');
$rootText = empty($rootText) ? JText::_('COM_TIENDA_ALL_CATEGORIES') : $rootText;
$pathway .= " <a href='{$link}'>" . $rootText . '</a> ';
}
$table = JTable::getInstance('Categories', 'TiendaTable');
$table->load($catid);
if (empty($table->category_id)) {
return $pathway;
}
$path = $table->getPath();
foreach (@$path as $cat) {
if (!$cat->isroot) {
if (!($itemid = Tienda::getClass("TiendaHelperRoute", 'helpers.route')->category($cat->category_id, true))) {
$itemid = $root_itemid;
}
$slug = $cat->category_alias ? ":{$cat->category_alias}" : "";
$link = JRoute::_("index.php?option=com_tienda&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 = Tienda::getClass("TiendaHelperRoute", 'helpers.route')->category($table->category_id, true))) {
$itemid = $root_itemid;
}
$slug = $table->category_alias ? ":{$table->category_alias}" : "";
$link = JRoute::_("index.php?option=com_tienda&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;
}
示例6: store
/**
*
* @param unknown_type $updateNulls
* @return unknown_type
*/
function store($updateNulls = false)
{
if ($return = parent::store($updateNulls)) {
if ($this->notify_customer == '1') {
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelSubscriptions", "models.subscriptions");
$model->setId($this->subscription_id);
$subscription = $model->getItem();
$helper->sendEmailNotices($subscription, 'subscription');
}
}
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') {
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "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;
}
示例8: display
/**
* Displays search results
*
* (non-PHPdoc)
* @see tienda/admin/TiendaController#display($cachable)
*/
function display($cachable = false, $urlparams = false)
{
JRequest::setVar('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 = Tienda::getClass('TiendaHelperProduct', 'helpers.product')->getCategories($row->product_id);
if (!empty($categories)) {
$row->category_id = $categories[0];
}
$itemid = Tienda::getClass("TiendaHelperRoute", 'helpers.route')->product($row->product_id, $row->category_id, true);
$row->itemid = empty($itemid) ? JRequest::getInt('Itemid') : $itemid;
}
}
parent::display($cachable, $urlparams);
}
示例9: processStringForOrder
/**
* Processes a new order
*
* @param $order_id
* @return unknown_type
*/
public function processStringForOrder($order_id, &$string)
{
// get the order
$model = JModel::getInstance('Orders', 'TiendaModel');
$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 < Tienda::getGuestIdStart()) {
$this->_user = $order->user_id;
} else {
$this->_user = JFactory::getUser($order->user_id);
}
$this->products_model = Tienda::getClass('TiendaModelProducts', 'models.products');
return $this->processString($string);
}
示例10: getGroups
public function getGroups()
{
$groups = array();
if (empty($this->user->id)) {
$groups[] = $this->defines->get('default_user_group', '1');
return $groups;
}
$model = Tienda::getClass("TiendaModelUserGroups", 'models.usergroups');
$model->setState('filter_user', $this->user->id);
if ($usergroups = $model->getList()) {
foreach ($usergroups as $usergroup) {
$groups[] = $usergroup->group_id;
}
}
if (empty($groups)) {
$groups = array();
$groups[] = $this->defines->get('default_user_group', '1');
}
return $groups;
}
示例11: 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 Tienda class has been overridden
if (!class_exists('Tienda')) {
JLoader::register("Tienda", JPATH_ADMINISTRATOR . "/components/com_tienda/defines.php");
}
// load the config class
Tienda::load('Tienda', 'defines');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
$user = JFactory::getUser();
// get the model
$model = JModel::getInstance('OrderItems', 'TiendaModel');
$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', '#__tienda_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 = Tienda::getClass('TiendaHelperRoute', 'helpers.route');
$product = Tienda::getClass('TiendaHelperProduct', '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;
}
示例12: __construct
function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
$language = JFactory::getLanguage();
$language->load('plg_tienda_' . $this->_element, JPATH_ADMINISTRATOR, 'en-GB', true);
$language->load('plg_tienda_' . $this->_element, JPATH_ADMINISTRATOR, null, true);
$this->account_id = $this->params->get('account_id', '');
// Load helper
if (version_compare(JVERSION, '1.6.0', 'ge')) {
// Joomla! 1.6+ code here
$this->helper = Tienda::getClass('TiendaHelperGoogle', 'googleproducts.googleproducts.helper', array('site' => 'site', 'type' => 'plugins', 'ext' => 'tienda'));
} else {
// Joomla! 1.5 code here
$this->helper = Tienda::getClass('TiendaHelperGoogle', 'googleproducts.helper', array('site' => 'site', 'type' => 'plugins', 'ext' => 'tienda'));
}
// Params
$this->helper->setUsername($this->params->get('username', ''));
$this->helper->setPassword($this->params->get('password', ''));
$this->helper->service = 'structuredcontent';
$this->helper->source = JURI::base();
$this->buildfeed = $this->params->get('build_feed', '0');
//$this->helper->source = 'http://www.weble.it';
}
示例13: _process
/**
* Processing the payment
*
* @param $data array form post data
* @return string HTML to display
*/
function _process($data)
{
$errors = array();
// load the orderpayment record and set some values
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment_id = $data['orderpayment_id'];
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($orderpayment_id);
$orderpayment->transaction_details = $data['orderpayment_type'];
$orderpayment->transaction_id = $data['orderpayment_id'];
$orderpayment->transaction_status = "Payment Incomplete";
// check the stored amount against the payment amount
Tienda::load('TiendaHelperBase', 'helpers._base');
$stored_amount = TiendaHelperBase::number($orderpayment->get('orderpayment_amount'), array('thousands' => ''));
$respond_amount = TiendaHelperBase::number($data['orderpayment_amount'], array('thousands' => ''));
if ($stored_amount != $respond_amount) {
$errors[] = JText::_('TIENDA ALPHAUSERPOINTS PAYMENT MESSAGE AMOUNT INVALID');
$errors[] = $stored_amount . " != " . $respond_amount;
}
// check if user has enough points
$userpoints = $this->getUserpoints();
if ($data['amount_points'] > $userpoints) {
$errors[] = JText::_('TIENDA ALPHAUSERPOINTS PAYMENT MESSAGE NOT ENOUGH POINTS');
}
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($orderpayment->order_id);
if (count($errors)) {
// if an error occurred
$order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
$setOrderPaymentReceived = false;
$send_email = false;
} else {
$order->order_state_id = $this->params->get('payment_received_order_state', '17');
// PAYMENT RECEIVED
$orderpayment->transaction_status = "Payment Received";
//reduce number of alphauserpoints
$errors[] = $this->reduceUserpoints($data['amount_points']);
// do post payment actions
$setOrderPaymentReceived = true;
// send email
$send_email = true;
}
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if (!empty($setOrderPaymentReceived)) {
$this->setOrderPaymentReceived($orderpayment->order_id);
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order = $model->getItem();
$helper->sendEmailNotices($order, 'new_order');
}
return count($errors) ? implode("\n", $errors) : '';
}
示例14: sendShipmentAjax
/**
*
* Enter description here ...
* @return unknown_type
*/
function sendShipmentAjax()
{
$model = JModel::getInstance('Orders', 'TiendaModel');
$model->setId(JRequest::getInt('order_id'));
$order = $model->getItem();
if ($this->sendShipment($order)) {
$html = JText::_('COM_TIENDA_SHIPMENT_SENT') . '<br />';
$path = Tienda::getPath('order_files') . DS . $order->order_id;
$helper = Tienda::getClass('TiendaHelperProduct', 'helpers.product');
$labels = $helper->getServerFiles($path);
$plugin = $this->_getMe();
$plugin_id = $plugin->id;
$vars = new JObject();
$vars->link = "index.php?option=com_plugins&view=plugin&client=site&task=edit&cid[]={$plugin_id}";
$vars->id = $plugin_id;
$vars->labels = $labels;
$vars->order_id = $order->order_id;
$html .= $this->_getLayout('labels', $vars);
return $html;
} else {
return JText::_('COM_TIENDA_SHIPMENT_FAILED') . '<br />' . $this->getError();
}
}
示例15: _process
function _process($data)
{
$post = JRequest::get('post');
$orderpayment_id = @$data['ssl_invoice_number'];
$errors = array();
$send_email = false;
// load the orderpayment record and set some values
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($orderpayment_id);
if (empty($orderpayment_id) || empty($orderpayment->orderpayment_id)) {
$errors[] = JText::_('VIRTUALMERCHANT MESSAGE INVALID ORDERPAYMENTID');
return count($errors) ? implode("\n", $errors) : '';
}
$orderpayment->transaction_details = $data['ssl_result_message'];
$orderpayment->transaction_id = $data['ssl_txn_id'];
$orderpayment->transaction_status = $data['ssl_result'];
// check the stored amount against the payment amount
Tienda::load('TiendaHelperBase', 'helpers._base');
$stored_amount = TiendaHelperBase::number($orderpayment->get('orderpayment_amount'), array('thousands' => ''));
$respond_amount = TiendaHelperBase::number($data['ssl_amount'], array('thousands' => ''));
if ($stored_amount != $respond_amount) {
$errors[] = JText::_('VIRTUALMERCHANT MESSAGE AMOUNT INVALID');
$errors[] = $stored_amount . " != " . $respond_amount;
}
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($orderpayment->order_id);
if (count($errors)) {
// if an error occurred
$order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
} else {
$order->order_state_id = $this->params->get('payment_received_order_state', '17');
// PAYMENT RECEIVED
// do post payment actions
$setOrderPaymentReceived = true;
// send email
$send_email = true;
}
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if (!empty($setOrderPaymentReceived)) {
$this->setOrderPaymentReceived($orderpayment->order_id);
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order = $model->getItem();
$helper->sendEmailNotices($order, 'new_order');
}
return count($errors) ? implode("\n", $errors) : '';
return true;
}