本文整理汇总了PHP中CitruscartHelperBase::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP CitruscartHelperBase::getInstance方法的具体用法?PHP CitruscartHelperBase::getInstance怎么用?PHP CitruscartHelperBase::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CitruscartHelperBase
的用法示例。
在下文中一共展示了CitruscartHelperBase::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: downloadFile
/**
* downloads a file
*
* @return void
*/
function downloadFile()
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
$productfile_id = $app->input->getInt('id', 0);
//$productfile_id = intval( JRequest::getvar( 'id', '', 'request', 'int' ) );
$product_id = $app->input->getInt('product_id', 0);
$link = 'index.php?option=com_citruscart&view=products&task=edit&id=' . $product_id;
Citruscart::load('CitruscartHelperBase', 'helpers._base');
$helper = CitruscartHelperBase::getInstance('ProductDownload', 'CitruscartHelper');
JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_citruscart' . DS . 'tables');
$productfile = JTable::getInstance('ProductFiles', 'CitruscartTable');
$productfile->load($productfile_id);
if (empty($productfile->productfile_id)) {
$this->messagetype = 'notice';
$this->message = JText::_('COM_CITRUSCART_INVALID FILE');
$this->setRedirect($link, $this->message, $this->messagetype);
return false;
}
// log and download
Citruscart::load('CitruscartFile', '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 = CitruscartFile::download($productfile)) {
$link = JRoute::_($link, false);
$this->setRedirect($link);
}
}
示例2: save
/**
* Run function after saving
*/
function save($src = '', $orderingFilter = '', $ignore = '')
{
if ($return = parent::save($src, $orderingFilter, $ignore)) {
Citruscart::load("CitruscartHelperProduct", 'helpers.product');
$helper = CitruscartHelperBase::getInstance('product');
$helper->doProductQuantitiesReconciliation($this->product_id, '0');
}
return $return;
}
示例3: save
/**
* Run function when saving
* @see Citruscart/admin/tables/CitruscartTable#save()
*/
function save($src = '', $orderingFilter = '', $ignore = '')
{
if ($return = parent::save($src, $orderingFilter, $ignore)) {
$pa = JTable::getInstance('ProductAttributes', 'CitruscartTable');
$pa->load($this->productattribute_id);
Citruscart::load("CitruscartHelperProduct", 'helpers.product');
$helper = CitruscartHelperBase::getInstance('product');
$helper->doProductQuantitiesReconciliation($pa->product_id);
}
return $return;
}
示例4: 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;
}
示例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("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;
}
示例6: 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";
}
Citruscart::load("CitruscartHelperBase", 'helpers._base');
$helper = CitruscartHelperBase::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);
}
示例7: _buildQueryFields
protected function _buildQueryFields(&$query)
{
Citruscart::load('CitruscartHelperUser', 'helpers.user');
$date = JFactory::getDate()->toSql();
$filter_product = $this->getState('filter_product');
$user = CitruscartHelperBase::getInstance('user');
if (strlen($filter_product)) {
$default_group = $user->getUserGroup(JFactory::getUser()->id, (int) $filter_product);
} else {
$default_group = Citruscart::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 #__citruscart_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 #__citruscart_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);
}
示例8: 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');
Citruscart::load("CitruscartHelperBase", 'helpers._base');
$currency_helper = CitruscartHelperBase::getInstance('Currency');
// Add CSS
$document->addStyleSheet(JURI::root(true) . '/modules/mod_citruscart_my_orders/tmpl/mod_citruscart_my_orders.css');
$user = JFactory::getUser();
if ($orders && $user->id) {
$count = 0;
foreach (@$orders as $order) {
?>
<div class="mod_citruscart_my_orders_item">
<?php
if ($params->get('display_date')) {
?>
<span class="mod_citruscart_my_orders_item_date"><a href="<?php
echo $order->link;
?>
"><?php
echo JHTML::_('date', $order->created_date, Citruscart::getInstance()->get('date_format'));
示例9: _migrateImages
/**
* Migrate the images
*
* param int $product_id
* param string $images
*/
private function _migrateImages($product_id, $images)
{
Citruscart::load('CitruscartImage', 'library.image');
foreach ($images->children() as $image) {
$check = false;
$multiple = false;
$image = (string) $image;
if (JURI::isInternal($image)) {
$internal = true;
$int_image = JPATH_SITE . DIRECTORY_SEPARATOR . $image;
if (is_dir($int_image)) {
$check = JFolder::exists($int_image);
$multiple = true;
} else {
$check = JFile::exists($int_image);
}
// Now check the extracted images path
if (!$check) {
$dir = $this->_temp_dir . DIRECTORY_SEPARATOR . 'images' . DS;
if (is_dir($dir . $image)) {
$check = JFolder::exists($dir . $image);
$multiple = true;
} else {
$check = JFile::exists($dir . $image);
}
if ($check) {
$image = $dir . $image;
}
} else {
$image = $int_image;
}
} else {
$internal = false;
$check = $this->url_exists($image);
}
// Add a single image
if (!$multiple) {
$images_to_copy = array($image);
} else {
// Fetch the images from the folder and add them
$images_to_copy = Citruscart::getClass("CitruscartHelperProduct", 'helpers.product')->getGalleryImages($image);
foreach ($images_to_copy as &$i) {
$i = $image . DIRECTORY_SEPARATOR . $i;
}
}
if ($check) {
foreach ($images_to_copy as $image_to_copy) {
if ($internal) {
$img = new CitruscartImage($image_to_copy);
} else {
$tmp_path = JFactory::getApplication()->getCfg('tmp_path');
$file = fopen($image_to_copy, 'r');
$file_content = stream_get_contents($file);
fclose($file);
$file = fopen($tmp_path . DIRECTORY_SEPARATOR . $image_to_copy, 'w');
fwrite($file, $file_content);
fclose($file);
$img = new CitruscartImage($tmp_path . DIRECTORY_SEPARATOR . $image_to_copy);
}
Citruscart::load('CitruscartTableProducts', 'tables.products');
$product = JTable::getInstance('Products', 'CitruscartTable');
$product->load($product_id);
$path = $product->getImagePath();
$type = $img->getExtension();
$img->load();
$img->setDirectory($path);
// Save full Image
$img->save($path . $img->getPhysicalName());
// Save Thumb
Citruscart::load('CitruscartHelperImage', 'helpers.image');
$imgHelper = CitruscartHelperBase::getInstance('Image', 'CitruscartHelper');
$imgHelper->resizeImage($img, 'product');
}
}
}
}
示例10: _migrateImages
private function _migrateImages($prefix = 'jos_', $vm_prefix = 'vm_', &$results, $internal = true)
{
$p = $prefix . $vm_prefix;
// Fetch the VM full image
if ($internal) {
$db = JFactory::getDBO();
} else {
$db = $this->_verifyDB();
}
$query = "SELECT product_id as id, product_full_image as image FROM {$p}product";
$db->setQuery($query);
$products = $db->loadAssocList();
Citruscart::load('CitruscartImage', 'library.image');
if ($internal) {
$vm_image_path = JPATH_SITE . "/components/com_virtuemart/shop_image/product/";
} else {
$state = $this->_getState();
$url = $state->external_site_url;
$vm_image_path = $url . "/components/com_virtuemart/shop_image/product/";
}
$n = count($results);
$results[$n]->title = 'Product Images';
$results[$n]->query = 'Copy Product Images & Resize';
$results[$n]->error = '';
$results[$n]->affectedRows = 0;
foreach ($products as $result) {
$check = false;
if ($internal) {
$check = JFile::exists($vm_image_path . $result['image']);
} else {
$check = $this->url_exists($vm_image_path) && $result['image'];
}
if ($check) {
if ($internal) {
$img = new CitruscartImage($vm_image_path . $result['image']);
} else {
$tmp_path = JFactory::getApplication()->getCfg('tmp_path');
$file = fopen($vm_image_path . $result['image'], 'r');
$file_content = stream_get_contents($file);
fclose($file);
$file = fopen($tmp_path . DIRECTORY_SEPARATOR . $result['image'], 'w');
fwrite($file, $file_content);
fclose($file);
$img = new CitruscartImage($tmp_path . DS . $result['image']);
}
Citruscart::load('CitruscartTableProducts', 'tables.products');
$product = JTable::getInstance('Products', 'CitruscartTable');
$product->load($result['id']);
$path = $product->getImagePath();
$type = $img->getExtension();
$img->load();
$name = $img->getPhysicalName();
// Save full Image
if (!$img->save($path . $name)) {
$results[$n]->error .= '::Could not Save Product Image- From: ' . $vm_image_path . $result['image'] . ' To: ' . $path . $result['image'];
}
$img->setDirectory($path);
// Save Thumb
Citruscart::load('CitruscartHelperImage', 'helpers.image');
$imgHelper = CitruscartHelperBase::getInstance('Image', 'CitruscartHelper');
if (!$imgHelper->resizeImage($img, 'product')) {
$results[$n]->error .= '::Could not Save Product Thumb';
}
// Save correct image naming
$product->product_full_image = $name;
$product->save();
$results[$n]->affectedRows++;
}
}
$n++;
// CATEGORIES
// Fetch the VM full image
$query = "SELECT category_id as id, category_full_image as image FROM {$p}category";
$db->setQuery($query);
$products = $db->loadAssocList();
Citruscart::load('CitruscartImage', 'library.image');
if ($internal) {
$vm_image_path = JPATH_SITE . "/components/com_virtuemart/shop_image/category/";
} else {
$state = $this->_getState();
$url = $state->external_site_url;
$vm_image_path = $url . "/components/com_virtuemart/shop_image/category/";
}
$results[$n]->title = 'Category Images';
$results[$n]->query = 'Copy Category Images & Resize';
$results[$n]->error = '';
$results[$n]->affectedRows = 0;
foreach ($products as $result) {
$check = false;
if ($internal) {
$check = JFile::exists($vm_image_path . $result['image']);
} else {
$check = $this->url_exists($vm_image_path) && $result['image'];
}
if ($check) {
if ($internal) {
$img = new CitruscartImage($vm_image_path . $result['image']);
} else {
$tmp_path = JFactory::getApplication()->getCfg('tmp_path');
$file = fopen($vm_image_path . $result['image'], 'r');
//.........这里部分代码省略.........
示例11: 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');
Citruscart::load('CitruscartHelperBase', 'helpers._base');
Citruscart::load('CitruscartSelect', 'library.select');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
$helper = CitruscartHelperBase::getInstance();
$url = JRoute::_('index.php?option=com_citruscart&view=currency&task=set&return=' . base64_encode(JURI::getInstance()->__toString()), false);
// Check the currently selected currency
$selected = CitruscartHelperBase::getSessionVariable('currency_id', Citruscart::getInstance()->get('default_currencyid', 1));
?>
<div id="mod_citruscart_currency">
<form action="<?php
echo $url;
?>
" method="post" name="currencySwitch">
<?php
// echo JText::_('COM_CITRUSCART_SELECT_CURRENCY').': ';
?>
<?php
$attribs = array('onChange' => 'document.currencySwitch.submit(); ');
示例12: load
/**
* Loads a row from the database and binds the fields to the object properties
* If $load_eav is true, binds also the eav fields linked to this entity
*
* @access public
* @param mixed Optional primary key. If not specifed, the value of current key is used
* @param bool reset the object values?
* @param bool load the eav values for this object
*
* @return boolean True if successful
*/
function load($oid = null, $reset = true, $load_eav = true)
{
$eavs = array();
/* Get the application */
$app = JFactory::getApplication();
$editable_by = $app->isAdmin() ? 1 : 2;
if ($app->isAdmin()) {
$view = $app->input->get('view', '');
//$view = JRequest::get('view', '' );
if ($view == 'pos') {
// display all for POS
$editable_by = array(1, 2);
}
}
if (!is_array($oid)) {
// load by primary key if not array
$keyName = $this->getKeyName();
$oid = array($keyName => $oid);
}
if (empty($oid)) {
// if empty, use the value of the current key
$keyName = $this->getKeyName();
$oid = $this->{$keyName};
if (empty($oid)) {
// if still empty, fail
$this->setError(JText::_('COM_CITRUSCART_CANNOT_LOAD_WITH_EMPTY_KEY'));
return false;
}
}
// allow $oid to be an array of key=>values to use when loading
$oid = (array) $oid;
$this->_linked_table_key = isset($this->_linked_table_key) ? $this->_linked_table_key : (isset($oid[$this->_linked_table_key_name]) ? $oid[$this->_linked_table_key_name] : '');
if (!empty($reset)) {
$this->reset();
}
$db = $this->getDBO();
// initialize the query
$query = new DSCQuery();
$query->select('*');
$query->from($this->getTableName());
if ($load_eav) {
Citruscart::load("CitruscartHelperBase", 'helpers._base');
$eav_helper = CitruscartHelperBase::getInstance('Eav');
$k = $this->_tbl_key;
$id = $this->{$k};
// Get the custom fields for this entities
Citruscart::load('CitruscartHelperEav', 'helpers.eav');
$eavs = CitruscartHelperEav::getAttributes($this->get('_suffix'), $id, true, $editable_by);
// Is this a mirrored table (see decription at the beginning of this file)
if (strlen($this->_linked_table) && $this->_linked_table_key) {
// Copy the custom field value to this table
$mirrored_eavs = $eav_helper->getAttributes($this->_linked_table, $this->_linked_table_key, true, $editable_by);
$eavs = array_merge($eavs, $mirrored_eavs);
}
}
foreach ($oid as $key => $value) {
// Check that $key is field in table
if (!in_array($key, array_keys($this->getProperties()))) {
// Check if it is a eav field
if ($load_eav) {
// loop through until the key is found or the eav are finished
$found = false;
$i = 0;
while (!$found && $i < count($eavs)) {
// Does the key exists?
if ($key == $eavs[$i]->eavattribute_alias) {
$found = true;
} else {
$i++;
}
}
// Was the key found?
if (!$found) {
// IF not return an error
$this->setError(get_class($this) . ' does not have the field ' . $key);
return false;
}
// key was found -> add this EAV field
$value_tbl_name = 'value_' . $eavs[$i]->eavattribute_alias;
// for some reason MySQL makes spaces around '-' charachter
// (which is often charachter in aliases) that's why we replace it with '_'
$value_tbl_name = str_replace("-", "_", $value_tbl_name);
// Join the table based on the type of the value
$table_type = $eav_helper->getType($eavs[$i]->eavattribute_alias);
// Join the tables
$query->join('LEFT', '#__citruscart_eavvalues' . $table_type . ' AS ' . $value_tbl_name . ' ON ( ' . $value_tbl_name . '.eavattribute_id = ' . $eavs[$i]->eavattribute_id . ' AND ' . $value_tbl_name . '.eaventity_id = ' . $this->_tbl_key . ' )');
// Filter using '='
$query->where($value_tbl_name . ".eavvalue_value = '" . $value . "'");
// else let the store() method worry over this
//.........这里部分代码省略.........
示例13: recreateThumbs
/**
* Batch resize of thumbs
* @author Skullbock
*/
function recreateThumbs()
{
$app = JFactory::getApplication();
$per_step = 100;
$from_id = $app->input->getInt('from_id', 0);
$to = $from_id + $per_step;
Citruscart::load('CitruscartHelperManufacturer', 'helpers.manufacturer');
Citruscart::load('CitruscartImage', 'library.image');
$width = Citruscart::getInstance()->get('manufacturer_img_width', '0');
$height = Citruscart::getInstance()->get('manufacturer_img_height', '0');
$model = $this->getModel('Manufacturers', 'CitruscartModel');
$model->setState('limistart', $from_id);
$model->setState('limit', $to);
$row = $model->getTable();
$count = $model->getTotal();
$manufacturers = $model->getList();
$i = 0;
$last_id = $from_id;
foreach ($manufacturers as $p) {
$i++;
$image = $p->manufacturer_full_image;
if ($image != '') {
$img = new CitruscartImage($image, 'manufacturer');
$img->setDirectory(Citruscart::getPath('manufacturers_images'));
// Thumb
Citruscart::load('CitruscartHelperImage', 'helpers.image');
$imgHelper = CitruscartHelperBase::getInstance('Image', 'CitruscartHelper');
$imgHelper->resizeImage($img, 'manufacturer');
}
$last_id = $p->manufacturer_id;
}
if ($i < $count) {
$redirect = "index.php?option=com_citruscart&controller=manufacturers&task=recreateThumbs&from_id=" . ($last_id + 1);
} else {
$redirect = "index.php?option=com_citruscart&view=config";
}
$redirect = JRoute::_($redirect, false);
$this->setRedirect($redirect, JText::_('COM_CITRUSCART_DONE'), 'notice');
return;
}
示例14: getItem
public function getItem($pk = null, $refresh = false, $emptyState = true)
{
if (empty($this->_item)) {
Citruscart::load('CitruscartHelperBase', 'helpers._base');
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
$amigos = CitruscartHelperBase::getInstance('Amigos');
$currency_helper = CitruscartHelperBase::getInstance('Currency');
if ($item = parent::getItem($pk, $refresh, $emptyState)) {
// get the orderinfo
$item->orderinfo = JTable::getInstance('OrderInfo', 'CitruscartTable');
$item->orderinfo->load(array('order_id' => $item->order_id));
//retrieve the order's items
$model = JModelLegacy::getInstance('OrderItems', 'CitruscartModel');
$model->setState('filter_orderid', $item->order_id);
$model->setState('order', 'tbl.orderitem_name');
$model->setState('direction', 'ASC');
$item->orderitems = $model->getList($refresh);
foreach ($item->orderitems as $orderitem) {
$model = JModelLegacy::getInstance('OrderItemAttributes', 'CitruscartModel');
$model->setState('filter_orderitemid', $orderitem->orderitem_id);
$attributes = $model->getList();
$attributes_names = array();
$attributes_codes = array();
foreach ($attributes as $attribute) {
// store a csv of the attrib names
$attributes_names[] = JText::_($attribute->orderitemattribute_name);
if ($attribute->orderitemattribute_code) {
$attributes_codes[] = JText::_($attribute->orderitemattribute_code);
}
}
$orderitem->attributes_names = implode(', ', $attributes_names);
$orderitem->attributes_codes = implode(', ', $attributes_codes);
// adjust the price
$orderitem->orderitem_price = $orderitem->orderitem_price + floatval($orderitem->orderitem_attributes_price);
}
//retrieve the order's history
$model = JModelLegacy::getInstance('OrderHistory', 'CitruscartModel');
$model->setState('filter_orderid', $item->order_id);
$model->setState('order', 'tbl.date_added');
$model->setState('direction', 'ASC');
$item->orderhistory = $model->getList($refresh);
$item->link_view = 'index.php?option=com_citruscart&view=orders&task=view&id=' . $item->order_id;
//retrieve the order's payments
$model = JModelLegacy::getInstance('OrderPayments', 'CitruscartModel');
$model->setState('filter_orderid', $item->order_id);
$model->setState('order', 'tbl.created_date');
$model->setState('direction', 'ASC');
$item->orderpayments = $model->getList($refresh);
//retrieve the order's shippings
$model = JModelLegacy::getInstance('OrderShippings', 'CitruscartModel');
$model->setState('filter_orderid', $item->order_id);
$model->setState('order', 'tbl.created_date');
$model->setState('direction', 'ASC');
$item->ordershippings = $model->getList($refresh);
//retrieve the order's taxclasses
$model = JModelLegacy::getInstance('OrderTaxClasses', 'CitruscartModel');
$model->setState('filter_orderid', $item->order_id);
$model->setState('order', 'tbl.ordertaxclass_description');
$model->setState('direction', 'ASC');
$item->ordertaxclasses = $model->getList($refresh);
// retrieve the order's taxrates
$model = JModelLegacy::getInstance('OrderTaxRates', 'CitruscartModel');
$model->setState('filter_orderid', $item->order_id);
$model->setState('order', 'tbl.ordertaxclass_id, tbl.ordertaxrate_level');
$item->ordertaxrates = $model->getList($refresh);
// retrieve the order's currency
// this loads the currency, using the FK is it is the same of the
// currency used in the order, or the DSCParameter currency of the order otherwise
$order_currency = new DSCParameter($item->order_currency);
$order_currency = $order_currency->toArray();
//$model = JModelLegacy::getInstance( 'Currencies', 'CitruscartModel' );
//$model->setId($item->currency_id);
$item->currency = $currency_helper->load($item->currency_id);
// if the order currency is not the same as it was during the order
if (!empty($item->currency) && !empty($order_currency['currency_code']) && $item->currency->currency_code != $order_currency['currency_code']) {
// overwrite it with the original one
foreach ($order_currency as $k => $v) {
$item->currency->{$k} = $v;
}
}
// has a commission?
if ($amigos->isInstalled()) {
$item->commissions = $amigos->getCommissions($item->order_id);
}
}
$this->_item = $item;
}
JFactory::getApplication()->triggerEvent('onPrepare' . $this->getTable()->get('_suffix'), array(&$this->_item));
return $this->_item;
}
示例15: checkPassword2
/**
* Checks that a password and password2 match
* return unknown_type
*/
function checkPassword2()
{
$input = JFactory::getApplication()->input;
Citruscart::load('CitruscartHelperBase', 'helpers._base');
$helper = CitruscartHelperBase::getInstance();
$response = array();
$response['msg'] = '';
$response['error'] = '';
// get elements from post
$elements = json_decode(preg_replace('/[\\n\\r]+/', '\\n', $input->getString('elements')));
// convert elements to array that can be binded
$values = CitruscartHelperBase::elementsToArray($elements);
$password = $values['password'];
$password2 = $values['password2'];
if (empty($password)) {
$response['msg'] = $helper->validationMessage("COM_CITRUSCART_PASSWORD_CANNOT_BE_EMPTY", 'fail');
$response['error'] = '1';
echo json_encode($response);
return;
}
if (empty($password2)) {
$response['msg'] = $helper->validationMessage("COM_CITRUSCART_PASSWORD_VERIFY_CANNOT_BE_EMPTY", 'fail');
$response['error'] = '1';
echo json_encode($response);
return;
}
$message = "";
if ($password != $password2) {
$message .= $helper->validationMessage('COM_CITRUSCART_PASSWORD_DO_NOT_MATCH', 'fail');
} else {
// no error
$message .= $helper->validationMessage('COM_CITRUSCART_PASSWORD_VALID', 'success');
}
$response['msg'] = $message;
$response['error'] = '1';
echo json_encode($response);
return;
}