本文整理汇总了PHP中Tienda类的典型用法代码示例。如果您正苦于以下问题:PHP Tienda类的具体用法?PHP Tienda怎么用?PHP Tienda使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tienda类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendBug
/**
* Submits a bug report to Dioscouri.
* Thanks so much! They really help improve the product!
*/
function sendBug()
{
$mainframe = JFactory::getApplication();
$body = JRequest::getVar('body');
$name = JRequest::getVar('title');
$body .= "\n\n Project: tienda";
$body .= "\n Tracker: Bug";
$body .= "\n Affected Version: " . Tienda::getVersion();
$doc = JDocument::getInstance('raw');
ob_start();
$option = JRequest::getCmd('option');
$db = JFactory::getDBO();
$path = JPATH_ADMINISTRATOR . '/components/com_admin/';
require_once $path . 'admin.admin.html.php';
$path .= 'tmpl/';
require_once $path . 'sysinfo_system.php';
require_once $path . 'sysinfo_directory.php';
require_once $path . 'sysinfo_phpinfo.php';
require_once $path . 'sysinfo_phpsettings.php';
require_once $path . 'sysinfo_config.php';
jimport('joomla.filesystem.file');
$contents = ob_get_contents();
ob_end_clean();
$doc->setBuffer($contents);
$contents = $doc->render();
$sitename = $config->get('sitename', $mainframe->getCfg('sitename'));
// write file with info
$config = JFactory::getConfig();
$filename = 'system_info_' . $sitename . '.html';
$file = JPATH_SITE . '/tmp/' . $filename;
JFile::write($file, $contents);
$mailer = JFactory::getMailer();
$success = false;
// For now, bug submission goes to info@dioscouri.com,
// but in the future, it will go to projects@dioscouri.com
// (once we get the Redmine auto-create working properly
// and format the subject/body of the email properly)
$mailer->addRecipient('projects@dioscouri.com');
$mailer->setSubject($name);
$mailfrom = $config->get('emails_defaultemail', $mainframe->getCfg('mailfrom'));
$fromname = $config->get('emails_defaultname', $mainframe->getCfg('fromname'));
// check user mail format type, default html
$mailer->setBody($body);
$mailer->addAttachment($file);
$sender = array($mailfrom, $fromname);
$mailer->setSender($sender);
$sent = $mailer->send();
if ($sent == '1') {
$success = true;
}
JFile::delete($file);
if ($success) {
$msg = JText::_('COM_TIENDA_BUG_SUBMIT_OK');
$msgtype = 'message';
} else {
$msg = JText::_('COM_TIENDA_BUG_SUBMIT_FAIL');
$msgtype = 'notice';
}
$mainframe->redirect(JRoute::_('index.php?option=com_tienda&view=dashboard'), $msg, $msgtype);
}
示例2: downloadFile
/**
* downloads a file
*
* @return void
*/
function downloadFile()
{
$user = JFactory::getUser();
$productfile_id = intval(JRequest::getvar('id', '', 'request', 'int'));
$product_id = intval(JRequest::getvar('product_id', '', 'request', 'int'));
$link = 'index.php?option=com_tienda&view=products&task=edit&id=' . $product_id;
Tienda::load('TiendaHelperBase', 'helpers._base');
$helper = TiendaHelperBase::getInstance('ProductDownload', 'TiendaHelper');
JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_tienda' . DS . 'tables');
$productfile = JTable::getInstance('ProductFiles', 'TiendaTable');
$productfile->load($productfile_id);
if (empty($productfile->productfile_id)) {
$this->messagetype = 'notice';
$this->message = JText::_('COM_TIENDA_INVALID FILE');
$this->setRedirect($link, $this->message, $this->messagetype);
return false;
}
// log and download
Tienda::load('TiendaFile', '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 = TiendaFile::download($productfile)) {
$link = JRoute::_($link, false);
$this->setRedirect($link);
}
}
示例3: processExport
/**
* Method to process the export
* @return
*/
function processExport()
{
$export = new JObject();
if (empty($this->_model)) {
$this->_errors = JText::_('COM_TIENDA_PLEASE_SET_A_MODEL_IN_THE_PLUGIN_METHOD_PROCESSEXPORT');
return $this;
}
$classname = 'TiendaGenericExporterModel' . $this->_model;
if (version_compare(JVERSION, '1.6.0', 'ge')) {
// Joomla! 1.6+ code here
Tienda::load($classname, 'genericexporter.genericexporter.models.' . $this->_model, array('site' => 'site', 'type' => 'plugins', 'ext' => 'tienda'));
} else {
// Joomla! 1.5 code here
Tienda::load($classname, 'genericexporter.models.' . $this->_model, array('site' => 'site', 'type' => 'plugins', 'ext' => 'tienda'));
}
$class = new $classname();
$items = $class->loadDataList();
$this->_modelone = $class->getSingleName();
if (empty($items)) {
$this->_errors = JText::_('COM_TIENDA_NO_DATA_FOUND');
return $this;
}
//convert items to array upto child nodes
//$items = $this->objectToArray( $items );
$f_name = $this->_model . '_' . time() . '.xml';
$this->_link = 'tmp/' . $f_name;
$this->_name = $f_name;
if (!($res = $this->fromXMLToFile('tmp/' . $f_name, $items))) {
$this->_errors = JText::_('COM_TIENDA_ERROR_SAVING_FILE');
}
return $this;
}
示例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_TIENDA_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(TiendaHelperBase::getOffsetDate($this->publishing_date, -$offset)));
}
$nullDate = $this->_db->getNullDate();
Tienda::load('TiendaHelperBase', 'helpers._base');
if (empty($this->created_date) || $this->created_date == $nullDate) {
$date = JFactory::getDate();
$this->created_date = $date->toMysql();
}
$date = JFactory::getDate();
$this->modified_date = $date->toMysql();
$act = strtotime(Date('Y-m-d', strtotime($this->publishing_date)));
$db = $this->_db;
if (empty($this->product_issue_id)) {
$q = 'SELECT `publishing_date` FROM `#__tienda_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_TIENDA_PUBLISHING_DATE_IS_NOT_PRESERVING_ISSUE_ORDER') . ' - ' . $this->publishing_date);
return false;
}
} else {
$q = 'SELECT `publishing_date` FROM `#__tienda_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 `#__tienda_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 `#__tienda_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_TIENDA_PUBLISHING_DATE_IS_NOT_PRESERVING_ISSUE_ORDER') . ' - ' . $this->publishing_date);
return false;
}
}
return true;
}
示例5: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$output = '
<input type="text" class="text_area" value="" id="pluginstiendaproductPrice" name="plugins[tiendaproductPrice]">
<span class="k2Note">' . JText::_('Set Normal Price Now Special Prices Later') . '</span>
';
$id = JRequest::getInt('cid');
if ($id) {
$K2Item = JTable::getInstance('K2Item', 'Table');
$K2Item->load($id);
$params = new K2Parameter($K2Item->plugins, JPATH_PLUGINS . '/k2/tienda.xml', 'tienda');
$productID = $params->get('productID');
if ($productID) {
Tienda::load('TiendaUrl', 'library.url');
Tienda::load("TiendaHelperProduct", 'helpers.product');
$prices = TiendaHelperProduct::getPrices($productID);
if (count($prices)) {
$output = '<div class="tiendaButton">' . TiendaUrl::popup("index.php?option=com_tienda&controller=products&task=setprices&id=" . $productID . "&tmpl=component", JText::_('COM_TIENDA_SET_PRICES')) . '</div>';
$output .= '<div>';
foreach (@$prices as $price) {
$output .= '
<div>
<span>' . TiendaHelperBase::currency($price->product_price) . '</span>
<div class="tiendaButton"><a href="' . $price->link_remove . '&return=' . base64_encode("index.php?option=com_k2&view=item&cid=" . $id) . '">' . JText::_('Remove') . '</a></div>
</div>';
}
$output .= '</div>';
}
}
}
return $output;
}
示例6: _getData
/**
* Override parent::_getData()
*
* @return unknown_type
*/
function _getData()
{
$app = JFactory::getApplication();
Tienda::load('TiendaQuery', '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;
}
示例7: processOrder
/**
* Processes a new order
*
* @param $order_id
* @return unknown_type
*/
public function processOrder($order_id)
{
// 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);
}
// find the products in the order that are integrated
foreach ($order->orderitems as $orderitem) {
$model = JModel::getInstance('Products', 'TiendaModel');
$product = $model->getTable();
$product->load($orderitem->product_id);
$this->_product = $product;
$this->_orderitem = $orderitem;
if (!empty($product->product_sql)) {
$this->processSQL($product->product_sql);
}
}
}
示例8: 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');
// get the model
Tienda::load('TiendaModelCategories', 'models.categories');
$model = new TiendaModelCategories(array());
// $model = JModel::getInstance( 'Categories', 'TiendaModel' ); 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) {
Tienda::load('TiendaHelperRoute', 'helpers.route');
$item->itemid = TiendaHelperRoute::category($item->category_id, true);
if (empty($item->itemid)) {
$item->itemid = $this->params->get('itemid');
}
}
}
return $items;
}
示例9: _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_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 (Tienda::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;
}
示例10: 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();
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
Tienda::load('TiendaQuery', 'library.query');
$q = new TiendaQuery();
$q->select('manufacturer_id');
$q->from('`#__tienda_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 = JModel::getInstance('Manufacturers', 'TiendaModel');
$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;
}
示例11: setRates
function setRates()
{
Tienda::load('TiendaGrid', 'library.grid');
Tienda::load('TiendaSelect', 'library.select');
$this->includeCustomModel('ShippingRatesWeightbased');
$sid = JRequest::getVar('sid');
$this->includeCustomTables();
$row = JTable::getInstance('ShippingMethodsWeightbased', 'TiendaTable');
$row->load($sid);
$model = JModel::getInstance('ShippingRatesWeightbased', 'TiendaModel');
$model->setState('filter_shippingmethod', $sid);
$app = JFactory::getApplication();
$ns = $this->getNamespace();
$state = array();
$state['limit'] = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int');
$state['limitstart'] = $app->getUserStateFromRequest($ns . 'limitstart', 'limitstart', 0, 'int');
foreach (@$state as $key => $value) {
$model->setState($key, $value);
}
$items = $model->getList();
//form
$form = array();
$form['action'] = $this->baseLink();
// view
$view = $this->getView('shipping_weightbased', 'html');
$view->hidemenu = true;
$view->hidestats = true;
$view->setModel($model, true);
$view->assign('row', $row);
$view->assign('items', $items);
$view->assign('form2', $form);
$view->assign('baseLink', $this->baseLink());
$view->setLayout('setrates');
$view->display();
}
示例12: 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;
}
示例13: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$output = '<span class="k2Note">' . JText::_('Click Apply to be able to create product attributes') . '</span>';
$id = JRequest::getInt('cid');
if ($id) {
$K2Item = JTable::getInstance('K2Item', 'Table');
$K2Item->load($id);
$params = new K2Parameter($K2Item->plugins, JPATH_PLUGINS . '/k2/tienda.xml', 'tienda');
$productID = $params->get('productID');
if ($productID) {
Tienda::load('TiendaUrl', 'library.url');
Tienda::load("TiendaHelperProduct", 'helpers.product');
$attributes = TiendaHelperProduct::getAttributes($productID);
$output = '<div class="tiendaButton">' . TiendaUrl::popup("index.php?option=com_tienda&controller=products&task=setattributes&id=" . $productID . "&tmpl=component", JText::_('Set Attributes')) . '</div>';
$output .= '<div>';
foreach (@$attributes as $attribute) {
$output .= '
<div>
<span>' . $attribute->productattribute_name . '(' . $attribute->option_names_csv . ')</span>
<div class="tiendaButton">' . TiendaUrl::popup("index.php?option=com_tienda&controller=products&task=setattributeoptions&id=" . $attribute->productattribute_id . "&tmpl=component", JText::_('Set Attribute Options')) . '</div>
<div class="tiendaButton"><a href="' . "index.php?option=com_tienda&controller=productattributes&task=delete&cid[]=" . $attribute->productattribute_id . "&return=" . base64_encode("index.php?option=com_k2&view=item&cid=" . $id) . '">' . JText::_('Remove') . '</a></div>
</div>';
}
$output .= '</div>';
}
}
return $output;
}
示例14: renderForm
/**
* Renders the DirectPayment form
*
* @param object $row
* @param array $prepop Array of values to fill in the form fields
* @param boolean $display_note
* @param boolean $display_typeinfo
* @return string
* @access public
*/
function renderForm($row, $prepop = array(), $display_note = '1', $display_typeinfo = '1')
{
$user = JFactory::getUser();
$secure_post = $this->_params->get('secure_post', '0');
$config = Tienda::getInstance();
/*
* get all necessary data and prepare vars for assigning to the template
*/
$vars = new JObject();
$vars->action_url = JRoute::_("index.php?option=com_tienda&controller=checkout&task=confirmPayment&orderpayment_type={$this->_plugin_type}&paction=process_direct_payment", false, $secure_post);
$vars->prepop = $prepop;
$vars->user = $user;
$vars->cctype_input = $this->_getCardTypesInput('cardtype', !empty($prepop['cardtype']) ? $prepop['cardtype'] : '');
$vars->country_input = $this->_getCountriesInput('country', !empty($prepop['country']) ? $prepop['country'] : '');
$vars->row = $row;
$vars->token_input = JHTML::_('form.token');
$vars->display_note = $display_note;
$vars->display_typeinfo = $display_typeinfo;
$vars->display_value = $config->get('display_value', '1');
$vars->display_period = $config->get('display_period', '1');
$vars->currency_preval = $config->get('currency_preval', '$');
$vars->currency_postval = $config->get('currency_postval', ' USD');
$html = $this->_getLayout('directpayment_form', $vars);
return $html;
}
示例15: export
function export()
{
Tienda::load('TiendaCSV', 'library.csv');
$request = JRequest::get('request');
//// load the plugins
JPluginHelper::importPlugin('tienda');
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
$params = json_decode(base64_decode($request['exportParams']));
$model = JModel::getInstance($params->view, 'TiendaModel');
$list = $model->getList();
$arr = array();
$header = array();
// header -> it'll be filled out when
$fill_header = true;
// we need to fill header
for ($i = 0, $c = count($list); $i < $c; $i++) {
if ($fill_header) {
$list_vars = get_object_vars($list[$i]);
foreach ($list_vars as $key => $value) {
if ($fill_header) {
$header[] = $key;
}
}
$fill_header = false;
// header is filled
}
$arr[] = $this->objectToString($list[$i], true);
}
$f_name = 'tmp/' . $params->view . '_' . time() . '.csv';
$res = TiendaCSV::FromArrayToFile($f_name, $arr, $header);
$this->render_page($f_name, $params->view);
}