本文整理汇总了PHP中TiendaHelperBase类的典型用法代码示例。如果您正苦于以下问题:PHP TiendaHelperBase类的具体用法?PHP TiendaHelperBase怎么用?PHP TiendaHelperBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TiendaHelperBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例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_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;
}
示例3: 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);
}
}
示例4: save
/**
* Run function after saving
*/
function save($src = '', $orderingFilter = '', $ignore = '')
{
if ($return = parent::save($src, $orderingFilter, $ignore)) {
Tienda::load("TiendaHelperProduct", 'helpers.product');
$helper = TiendaHelperBase::getInstance('product');
$helper->doProductQuantitiesReconciliation($this->product_id, '0');
}
return $return;
}
示例5: 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;
}
$nullDate = $this->_db->getNullDate();
Tienda::load('TiendaHelperBase', 'helpers._base');
$TiendaHelperBase = new TiendaHelperBase();
$this->product_price_startdate = $this->product_price_startdate != $nullDate ? $TiendaHelperBase->getOffsetDate($this->product_price_startdate) : $this->product_price_startdate;
$this->product_price_enddate = $this->product_price_enddate != $nullDate ? $TiendaHelperBase->getOffsetDate($this->product_price_enddate) : $this->product_price_enddate;
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();
return true;
}
示例6: 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::getCmd( '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->Quote('%' . $db->getEscaped($search, true) . '%', false);
$where[] = 'LOWER( tbl.product_name ) LIKE ' . $db->Quote('%' . $db->getEscaped($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 #__tienda_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 #__tienda_products AS tbl' . ' LEFT JOIN #__tienda_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
Tienda::load('TiendaHelperBase', 'helpers._base');
foreach ($this->_list as $item) {
$item->product_price = TiendaHelperBase::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;
}
示例7: save
/**
* Run function when saving
* @see tienda/admin/tables/TiendaTable#save()
*/
function save($src = '', $orderingFilter = '', $ignore = '')
{
if ($return = parent::save($src, $orderingFilter, $ignore)) {
$pa = JTable::getInstance('ProductAttributes', 'TiendaTable');
$pa->load($this->productattribute_id);
Tienda::load("TiendaHelperProduct", 'helpers.product');
$helper = TiendaHelperBase::getInstance('product');
$helper->doProductQuantitiesReconciliation($pa->product_id);
}
return $return;
}
示例8: 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;
}
示例9: 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;
}
示例10: display
function display($cachable = false, $urlparams = false)
{
$uri = JURI::getInstance();
$view = $this->getView($this->get('suffix'), JFactory::getDocument()->getType());
$view->set('hidemenu', false);
$view->set('_doTask', true);
$view->setLayout('default');
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$url = "index.php?option=com_users&view=user&task=user.edit";
} else {
$url = "index.php?option=com_user&view=user&task=edit";
}
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Ambra');
if ($helper->isInstalled()) {
$url = "index.php?option=com_ambra&view=users&task=edit&return=" . base64_encode($uri->toString());
}
$view->assign('url_profile', $url);
parent::display($cachable, $urlparams);
}
示例11: store
public function store($updateNulls = false)
{
// Check the table activation status first
if (!$this->active) {
// Activate it with a default value
$this->setType('');
}
if ($this->getType() == 'datetime') {
if (isset($this->eavvalue_value)) {
$null_date = JFactory::getDbo()->getNullDate();
if ($this->eavvalue_value == $null_date || $this->eavvalue_value == '') {
$this->eavvalue_value = $null_date;
} else {
$offset = JFactory::getConfig()->getValue('config.offset');
$this->eavvalue_value = date('Y-m-d H:i:s', strtotime(TiendaHelperBase::getOffsetDate($this->eavvalue_value, -$offset)));
}
}
}
return parent::store($updateNulls);
}
示例12: _buildQueryFields
protected function _buildQueryFields(&$query)
{
Tienda::load('TiendaHelperUser', 'helpers.user');
$date = JFactory::getDate()->toMysql();
$filter_product = $this->getState('filter_product');
$user = TiendaHelperBase::getInstance('user');
if (strlen($filter_product)) {
$default_group = $user->getUserGroup(JFactory::getUser()->id, (int) $filter_product);
} else {
$default_group = Tienda::getInstance()->get('default_user_group', '1');
}
$fields = array();
$fields[] = " p_from.product_name as product_name_from ";
$fields[] = " p_from.product_sku as product_sku_from ";
$fields[] = " p_from.product_model as product_model_from ";
$fields[] = "\n (\n SELECT \n prices.product_price\n FROM\n #__tienda_productprices AS prices \n WHERE \n prices.product_id = tbl.product_id_from \n AND prices.group_id = '{$default_group}'\n AND prices.product_price_startdate <= '{$date}' \n AND (prices.product_price_enddate >= '{$date}' OR prices.product_price_enddate = '0000-00-00 00:00:00' )\n ORDER BY prices.price_quantity_start ASC\n LIMIT 1\n ) \n AS product_price_from ";
$fields[] = " p_to.product_name as product_name_to ";
$fields[] = " p_to.product_sku as product_sku_to ";
$fields[] = " p_to.product_model as product_model_to ";
$fields[] = "\n (\n SELECT \n prices.product_price\n FROM\n #__tienda_productprices AS prices \n WHERE \n prices.product_id = tbl.product_id_to \n AND prices.group_id = '{$default_group}'\n AND prices.product_price_startdate <= '{$date}' \n AND (prices.product_price_enddate >= '{$date}' OR prices.product_price_enddate = '0000-00-00 00:00:00' )\n ORDER BY prices.price_quantity_start ASC\n LIMIT 1\n ) \n AS product_price_to ";
$query->select($this->getState('select', 'tbl.*'));
$query->select($fields);
}
示例13: array
<?php
if ($show_addtocart) {
?>
<div id="product_buy_<?php
echo $item->product_id;
?>
" class="product_buy">
<?php
echo TiendaHelperProduct::getCartButton($item->product_id, 'product_buy', array());
?>
</div>
<?php
} else {
?>
<?php
echo TiendaHelperBase::currency($item->product_price);
?>
<?php
}
?>
</td>
<?php
}
?>
</tr>
<?php
}
?>
示例14: recreateThumbs
/**
* Batch resize of thumbs
* @author Skullbock
*/
function recreateThumbs()
{
$per_step = 100;
$from_id = JRequest::getInt('from_id', 0);
$to = $from_id + $per_step;
Tienda::load('TiendaHelperCategory', 'helpers.category');
Tienda::load('TiendaImage', 'library.image');
$width = Tienda::getInstance()->get('category_img_width', '0');
$height = Tienda::getInstance()->get('category_img_height', '0');
$model = $this->getModel('Categories', 'TiendaModel');
$model->setState('limistart', $from_id);
$model->setState('limit', $to);
$row = $model->getTable();
$count = $model->getTotal();
$categories = $model->getList();
$i = 0;
$last_id = $from_id;
foreach ($categories as $p) {
$i++;
$image = $p->category_full_image;
$path = Tienda::getPath('categories_images');
if ($image != '') {
$img = new TiendaImage($path . '/' . $image);
$img->setDirectory(Tienda::getPath('categories_images'));
// Thumb
Tienda::load('TiendaHelperImage', 'helpers.image');
$imgHelper = TiendaHelperBase::getInstance('Image', 'TiendaHelper');
$imgHelper->resizeImage($img, 'category');
}
$last_id = $p->category_id;
}
if ($i < $count) {
$redirect = "index.php?option=com_tienda&controller=categories&task=recreateThumbs&from_id=" . ($last_id + 1);
} else {
$redirect = "index.php?option=com_tienda&view=config";
}
$redirect = JRoute::_($redirect, false);
$this->setRedirect($redirect, JText::_('COM_TIENDA_DONE'), 'notice');
return;
}
示例15: deleteExpiredSessionProductCompared
/**
*
* Enter description here ...
* @return unknown_type
*/
public function deleteExpiredSessionProductCompared()
{
$db = JFactory::getDBO();
Tienda::load('TiendaQuery', 'library.query');
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = new TiendaHelperBase();
$query = new TiendaQuery();
$query->select("tbl.session_id");
$query->from("#__session AS tbl");
$db->setQuery((string) $query);
$results = $db->loadAssocList();
$session_ids = $helper->getColumn($results, 'session_id');
$query = new TiendaQuery();
$query->delete();
$query->from("#__tienda_productcompare");
$query->where("`user_id` = '0'");
$query->where("`session_id` NOT IN('" . implode("', '", $session_ids) . "')");
$db->setQuery((string) $query);
if (!$db->query()) {
$this->setError($db->getErrorMsg());
return false;
}
$date = JFactory::getDate();
$now = $date->toMySQL();
// Update config to say this has been done already
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$config = JTable::getInstance('Config', 'TiendaTable');
$config->load(array('config_name' => 'last_deleted_expired_sessionproductscompared'));
$config->config_name = 'last_deleted_expired_sessionproductscompared';
$config->value = $now;
$config->save();
return true;
}