Spade

Mini Shell

Directory:~$ /home/lmsyaran/www/css/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/www/css/com_hikamarket.tar

controllers/category.php000064400000027475151166607730011473
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class categoryMarketController extends hikamarketController {
	protected $rights = array(
		'display' =>
array('show','listing','upload','image','edit_translation','galleryimage','gettree','findlist'),
		'add' => array('add'),
		'edit' =>
array('edit','addimage','toggle',
'galleryselect'),
		'modify' => array('apply', 'save',
'save_translation', 'saveorder',
'save2new'),
		'delete' => array('delete')
	);

	protected $ordering = array(
		'type' => 'category',
		'pkey' => 'category_id',
		'table' => 'category',
		'groupMap' => 'category_parent_id',
		'orderingMap' => 'category_ordering',
		'groupVal' => 0
	);

	protected $type = 'category';
	protected $config = null;

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		if(!$skip)
			$this->registerDefaultTask('listing');
		$this->config = hikamarket::config();
	}

	public function listing() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;
		if(!hikamarket::acl('category/listing'))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CATEGORY_LISTING')));
		hikaInput::get()->set('layout', 'listing');
		return parent::display();
	}

	public function saveorder(){
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;
		if( !hikamarket::acl('category/edit') )
			return hikamarket::deny('category',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CATEGORY_EDIT')));

		$category_id = hikamarket::getCID('category_id');
		if(!hikamarket::isVendorCategory($category_id))
			return hikamarket::deny('category',
JText::_('HIKAM_PAGE_DENY'));

		$this->ordering['groupVal'] = $category_id;
		return parent::saveorder();
	}

	public function authorize($task) {
		if($task == 'toggle' || $task == 'delete') {
			$completeTask = hikaInput::get()->getCmd('task');
			if(strrpos($completeTask, '-') !== false) {
				$category_id = (int)substr($completeTask, strrpos($completeTask,
'-') + 1);
			} else {
				$category_id = hikaInput::get()->getInt('category_id');
				if(empty($category_id))
					$category_id = hikaInput::get()->getInt('value');
			}

			if(!hikamarket::loginVendor())
				return false;
			if(!$this->config->get('frontend_edition',0))
				return false;
			if(!JSession::checkToken('request'))
				return false;
			if($task == 'toggle' &&
!hikamarket::acl('category/edit/published'))
				return false;
			if($task == 'delete' &&
!hikamarket::acl('category/delete'))
				return false;
			if(!hikamarket::isVendorCategory($category_id))
				return false;
			return true;
		}
		return parent::authorize($task);
	}

	public function show() {
		$this->edit();
	}

	public function save2new() {
		$this->store(true);
		return $this->add();
	}

	public function edit() {
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;
		if( !hikamarket::acl('category/edit') )
			return hikamarket::deny('category',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CATEGORY_EDIT')));

		$category_id = hikamarket::getCID('category_id');
		if(!hikamarket::isVendorCategory($category_id))
			return hikamarket::deny('category',
JText::_('HIKAM_PAGE_DENY'));

		hikaInput::get()->set('layout', 'form');
		return parent::display();
	}

	public function add() {
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;
		if( !hikamarket::acl('category/add') )
			return hikamarket::deny('category',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CATEGORY_EDIT')));


		hikaInput::get()->set('layout', 'form');
		return parent::display();
	}

	public function edit_translation() {
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;
		if( !hikamarket::acl('category/edit/translations') )
			return hikamarket::deny('category',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CATEGORY_EDIT')));

		$category_id = hikamarket::getCID('category_id');
		if(!hikamarket::isVendorProduct($category_id))
			return hikamarket::deny('category',
JText::_('HIKAM_PAGE_DENY'));

		hikaInput::get()->set('layout',
'edit_translation');
		return parent::display();
	}

	public function save_translation() {
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;
		if( !hikamarket::acl('category/edit/translations') )
			return hikamarket::deny('category',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CATEGORY_EDIT')));

		$category_id = hikamarket::getCID('category_id');
		if(!hikamarket::isVendorCategory($category_id))
			return hikamarket::deny('category',
JText::_('HIKAM_PAGE_DENY'));

		$category = null;
		$categoryClass = hikamarket::get('class.category');
		$category = $categoryClass->getRaw($category_id);
		if(!empty($category->category_id)) {
			$translationHelper =
hikamarket::get('shop.helper.translation');
			$translationHelper->getTranslations($product);
			$translationHelper->handleTranslations('category',
$category->category_id, $category);
		}
		$js =
'window.hikashop.ready(function(){window.parent.hikamarket.submitBox();});';
		$doc = JFactory::getDocument();
		$doc->addScriptDeclaration($js);
	}

	public function delete() {
		if( !$this->config->get('frontend_edition', 0)) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;

		$completeTask = hikaInput::get()->getCmd('task');
		if(strrpos($completeTask, '-') !== false) {
			$category_id = (int)substr($completeTask, strrpos($completeTask,
'-') + 1);
		} else {
			$category_id = hikaInput::get()->getInt('category_id');
		}
		if(empty($category_id))
			return false;

		if(!hikamarket::acl('category/delete') ||
!hikamarket::isVendorCategory($category_id))
			return false;

		$categoryClass = hikamarket::get('shop.class.category');
		$ret = $categoryClass->delete($category_id);

		$app = JFactory::getApplication();
		if(!empty($ret) && $ret > 0) {
			$app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS',
1), 'message');
		}
		$app->redirect(hikamarket::completeLink('category&task=listing',
false, true));
	}

	public function store($new = false) {
		if(!hikamarket::loginVendor())
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;
		if( !hikamarket::acl('category/edit') )
			return hikamarket::deny('category',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CATEGORY_EDIT')));

		$categoryClass = hikamarket::get('class.category');
		if( $categoryClass === null )
			return false;
		$status = $categoryClass->frontSaveForm();
		if($status) {
			hikaInput::get()->set('cid', $status);
			if($new)
				hikaInput::get()->set('cid', 0);
			hikaInput::get()->set('fail', null);
		}
		return $status;
	}

	public function getUploadSetting($upload_key, $caller = '') {
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('category/edit') )
			return false;

		$category_id = hikaInput::get()->getInt('category_id', 0);
		if(empty($upload_key) || (!empty($category_id) &&
!hikamarket::isVendorCategory($category_id)))
			return false;

		$upload_value = null;
		$upload_keys = array(
			'category_image' => array(
				'type' => 'image',
				'view' => 'form_image_entry'
			)
		);

		if(empty($upload_keys[$upload_key]))
			return false;
		$upload_value = $upload_keys[$upload_key];

		$shopConfig = hikamarket::config(false);
		$vendor_id = hikamarket::loadVendor(false, false);

		$options = array();
		if($upload_value['type'] == 'image')
			$options['upload_dir'] =
$shopConfig->get('uploadfolder');
		else
			$options['upload_dir'] =
$shopConfig->get('uploadsecurefolder');

		if($vendor_id > 1)
			$options['sub_folder'] = 'vendor'.$vendor_id.DS;

		return array(
			'limit' => 1,
			'type' => $upload_value['type'],
			'layout' => 'categorymarket',
			'view' => $upload_value['view'],
			'options' => $options,
			'extra' => array(
				'category_id' => $category_id
			)
		);
	}


	public function manageUpload($upload_key, &$ret, $uploadConfig,
$caller = '') {
		if(empty($ret))
			return;

		$config = hikamarket::config();
		$vendor_id = hikamarket::loadVendor(false, false);
		$category_id =
(int)$uploadConfig['extra']['category_id'];
		if(!empty($category_id) &&
!hikamarket::isVendorCategory($category_id))
			return;

		$file_type = 'category';
		if(!empty($uploadConfig['extra']['file_type']))
			$file_type = $uploadConfig['extra']['file_type'];

		$sub_folder = '';
		if(!empty($uploadConfig['options']['sub_folder']))
			$sub_folder = str_replace('\\', '/',
$uploadConfig['options']['sub_folder']);

		if($caller == 'upload' || $caller == 'addimage') {
			$file = new stdClass();
			$file->file_description = '';
			$file->file_name = $ret->name;
			$file->file_type = $file_type;
			$file->file_ref_id = $category_id;
			$file->file_path = $sub_folder . $ret->name;

			if(strpos($file->file_name, '.') !== false) {
				$file->file_name = substr($file->file_name, 0,
strrpos($file->file_name, '.'));
			}

			$fileClass = hikamarket::get('shop.class.file');
			$status = $fileClass->save($file, $file_type);

			$ret->file_id = $status;
			$ret->params->file_id = $status;
			return;
		}

		if($caller == 'galleryselect') {
			$file = new stdClass();
			$file->file_type = 'category';
			$file->file_ref_id = $category_id;
			$file->file_path = $sub_folder . $ret->name;

			$fileClass = hikamarket::get('shop.class.file');
			$status = $fileClass->save($file);

			$ret->file_id = $status;
			$ret->params->file_id = $status;

			return;
		}
	}

	public function getTree() {
		hikamarket::headerNoCache();
		hikamarket::cleanBuffers();

		if(!hikamarket::loginVendor() ||
!$this->config->get('frontend_edition',0)) {
			echo '[]';
			exit;
		}

		$category_id = hikaInput::get()->getInt('category_id', 0);
		$displayFormat =
hikaInput::get()->getString('displayFormat', '');
		$search = hikaInput::get()->getString('search', null);

		$nameboxType = hikamarket::get('type.namebox');
		$options = array(
			'start' => $category_id,
			'displayFormat' => $displayFormat
		);

		if(!hikamarket::isVendorCategory($category_id, null, true)) {
			echo '[]';
			exit;
		}

		$ret = $nameboxType->getValues($search, 'category',
$options);
		if(!empty($ret)) {
			echo json_encode($ret);
			exit;
		}
		echo '[]';
		exit;
	}

	public function findList() {
		hikamarket::headerNoCache();
		hikamarket::cleanBuffers();

		if(!hikamarket::loginVendor() ||
!$this->config->get('frontend_edition',0)) {
			echo '[]';
			exit;
		}

		$search = hikaInput::get()->getString('search',
'');
		$start = hikaInput::get()->getInt('start', 0);
		$type = hikaInput::get()->getString('category_type',
'');
		$displayFormat =
hikaInput::get()->getString('displayFormat', '');

		$types = array(
			'manufacturer' => 'brand',
			'order_status' => 'order_status'
		);
		if(!isset($types[$type])) {
			echo '[]';
			exit;
		}
		$type = $types[$type];
		$options = array();

		if(!empty($displayFormat))
			$options['displayFormat'] = $displayFormat;
		if($start > 0)
			$options['page'] = $start;

		$nameboxType = hikamarket::get('type.namebox');
		$elements = $nameboxType->getValues($search, $type, $options);
		echo json_encode($elements);
		exit;
	}
}
controllers/characteristic.php000064400000021335151166607730012633
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class characteristicMarketController extends hikamarketController {
	protected $rights = array(
		'display' =>
array('show','listing','findlist'),
		'add' => array('add'),
		'edit' => array('edit',),
		'modify' =>
array('apply','save','addcharacteristic'),
		'delete' => array('delete')
	);

	protected $ordering = array(
		'type' => 'characteristic',
		'pkey' => 'characteristic_id',
		'table' => 'characteristic',
		'groupMap' => 'characteristic_parent_id',
		'orderingMap' => 'characteristic_ordering',
		'groupVal' => 0
	);

	protected $type = 'characteristic';
	protected $config = null;

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		if(!$skip)
			$this->registerDefaultTask('listing');
		$this->config = hikamarket::config();
	}

	public function listing() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;
		if(!hikamarket::acl('characteristic/listing'))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CHARACTERISTIC_LISTING')));
		hikaInput::get()->set('layout', 'listing');
		return parent::display();
	}

	public function show() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;
		if(!hikamarket::acl('characteristic/show'))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CHARACTERISTIC_SHOWING')));

		$vendor_id = hikamarket::loadVendor(false);
		$characteristic_id = hikamarket::getCID('characteristic_id');
		$characteristic = null;
		if($characteristic_id > 0) {
			$characteristicClass =
hikamarket::get('class.characteristic');
			$characteristic = $characteristicClass->get($characteristic_id);
		}
		if(!empty($characteristic_id) && (empty($characteristic) ||
($characteristic->characteristic_vendor_id > 0 &&
$characteristic->characteristic_vendor_id != $vendor_id)))
			return hikamarket::deny('characteristic',
JText::sprintf('HIKAM_ACTION_ERROR',
JText::_('HIKAM_WRONG_DATA')));

		return parent::show();
	}

	public function edit() {
		return $this->show();
	}

	public function add() {
		return $this->show();
	}

	public function store() {
		if(!hikamarket::loginVendor())
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;

		$characteristic_id = hikamarket::getCID('characteristic_id');
		if(!empty($characteristic_id) &&
!hikamarket::acl('characteristic/edit') )
			return hikamarket::deny('characteristic',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CHARACTERISTIC_EDIT')));
		if(empty($characteristic_id) &&
!hikamarket::acl('characteristic/add') )
			return hikamarket::deny('characteristic',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CHARACTERISTIC_ADD')));

		JSession::checkToken() || die('Invalid Token');
		$tmpl = hikaInput::get()->getCmd('tmpl', '');

		$characteristicClass =
hikamarket::get('class.characteristic');
		if($characteristicClass === null)
			return false;
		$status = $characteristicClass->frontSaveForm();

		if($tmpl == 'json') {
			if(!empty($status))
				echo '{id:' . $status . '}';
			else
				echo '{err:"failed"}';
			exit;
		}

		$app = JFactory::getApplication();
		if($status) {
			$app->enqueueMessage(JText::_('HIKASHOP_SUCC_SAVED'),
'success');
			hikaInput::get()->set('cid', $status);
			hikaInput::get()->set('fail', null);
		} else {
			$app->enqueueMessage(JText::_('ERROR_SAVING'),
'error');
			if(!empty($characteristicClass->errors)) {
				foreach($characteristicClass->errors as $err) {
					$app->enqueueMessage($err, 'error');
				}
			}
		}
		return $status;
	}

	public function addCharacteristic() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;

		JSession::checkToken('request') || die('Invalid
Token');
		$tmpl = hikaInput::get()->getCmd('tmpl', '');

		$characteristic_parent_id =
hikaInput::get()->getInt('characteristic_parent_id', 0);
		$characteristic_type =
hikaInput::get()->getCmd('characteristic_type',
'');

		$value = hikaInput::get()->getString('value',
'');
		if(empty($value))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_ERROR',
JText::_('HIKAM_WRONG_DATA')));

		$value = trim($value);
		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id == 1)
			$vendor_id = 0;

		$ret = false;

		if($characteristic_type == 'value') {
			if(!hikamarket::acl('characteristic/values/add'))
				return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CHARACTERISTIC_ADD')));

			if($characteristic_parent_id <= 0 ||
(!hikamarket::isVendorCharacteristic($characteristic_parent_id) &&
!hikamarket::isVendorCharacteristic($characteristic_parent_id, 0, 0)))
				return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_ERROR',
JText::_('HIKAM_WRONG_DATA')));

			$characteristicClass =
hikamarket::get('class.characteristic');

			$characteristic_vendor_id = $vendor_id;
			if($characteristic_vendor_id == 0 &&
hikamarket::acl('characteristic/values/edit/vendor'))
				$characteristic_vendor_id =
(int)hikaInput::get()->getInt('characteristic_vendor_id', 0);

			if($characteristicClass->findValue($value, $characteristic_parent_id,
$characteristic_vendor_id) > 0)
				return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_ERROR',
JText::_('HIKAM_WRONG_DATA')));

			$element = new stdClass();
			$element->characteristic_parent_id = $characteristic_parent_id;
			$element->characteristic_value = $value;
			$element->characteristic_vendor_id = $characteristic_vendor_id;

			$ret = $characteristicClass->save($element);
		} else {
			if(!hikamarket::acl('characteristic/add'))
				return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_CHARACTERISTIC_ADD')));

			$characteristicClass =
hikamarket::get('class.characteristic');

			$characteristic_vendor_id = $vendor_id;
			if($characteristic_vendor_id == 0 &&
hikamarket::acl('characteristic/edit/vendor'))
				$characteristic_vendor_id =
(int)hikaInput::get()->getInt('characteristic_vendor_id', 0);

			if($characteristicClass->findValue($value, 0,
$characteristic_vendor_id) > 0)
				return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_ERROR',
JText::_('HIKAM_WRONG_DATA')));

			$element = new stdClass();
			$element->characteristic_parent_id = 0;
			$element->characteristic_value = $value;
			$element->characteristic_alias = strtolower($value);
			$element->characteristic_vendor_id = $characteristic_vendor_id;

			$ret = $characteristicClass->save($element);
		}

		if($tmpl == 'json') {
			while(ob_get_level())
				@ob_end_clean();

			if(!empty($ret)) {
				$data = array(
					'value' => $ret,
					'name' => $value
				);
				if($vendor_id == 0) {
					$data['vendor_id'] = $element->characteristic_vendor_id;
					if($element->characteristic_vendor_id > 0) {
						$vendorClass = hikamarket::get('class.vendor');
						$vendor =
$vendorClass->get($element->characteristic_vendor_id);
						$data['vendor'] = $vendor->vendor_name;
					}
				}
				echo json_encode($data);
			} else
				echo '{err:"failed"}';
			exit;
		}

		hikaInput::get()->set('layout', 'listing');
		return parent::display();
	}

	public function findList() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;

		$search = hikaInput::get()->getString('search',
'');
		$type = hikaInput::get()->getString('characteristic_type',
'');
		$characteristic_parent_id =
hikaInput::get()->getInt('characteristic_parent_id', 0);

		$options = array(
			'vendor' => hikamarket::loadVendor(false)
		);

		if($type == 'value') {
			if($characteristic_parent_id <= 0 ||
(!hikamarket::isVendorCharacteristic($characteristic_parent_id) &&
!hikamarket::isVendorCharacteristic($characteristic_parent_id,0,0)))
				return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_ERROR',
JText::_('HIKAM_WRONG_DATA')), 'error',
'json');

			$type = 'characteristic_value';
			$options['url_params'] = array('ID' =>
$characteristic_parent_id);
		} else
			$type = 'characteristic';

		$nameboxType = hikamarket::get('type.namebox');
		$elements = $nameboxType->getValues($search, $type, $options);

		while(ob_get_level())
			@ob_end_clean();
		echo json_encode($elements);
		exit;
	}
}
controllers/discount.php000064400000011247151166607730011474
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class discountMarketController extends hikamarketController {
	protected $rights = array(
		'display' => array('show', 'listing'),
		'add' => array('add'),
		'edit' => array('edit'),
		'modify' => array('apply', 'save',
'toggle'),
		'delete' => array('delete')
	);

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		if(!$skip)
			$this->registerDefaultTask('listing');
		$this->config = hikamarket::config();
	}

	public function listing() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;
		if(!hikamarket::acl('discount/listing'))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_DISCOUNT_LISTING')));
		hikaInput::get()->set('layout', 'listing');
		return parent::display();
	}

	public function add() {
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;

		$redirection = 'discount';
		if(!hikamarket::acl('discount/listing'))
			$redirection = 'vendor';
		if( !hikamarket::acl('discount/add') ) {
			return hikamarket::deny($redirection,
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_DISCOUNT_ADD')));
		}

		hikaInput::get()->set('layout', 'show');
		return parent::display();
	}

	public function edit() {
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;

		$redirection = 'discount';
		if(!hikamarket::acl('discount/listing'))
			$redirection = 'vendor';
		if( !hikamarket::acl('discount/edit') ) {
			return hikamarket::deny($redirection,
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_DISCOUNT_EDIT')));
		}

		$discount_id = hikamarket::getCID('discount_id');
		if(!hikamarket::isVendorDiscount($discount_id))
			return hikamarket::deny($redirection,
JText::_('HIKAM_PAGE_DENY'));

		hikaInput::get()->set('layout', 'show');
		return parent::display();
	}

	public function store() {
		if(!hikamarket::loginVendor())
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;
		$redirection = 'discount';
		if(!hikamarket::acl('discount/listing'))
			$redirection = 'vendor';
		if( !hikamarket::acl('discount/edit') )
			return hikamarket::deny($redirection,
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_DISCOUNT_EDIT')));

		$discountClass = hikamarket::get('class.discount');
		if( $discountClass === null )
			return false;
		$status = $discountClass->frontSaveForm();
		if($status) {
			hikaInput::get()->set('cid', $status);
			hikaInput::get()->set('fail', null);
		}

		return $status;
	}

	public function delete() {
		if( !$this->config->get('frontend_edition', 0)) {
			throw new JAccessExceptionNotallowed(JText::_('Access
Forbidden'), 403);
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;

		$completeTask = hikaInput::get()->getCmd('task');
		if(strrpos($completeTask, '-') !== false) {
			$discount_id = (int)substr($completeTask, strrpos($completeTask,
'-') + 1);
		} else {
			$discount_id = hikaInput::get()->getInt('discount_id');
		}
		if(empty($discount_id))
			return false;

		if(!hikamarket::acl('discount/delete') ||
!hikamarket::isVendorDiscount($discount_id))
			return false;

		$discountClass = hikamarket::get('shop.class.discount');
		$ret = $discountClass->delete($discount_id);

		$app = JFactory::getApplication();
		if(!empty($ret) && $ret > 0) {
			$app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS',
1), 'message');
		}
		$app->redirect(hikamarket::completeLink('discount&task=listing',
false, true));
	}

	public function authorize($task) {
		if($task == 'toggle' || $task == 'delete') {
			$completeTask = hikaInput::get()->getCmd('task');
			$discount_id = (int)substr($completeTask, strrpos($completeTask,
'-') + 1);

			if(!hikamarket::loginVendor())
				return false;
			if(!$this->config->get('frontend_edition',0))
				return false;
			if(!JSession::checkToken('request'))
				return false;
			if($task == 'toggle' &&
!hikamarket::acl('discount/edit/published'))
				return false;
			if($task == 'delete' &&
!hikamarket::acl('discount/delete'))
				return false;
			if(!hikamarket::isVendorDiscount($discount_id))
				return false;
			return true;
		}
		return parent::authorize($task);
	}
}
controllers/index.html000064400000000032151166607730011116
0ustar00<html><body></body></html>controllers/order.php000064400000053255151166607730010764
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class orderMarketController extends hikamarketController {
	protected $rights = array(
		'display' =>
array('listing','show','invoice','mail','previewmail','status','history','showblock','request','create','payments'),
		'add' => array('add'),
		'edit' => array('edit',
'edit_additional', 'product_add',
'product_delete', 'customer_set', 'export',
'product_data'),
		'modify' =>
array('apply','save','customer_save','sendmail','submitblock'),
		'delete' => array(),
	);

	protected $subtasks = array(
		'customer',
		'billing_address',
		'shipping_address',
		'products',
		'additional',
		'general',
		'history'
	);

	protected $popupSubtasks = array(
		'additional',
		'products'
	);

	protected $config = null;

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		if(!$skip)
			$this->registerDefaultTask('listing');
		$this->config = hikamarket::config();
	}

	protected function checks($order_id = null) {
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition', 0) )
			return false;

		if($order_id !== null && !hikamarket::isVendorOrder($order_id))
			return false;

		return true;
	}

	public function listing() {
		if(!$this->checks())
			return false;
		if(!hikamarket::acl('order/listing'))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_LISTING')));
		hikaInput::get()->set('layout', 'listing');
		return parent::display();
	}

	public function payments() {
		if(!$this->checks())
			return false;
		if(!hikamarket::acl('order/payments'))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PAYMENTS_LISTING')));
		hikaInput::get()->set('layout', 'payments');
		return parent::display();
	}

	public function save() {
		$status = $this->store();
		$tmpl = hikaInput::get()->getVar('tmpl', '');

		if($tmpl == 'component' &&
hikaInput::get()->getInt('closepopup', 0)) {
			if(empty($status)) {
				return '';
			}

			$orderClass = hikamarket::get('class.order');
			if(is_int($status)) {
				$order = $orderClass->getRaw((int)$status);
			} else {
				$order = $status;
			}

			$events = $orderClass->getEvents();
			$extra_js = array();
			if(!empty($events)) {
				foreach($events as $k => $v) {
					$extra_js[] =
'window.parent.Oby.fireAjax("'.$k.'",
'.json_encode($v).');';
				}
			}

			ob_end_clean();
			echo '<html><body>'.
				'<script
type="text/javascript">'."\r\n".
				'window.parent.hikamarket.submitBox('.json_encode(array(
					'order_status' => $order->order_status,
					'name' =>
hikamarket::orderStatus($order->order_status)
				)).');'."\r\n" . implode("\r\n",
$extra_js) .
				'</script>'."\r\n".
				'</body></html>';
			exit;
		}

		if($tmpl == 'component')
			return $this->show();
		return $this->listing();
	}

	public function add() {
		if(!$this->checks())
			return false;
		if( !hikamarket::acl('order/add') )
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EDIT')));

		$app = JFactory::getApplication();

		$formData = hikaInput::get()->get('data', array(),
'array');
		if(empty($formData['order']) ||
empty($formData['order']['order_user_id'])) {
			$app->redirect(
hikamarket::completeLink('order&task=create') );
			return;
		}

		$orderClass = hikamarket::get('class.order');
		$order = $orderClass->saveCreateForm();

		if(!empty($order)) {
			$app->redirect(
hikamarket::completeLink('order&task=show&cid=' .
$order->order_id ) );
		} else {
			$app->enqueueMessage(JText::_('HIKAM_ERR_ORDER_CREATION'),
'error');
			$app->redirect(
hikamarket::completeLink('order&task=create') );
		}
	}

	public function store() {
		$order_id = hikamarket::getCID('order_id');
		if(!$this->checks($order_id))
			return false;

		$orderClass = hikamarket::get('class.order');
		if( $orderClass === null )
			return false;

		$task = hikaInput::get()->getVar('subtask', null);
		if($task !== null) {
			if(!in_array($task, $this->subtasks))
				return false;
			if(!hikamarket::acl('order/edit/'.$task))
				return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EDIT')));

			$status = $orderClass->frontSaveFormLegacy($task);
			if($status) {
				hikaInput::get()->set('cid', $status);
				hikaInput::get()->set('fail', null);
			}
			return $status;
		}

		if(!hikamarket::acl('order/edit'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EDIT')));

		$status = $orderClass->frontSaveForm();
		return $status;
	}

	public function show() {
		$order_id = hikamarket::getCID('order_id');
		if(!$this->checks($order_id))
			return false;

		$task = hikaInput::get()->getVar('subtask', '');
		if(!empty($task) && !in_array($task, $this->subtasks))
			return false;
		if(!hikamarket::acl('order/show'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_SHOW')));
		$vendor_id = hikamarket::loadVendor(false);

		hikaInput::get()->set('layout', 'show');
		if($vendor_id > 1 &&
$this->config->get('order_vendor_edition_legacy', 0))
			hikaInput::get()->set('layout', 'show_vendor');
		else if(!empty($task))
			hikaInput::get()->set('layout', 'show_'.$task);

		$tmpl = hikaInput::get()->getVar('tmpl', '');
		if($tmpl == 'component') {
			ob_end_clean();
			parent::display();
			exit;
		}
		return parent::display();
	}

	public function create() {
		if(!$this->checks())
			return false;
		if(!hikamarket::acl('order/add'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_SHOW')));

		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id > 1 &&
!$this->config->get('vendor_edit_order', 0))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_SHOW')));

		hikaInput::get()->set('layout', 'create');
		return parent::display();
	}

	public function status() {
		$order_id = hikamarket::getCID('order_id');
		if(!$this->checks($order_id))
			return false;
		if(!hikamarket::acl('order/edit/general'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_MAIL')));

		hikaInput::get()->set('layout', 'status');
		return parent::display();
	}

	public function invoice() {
		$order_id = hikamarket::getCID('order_id');
		if(!$this->checks($order_id))
			return false;

		if(!hikamarket::acl('order/show'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_SHOW')));

		hikaInput::get()->set('layout', 'invoice');
		return parent::display();
	}

	public function export() {
		if(!$this->checks())
			return false;
		if(!hikamarket::acl('order/export'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EXPORT')));

		hikaInput::get()->set('layout', 'export_show');

		$formData = hikaInput::get()->get('data', array(),
'array');
		if(!empty($formData)) {
			if(!JSession::checkToken()) {
				$app = JFactory::getApplication();
				$app->enqueueMessage(JText::_('INVALID_TOKEN'),
'error');
			} else {
				hikaInput::get()->set('layout', 'export');
			}
		}
		return parent::display();
	}

	public function history() {
		$order_id = hikaInput::get()->getInt('order_id', 0);
		if(!$this->checks($order_id))
			return false;

		if(!hikamarket::acl('order/show/historydata'))
			return false;

		hikaInput::get()->set('layout', 'history');
		return parent::display();
	}

	public function showblock() {
		hikamarket::headerNoCache();
		$order_id = hikamarket::getCID('order_id');
		if(empty($order_id) || !$this->checks($order_id))
			return false;

		$tmpl = hikaInput::get()->getCmd('tmpl', '');
		hikaInput::get()->set('layout', 'showblock');
		if($tmpl == 'component' || $tmpl == 'ajax') {
			ob_end_clean();
			parent::display();
			exit;
		}
		return $this->display();
	}

	public function submitblock() {
		JSession::checkToken('request') || jexit('Invalid
Token');
		$tmpl = hikaInput::get()->getCmd('tmpl', '');

		$order_id = hikamarket::getCID('order_id', 0);
		if(empty($order_id) || !$this->checks($order_id))
			return false;

		$orderClass = hikamarket::get('class.order');
		if( $orderClass === null )
			return false;
		$updateOrder = $orderClass->frontSaveForm();

		if($updateOrder === false) {
			ob_end_clean();
			echo '0';
			if($tmpl == 'component' || $tmpl == 'ajax')
				exit;
			return false;
		}

		$block = hikaInput::get()->getCmd('block', '');
		if(in_array($block, array('delete_product'))) {
			ob_end_clean();
			echo '1';
			exit;
		}

		if($block == 'product' && $tmpl == 'ajax') {
			$pid = hikaInput::get()->getInt('pid', 0);
			if($pid === 0 && count($updateOrder->product) == 1) {
				$p = reset($updateOrder->product);
				$pid = (int)$p->order_product_id;
				hikaInput::get()->set('pid', $pid);
			}
		}

		hikaInput::get()->set('blocksubmitted', 1);
		return $this->showblock();
	}

	public function product_data() {
		JSession::checkToken('request') || jexit('Invalid
Token');

		$order_id = hikamarket::getCID('order_id');
		if(empty($order_id) || !$this->checks($order_id) ||
!hikamarket::acl('order/edit/products'))
			return false;

		$shopConfig = hikamarket::config(false);
		$productClass = hikamarket::get('class.product');
		$orderClass = hikamarket::get('class.order');
		$addressClass = hikamarket::get('shop.class.address');
		$zoneClass = hikamarket::get('shop.class.zone');
		$product_id = hikaInput::get()->getInt('product', 0);
		$qty = hikaInput::get()->getInt('qty', 0);

		$order_product_id = 0;

		$data = array();
		if($qty <= 0)
			$qty = 1;

		$order = $orderClass->getRaw($order_id);

		if($shopConfig->get('tax_zone_type', 'shipping')
== 'billing')
			$order_address =
$addressClass->get((int)$order->order_billing_address_id);
		else
			$order_address =
$addressClass->get((int)$order->order_shipping_address_id);
		$address_base = !empty($order_address->address_state) ?
$order_address->address_state : $order_address->address_country;
		$zone = $zoneClass->get($address_base);

		$product = $productClass->getProduct($product_id, array(
			'price' => array(
				'currency' => (int)$order->order_currency_id,
				'qty' => (int)$qty,
				'user' => (int)$order->order_user_id,
				'zone' => (int)$zone->zone_id
			)
		));

		if(empty($product)) {
			ob_end_clean();
			echo json_encode($data);
			exit;
		}

		$p = end($product->prices);
		$data = array(
			'name' => $product->product_name,
			'code' => $product->product_code,
			'tax' => isset($p->taxes[0]) ?
$p->taxes[0]->tax_namekey : '',
			'price' => isset($p->price_value_with_tax) ?
$p->price_value_with_tax : $p->price_value
		);

		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id > 1 && !empty($product->product_vendor_id)
&& (int)$product->product_vendor_id != $vendor_id) {
			ob_end_clean();
			echo '{}';
			exit;
		}

		if($vendor_id <= 1 && !empty($product->product_vendor_id))
{
			$vendorClass = hikamarket::get('class.vendor');
			$vendorObj = $vendorClass->get((int)$product->product_vendor_id);
			if(!empty($vendorObj)) {
				$data['vendor'] = array(
					'id' => (int)$vendorObj->vendor_id,
					'name' => $vendorObj->vendor_name
				);
				$product->product_vendor_id = $vendorObj->vendor_id;
			} else
				$product->product_vendor_id = null;
		}

		if(!empty($product->product_vendor_id)) {
			$p->price_value = (float)hikamarket::toFloat($p->price_value);
			$p->price_value_with_tax =
(float)hikamarket::toFloat($p->price_value_with_tax);

			$vendor_ids = array((int)$product->product_vendor_id =>
(int)$product->product_vendor_id);
			$products = array(
				0 => array(
					'_id' => 0,
					'id' => (int)$product->product_id,
					'vendor' => (int)$product->product_vendor_id,
					'fee' => array(),
					'qty' => (int)$qty,
					'price' => $p->price_value,
					'price_tax' => $p->price_value_with_tax -
$p->price_value
				)
			);

			$config = hikamarket::config();
			if($config->get('calculate_vendor_price_with_tax', false))
				$full_price = (float)($products[0]['price'] +
$products[0]['price_tax']) * (int)$products[0]['qty'];
			else
				$full_price = (float)$products[0]['price'] *
(int)$products[0]['qty'];

			$feeClass = hikamarket::get('class.fee');
			$allFees = $feeClass->getProducts($products, $vendor_ids);

			$orderProduct = new stdClass();
			$orderProduct->order_product_quantity = (int)$qty;
			$orderProduct->order_product_price =
isset($p->price_value_with_tax) ? $p->price_value_with_tax :
$p->price_value;

			if($config->get('calculate_vendor_price_with_tax', false))
				$orderProduct->order_product_vendor_price =
$p->price_value_with_tax;
			else
				$orderProduct->order_product_vendor_price = $p->price_value;

			$product_fee = $orderClass->getProductFee($orderProduct,
$products[0]['fee'], $full_price, $order->order_full_price,
$products[0]['qty']);

			$data['vendorprice'] = $product_fee['vendor'];
		}

		ob_end_clean();
		echo json_encode($data);
		exit;
	}

	public function request() {
		if(!$this->checks())
			return false;
		if(!hikamarket::acl('order/request'))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_REQUEST')));

		$formData = hikaInput::get()->get('data', array(),
'array');
		if(!empty($formData)) {
			$app = JFactory::getApplication();

			if(!JSession::checkToken()) {
				$app->enqueueMessage(JText::_('INVALID_TOKEN'),
'error');
			} else {
				$vendor = hikamarket::loadVendor(true);

				$mailClass = hikamarket::get('class.mail');
				$infos = new stdClass;
				$infos->vendor = hikamarket::loadVendor(true);
				$infos->user = hikamarket::loadUser(true);
				$mail = $mailClass->load('vendor_payment_request',
$infos);

				if(!empty($mail) && $mail->published) {
					$shopConfig = hikamarket::config(false);

					if(!empty($mail->subject))
						$mail->subject = JText::sprintf($mail->subject,
HIKASHOP_LIVE);

					$mail->from_email = $shopConfig->get('from_email');
					$mail->from_name = $shopConfig->get('from_name');

					if(!empty($infos->email))
						$mail->dst_email = $infos->email;
					else
						$mail->dst_email = $shopConfig->get('from_email');

					if(!empty($infos->name))
						$mail->dst_name = $infos->name;
					else
						$mail->dst_name = $shopConfig->get('from_name');

					if(!empty($mail->dst_email))
						$mail_sent = $mailClass->sendMail($mail);
				}

				if($mail_sent) {
					$app->enqueueMessage(JText::_('HIKAM_REQUEST_SENT'));
				} else {
					$app->enqueueMessage(JText::_('MAIL_ERROR'),
'error');
				}
			}
		}

		hikaInput::get()->set('layout', 'request');
		return parent::display();
	}

	public function mail() {
		$order_id = hikamarket::getCID('order_id');
		if(empty($order_id) || !$this->checks($order_id))
			return false;

		if(!hikamarket::acl('order/edit/mail'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_MAIL')));

		hikaInput::get()->set('layout', 'mail');
		return parent::display();
	}

	public function previewmail() {
		$order_id = hikamarket::getCID('order_id');
		if(empty($order_id) || !$this->checks($order_id))
			return false;

		if(!hikamarket::acl('order/edit/mail'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_MAIL')));

		hikamarket::cleanBuffers();
		hikaInput::get()->set('layout', 'previewmail');
		parent::display();
		exit;
	}


	public function sendmail() {
		$order_id = hikamarket::getCID('order_id');
		if(empty($order_id) || !$this->checks($order_id))
			return false;
		if(!hikamarket::acl('order/edit/mail'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_MAIL')));

		$orderClass = hikamarket::get('shop.class.order');

		$formData = hikaInput::get()->get('data', array(),
'array');
		$params = array();
		if(!empty($formData['mail']['params'])) {
			foreach($formData['mail']['params'] as $k => $v)
{
				if(is_numeric($v))
					$v = (int)$v;
				if(is_string($v))
					$v = strip_tags($v);
				$params[$k] = $v;
			}
		}

		$order = $orderClass->get($order_id);
		$order->url_itemid = '';
		$orderClass->loadOrderNotification($order,
'market.user_order_notification', $params);

		$vendor = hikamarket::loadVendor(true);
		$user = hikamarket::loadUser(true);
		if($vendor->vendor_id > 1 &&
!empty($vendor->vendor_email)) {
			$order->mail->from_email = $vendor->vendor_email;
			$order->mail->from_name = $vendor->vendor_name;
		}

		if(!empty($formData['mail']['subject'])) {
			$subject =
trim(strip_tags($formData['mail']['subject']));
			if(!empty($subject))
				$order->mail->subject = $subject;
		}

		$order->mail->dst_email = $order->customer->user_email;
		if(!empty($order->customer->name))
			$order->mail->dst_name = $order->customer->name;
		if((int)$formData['mail']['dst_email'] == 1) {
			$order->mail->dst_email = $user->user_email; //
$vendor->vendor_email;
			$order->mail->dst_name = $user->name; //
$vendor->vendor_name;
		}

		$mailClass = hikamarket::get('shop.class.mail');
		$mailClass->sendMail($order->mail);

		if(!$mailClass->mail_success) {
			hikaInput::get()->set('layout', 'mail');
			return parent::display();
		}

		hikamarket::headerNoCache();
		echo '<html><head><script
type="text/javascript">window.parent.hikamarket.submitBox();</script></head><body></body></html>';
		exit;
	}

	private function show_products() {
		$tmpl = hikaInput::get()->getVar('tmpl', '');
		if($tmpl == 'component') {
			hikaInput::get()->set('layout',
'show_products');
			ob_end_clean();
			parent::display();
			exit;
		}
		hikaInput::get()->set('layout', 'show');
		return parent::display();
	}

	public function edit() {
		$order_id = hikamarket::getCID('order_id');
		if(!$this->checks($order_id))
			return false;

		$task = hikaInput::get()->getVar('subtask', '');
		if(!in_array($task, $this->subtasks)) {
			$tmpl = hikaInput::get()->getVar('tmpl', '');
			if($tmpl == 'component') {
				exit;
			}
			return false;
		}
		if(!hikamarket::acl('order/edit/'.$task))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EDIT')));

		hikaInput::get()->set('layout', 'show_'.$task);

		if(!in_array($task , $this->popupSubtasks)) {
			$tmpl = hikaInput::get()->getVar('tmpl', '');
			if($tmpl == 'component') {
				ob_end_clean();
				parent::display();
				exit;
			}
		} else {
			hikaInput::get()->set('layout', 'edit_'.$task);
		}
		return parent::display();
	}

	public function customer_save() {
		if(!$this->checks())
			return false;

		if(!hikamarket::acl('order/edit/customer'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EDIT')));

		$prderClass = hikamarket::get('class.order');
		if( $prderClass === null )
			return false;
		$status = $prderClass->frontSaveFormLegacy('customer');
		if($status) {
			hikaInput::get()->set('cid', $status);
			hikaInput::get()->set('fail', null);
		}

		$tmpl = hikaInput::get()->getVar('tmpl', '');
		if($tmpl == 'component') {
			ob_end_clean();
			hikaInput::get()->set('layout', 'customer_set');
			return parent::display();
		}
		return $this->show();
	}

	public function customer_set() {
		$order_id = hikaInput::get()->getInt('order_id', 0);
		if(!$this->checks($order_id))
			return false;

		if(!hikamarket::acl('order/edit/customer'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EDIT')));

		hikaInput::get()->set('layout', 'customer_set');
		return parent::display();
	}

	public function product_add() {
		if(!$this->checks())
			return false;

		if(!hikamarket::acl('order/edit/products'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EDIT')));

		$formData = hikaInput::get()->get('data', array(),
'array');
		$product_quantity = -1;
		if(isset($formData['order']) &&
isset($formData['order']['product']['order_product_quantity']))
			$product_quantity =
(int)$formData['order']['product']['order_product_quantity'];

		if($product_quantity >= 0) {
			if(!JSession::checkToken())
				return false;

			$orderClass = hikamarket::get('class.order');
			if( $orderClass === null )
				return false;
			$status = $orderClass->saveForm('product');
			if($status) {
				hikaInput::get()->set('cid', $status);
				hikaInput::get()->set('fail', null);
			}
		} else {
			hikaInput::get()->set('layout',
'edit_products');
			return parent::display();
		}

		return $this->show_products();
	}

	public function product_delete() {
		if(!$this->checks())
			return false;

		if(!hikamarket::acl('order/edit/products'))
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EDIT')));

		$orderClass = hikamarket::get('class.order');
		if( $orderClass === null )
			return false;
		$status =
$orderClass->frontSaveFormLegacy('product_delete');
		if($status) {
			hikaInput::get()->set('cid', $status);
			hikaInput::get()->set('fail', null);
		}

		$tmpl = hikaInput::get()->getVar('tmpl', '');
		if($tmpl == 'component')
			return $this->show_products();
		return $this->show();
	}
}
controllers/payment.php000064400000003130151166607730011311
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class paymentMarketController extends hikamarketController {
	protected $rights = array(
		'display' => array(),
		'add' => array(),
		'edit' => array('toggle'),
		'modify' => array(),
		'delete' => array('delete')
	);
	protected $type = 'payment';
	protected $config = null;

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		$this->config = hikamarket::config();
	}

	public function authorize($task) {
		if(!in_array($task, array('toggle', 'delete')))
			return parent::authorize($task);

		$completeTask = hikaInput::get()->getCmd('task',
'');
		$value = hikaInput::get()->getCmd('value', '');
		if(strrpos($completeTask, '-') !== false)
			$plugin_id = (int)substr($completeTask, strrpos($completeTask,
'-') + 1);
		else
			$plugin_id = (int)substr($value, 0, strpos($value, '-'));

		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;
		if(!JSession::checkToken('request'))
			return false;
		if($task == 'toggle' &&
!hikamarket::acl('paymentplugin/edit/published'))
			return false;
		if($task == 'delete' &&
!hikamarket::acl('paymentplugin/delete'))
			return false;
		if(!hikamarket::isVendorPlugin($plugin_id, 'payment'))
			return false;
		return true;
	}
}
controllers/plugin.php000064400000021521151166607730011136
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class pluginMarketController extends hikamarketController {
	protected $rights = array(
		'display' => array('show', 'listing'),
		'add' => array('add'),
		'edit' => array('edit', 'toggle',),
		'modify' => array('apply', 'save'), // ,
'saveorder'
		'delete' => array('delete')
	);

	protected $ordering = array(
		'type' => 'plugin',
		'pkey' => 'plugin_id',
		'table' => 'shop.plugin',
		'groupMap' => 'plugin_type',
		'orderingMap' => 'plugin_ordering',
		'groupVal' => 0
	);

	protected $type = 'plugin';
	protected $config = null;

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		if(!$skip)
			$this->registerDefaultTask('listing');
		$this->config = hikamarket::config();
	}

	public function listing() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;

		$plugin_type = hikaInput::get()->getCmd('plugin_type',
'payment');
		if(!in_array($plugin_type,
array('payment','shipping', 'generic')))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_LISTING')));
		if(!hikamarket::acl($plugin_type.'plugin/listing'))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_LISTING')));

		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id === null || ((int)$vendor_id > 1 &&
(int)$this->config->get('plugin_vendor_config', 0) == 0))
			return hikamarket::deny('vendor',
JText::_('HIKAM_PAGE_DENY'));

		hikaInput::get()->set('layout', 'listing');
		return parent::display();
	}

	public function saveorder(){
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;
		$plugin_type = hikaInput::get()->getCmd('plugin_type',
'');
		if(!in_array($plugin_type,
array('payment','shipping', 'generic')))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_EDIT')));
		if( !hikamarket::acl($plugin_type.'plugin/edit') )
			return hikamarket::deny('plugin',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_EDIT')));

		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id === null || ((int)$vendor_id > 1 &&
(int)$this->config->get('plugin_vendor_config', 0) == 0))
			return
hikamarket::deny('plugin&plugin_type='.$plugin_type,
JText::_('HIKAM_PAGE_DENY'));

		$plugin_id = hikamarket::getCID('plugin_id');
		if(!hikamarket::isVendorPlugin($plugin_id, $plugin_type))
			return
hikamarket::deny('plugin&plugin_type='.$plugin_type,
JText::_('HIKAM_PAGE_DENY'));

		$this->ordering['groupVal'] = $plugin_id;
		return parent::saveorder();
	}

	public function authorize($task) {
		if($task == 'toggle' || $task == 'delete') {
			$completeTask = hikaInput::get()->getCmd('task');
			if(strrpos($completeTask, '-') !== false) {
				$plugin_id = (int)substr($completeTask, strrpos($completeTask,
'-') + 1);
			} else {
				$plugin_id = hikaInput::get()->getInt('plugin_id');
				if(empty($plugin_id))
					$plugin_id = hikaInput::get()->getInt('value');
			}

			$plugin_type = hikaInput::get()->getCmd('plugin_type',
'');
			if(!in_array($plugin_type,
array('payment','shipping', 'generic')))
				return false;

			if(!hikamarket::loginVendor())
				return false;
			if(!$this->config->get('frontend_edition',0))
				return false;
			if(!JSession::checkToken('request'))
				return false;
			if($task == 'toggle' &&
!hikamarket::acl($plugin_type.'plugin/edit/published'))
				return false;
			if($task == 'delete' &&
!hikamarket::acl($plugin_type.'plugin/delete'))
				return false;
			if($plugin_type == 'generic' &&
!hikamarket::isVendorPlugin($plugin_id, 'plugin'))
				return false;
			if($plugin_type != 'generic' &&
!hikamarket::isVendorPlugin($plugin_id, $plugin_type))
				return false;
			return true;
		}
		return parent::authorize($task);
	}

	public function show() {
		$this->edit();
	}

	public function edit() {
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;

		$plugin_type = hikaInput::get()->getCmd('plugin_type',
'');
		if(!in_array($plugin_type,
array('payment','shipping', 'generic')))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_EDIT')));
		if( !hikamarket::acl($plugin_type.'plugin/edit') )
			return hikamarket::deny('plugin',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_EDIT')));

		$plugin_id = hikamarket::getCID('plugin_id');
		if(!empty($plugin_id) && !hikamarket::isVendorPlugin($plugin_id,
$plugin_type))
			return
hikamarket::deny('plugin&plugin_type='.$plugin_type,
JText::_('HIKAM_PAGE_DENY'));

		if(empty($plugin_id)) {
			if( !hikamarket::acl($plugin_type.'plugin/add') )
				return hikamarket::deny('plugin',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_EDIT')));
			$vendor_id = hikamarket::loadVendor(false);
			if($vendor_id === null || ((int)$vendor_id > 1 &&
(int)$this->config->get('plugin_vendor_config', 0) == 0))
				return
hikamarket::deny('plugin&plugin_type='.$plugin_type,
JText::_('HIKAM_PAGE_DENY'));
		}

		hikaInput::get()->set('layout', 'form');
		return parent::display();
	}

	public function add() {
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;
		$plugin_type = hikaInput::get()->getCmd('plugin_type',
'');
		if(!in_array($plugin_type,
array('payment','shipping', 'generic')))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_EDIT')));
		if( !hikamarket::acl($plugin_type.'plugin/add') )
			return hikamarket::deny('plugin',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_EDIT')));

		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id === null || ((int)$vendor_id > 1 &&
(int)$this->config->get('plugin_vendor_config', 0) == 0))
			return
hikamarket::deny('plugin&plugin_type='.$plugin_type,
JText::_('HIKAM_PAGE_DENY'));


		hikaInput::get()->set('layout', 'add');
		return parent::display();
	}

	public function delete() {
		if( !$this->config->get('frontend_edition', 0)) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;

		$plugin_type = hikaInput::get()->getCmd('plugin_type',
'');

		$completeTask = hikaInput::get()->getCmd('task');
		if(strrpos($completeTask, '-') !== false) {
			$plugin_id = (int)substr($completeTask, strrpos($completeTask,
'-') + 1);
		} else {
			$plugin_id = hikaInput::get()->getInt('plugin_id');
		}
		if(empty($plugin_id))
			return false;

		if(!hikamarket::acl($plugin_type.'plugin/delete'))
			return false;
		if($plugin_type == 'generic' &&
!hikamarket::isVendorPlugin($plugin_id, 'plugin'))
			return false;
		if($plugin_type != 'generic' &&
!hikamarket::isVendorPlugin($plugin_id, $plugin_type))
			return false;

		if($plugin_type == 'generic') {
			$pluginClass = hikamarket::get('shop.class.plugin');
			$ret = $pluginClass->delete($plugin_id);
		} else {
			$pluginClass = hikamarket::get('shop.class.'.$plugin_type);
			$ret = $pluginClass->delete($plugin_id);
		}

		$app = JFactory::getApplication();
		if(!empty($ret) && $ret > 0) {
			$app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS',
1), 'message');
		}
		$app->redirect(hikamarket::completeLink('plugin&task=listing&plugin_type='.$plugin_type,
false, true));
	}

	public function store() {
		if(!hikamarket::loginVendor())
			return false;
		if( !$this->config->get('frontend_edition',0) )
			return false;
		$plugin_type = hikaInput::get()->getCmd('plugin_type',
'payment');
		if(!in_array($plugin_type,
array('payment','shipping', 'generic')))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_EDIT')));
		if( !hikamarket::acl($plugin_type.'plugin/edit') )
			return hikamarket::deny('plugin',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PLUGIN_EDIT')));

		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id === null || ((int)$vendor_id > 1 &&
(int)$this->config->get('plugin_vendor_config', 0) == 0))
			return
hikamarket::deny('plugin&plugin_type='.$plugin_type,
JText::_('HIKAM_PAGE_DENY'));

		$pluginClass = hikamarket::get('class.plugin');
		if( $pluginClass === null )
			return false;
		$status = $pluginClass->frontSaveForm();
		if($status) {
			hikaInput::get()->set('cid', $status);
			hikaInput::get()->set('fail', null);
		}
		return $status;
	}
}
controllers/product.php000064400000117161151166607730011326
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class productMarketController extends hikamarketController {
	protected $rights = array(
		'display' => array(
			'listing',
			'getprice', 'editprice', 'gettree',
'findtree',
			'upload', 'image', 'file',
'file_entry', 'galleryimage',
			'edit_translation', 'cartlink',
'waitingapproval',
		),
		'add' => array('add'),
		'edit' => array('edit', 'variant',
'variants', 'characteristic', 'addimage',
'addfile', 'galleryselect', 'approve',
'saveorder'),
		'modify' => array('apply', 'save',
'save_translation', 'copy', 'toggle'),
		'delete' => array('delete')
	);
	protected $type = 'product';
	protected $config = null;

	protected $ordering = array(
		'type' => 'product',
		'pkey' => 'product_id',
		'table' => 'product_category',
		'groupMap' => 'category_id',
		'orderingMap' => 'ordering',
		'groupVal' => 0
	);

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		if(!$skip)
			$this->registerDefaultTask('listing');
		$this->config = hikamarket::config();
	}

	protected function raiseForbidden() {
		throw new JAccessExceptionNotallowed(JText::_('Access
Forbidden'), 403);
	}

	public function authorize($task) {
		if($task == 'toggle' || $task == 'delete') {
			$completeTask = hikaInput::get()->getCmd('task');
			if(strrpos($completeTask, '-') !== false) {
				$product_id = (int)substr($completeTask, strrpos($completeTask,
'-') + 1);
			} else {
				$product_id = hikaInput::get()->getInt('product_id');
				if(empty($product_id))
					$product_id = hikaInput::get()->getInt('value');
			}
			if(empty($product_id))
				return false;
			if(!hikamarket::loginVendor())
				return false;
			if(!$this->config->get('frontend_edition',0))
				return false;
			if(!JSession::checkToken('request'))
				return false;
			if($task == 'toggle' &&
!hikamarket::acl('product/edit/published'))
				return false;
			if($task == 'delete' &&
!hikamarket::acl('product/delete'))
				return false;
			if(!hikamarket::isVendorProduct($product_id))
				return false;
			return true;
		}
		return parent::authorize($task);
	}

	public function listing() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if(!hikamarket::loginVendor())
			return false;
		if(!hikamarket::acl('product/listing'))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_LISTING')));

		hikaInput::get()->set('layout', 'listing');
		return parent::display();
	}

	public function save() {
		if(!$this->store())
			return $this->edit();

		$subtask = hikaInput::get()->getCmd('subtask',
'');
		if($subtask == 'variant')
			return $this->variant();

		$app = JFactory::getApplication();
		$product_id = hikaInput::get()->getInt('cid');
		$cancel_action = hikaInput::get()->getCmd('cancel_action');
		if(!empty($cancel_action) && !empty($product_id)) {
			switch($cancel_action) {
				case 'product':
					$app->redirect(
hikamarket::completeLink('shop.product&task=show&cid='.$product_id,
false, true) );
					break;
				case 'url':
					$cancel_url =
urldecode(hikaInput::get()->getString('cancel_url',
''));
					if(!empty($cancel_url) &&
!hikamarket::disallowUrlRedirect($cancel_url))
						$app->redirect( base64_decode($cancel_url) );
					break;
			}
		}

		$app->redirect(
hikamarket::completeLink('product&task=listing', false, true)
);
		return false;
	}

	public function edit() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$product_id = hikamarket::getCID('product_id');
		if(!hikamarket::isVendorProduct($product_id)) {
			if(hikaInput::get()->getCmd('duplicate', 0) == 0)
				return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

			$productClass = hikamarket::get('class.product');
			$product = $productClass->get($product_id);
			if(empty($product) || (int)$product->product_vendor_id > 0)
				return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

			$query = 'SELECT c.characteristic_id FROM ' .
hikamarket::table('shop.variant') . ' AS v '.
				' INNER JOIN ' .
hikamarket::table('shop.characteristic') . ' AS c ON
v.variant_characteristic_id = c.characteristic_id '.
				' WHERE c.characteristic_parent_id = 0 AND c.characteristic_alias
= \'vendor\' AND v.variant_product_id = ' .
(int)$product_id.' '.
				' ORDER BY v.ordering ASC';
			$db = JFactory::getDBO();
			$db->setQuery($query);
			$characteristic_id = (int)$db->loadResult();
			if(empty($characteristic_id))
				return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

			$product_duplication = new stdClass();
			$product_duplication->product_id = $product_id;
			$product_duplication->characteristic_id = $characteristic_id;
			hikaInput::get()->set('product_duplication',
$product_duplication);
		}

		hikaInput::get()->set('layout', 'form');
		return parent::display();
	}

	public function variant() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit/variants') ||
!hikamarket::acl('product/variant') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$product_id = hikamarket::getCID('variant_id');
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		hikaInput::get()->set('layout', 'variant');
		if(hikaInput::get()->getCmd('tmpl', '') ==
'component') {
			ob_end_clean();
			parent::display();
			exit;
		}
		return parent::display();
	}

	public function variants() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit/variants'))
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$product_id = hikaInput::get()->getInt('product_id', 0);
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		hikaInput::get()->set('layout', 'form_variants');

		$subtask = hikaInput::get()->getCmd('subtask',
'');
		if(!empty($subtask)) {
			switch($subtask) {
				case 'setdefault':
					$variant_id = hikaInput::get()->getInt('variant_id');
					$productClass = hikamarket::get('class.product');
					$ret = $productClass->setDefaultVariant($product_id, $variant_id);
					break;

				case 'add':
				case 'duplicate':
					JSession::checkToken('request') || die('Invalid
Token');
					hikaInput::get()->set('layout',
'form_variants_add');
					break;

				case 'delete';
					JSession::checkToken('request') || die('Invalid
Token');
					$cid = hikaInput::get()->get('cid', array(),
'array');
					if(empty($cid)) {
						ob_end_clean();
						echo '0';
						exit;
					}
					$productClass = hikamarket::get('class.product');
					$ret = $productClass->deleteVariants($product_id, $cid);
					ob_end_clean();
					if($ret !== false)
						echo $ret;
					else
						echo '0';
					exit;

				case 'populate':
					JSession::checkToken('request') || die('Invalid
Token');
					hikaInput::get()->set('layout',
'form_variants_add');

					$productClass = hikamarket::get('class.product');
					$data = hikaInput::get()->get('data', array(),
'array');
					if(isset($data['variant_duplicate'])) {
						$cid = hikaInput::get()->get('cid', array(),
'array');
						hikamarket::toInteger($cid);
						$ret = $productClass->duplicateVariant($product_id, $cid, $data);
					} else
						$ret = $productClass->populateVariant($product_id, $data);
					if($ret !== false) {
						ob_end_clean();
						echo $ret;
						exit;
					}
					break;
			}
		}

		if(hikaInput::get()->getCmd('tmpl', '') ==
'component') {
			ob_end_clean();
			parent::display();
			exit;
		}
		return parent::display();
	}

	public function characteristic() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit/variants'))
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$product_id = hikamarket::getCID('product_id');
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		$subtask = hikaInput::get()->getCmd('subtask',
'');
		if(empty($subtask)) {
		}

		$productClass = hikamarket::get('class.product');
		switch($subtask) {
			case 'add':
				JSession::checkToken() || die('Invalid Token');

				$vendor_id = hikamarket::loadVendor(false);
				$characteristic_id =
hikaInput::get()->getInt('characteristic_id', 0);
				$characteristic_value_id =
hikaInput::get()->getInt('characteristic_value_id', 0);
				$ret = $productClass->addCharacteristic($product_id,
$characteristic_id, $characteristic_value_id, $vendor_id);
				ob_end_clean();
				if($ret === false)
					echo '-1';
				else
					echo (int)$ret;
				exit;

			case 'remove':
				JSession::checkToken() || die('Invalid Token');

				$characteristic_id =
hikaInput::get()->getInt('characteristic_id', 0);
				$ret = $productClass->removeCharacteristic($product_id,
$characteristic_id);
				ob_end_clean();
				if($ret === false)
					echo '-1';
				else
					echo (int)$ret;
				exit;
		}

		exit;
	}

	public function add() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/add') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$vendorClass = hikamarket::get('class.vendor');
		$vendor = hikamarket::loadVendor(true, false);

		$vendorCompleted = $vendorClass->checkVendorCompletion($vendor,
false);
		if($vendorCompleted !== true)
			return hikamarket::deny('vendor&task=form',
JText::_('VENDOR_UNCOMPLETED'));

		$limitation = $vendorClass->checkProductLimitation($vendor, false);
		if($limitation !== true) {
			if($limitation > 1)
				return hikamarket::deny('product',
JText::sprintf('VENDOR_PRODUCT_LIMITATION_X_REACHED',
$limitation));
			return hikamarket::deny('product',
JText::_('VENDOR_PRODUCT_LIMITATION_REACHED'));
		}


		hikaInput::get()->set('layout', 'form');
		return parent::display();
	}

	public function copy() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;

		$vendor = hikamarket::loadVendor(true, false);
		if( ($vendor->vendor_id != 0 && $vendor->vendor_id != 1) ||
!hikamarket::acl('product/add') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_COPY')));

		$product_id = hikamarket::getCID('product_id');
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		$vendorClass = hikamarket::get('class.vendor');
		$limitation = $vendorClass->checkProductLimitation($vendor, false);
		if($limitation !== true) {
			if($limitation > 1)
				return hikamarket::deny('product',
JText::sprintf('VENDOR_PRODUCT_LIMITATION_X_REACHED',
$limitation));
			return hikamarket::deny('product',
JText::_('VENDOR_PRODUCT_LIMITATION_REACHED'));
		}

		$app = JFactory::getApplication();
		$importHelper = hikamarket::get('shop.helper.import');
		if(!$importHelper->copyProduct($product_id)) {
			$app->enqueueMessage(JText::_('PRODUCT_SAVE_UNKNOWN_ERROR'),
'error');
		} else {
			$app->enqueueMessage(JText::_('HIKAM_SUCC_SAVED'));
		}

		$return_url = hikaInput::get()->getString('return_url',
'');
		if(!empty($return_url)) {
			try{
				$return_url = urldecode(base64_decode($return_url));
			}catch(Exception $e) {
				$return_url = '';
			}
		}
		if(!empty($return_url))
			$app->redirect($return_url);
		$app->redirect(hikamarket::completeLink('product&task=listing',
false, true));
	}

	public function delete() {
		if( !$this->config->get('frontend_edition', 0)) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;

		$completeTask = hikaInput::get()->getCmd('task');
		if(strrpos($completeTask, '-') !== false) {
			$product_id = (int)substr($completeTask, strrpos($completeTask,
'-') + 1);
		} else {
			$product_id = hikaInput::get()->getInt('product_id');
		}
		if(empty($product_id))
			return false;

		if(!hikamarket::acl('product/delete') ||
!hikamarket::isVendorProduct($product_id))
			return false;

		$productClass = hikamarket::get('shop.class.product');
		$shopConfig = hikamarket::config(false);
		if($shopConfig->get('use_trash', 0)) {
			$ret = $productClass->trash($product_id);
		} else {
			$ret = $productClass->delete($product_id);
		}

		$app = JFactory::getApplication();
		if(!empty($ret) && $ret > 0) {
			$app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS',
1), 'message');
		}
		$app->redirect(hikamarket::completeLink('product&task=listing',
false, true));
	}

	public function saveorder() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		$vendor_id = hikamarket::loadVendor(false);
		if( $vendor_id > 1 )
			return false;
		if( !hikamarket::acl('product/sort') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_SORT')));

		$category_explorer =
$this->config->get('show_category_explorer', 1);
		if(!$category_explorer)
			return false;

		$app = JFactory::getApplication();

		$cid = hikamarket::getCID();
		if(empty($cid) || $cid == 1)
			$cid =
(int)$app->getUserState(HIKAMARKET_COMPONENT.'.product.listing_cid');
		if(empty($cid))
			$cid = 1;

		$this->ordering['groupVal'] = $cid;
		parent::saveorder();

		$app = JFactory::getApplication();
		$app->redirect(hikamarket::completeLink('product&task=listing',
false, true));
	}

	public function approve() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		$vendor_id = hikamarket::loadVendor(false);
		if( $vendor_id > 1 ||
!$this->config->get('product_approval',0) )
			return false;
		if( !hikamarket::acl('product/approve') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_APPROVE')));

		$product_id = hikamarket::getCID('product_id');
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		$productClass = hikamarket::get('class.product');
		$status = $productClass->approve($product_id);

		if($status) {
			$app = JFactory::getApplication();
			$app->enqueueMessage(JText::_('HIKAMARKET_PRODUCT_APPROVED'));
		}

		hikaInput::get()->set('layout', 'form');
		return parent::display();
	}

	public function waitingapproval() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !$this->config->get('product_approval',0) )
			return false;
		if( !hikamarket::acl('product/approve') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_APPROVE')));

		hikaInput::get()->set('layout',
'waitingapproval');
		return parent::display();
	}
	public function edit_translation() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit/translations') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$product_id = hikamarket::getCID('product_id');
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		hikaInput::get()->set('layout',
'edit_translation');
		return parent::display();
	}

	public function save_translation() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit/translations') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$product_id = hikamarket::getCID('product_id');
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		$product = null;
		$productClass = hikamarket::get('class.product');
		$product = $productClass->getRaw($product_id);
		if(!empty($product->product_id))
			$productClass->handleTranslation($product);
		$js =
'window.hikashop.ready(function(){window.parent.hikamarket.submitBox();});';
		$doc = JFactory::getDocument();
		$doc->addScriptDeclaration($js);
	}

	public function store() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if(!hikamarket::loginVendor())
			return false;
		if( !hikamarket::acl('product/edit') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$productClass = hikamarket::get('class.product');
		if($productClass === null)
			return false;

		$subtask = hikaInput::get()->getCmd('subtask',
'');
		if($subtask == 'variant') {
			$status = $productClass->frontSaveVariantForm();
		} else {
			$status = $productClass->frontSaveForm();
		}

		if($status) {
			hikaInput::get()->set('cid', $status);
			hikaInput::get()->set('fail', null);
		}
		return $status;
	}

	public function image() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$product_id = hikaInput::get()->getInt('pid', 0);
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		hikaInput::get()->set('layout', 'image');
		return parent::display();
	}

	public function file() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$product_id = hikaInput::get()->getInt('pid', 0);
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		hikaInput::get()->set('layout', 'file');
		return parent::display();
	}

	public function file_entry() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$product_id = hikaInput::get()->getInt('pid', 0);
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		hikaInput::get()->set('layout',
'form_file_entry');
		ob_end_clean();
		parent::display();
		exit;
	}

	public function cartlink() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$product_id = hikaInput::get()->getInt('pid', 0);
		if(!hikamarket::isVendorProduct($product_id))
			return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

		echo '
<textarea style="width:100%"
rows="4">'.HIKASHOP_LIVE.'index.php?option='.HIKASHOP_COMPONENT.'&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id='.$product_id.'</textarea><br/>
<textarea style="width:100%" rows="5">&lt;a
class=&quot;hikashop_html_add_to_cart_link&quot;
href="'.HIKASHOP_LIVE.'index.php?option='.HIKASHOP_COMPONENT.'&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id='.$product_id.'">'.JText::_('ADD_TO_CART').'</a></textarea>
';
	}

	public function getUploadSetting($upload_key, $caller = '') {
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit') )
			return false;

		$product_id = hikaInput::get()->getInt('product_id', 0);
		if(empty($upload_key) || (!empty($product_id) &&
!hikamarket::isVendorProduct($product_id)))
			return false;

		$upload_value = null;
		$upload_keys = array(
			'product_image' => array(
				'type' => 'image',
				'view' => 'form_image_entry',
				'file_type' => 'product',
			),
			'product_file' => array(
				'type' => 'file',
				'view' => 'form_file_entry',
				'file_type' => 'file'
			),
		);

		if(empty($upload_keys[$upload_key]))
			return false;
		$upload_value = $upload_keys[$upload_key];

		$shopConfig = hikamarket::config(false);
		$vendor_id = hikamarket::loadVendor(false, false);

		$options = array();
		if($upload_value['type'] == 'image') {
			$options['upload_dir'] =
$shopConfig->get('uploadfolder');
			$options['processing'] = 'resize';
		} else
			$options['upload_dir'] =
$shopConfig->get('uploadsecurefolder');

		if($vendor_id > 1)
			$options['sub_folder'] = 'vendor'.$vendor_id.DS;

		$options['max_file_size'] = null;

		$product_type = hikaInput::get()->getCmd('product_type',
'product');
		if(!in_array($product_type,
array('product','variant')))
			$product_type = 'product';

		return array(
			'limit' => 1,
			'type' => $upload_value['type'],
			'layout' => 'productmarket',
			'view' => $upload_value['view'],
			'options' => $options,
			'extra' => array(
				'product_id' => $product_id,
				'file_type' => $upload_value['file_type'],
				'product_type' => $product_type
			)
		);
	}

	public function manageUpload($upload_key, &$ret, $uploadConfig,
$caller = '') {
		if(empty($ret))
			return;

		$config = hikamarket::config();
		$vendor_id = hikamarket::loadVendor(false, false);

		$product_id =
(int)$uploadConfig['extra']['product_id'];
		if(!empty($product_id) &&
!hikamarket::isVendorProduct($product_id))
			return;

		$file_type = 'product';
		if(!empty($uploadConfig['extra']['file_type']))
			$file_type = $uploadConfig['extra']['file_type'];

		$sub_folder = '';
		if(!empty($uploadConfig['options']['sub_folder']))
			$sub_folder = str_replace('\\', '/',
$uploadConfig['options']['sub_folder']);

		if($file_type == 'product')
			$ret->params->product_type =
hikaInput::get()->getCmd('product_type',
'product');


		if($caller == 'upload' || $caller == 'addimage') {
			$file = new stdClass();
			$file->file_description = '';
			$file->file_name = $ret->name;
			$file->file_type = $file_type;
			$file->file_ref_id = $product_id;
			$file->file_path = $sub_folder.$ret->name;

			if($file_type != 'product') {
				$file->file_free_download =
$config->get('upload_file_free_download', false);
				$file->file_limit = 0;
			}

			if(strpos($file->file_name, '.') !== false) {
				$file->file_name = substr($file->file_name, 0,
strrpos($file->file_name, '.'));
			}

			$fileClass = hikamarket::get('shop.class.file');
			$status = $fileClass->save($file, $file_type);

			$ret->file_id = $status;
			$ret->params->file_id = $status;

			if($file_type != 'product') {
				$ret->params->file_free_download = $file->file_free_download;
				$ret->params->file_limit = $file->file_limit;
				$ret->params->file_size =
@filesize($uploadConfig['upload_dir'] .
@$uploadConfig['options']['sub_folder'] .
$file->file_name);
			}

			return;
		}

		if($caller == 'galleryselect') {
			$file = new stdClass();
			$file->file_type = 'product';
			$file->file_ref_id = $product_id;
			$file->file_path = $sub_folder.$ret->name;

			$fileClass = hikamarket::get('shop.class.file');
			$status = $fileClass->save($file);

			$ret->file_id = $status;
			$ret->params->file_id = $status;

			return;
		}
	}

	public function addimage() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$ret = $this->saveFile('image');
		if($ret)
			hikaInput::get()->set('layout', 'addimage');
		else
			hikaInput::get()->set('layout', 'image');
		return parent::display();
	}

	public function addfile() {
		if( !$this->config->get('frontend_edition',0) ) {
			$this->raiseForbidden();
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		if( !hikamarket::acl('product/edit') )
			return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));

		$ret = $this->saveFile('file');
		if($ret)
			hikaInput::get()->set('layout', 'addfile');
		else
			hikaInput::get()->set('layout', 'file');

		return parent::display();
	}

	private function saveFile($type) {
		$app = JFactory::getApplication();
		$fileClass = hikamarket::get('shop.class.file');
		$formData = hikaInput::get()->get('data', array(),
'array');

		if(!in_array($type, array('file', 'image')))
			return false;

		$file = new stdClass();
		$file->file_id = hikamarket::getCID('file_id');
		$file->file_type = (($type == 'file') ? 'file' :
'product');

		$fields = array(
			'image' => array('file_id',
'file_name', 'file_description',
'file_ref_id'),
			'file' => array('file_id', 'file_name',
'file_description', 'file_ref_id',
'file_free_download', 'file_limit')
		);
		$formData = hikaInput::get()->get('data', array(),
'array');
		foreach($formData['file'] as $column => $value) {
			if(!in_array($column, $fields[$type]))
				continue;

			hikamarket::secureField($column);
			$file->$column = strip_tags($value);
		}

		if(!empty($file->file_id)) {
			$file->old = $fileClass->get( (int)$file->file_id );

			if(empty($file->file_ref_id) || !isset($file->file_ref_id))
				$file->file_ref_id = (int)$file->old->file_ref_id;

			if((int)$file->old->file_ref_id != $file->file_ref_id ||
$file->old->file_type != $file->file_type) {
				$app->enqueueMessage('Invalid data', 'error');
				return false;
			}
		}

		$product_id = (int)$file->file_ref_id;
		if(!hikamarket::isVendorProduct($product_id))
			return false;

		$filemode = 'upload';
		if(!empty($formData['filemode']))
			$filemode = $formData['filemode'];

		$vendor_path = '';
		$vendor_id = hikamarket::loadVendor(false, false);
		if($vendor_id > 1) {
			$vendor_path = 'vendor' . $vendor_id;
		}

		if(!empty($file->file_id))
			$filemode = null;

		switch($filemode) {
			case 'upload':
				if(empty($file->file_id)) {
					$ids = $fileClass->storeFiles($file->file_type,
$file->file_ref_id, 'files', $vendor_path);
					if(is_array($ids) && !empty($ids)) {
						$file->file_id = array_shift($ids);
						if(isset($file->file_path))
							unset($file->file_path);
					} else {
						return false;
					}
				}
				break;

			case 'path':
			default:
				if(isset($formData['filepath']))
					$file->file_path = trim($formData['filepath']);
				if(isset($formData['file']['file_path']))
					$file->file_path =
trim($formData['file']['file_path']);
				break;
		}


		if(isset($file->file_path)) {
			if(strpos($file->file_path, '..') !== false) {
				$app->enqueueMessage('Invalid data', 'error');
				return false;
			}

			if($vendor_id > 1) {
				if(preg_match('#^([a-z]):[\/\\\]{1}#i',
$file->file_path))
					$file->file_path = '';

				$file->file_path = ltrim($file->file_path, '/\\');
				$firstChar = substr($file->file_path, 0, 1);

				if(!in_array($firstChar, array('#', '@'))
&& substr($file->file_path, 0, strlen($vendor_path)) !=
$vendor_path)
					$file->file_path = $vendor_path . '/' .
$file->file_path;
			}

			$shopConfig = hikamarket::config(false);
			$firstChar = substr($file->file_path, 0, 1);
			$isVirtual = in_array($firstChar, array('#', '@'));
			$isLink = (substr($file->file_path, 0, 7) == 'http://' ||
substr($file->file_path, 0, 8) == 'https://');

			if(!$isLink && !$isVirtual) {
				if($vendor_id > 1 && strpos($file->file_path,
':') !== false) {
					$app->enqueueMessage('File does not exists',
'error');
					return false;
				}

				if($firstChar == '/' || preg_match('#:[\/\\\]{1}#',
$file->file_path)) {
					$clean_filename = JPath::clean($file->file_path);
					if(!JFile::exists($clean_filename)) {
						$app->enqueueMessage('Invalid data',
'error');
						return false;
					}

					$secure_path = $shopConfig->get('uploadsecurefolder');
					if((JPATH_ROOT != '') && strpos($clean_filename,
JPath::clean(JPATH_ROOT)) !== 0 && strpos($clean_filename,
JPath::clean($secure_path)) !== 0) {
						$app->enqueueMessage('Invalid data',
'error');
						return false;
					}
				} else {
					$secure_path = $shopConfig->get('uploadsecurefolder');
					$clean_filename = JPath::clean($secure_path . '/' .
$file->file_path);
					if(!JFile::exists($clean_filename) && (JPATH_ROOT ==
'' || !JFile::exists(JPATH_ROOT . DS . $clean_filename))) {
						$app->enqueueMessage('File does not exists',
'error');
						return false;
					}
				}
			}
		}

		if(isset($file->file_ref_id) && empty($file->file_ref_id))
{
			unset($file->file_ref_id);
		}

		if(isset($file->file_limit)) {
			$limit = (int)$file->file_limit;
			if($limit == 0 && $file->file_limit !== 0 &&
$file->file_limit != '0') {
				$file->file_limit = -1;
			} else {
				$file->file_limit = $limit;
			}
		}

		JPluginHelper::importPlugin('hikamarket');
		JPluginHelper::importPlugin('hikashop');
		$do = true;
		$app->triggerEvent('onHikaBeforeFileSave', array(&$file,
&$do));

		if(!$do)
			return false;

		if(empty($file->file_id) && (empty($file->file_path) ||
empty($file->file_ref_id))) {
			$app->enqueueMessage('Invalid data', 'error');
			return false;
		}

		if(empty($file->file_id) && $file->file_type ==
'file' && empty($file->file_name)) {
			$app->enqueueMessage('Please provide a file name',
'error');
			return false;
		}

		if(isset($file->file_path) && empty($file->file_path))
			unset($file->file_path);
		if(isset($file->file_name) && empty($file->file_name)
&& $file->file_type == 'file')
			unset($file->file_path);

		$status = $fileClass->save($file);
		if(empty($file->file_id) && $status) {
			$file->file_id = $status;
		}
		if(!empty($file->file_id))
			hikaInput::get()->set('cid', $file->file_id);

		$app->triggerEvent('onHikaAfterFileSave',
array(&$file));
		return $status;
	}

	public function editprice() {
		$product_id = hikaInput::get()->getInt('product_id', 0);
		$variant_product_id =
hikaInput::get()->getInt('variant_product_id', 0);
		while(ob_get_level())
			@ob_end_clean();

		if(!hikamarket::loginVendor() ||
!$this->config->get('frontend_edition', 0)) {
			header('HTTP/1.1 403 Forbidden');
			exit;
		}
		if(empty($variant_product_id) &&
(!hikamarket::acl('product/edit/price') ||
!hikamarket::isVendorProduct($product_id))) {
			echo '';
			exit;
		}
		if(!empty($variant_product_id) &&
(!hikamarket::acl('product/variant/price') ||
!hikamarket::isVendorProduct($variant_product_id))) {
			echo '';
			exit;
		}

		hikaInput::get()->set('layout',
'form_price_entry');
		parent::display();
		exit;
	}

	public function getPrice() {
		if(!hikamarket::loginVendor() ||
!$this->config->get('frontend_edition', 0)) {
			header('HTTP/1.1 403 Forbidden');
			exit;
		}

		$price = hikaInput::get()->getString('price');
		$price = hikamarket::toFloat($price);
		$tax_id = hikaInput::get()->getInt('tax_id', 0);
		$product_id = hikaInput::get()->getInt('product_id', 0);
		$conversion = hikaInput::get()->getInt('conversion');
		$currencyClass = hikamarket::get('shop.class.currency');

		if($tax_id < 0 && $product_id > 0) {
			$productClass = hikamarket::get('shop.class.product');
			$product = $productClass->get($product_id);
			if($product)
				$tax_id = $product->product_tax_id;
		}

		while(ob_get_level())
			@ob_end_clean();

		$shopConfig = hikamarket::config(false);
		$main_tax_zone = explode(',',
$shopConfig->get('main_tax_zone',1346) );
		if(count($main_tax_zone) && !empty($tax_id) &&
!empty($price) && !empty($main_tax_zone)) {
			if($conversion) {
				echo $currencyClass->getUntaxedPrice($price,
array_shift($main_tax_zone), $tax_id, 5);
			} else {
				echo $currencyClass->getTaxedPrice($price,
array_shift($main_tax_zone), $tax_id, 5);
			}
		} else {
			echo $price;
		}
		exit;
	}

	public function getTree() {
		while(ob_get_level())
			@ob_end_clean();

		if(!hikamarket::loginVendor() ||
!$this->config->get('frontend_edition',0)) {
			echo '[]';
			exit;
		}

		$config = hikamarket::config();

		$category_id = hikaInput::get()->getInt('category_id', 0);
		$displayFormat =
hikaInput::get()->getString('displayFormat', '');
		$allvendors = hikaInput::get()->getInt('allvendors', 0);
		$variants = hikaInput::get()->getInt('variants', 0);
		$search = hikaInput::get()->getString('search', null);

		$vendor_chroot_category =
(int)$config->get('vendor_chroot_category', 0);
		if(empty($category_id) && !empty($vendor_chroot_category)
&& $vendor_chroot_category == 1) {
			$vendor_id = hikamarket::loadVendor();
			$vendorClass = hikamarket::get('class.vendor');
			$category_id = $vendorClass->getRootCategory($vendor_id);
		}
		if(empty($category_id) && !empty($vendor_chroot_category))
			$category_id = (int)$config->get('vendor_root_category',
0);

		if(!hikamarket::isVendorCategory($category_id, null, true)) {
			echo '[]';
			exit;
		}

		$nameboxType = hikamarket::get('type.namebox');
		$options = array(
			'start' => $category_id,
			'displayFormat' => $displayFormat,
			'allvendors' => $allvendors,
			'variants' => $variants
		);
		$ret = $nameboxType->getValues($search, 'product',
$options);
		if(!empty($ret)) {
			echo json_encode($ret);
			exit;
		}
		echo '[]';
		exit;
	}
	public function findTree() { return $this->getTree(); }

	public function upload() {
		if( !hikamarket::loginVendor() ||
!$this->config->get('frontend_edition',0) ) {
			header('HTTP/1.1 403 Forbidden');
			exit;
		}

		JSession::checkToken() || die('Invalid Token');

		$config = hikamarket::config();
		$shopConfig = hikamarket::config(false);
		$product_id = hikaInput::get()->getInt('product_id', 0);
		$file_type = hikaInput::get()->getString('file_type',
'product');

		if($file_type == 'product') {
			if(!hikamarket::acl('product/edit/images/upload')) {
				header('HTTP/1.1 403 Forbidden');
				return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));
			}
		} else {
			if(!hikamarket::acl('product/edit/files/upload')) {
				header('HTTP/1.1 403 Forbidden');
				return hikamarket::deny('product',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_PRODUCT_EDIT')));
			}
		}

		if($file_type == 'product') {
			$options = array(
				'upload_dir' =>
$shopConfig->get('uploadfolder'),
				'upload_url' => '',
				'type' => $file_type
			);
		} else {
			$options = array(
				'upload_dir' =>
$shopConfig->get('uploadsecurefolder'),
				'upload_url' => '',
				'type' => $file_type
			);
		}

		$options['upload_url'] =
ltrim(JPath::clean(html_entity_decode($options['upload_dir'])),DS);
		$options['upload_url'] =
str_replace(DS,'/',rtrim($options['upload_url'],DS).DS);
		$app = JFactory::getApplication();
		if($app->isAdmin()) {
			$options['upload_url'] =
'../'.$options['upload_url'];
		} else {
			$options['upload_url'] =
rtrim(JURI::base(true),'/').'/'.$options['upload_url'];
		}

		$options['upload_dir'] =
rtrim(JPath::clean(html_entity_decode($options['upload_dir'])),
DS.' ').DS;
		if(!preg_match('#^([A-Z]:)?/.*#',$options['upload_dir']))
{
			if(substr($options['upload_dir'], 0, 1) != '/' ||
!is_dir($options['upload_dir'])) {
				$options['upload_dir'] =
JPath::clean(HIKASHOP_ROOT.DS.trim($options['upload_dir'],
DS.' ').DS);
			}
		}

		$vendor_id = hikamarket::loadVendor(false, false);
		if($vendor_id > 0) {
			$options['upload_dir'] .= 'vendor'.$vendor_id.DS;
			$options['upload_url'] .=
'vendor'.$vendor_id.'/';
		}

		$uploadHelper = hikamarket::get('helper.upload');
		$ret = $uploadHelper->process($options);
		if($ret !== false && empty($ret->error)) {
			$helperImage = null;
			$fileType = 'file';
			if($file_type == 'product') {
				$fileType = 'image';
				$helperImage = hikamarket::get('shop.helper.image');
			}

			foreach($ret as &$r) {
				if(!empty($r->error))
					continue;

				$file = new stdClass();
				$file->file_description = '';
				$file->file_name = $r->name;
				$file->file_type = $file_type;
				$file->file_ref_id = $product_id;
				$file->file_path = $r->name;
				if($file_type != 'product')
					$file->file_free_download =
$config->get('upload_file_free_download', false);

				if($vendor_id > 0)
					$file->file_path =
'vendor'.$vendor_id.'/'.$r->name; // Not
"DS" here

				if(strpos($file->file_name, '.') !== false) {
					$file->file_name = substr($file->file_name, 0,
strrpos($file->file_name, '.'));
				}

				$fileClass = hikamarket::get('shop.class.file');
				$status = $fileClass->save($file);
				if(empty($file->file_id)) {
					$file->file_id = $status;
				}
				$r->file_id = $status;
				$r->html = '';
				$js = '';

				if($status) {
					if($file_type == 'product') {
						$helperImage->resizeImage($file->file_path, 'image',
null, null);
						$helperImage->display($file->file_path, false, '',
'', '', 100, 100);
						$r->thumbnail_url = $helperImage->uploadFolder_url_thumb;

						$params = new stdClass();
						$params->product_id = $product_id;
						$params->file_id = $status;
						$params->file_path = $file->file_path;
						$params->file_name = $file->file_name;
						$params->product_type =
hikaInput::get()->getCmd('product_type',
'product');

						$r->html = hikamarket::getLayout('productmarket',
'form_image_entry', $params, $js);
					} else {
						$params = new stdClass();
						$params->product_id = $product_id;
						$params->file_id = $status;
						$params->file_name = $file->file_name;
						$params->file_path = $file->file_path;
						$params->file_free_download = $file->file_free_download;
						$params->file_limit = -1;
						$params->file_size = @filesize($options['upload_dir'] .
$file->file_name);
						$r->html = hikamarket::getLayout('productmarket',
'form_file_entry', $params, $js);
					}
				}

				unset($r->path);
				unset($r);
			}
		}

		while(ob_get_level())
			@ob_end_clean();
		echo json_encode($ret);
		exit;
	}
}
controllers/shipping.php000064400000003135151166607730011462
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class shippingMarketController extends hikamarketController {
	protected $rights = array(
		'display' => array(),
		'add' => array(),
		'edit' => array('toggle'),
		'modify' => array(),
		'delete' => array('delete')
	);
	protected $type = 'shipping';
	protected $config = null;

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		$this->config = hikamarket::config();
	}

	public function authorize($task) {
		if(!in_array($task, array('toggle', 'delete')))
			return parent::authorize($task);

		$completeTask = hikaInput::get()->getCmd('task',
'');
		$value = hikaInput::get()->getCmd('value', '');
		if(strrpos($completeTask, '-') !== false)
			$plugin_id = (int)substr($completeTask, strrpos($completeTask,
'-') + 1);
		else
			$plugin_id = (int)substr($value, 0, strpos($value, '-'));

		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;
		if(!JSession::checkToken('request'))
			return false;
		if($task == 'toggle' &&
!hikamarket::acl('shippingplugin/edit/published'))
			return false;
		if($task == 'delete' &&
!hikamarket::acl('shippingplugin/delete'))
			return false;
		if(!hikamarket::isVendorPlugin($plugin_id, 'shipping'))
			return false;
		return true;
	}
}
controllers/toggle.php000064400000007732151166607730011131
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class toggleMarketController extends hikashopBridgeController {
	public function __construct($config = array()) {
		parent::__construct($config);
		$this->registerDefaultTask('toggle');
		if(!headers_sent()) {
			header('Cache-Control: no-store, no-cache, must-revalidate');
			header('Cache-Control: post-check=0, pre-check=0', false);
			header('Pragma: no-cache');
		}
	}

	public function authorize($task) {
		return true;
	}

	public function toggle() {
		$completeTask = hikaInput::get()->getCmd('task');
		$task = substr($completeTask, 0, strrpos($completeTask, '-'));
		$elementPkey = substr($completeTask, strrpos($completeTask,
'-') + 1);
		$value = hikaInput::get()->getCmd('value', '');
		$controllerName = hikaInput::get()->getWord('table',
'');

		while(ob_get_level())
			@ob_end_clean();

		if(empty($controllerName)) {
			echo 'No controller';
			exit;
		}

		$controller = hikamarket::get('controller.'.$controllerName);

		if(empty($controller)) {
			echo 'No controller';
			exit;
		}

		if(!$controller->authorize('toggle')) {
			echo 'Forbidden task';
			exit;
		}

		$class = hikamarket::get('class.'.$controllerName);
		$id = false;
		if(method_exists($class, 'toggleId'))
			$id = $class->toggleId($task, $elementPkey);
		if($id === false || empty($id)) {
			echo 'Forbidden';
			exit;
		}
		$obj = new stdClass();
		$obj->$task = $value;
		$obj->$id = $elementPkey;

		$ret = $value;
		if(!$class->save($obj)) {
			$table = false;
			if(method_exists($class,'getTable')) {
				$table = $class->getTable();
				if(substr($table,0,1) != '#')
					$table = hikamarket::table($table);
			}
			if(empty($table)) {
				$table = hikamarket::table($controllerName);
			}
			$db	= JFactory::getDBO();
			$db->setQuery('SELECT '.$task.' FROM
'.$table.' WHERE '.$id.' =
'.$db->Quote($elementPkey), 0, 1);
			$ret = $db->loadResult();
		}

		$tmpl = hikaInput::get()->getString('tmpl', '');
		if($tmpl == 'raw') {
			echo '1';
			exit;
		}
		$toggleClass = hikamarket::get('helper.toggle');
		$extra = hikaInput::get()->get('extra', array(),
'array');
		if(!empty($extra)) {
			foreach($extra as $key => $val) {
				$extra[$key] = urldecode($val);
			}
		}
		echo
$toggleClass->toggle(hikaInput::get()->getCmd('task',
''), $ret, $controllerName, $extra);
		exit;
	}

	public function delete() {
		while(ob_get_level())
			@ob_end_clean();

		$value2 = '';
		if(strpos(hikaInput::get()->getCmd('value'), '-')
!== false)
			list($value1, $value2) = explode('-',
hikaInput::get()->getCmd('value'));
		else
			$value1 = hikaInput::get()->getCmd('value');
		$table =  hikaInput::get()->getWord('table', '');
		$controller = hikamarket::get('controller.'.$table);
		if(empty($controller)) {
			echo 'No controller';
			exit;
		}

		if(!$controller->authorize('delete')) {
			echo 'Forbidden';
			exit;
		}

		$destClass = hikamarket::get('class.'.$table);
		$deleteToggle = $destClass->toggleDelete($value1, $value2);
		if(empty($deleteToggle)) {
			echo 'Forbidden';
			exit;
		}
		if($deleteToggle === true) {
			echo '1';
			exit;
		}

		$key2 = '';
		$v = reset($deleteToggle);
		if(is_array($v) && count($v) > 1)
			list($key1, $key2) = reset($deleteToggle);
		else
			$key1 = reset($deleteToggle);
		$table = key($deleteToggle);
		if(empty($key1) || empty($value1) || (!empty($key2) &&
empty($value2)) ) {
			echo 'No value';
			exit;
		}

		$db	= JFactory::getDBO();
		$query = 'DELETE FROM '.hikamarket::table($table).' WHERE
'.$key1.' = '.$db->Quote($value1);
		if(!empty($key2))
			$query .= ' AND '.$key2.' =
'.$db->Quote($value2);
		$db->setQuery($query);
		$db->execute();

		echo '1';
		exit;
	}

}
controllers/upload.php000064400000034114151166607730011126
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php

class uploadMarketController extends hikamarketController {

	protected $rights = array(
		'display' =>
array('upload','image','galleryimage'),
		'add' => array(),
		'edit' =>
array('addimage','galleryselect'),
		'modify' => array('upload'),
		'delete' => array()
	);

	protected $controller = null;

	public function __construct($config = array())	{
		parent::__construct($config);
		$this->registerDefaultTask('galleryimage');
		$this->config = hikamarket::config();

		$controllerName = hikaInput::get()->getCmd('uploader',
'');
		if(substr($controllerName, 0, 11) == 'plg.market.')
			$controllerName = substr($controllerName, 11);

		if(!empty($controllerName)) {
			$this->controller =
hikamarket::get('controller.'.$controllerName);
			if(!method_exists($this->controller, 'getUploadSetting'))
				$this->controller = null;
		}
	}

	public function image() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;

		$upload_key = hikaInput::get()->getString('field',
'');
		if(empty($this->controller))
			return false;

		$uploadConfig = $this->controller->getUploadSetting($upload_key);
		if($uploadConfig === false)
			return false;

		if(!empty($uploadConfig['type']) &&
$uploadConfig['type'] != 'image')
			return false;

		hikaInput::get()->set('layout', 'sendfile');
		hikaInput::get()->set('uploadConfig', $uploadConfig);
		return parent::display();
	}

	public function galleryimage() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;

		$upload_key = hikaInput::get()->getString('field',
'');
		if(empty($this->controller))
			return false;

		$uploadConfig = $this->controller->getUploadSetting($upload_key);
		if($uploadConfig === false)
			return false;

		if(!empty($uploadConfig['type']) &&
$uploadConfig['type'] != 'image')
			return false;

		hikaInput::get()->set('layout', 'galleryimage');
		hikaInput::get()->set('uploadConfig', $uploadConfig);
		return parent::display();
	}

	public function addImage() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;

		$upload_key = hikaInput::get()->getString('field',
'');
		if(empty($this->controller))
			return false;

		$uploadConfig = $this->controller->getUploadSetting($upload_key);
		if($uploadConfig === false)
			return false;

		if(!empty($uploadConfig['type']) &&
$uploadConfig['type'] != 'image')
			return false;

		$layout = 'uploadmarket';
		if(!empty($uploadConfig['layout']))
			$layout = $uploadConfig['layout'];
		$viewName = '';
		if(!empty($uploadConfig['view']))
			$viewName = $uploadConfig['view'];
		$type = 'image';
		if(!empty($uploadConfig['type']))
			$type = $uploadConfig['type'];
		if(empty($viewName))
			$viewName = ($type == 'image') ? 'image_entry' :
'file_entry';

		$extra_data = array();
		if(!empty($uploadConfig['extra']))
			$extra_data = $uploadConfig['extra'];

		if(empty($extra_data['field']))
			$extra_data['field'] = $upload_key;

		$options = array();
		if(!empty($uploadConfig['options']))
			$options = $uploadConfig['options'];

		$this->processUploadOption($options, $type);
		if(empty($options) || empty($options['upload_dir']))
			return false;

		$uploadHelper = hikamarket::get('helper.upload');
		$ret = $uploadHelper->processFallback($options);

		$output = '[]';
		if($ret !== false && empty($ret->error)) {
			$helperImage = null;
			if($type == 'image') {
				$helperImage = hikamarket::get('shop.helper.image');
			}

			$out = array();
			foreach($ret as &$r) {
				if(!empty($r->error))
					continue;

				$file = new stdClass();
				$file->file_description = '';
				$file->file_name = $r->name;
				$file->file_type = $type;
				$file->file_path = $options['sub_folder'].$r->name;
				$file->file_url =
$options['upload_url'].$options['sub_folder'];

				foreach($extra_data as $k => $v) {
					$file->$k = $v;
				}

				if(strpos($file->file_name, '.') !== false) {
					$file->file_name = substr($file->file_name, 0,
strrpos($file->file_name, '.'));
				}

				$r->html = '';
				$js = '';

				if(!empty($options['processing']) &&
$options['processing'] == 'custom' &&
method_exists($this->controller, 'processUploadFile'))
					$this->controller->processUploadFile($upload_key, $file,
$uploadConfig, 'addimage');

				if($type == 'image') {
					if(!empty($options['processing']) &&
$options['processing'] == 'resize') {
						$helperImage->resizeImage($file->file_path, 'image',
null, null);
					}
					$img = $helperImage->getThumbnail($file->file_path, array(100,
100), array('default' => true));
					$r->thumbnail_url = $img->url;

					$params = new stdClass();
					$params->file_path = $file->file_path;
					$params->file_name = $file->file_name;
					$params->file_url = $file->file_url;
				} else {
					$params = new stdClass();
					$params->file_name = $file->file_name;
					$params->file_path = $file->file_path;
					$params->file_url = $file->file_url;
					$params->file_limit = -1;
					$params->file_size = @filesize($options['upload_dir'] .
$options['sub_folder'] . $file->file_name);
				}

				foreach($extra_data as $k => $v) {
					$params->$k = $v;
				}

				$r->params = $params;
				$this->controller->manageUpload($upload_key, $r, $uploadConfig,
'addimage');

				if(empty($r->html))
					$r->html = hikamarket::getLayout($layout, $viewName, $params,
$js);

				$out[] = $r->html;

				unset($r->path);
				unset($r->params);
				unset($r);
			}

			if(!empty($out))
				$output = json_encode($out);
			unset($out);
			unset($ret);
		}

		$js =
'window.hikashop.ready(function(){window.parent.hikashop.submitBox({images:'.$output.'});});';
		$doc = JFactory::getDocument();
		$doc->addScriptDeclaration($js);
		return true;
	}

	public function galleryselect() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;

		$upload_key = hikaInput::get()->getString('field',
'');
		if(empty($this->controller))
			return false;

		$uploadConfig = $this->controller->getUploadSetting($upload_key,
'galleryselect');
		if($uploadConfig === false)
			return false;

		if(!empty($uploadConfig['type']) &&
$uploadConfig['type'] != 'image')
			return false;

		$layout = 'uploadmarket';
		if(!empty($uploadConfig['layout']))
			$layout = $uploadConfig['layout'];
		$viewName = '';
		if(!empty($uploadConfig['view']))
			$viewName = $uploadConfig['view'];
		$type = 'image';
		if(!empty($uploadConfig['type']))
			$type = $uploadConfig['type'];
		if(empty($viewName))
			$viewName = ($type == 'image') ? 'image_entry' :
'file_entry';

		$options = array();
		if(!empty($uploadConfig['options']))
			$options = $uploadConfig['options'];

		$extra_data = array();
		if(!empty($uploadConfig['extra']))
			$extra_data = $uploadConfig['extra'];

		if(empty($extra_data['field']))
			$extra_data['field'] = $upload_key;

		$this->processUploadOption($options, $type);
		if(empty($options) || empty($options['upload_dir']))
			return false;

		$filesData = hikaInput::get()->get('files', array(),
'array');

		$output = '[]';
		if(!empty($filesData)) {
			$helperImage = hikamarket::get('shop.helper.image');
			$ret = array();
			$out = array();
			foreach($filesData as $filename) {
				$r = new stdClass();
				$r->name = $filename;
				$r->url = str_replace('//', '/',
$options['upload_url'].$options['sub_folder'].rawurlencode($filename));
				$r->path = str_replace('//', '/',
$options['upload_dir'].$options['sub_folder'].$filename);
				$r->type = $type;
				$r->size = filesize($r->path);

				$params = new stdClass();
				$params->file_path = str_replace('//', '/',
$options['sub_folder'].$filename);
				$params->file_name = $filename;
				$params->file_url = $r->url;

				foreach($extra_data as $k => $v) {
					$params->$k = $v;
				}

				$r->params = $params;
				$this->controller->manageUpload($upload_key, $r, $uploadConfig,
'galleryselect');

				if(empty($r->html))
					$r->html = hikamarket::getLayout($layout, $viewName, $r->params,
$js);

				unset($r->params);
				$ret[] = $r;
				$out[] = $r->html;
				unset($r);
			}
			if(!empty($out))
				$output = json_encode($out);
			unset($out);
			unset($ret);
		}

		$js =
'window.hikashop.ready(function(){window.parent.hikashop.submitBox({images:'.$output.'});});';
		$doc = JFactory::getDocument();
		$doc->addScriptDeclaration($js);
		return true;
	}

	public function upload() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;

		JSession::checkToken() || die('Invalid Token');

		while(ob_get_level())
			@ob_end_clean();

		$config = hikamarket::config();
		$upload_key = hikaInput::get()->getString('field',
'');
		if(empty($this->controller))
			exit;

		$uploadConfig = $this->controller->getUploadSetting($upload_key,
'upload');
		if($uploadConfig === false) {
			header('HTTP/1.1 403 Forbidden');
			exit;
		}

		$layout = 'uploadmarket';
		if(!empty($uploadConfig['layout']))
			$layout = $uploadConfig['layout'];

		$viewName = '';
		if(!empty($uploadConfig['view']))
			$viewName = $uploadConfig['view'];

		$type = 'image';
		if(!empty($uploadConfig['type']))
			$type = $uploadConfig['type'];

		$options = array();
		if(!empty($uploadConfig['options']))
			$options = $uploadConfig['options'];

		$extra_data = array();
		if(!empty($uploadConfig['extra']))
			$extra_data = $uploadConfig['extra'];

		if(empty($extra_data['field']))
			$extra_data['field'] = $upload_key;

		if(empty($viewName))
			$viewName = ($type == 'image') ? 'image_entry' :
'file_entry';

		$this->processUploadOption($options, $type);
		if(empty($options) || empty($options['upload_dir']))
			return false;

		$max_width = (int)$config->get('max_image_size_width', 0);
		$max_height = (int)$config->get('max_image_size_height',
0);

		$uploadHelper = hikamarket::get('helper.upload');
		$ret = $uploadHelper->process($options);

		if($ret === false || !empty($ret->error) || !empty($ret->partial))
{
			if($ret !== false) {
				unset($ret->path);
				unset($ret->params);
			}
			echo json_encode($ret);
			exit;
		}

		$helperImage = null;
		if($type == 'image') {
			$helperImage = hikamarket::get('shop.helper.image');
		}

		$file = new stdClass();
		$file->file_description = '';
		$file->file_name = $ret->name;
		$file->file_type = $type;
		$file->file_path = $options['sub_folder'].$ret->name;
		$file->file_url =
$options['upload_url'].$options['sub_folder'];

		foreach($extra_data as $k => $v) {
			$file->$k = $v;
		}

		if(strpos($file->file_name, '.') !== false) {
			$file->file_name = substr($file->file_name, 0,
strrpos($file->file_name, '.'));
		}

		$ret->file = $file;
		$ret->html = '';
		$js = '';

		if(!empty($options['processing']) &&
$options['processing'] == 'custom' &&
method_exists($this->controller, 'processUploadFile'))
			$this->controller->processUploadFile($upload_key, $file,
$uploadConfig, 'upload');

		if($type == 'image') {
			if($max_height > 0 || $max_width > 0) {
			}
			if(!empty($options['processing']) &&
$options['processing'] == 'resize') {
				$helperImage->resizeImage($file->file_path, 'image',
null, null);
			}
			$img = $helperImage->getThumbnail($file->file_path, array(100,
100), array('default' => true));
			$ret->thumbnail_url = $img->url;

			$params = new stdClass();
			$params->file_path = $file->file_path;
			$params->file_name = $file->file_name;
			$params->file_url = $file->file_url;
		} else {
			$params = new stdClass();
			$params->file_name = $file->file_name;
			$params->file_path = $file->file_path;
			$params->file_url = $file->file_url;
			$params->file_limit = -1;
			$params->file_size = @filesize($options['upload_dir'] .
$options['sub_folder'] . $file->file_name);
		}

		foreach($extra_data as $k => $v) {
			$params->$k = $v;
		}

		$ret->params = $params;

		$this->controller->manageUpload($upload_key, $ret, $uploadConfig,
'upload');

		if(empty($ret->html))
			$ret->html = hikamarket::getLayout($layout, $viewName,
$ret->params, $js);

		unset($ret->path);
		unset($ret->params);

		echo json_encode($ret);
		exit;
	}

	private function processUploadOption(&$options, $type =
'image') {
		$shopConfig = hikamarket::config(false);

		if($type == 'image') {
			if(empty($options['upload_dir']))
				$options['upload_dir'] =
$shopConfig->get('uploadfolder');
			if(empty($options['type']))
				$options['type'] = 'image';
		} else {
			if(empty($options['upload_dir']))
				$options['upload_dir'] =
$shopConfig->get('uploadsecurefolder');
			if(empty($options['type']))
				$options['type'] = 'file';
		}

		if(empty($options) || empty($options['upload_dir']))
			return false;

		if(empty($options['sub_folder']))
			$options['sub_folder'] = '';
		else
			$options['sub_folder'] =
str_replace(DS,'/',rtrim($options['sub_folder'],
DS).DS);

		$options['upload_url'] =
ltrim(JPath::clean(html_entity_decode($options['upload_dir'])),DS);
		$options['upload_url'] =
str_replace(DS,'/',rtrim($options['upload_url'],DS).DS);
		$app = JFactory::getApplication();
		if($app->isAdmin()) {
			$options['upload_url'] =
'../'.$options['upload_url'];
		} else {
			$options['upload_url'] =
rtrim(JURI::base(true),'/').'/'.$options['upload_url'];
		}

		$options['upload_dir'] =
rtrim(JPath::clean(html_entity_decode($options['upload_dir'])),
DS.' ').DS;
		if(!preg_match('#^([A-Z]:)?/.*#',$options['upload_dir'])
&& (substr($options['upload_dir'], 0, 1) != '/'
|| !is_dir($options['upload_dir']))) {
			$options['upload_dir'] =
JPath::clean(HIKASHOP_ROOT.DS.trim($options['upload_dir'],
DS.' ').DS);
		}

		return true;
	}
}
controllers/user.php000064400000015161151166607730010621 0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class userMarketController extends hikamarketController {
	protected $rights = array(
		'display' =>
array('listing','state','show','address','getaddresslist','getvalues'),
		'add' => array(),
		'edit' => array(),
		'modify' => array('apply','save'),
		'delete' => array()
	);

	protected $type = 'user';
	protected $config = null;

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		if(!$skip)
			$this->registerDefaultTask('listing');
		$this->config = hikamarket::config();
	}

	public function edit() {
		return $this->show();
	}

	public function show() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;

		$customer_id = hikamarket::getCID();
		$vendor_id = hikamarket::loadVendor(false, false);
		if($vendor_id > 1 &&
!hikamarket::isVendorCustomer($customer_id))
			return false;

		if(!hikamarket::acl('user/show'))
			return false;

		hikaInput::get()->set('layout', 'show');
		return parent::display();
	}

	public function address() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;

		$vendor_id = hikamarket::loadVendor(false, false);
		if($vendor_id > 1)
			return false;

		if(!hikamarket::acl('user/edit/address'))
			return false;

		hikaInput::get()->set('layout', 'address');

		$tmpl = hikaInput::get()->getCmd('tmpl', '');
		$subtask = hikaInput::get()->getCmd('subtask',
'');
		if($subtask == 'edit')
			hikaInput::get()->set('edition', true);

		if($subtask == 'listing') {
			$user_id = hikaInput::get()->getInt('user_id');
			if(empty($user_id))
				return false;
			hikaInput::get()->set('layout', 'show_address');
		}

		if($subtask == 'save') {
			JSession::checkToken('request') || die('Invalid
Token');

			$user_id = hikaInput::get()->getInt('user_id');
			if($user_id > 0) {
				$addressClass = hikamarket::get('class.address');
				$result = $addressClass->frontSaveForm($user_id,
'display:vendor_user_edit=1');
			}
			if(empty($result)) {
				hikaInput::get()->set('edition', true);
			} else {
				hikaInput::get()->set('previous_cid',
$result->previous_id);
				hikaInput::get()->set('cid', $result->id);
			}
		}

		if($subtask == 'delete') {
			JSession::checkToken('request') || die('Invalid
Token');
			$address_id = hikamarket::getCID('address_id');
			$user_id = hikaInput::get()->getInt('user_id');
			$addressClass = hikamarket::get('class.address');
			$addr = $addressClass->get($address_id);
			if(!empty($addr) && $addr->address_user_id == $user_id) {
				$ret = $addressClass->delete($addr);

				if($tmpl == 'component') {
					ob_end_clean();
					if(!empty($ret))
						echo '1';
					else
						echo '0';
					exit;
				}
				if(in_array($tmpl, array('ajax', 'raw'))) {
					hikaInput::get()->set('layout',
'show_address');
					hikaInput::get()->set('hidemainmenu', 1);
					ob_end_clean();
					parent::display();
					exit;
				}

				$app = JFactory::getApplication();
				if($ret)
					$app->enqueueMessage(JText::_('ADDRESS_DELETED_WITH_SUCCESS'));
				else
					$app->enqueueMessage(JText::_('ADDRESS_NOT_DELETED'),
'error');
				$app->redirect(
hikamarket::completeLink('user&task=show&cid=' .
$user_id) );
			}
			return false;
		}

		if(in_array($tmpl, array('component', 'ajax',
'raw'))) {
			hikaInput::get()->set('hidemainmenu', 1);
			ob_end_clean();
			parent::display();
			exit;
		}
		return parent::display();
	}

	public function listing() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;
		if(!hikamarket::acl('user/listing'))
			return false;

		hikaInput::get()->set('layout', 'listing');
		return parent::display();
	}

	public function store() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;
		$vendor_id = hikamarket::loadVendor(false, false);
		if($vendor_id > 1)
			return false;

		$redirection = 'user';
		if(!hikamarket::acl('user/listing'))
			$redirection = 'vendor';
		if( !hikamarket::acl('user/edit') )
			return hikamarket::deny($redirection,
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_USER_EDIT')));

		$userClass = hikamarket::get('class.user');
		if( $userClass === null )
			return false;
		$status = $userClass->frontSaveForm();
		if($status) {
			hikaInput::get()->set('cid', $status);
			hikaInput::get()->set('fail', null);
		}

		return $status;
	}

	public function state() {
		if(!hikamarket::loginVendor())
			return false;
		if(!$this->config->get('frontend_edition',0))
			return false;
		hikaInput::get()->set('layout', 'state');
		return parent::display();
	}

	public function getAddressList() {
		while(ob_get_level())
			@ob_end_clean();

		if(!hikamarket::loginVendor() ||
!$this->config->get('frontend_edition',0)) {
			echo '[]';
			exit;
		}

		$user_id = hikaInput::get()->getInt('user_id', 0);
		$address_type = hikaInput::get()->getCmd('address_type',
'');
		$displayFormat =
hikaInput::get()->getString('displayFormat',
'{address_mini_format}');
		$search = hikaInput::get()->getString('search', null);

		if(!hikamarket::isVendorCustomer($user_id, null, true)) {
			echo '[]';
			exit;
		}

		$nameboxType = hikamarket::get('type.namebox');
		$options = array(
			'url_params' => array(
				'USER_ID' => $user_id,
				'ADDR_TYPE' => $address_type,
			),
			'displayFormat' => $displayFormat
		);

		$ret = $nameboxType->getValues($search, 'address',
$options);
		if(!empty($ret)) {
			echo json_encode($ret);
			exit;
		}
		echo '[]';
		exit;
	}

	public function getValues() {
		if(!hikamarket::loginVendor() ||
!$this->config->get('frontend_edition',0) ||
!hikamarket::acl('user/listing')) {
			echo '[]';
			exit;
		}

		$displayFormat =
hikaInput::get()->getString('displayFormat', '');
		$search = hikaInput::get()->getString('search', null);
		$start = hikaInput::get()->getInt('start', 0);

		$nameboxType = hikamarket::get('type.namebox');
		$options = array(
			'displayFormat' => $displayFormat,
			'start' => $start
		);
		$ret = $nameboxType->getValues($search, 'user', $options);
		if(!empty($ret)) {
			echo json_encode($ret);
			exit;
		}
		echo '[]';
		exit;
	}
}
controllers/vendor.php000064400000044775151166607730011155
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class vendorMarketController extends hikamarketController {
	protected $rights = array(
		'display' => array(
			'cpanel', 'show', 'registration',
'form', 'terms', 'activate',
'reports'
			,'listing', 'selection', 'useselection',
'getvalues', 'vendorpaynotify'
		),
		'add' => array('adduser','register'),
		'edit' => array('save',
'switchvendor'),
		'modify' => array(),
		'delete' => array()
	);

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		if(!$skip)
			$this->registerDefaultTask('cpanel');
	}

	public function show() {
		$shopConfig = hikamarket::config(false);
		if($shopConfig->get('store_offline')) {
			$app = JFactory::getApplication();
			$app->enqueueMessage(JText::_('SHOP_IN_MAINTENANCE'));
			return false;
		}

		$cid = hikamarket::getCID('vendor_id');
		if(empty($cid)) {
			$app = JFactory::getApplication();
			$menus = $app->getMenu();
			$menu = $menus->getActive();
			if(empty($menu) && !empty($Itemid)) {
				$menus->setActive($Itemid);
				$menu = $menus->getItem($Itemid);
			}
			if(is_object($menu)) {
				$market_params = new HikaParameter($menu->params);
				$cid = $market_params->get('vendor_id');
				$cid = is_array($cid) ? (int)$cid[0] : (int)$cid;
				hikaInput::get()->set('vendor_id', $cid);
				hikaInput::get()->set('cid', $cid);
			}
		}
		if(empty($cid)) {
			$vendor_id = hikamarket::loadVendor(false);
			if(!empty($vendor_id)) {
				hikaInput::get()->set('vendor_id', $vendor_id);
				hikaInput::get()->set('cid', $vendor_id);
			}
		}

		hikaInput::get()->set('layout', 'show');
		return $this->display();
	}

	public function cpanel() {
		$config = hikamarket::config();
		if( !$config->get('frontend_edition', 0) ) {
			header($_SERVER['SERVER_PROTOCOL'] . ' 403
Forbidden', true, 403);
			$app = JFactory::getApplication();
			$app->enqueueMessage(JText::_('Access Forbidden'),
'error');
			return false;
		}
		if( !hikamarket::loginVendor() )
			return false;
		hikaInput::get()->set('layout', 'cpanel');
		return parent::display();
	}

	public function terms() {
		$shopConfig = hikamarket::config(false);
		if($shopConfig->get('store_offline')) {
			$app = JFactory::getApplication();
			$app->enqueueMessage(JText::_('SHOP_IN_MAINTENANCE'));
			return false;
		}

		hikaInput::get()->set('layout', 'terms');
		return parent::display();
	}

	public function save() {
		$this->store();
		return $this->form();
	}

	public function store() {
		$config = hikamarket::config();
		if( !$config->get('frontend_edition', 0) ) {
			header($_SERVER['SERVER_PROTOCOL'] . ' 403
Forbidden', true, 403);
			$app = JFactory::getApplication();
			$app->enqueueMessage(JText::_('Access Forbidden'),
'error');
			return false;
		}

		$app = JFactory::getApplication();
		JSession::checkToken() || die('Invalid Token');

		$vendorClass = hikamarket::get('class.vendor');
		$status = $vendorClass->frontSaveForm();
		if($status) {
			$app->enqueueMessage(JText::_('HIKAM_SUCC_SAVED'),
'message');
			hikaInput::get()->set('cid', $status);
			hikaInput::get()->set('fail', null);
		} else {
			$app->enqueueMessage(JText::_('ERROR_SAVING'),
'error');
			if(!empty($vendorClass->errors)) {
				foreach($vendorClass->errors as $err) {
					$app->enqueueMessage($err, 'error');
				}
			}
		}
		return $status;
	}

	public function form() {
		$app = JFactory::getApplication();
		$config = hikamarket::config();

		if(!$config->get('frontend_edition', 0))
			return false;

		$registration = false;
		$user = hikamarket::loadUser(true);
		$vendor = hikamarket::loadVendor(false);
		$registration = $config->get('allow_registration', 1);

		if(empty($vendor) && !$registration) {
			$app->redirect('index.php');
			return false;
		}

		if(empty($user)) {
			jimport('joomla.application.component.helper');
			$usersConfig = JComponentHelper::getParams('com_users');
			if($usersConfig->get('allowUserRegistration') ==
'0') {
				$app->enqueueMessage(JText::_('PLEASE_LOGIN_FIRST'));
				global $Itemid;
				$url = '';
				if(!empty($Itemid)) { $url = '&Itemid=' . $Itemid; }
				$url = 'index.php?option=com_users&view=login' . $url;
				$app->redirect(JRoute::_($url .
'&return='.urlencode(base64_encode(hikamarket::currentUrl())),
false));
			}
		}

		if(!empty($vendor) && !hikamarket::acl('vendor/edit'))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_VENDOR_EDIT')));

		hikaInput::get()->set('layout', 'form');
		return parent::display();
	}

	public function registration() {
		return $this->form();
	}

	public function register() {
		$app = JFactory::getApplication();
		$config = hikamarket::config();
		$allow_registration = $config->get('allow_registration',
1);

		if(!$allow_registration || !$config->get('frontend_edition',
0)) {
			$app->redirect('index.php');
			return false;
		}

		$vendor = hikamarket::loadVendor(true);
		if($vendor != null) {
			$app->enqueueMessage(JText::_('HIKAM_ERR_REGISTER_ALREADY_VENDOR'));
			$app->redirect(hikamarket::completeLink('vendor', false,
true));
			return false;
		}

		JSession::checkToken() || die('Invalid Token');

		$vendorClass = hikamarket::get('class.vendor');
		$user = hikamarket::loadUser(true);
		$create_user = empty($user);

		$status = $vendorClass->register($user);
		if($status) {
			$app->enqueueMessage(JText::sprintf('THANK_YOU_FOR_REGISTERING',HIKASHOP_LIVE));

			if($create_user) {
				$usersConfig = JComponentHelper::getParams('com_users');
				if((int)$usersConfig->get('useractivation') > 0)
					$app->enqueueMessage(JText::_('HIKA_REG_COMPLETE_ACTIVATE'));
			}

			hikaInput::get()->set('layout',
'after_register');
			return parent::display();
		}
		hikaInput::get()->set('layout', 'registration');
		return $this->form();
		return parent::display();
	}

	public function activate() {
		$app = JFactory::getApplication();
		$db	= JFactory::getDBO();
		$juser = JFactory::getUser();

		$usersConfig = JComponentHelper::getParams('com_users');
		$userActivation	= $usersConfig->get('useractivation');
		$allowUserRegistration =
$usersConfig->get('allowUserRegistration');

		if($juser->get('id')) {
			$app->redirect(hikamarket::completeLink('vendor',false,true));
			return false;
		}
		unset($juser);

		if($allowUserRegistration == '0' || $userActivation ==
'0') {
			header($_SERVER['SERVER_PROTOCOL'] . ' 403
Forbidden', true, 403);
			$app = JFactory::getApplication();
			$app->enqueueMessage(JText::_('Access Forbidden'),
'error');
			return false;
		}

		$lang = JFactory::getLanguage();
		$lang->load('com_user', JPATH_SITE);
		jimport('joomla.user.helper');

		$activation =
hikamarket::getEscaped(hikaInput::get()->getAlnum('activation',
''));

		if(empty($activation)) {
			$app->enqueueMessage(JText::_('HIKA_REG_ACTIVATE_NOT_FOUND'));
			$app->redirect('index.php');
			return false;
		}

		if(HIKASHOP_J30) {
			JModelLegacy::addIncludePath(HIKASHOP_ROOT.DS.'components'.DS.'com_users'.DS.'models');
		} else {
			JModel::addIncludePath(HIKASHOP_ROOT.DS.'components'.DS.'com_users'.DS.'models');
		}

		$model = $this->getModel('Registration',
'UsersModel', array(), true);
		$language = JFactory::getLanguage();
		$language->load('com_users', JPATH_SITE,
$language->getTag(), true);
		$result = false;
		if($model)
			$result = $model->activate($activation);

		if(!$result) {
			$app->enqueueMessage(JText::_('HIKA_REG_ACTIVATE_NOT_FOUND'));
			$app->redirect('index.php');
			return false;
		}

		$app->enqueueMessage(JText::_('HIKA_REG_ACTIVATE_COMPLETE'));
		$id = hikaInput::get()->getInt('id', 0);
		$userClass = hikamarket::get('shop.class.user');
		$user = $userClass->get($id);
		if($id &&
file_exists(JPATH_ROOT.DS.'components'.DS.'com_comprofiler'.DS.'comprofiler.php')
&& (int)$userActivation < 2) {
			$userClass->addAndConfirmUserInCB($user);
		}

		$infos = hikaInput::get()->getString('infos',
'');
		global $Itemid;
		$url = '';
		if(!empty($Itemid))
			$url = '&Itemid='.$Itemid;

		if(!empty($infos) && function_exists('json_decode')) {
			$infos = json_decode(base64_decode($infos), true);

			JPluginHelper::importPlugin('user');
			if($userActivation < 2 && is_array($infos) &&
!empty($infos['passwd']) &&
!empty($infos['username'])) {
				$options = array(
					'remember' => false,
					'return' => false
				);
				$credentials = array(
					'username' => $infos['username'],
					'password' => $infos['passwd']
				);
				$error = $app->login($credentials, $options);
				$juser = JFactory::getUser();
				if(JError::isError($error) || $juser->guest) {
					$app->redirect('index.php');
					return false;
				}

				$user_id = $userClass->getID($juser->get('id'));
				if(!empty($user_id)) {
					$app->setUserState(HIKASHOP_COMPONENT.'.user_id',
$user_id);
				}
			} elseif($userActivation >= 2) {
				$app->enqueueMessage(JText::_('HIKA_ADMIN_CONFIRM_ACTIVATION'));
			}
		}

		$app->redirect(hikamarket::completeLink('vendor',false,true));
		return false;
	}

	public function adduser() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$config = hikamarket::config();
		$vendor = hikamarket::loadVendor(true);

		if(!$config->get('frontend_edition', 0))
			return false;

		while(ob_get_level())
			@ob_end_clean();

		if($vendor == null) {
			echo JText::_('PLEASE_LOGIN_FIRST');
			exit;
		}

		if(!hikamarket::acl('vendor/edit')) {
			echo JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_VENDOR_EDIT'));
			exit;
		}

		$email = hikaInput::get()->getString('email',
'');
		if(empty($email)) {
			echo JText::_('HIKAM_INVALID_USER');
			exit;
		}

		$query = 'SELECT hu.*, ju.* FROM
'.hikamarket::table('shop.user').' AS hu '.
			' INNER JOIN
'.hikamarket::table('joomla.users').' AS ju ON
hu.user_cms_id = ju.id '.
			' WHERE hu.user_vendor_id = 0 AND ju.block = 0 AND hu.user_email =
' . $db->Quote($email);
		$db->setQuery($query);
		$user = $db->loadObject();

		if(!empty($user)) {
			$ret = new stdClass();
			$ret->user_id = (int)$user->user_id;
			$ret->user_email = $user->user_email;
			$ret->user_vendor_id = $user->user_vendor_id;
			$ret->user_vendor_access = $user->user_vendor_access;
			$ret->name = $user->name;
			$ret->username = $user->username;

			echo json_encode($ret);

		} else {
			echo JText::_('HIKAM_INVALID_USER');
		}

		exit;
	}

	public function reports() {
		while(ob_get_level())
			@ob_end_clean();

		$vendor_id = hikamarket::loadVendor(false);
		$config = hikamarket::config();
		if(empty($vendor_id) || !$config->get('frontend_edition',0)
|| !hikamarket::acl('vendor/statistics')) {
			echo '{}';
			exit;
		}

		$statName = hikaInput::get()->getCmd('chart',
'');
		$statValue = hikaInput::get()->getString('value',
'');
		if(empty($statName) || empty($statValue)) {
			echo '{}';
			exit;
		}

		$statisticsClass = hikamarket::get('class.statistics');
		$ret = $statisticsClass->getAjaxData($vendor_id, $statName,
$statValue);

		if($ret === false) {
			echo '{}';
			exit;
		}
		echo $ret;
		exit;
	}

	public function switchvendor() {
		JSession::checkToken() || die('Invalid Token');

		if(!hikamarket::loginVendor())
			return false;

		$config = hikamarket::config();
		if(!$config->get('frontend_edition',0))
			return false;

		$vendor_id = hikamarket::getCID('vendor_id');
		if($config->get('user_multiple_vendor', 0) &&
!empty($vendor_id)) {
			$vendorClass = hikamarket::get('class.vendor');
			$vendorClass->switchVendor($vendor_id);
		}

		global $Itemid;
		$url = !empty($Itemid) ? '&Itemid=' . $Itemid :
'';

		$app = JFactory::getApplication();
		$app->redirect(hikamarket::completeLink('vendor'.$url,
false, true));
	}

	public function selection() {
		if(!hikamarket::loginVendor())
			return false;

		$config = hikamarket::config();
		if(!$config->get('frontend_edition',0))
			return false;

		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id > 1)
			return false;

		hikaInput::get()->set('layout', 'selection');
		return parent::display();
	}

	public function useselection() {
		if(!hikamarket::loginVendor())
			return false;

		$config = hikamarket::config();
		if(!$config->get('frontend_edition',0))
			return false;
		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id > 1)
			return false;

		hikaInput::get()->set('layout', 'useselection');
		return parent::display();
	}

	public function vendorpaynotify() {
		while(ob_get_level())
			@ob_end_clean();

		$mode = hikaInput::get()->getString('mode', null);
		if(empty($mode))
			$mode = @$_GET['mode'];
		if(empty($mode))
			exit;

		$order_id = (int)@$_GET['order_id'];
		$orderClass = hikamarket::get('class.order');
		$order = $orderClass->getRaw($order_id);

		if($order->order_type != 'vendorpayment')
			exit;

		switch($mode) {
			case 'paypal':
				$raw_data = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA :
file_get_contents('php://input');
				$ipndata = $this->processIPNdata($raw_data);
				$ipnConfirm =
$this->sendIPNconfirm('https://www.paypal.com/webscr',
$raw_data . '&cmd=_notify-validate');
				$verified = preg_match('#VERIFIED#i', $ipnConfirm);
				$completed = preg_match('#Completed#i',
$ipndata['payment_status']);
				if($verified && $completed) {
					$shopConfig = hikamarket::config(false);
					$confirmed_status =
$shopConfig->get('order_confirmed_status',
'confirmed');

					$update_order = new stdClass();
					$update_order->order_id = (int)$order_id;
					$update_order->order_status = $confirmed_status;
					$update_order->history = new stdClass();
					$update_order->history->history_reason =
JText::_('AUTOMATIC_PAYMENT_NOTIFICATION');
					$update_order->history->history_notified = true;
				}
				break;
		}
		exit;
	}

	private function processIPNdata($data = '') {
		if(empty($data))
			return array();
		$ret = array();
		$elements = explode('&', $data);
		foreach($elements as $element) {
			list($k, $v) = explode('=', $element, 2);
			$k = urldecode($k);
			$v = urldecode($v);
			preg_match('/(\w+)(?:\[(\d+)\])?(?:\.(\w+))?/', $k, $parts);
			switch(count($parts)) {
				case 4:
					if(!isset($ret[ $parts[1] ])) $ret[ $parts[1] ] = array();
					if(!isset($ret[ $parts[1] ][ $parts[2] ])) $ret[ $parts[1] ][
$parts[2] ] = array();
					$ret[ $parts[1] ][ $parts[2] ][ $parts[3] ] = $v;
					break;
				case 3:
					if(!isset($ret[$parts[1]])) $ret[ $parts[1] ] = array();
					$ret[ $parts[1] ][ $parts[2] ] = $v;
					break;
				default:
					$ret[$k] = $v;
					break;
			}
		}
		return $ret;
	}

	private function sendIPNconfirm($notif_url, $data = '') {
		$url = parse_url($notif_url);
		if(!isset($url['query'])) $url['query'] =
'';

		if(!isset($url['port'])) {
			if(!empty($url['scheme']) &&
in_array($url['scheme'], array('https',
'ssl'))) $url['port'] = 443;
			else $url['port'] = 80;
		}

		if(!empty($url['scheme']) &&
in_array($url['scheme'], array('https',
'ssl'))) $url['host_socket'] = 'ssl://' .
$url['host'];
		else $url['host_socket'] = $url['host'];

		$fp = fsockopen($url['host_socket'], $url['port'],
$errno, $errstr, 30);
		if(!$fp) return false;
		$uri = $url['path'] . ($url['query'] != ''
? '?' . $url['query'] : '');
		$header = 'POST '.$uri.' HTTP/1.1'."\r\n".
			'User-Agent: PHP/'.phpversion()."\r\n".
			'Referer: '.hikashop_currentURL()."\r\n".
			'Server:
'.$_SERVER['SERVER_SOFTWARE']."\r\n".
			'Host: '.$url['host']."\r\n".
			'Content-Type:
application/x-www-form-urlencoded'."\r\n".
			'Content-Length: '.strlen($data)."\r\n".
			'Accept: */'.'*'."\r\n".
			'Connection: close'."\r\n\r\n";
		fwrite($fp, $header . $data);
		$response = '';
		while(!feof($fp)) {
			$response .= fgets($fp, 1024);
		}
		fclose ($fp);
		return substr($response, strpos($response, "\r\n\r\n") +
strlen("\r\n\r\n"));
	}

	public function getUploadSetting($upload_key, $caller = '') {
		if(!hikamarket::loginVendor())
			return false;
		$config = hikamarket::config();
		if(!$config->get('frontend_edition',0))
			return false;

		$shopConfig = hikamarket::config(false);
		$vendor_id = hikamarket::loadVendor(false);
		if(empty($upload_key))
			return false;
		if(!empty($vendor_id) &&
!hikamarket::acl('vendor/edit/image'))
			return false;
		$upload_value = null;
		$upload_keys = array(
			'vendor_image' => array(
				'type' => 'image',
				'field' => 'data[vendor][vendor_image]'
			)
		);

		if(empty($upload_keys[$upload_key]))
			return false;
		$upload_value = $upload_keys[$upload_key];

		$options = array();
		$options['upload_dir'] =
$shopConfig->get('uploadfolder');
		if($vendor_id > 1)
			$options['sub_folder'] =
'vendor'.(int)$vendor_id.DS;

		if(empty($vendor_id))
			$options['sub_folder'] = 'vendor_register'.DS;

		return array(
			'limit' => 1,
			'type' => $upload_value['type'],
			'options' => $options,
			'extra' => array(
				'vendor_id' => $vendor_id,
				'field_name' => $upload_value['field']
			)
		);
	}

	public function manageUpload($upload_key, &$ret, $uploadConfig,
$caller = '') {
		$config = hikamarket::config();
		if(!$config->get('frontend_edition',0) || empty($ret) ||
empty($ret->name))
			return;

		$vendor_id = hikamarket::loadVendor(false);
		if(empty($vendor_id) || !hikamarket::acl('vendor/edit/image'))
			return;

		$vendorClass = hikamarket::get('class.vendor');
		$vendor = new stdClass();
		$vendor->vendor_id = $vendor_id;
		$vendor->vendor_image =
@$uploadConfig['options']['sub_folder'].$ret->name;
		$vendorClass->save($vendor);
	}

	public function getValues() {
		if(!hikamarket::loginVendor())
			return false;
		$config = hikamarket::config();
		if(!$config->get('frontend_edition', 0))
			return false;

		while(ob_get_level())
			@ob_end_clean();

		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id > 1) {
			echo '{}';
			exit;
		}

		$displayFormat =
hikaInput::get()->getString('displayFormat', '');
		$search = hikaInput::get()->getString('search', null);

		$nameboxType = hikamarket::get('type.namebox');
		$options = array(
			'displayFormat' => $displayFormat
		);
		$ret = $nameboxType->getValues($search, 'vendor',
$options);
		if(!empty($ret)) {
			echo json_encode($ret);
			exit;
		}
		echo '[]';
		exit;
	}
}
controllers/warehouse.php000064400000002460151166607730011643
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class warhouseMarketController extends hikamarketController {
	protected $rights = array(
		'display' => array('findvalue'),
		'add' => array(),
		'edit' => array(),
		'modify' => array(),
		'delete' => array()
	);
	protected $type = 'warehouse';
	protected $config = null;

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		$this->config = hikamarket::config();
	}

	function findValue() {
		while(ob_get_level())
			@ob_end_clean();

		if(!hikamarket::loginVendor() ||
!$this->config->get('frontend_edition',0)) {
			echo '[]';
			exit;
		}

		$displayFormat =
hikaInput::get()->getString('displayFormat', '');
		$search = hikaInput::get()->getString('search', null);

		$nameboxType = hikamarket::get('type.namebox');
		$options = array(
			'displayFormat' => $displayFormat
		);
		$ret = $nameboxType->getValues($search, $this->type, $options);
		if(!empty($ret)) {
			echo json_encode($ret);
			exit;
		}
		echo '[]';
		exit;
	}
}
controllers/zone.php000064400000002602151166607730010612 0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class zoneMarketController extends hikamarketController {
	protected $rights = array(
		'display' => array('gettree'),
		'add' => array(),
		'edit' => array(),
		'modify' => array(),
		'delete' => array()
	);

	protected $type = 'zone';
	protected $config = null;

	public function __construct($config = array(), $skip = false) {
		parent::__construct($config, $skip);
		$this->config = hikamarket::config();
	}

	public function getTree() {
		while(ob_get_level())
			@ob_end_clean();

		if(!hikamarket::loginVendor() ||
!$this->config->get('frontend_edition',0)) {
			echo '[]';
			exit;
		}

		$zone_key = hikaInput::get()->getString('zone_key', null);
		$displayFormat =
hikaInput::get()->getString('displayFormat', '');
		$search = hikaInput::get()->getString('search', null);

		$nameboxType = hikamarket::get('type.namebox');
		$options = array(
			'zone_key' => $zone_key,
			'displayFormat' => $displayFormat
		);
		$ret = $nameboxType->getValues($search, 'zone', $options);
		if(!empty($ret)) {
			echo json_encode($ret);
			exit;
		}
		echo '[]';
		exit;
	}
}
fields/hikamarketmenu.php000064400000003305151166607730011545
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class JFormFieldHikamarketmenu extends JFormField {
	protected $type = 'hikamarketmenu';

	protected function getInput() {
		if(!defined('DS'))
			define('DS', DIRECTORY_SEPARATOR);
		if(!defined('HIKAMARKET_COMPONENT') &&
!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikamarket'.DS.'helpers'.DS.'helper.php'))
			return 'This menu can not work without the HikaMarket
Component';

		$config = hikamarket::config();
		if(!hikamarket::isAllowed($config->get('acl_modules_manage',
'all')))
			return 'Access to the HikaMarket options of the menu is
restricted';

		$id = hikaInput::get()->getInt('id');
		if(empty($this->multiple) || !HIKASHOP_J30) {
			if(empty($id))
				return JText::_('HIKAMARKET_OPTIONS_EDIT');
			$text = '<a
title="'.JText::_('HIKAMARKET_OPTIONS').'" 
href="'.JRoute::_('index.php?option=com_hikamarket&ctrl=menus&fromjoomla=1&task=edit&cid[]='.$id).'">'.JText::_('HIKAMARKET_OPTIONS').'</a>';
			return $text;
		}

		$empty = '';
		$js = '';
		$params = new HikaParameter($empty);

		$params->set('id', $this->id);
		$params->set('cid', $id);
		$params->set('name', $this->name);
		$params->set('value', $this->value);
		$params->set('type',
$this->getAttribute('content'));
		$params->set('menu',
$this->getAttribute('menu'));

		$content = hikamarket::getLayout('menusmarket',
'options', $params, $js);
		return
'</div></div>'.$content.'<div><div>';
	}
}
fields/hikamarketmodule.php000064400000003322151166607730012065
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class JFormFieldHikamarketmodule extends JFormField {
	protected $type = 'hikamarketmodule';

	protected function getInput() {
		if(!defined('DS'))
			define('DS', DIRECTORY_SEPARATOR);
		if(!defined('HIKAMARKET_COMPONENT') &&
!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikamarket'.DS.'helpers'.DS.'helper.php'))
			return 'This module can not work without the HikaMarket
Component';

		$config = hikamarket::config();
		if(!hikamarket::isAllowed($config->get('acl_modules_manage',
'all')))
			return 'Access to the HikaMarket options of the modules is
restricted';

		$id = hikaInput::get()->getInt('id');
		if(empty($this->multiple) || !HIKASHOP_J30) {
			if(empty($id))
				return JText::_('HIKAMARKET_OPTIONS_EDIT');
			$text = '<a
title="'.JText::_('HIKASHOP_OPTIONS').'"
href="'.JRoute::_('index.php?option=com_hikamarket&ctrl=modules&fromjoomla=1&task=edit&cid[]='.$id).'"
>'.JText::_('HIKAMARKET_OPTIONS').'</a>';
			return $text;
		}

		$empty = '';
		$js = '';
		$params = new HikaParameter($empty);

		$params->set('id', $this->id);
		$params->set('cid', $id);
		$params->set('name', $this->name);
		$params->set('value', $this->value);
		$params->set('type',
$this->getAttribute('content'));
		$params->set('menu',
$this->getAttribute('menu'));

		$content = hikamarket::getLayout('modulesmarket',
'options', $params, $js);
		return
'</div></div>'.$content.'<div><div>';
	}
}

fields/hikamnamebox.php000064400000002525151166607730011206
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class JFormFieldHikamnamebox extends JFormField {
	protected $type = 'hikamnamebox';

	protected function getInput() {
		if(!defined('DS'))
			define('DS', DIRECTORY_SEPARATOR);
		if(!defined('HIKAMARKET_COMPONENT') &&
!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikamarket'.DS.'helpers'.DS.'helper.php'))
			return 'This module can not work without the HikaMarket
Component';

		$nameboxType = hikamarket::get('type.namebox');

		$namebox_type = 'vendor';
		if(isset($this->element['namebox_type']))
			$namebox_type = (string)$this->element['namebox_type'];

		$namebox_mode = hikamarketNameboxType::NAMEBOX_SINGLE;
		if($this->multiple) {
			$namebox_mode = hikamarketNameboxType::NAMEBOX_MULTIPLE;
			if(!is_array($this->value))
				$this->value = explode(',', $this->value);
		}

		$text = $nameboxType->display(
			$this->name,
			$this->value,
			$namebox_mode,
			$namebox_type,
			array(
				'delete' => true,
				'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>'
			)
		);
		return $text;
	}
}

fields/index.html000064400000000032151166607730010016
0ustar00<html><body></body></html>fields/selectoptions.php000064400000002361151166607730011434
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class JFormFieldSelectoptions extends JFormField {
	protected $type = 'selectoptions';

	protected function getInput() {
		if(!defined('DS'))
			define('DS', DIRECTORY_SEPARATOR);
		if(!class_exists('hikamarket') &&
!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikamarket'.DS.'helpers'.DS.'helper.php'))
			return 'This menu options cannot be displayed without the
HikaMarket Component';

		$shopConfig = hikamarket::config(false);
		if(!hikamarket::isAllowed($shopConfig->get('acl_menus_manage',
'all')))
			return 'Access to the HikaMarket options of the menus is
restricted';

		$id = hikaInput::get()->getInt('id');
		if(!empty($id)) {
			$text = '<a
title="'.JText::_('HIKAMARKET_OPTIONS').'" 
href="'.JRoute::_('index.php?option=com_hikamarket&ctrl=menus&fromjoomla=1&task=edit&cid[]='.$id).'">'.JText::_('HIKAMARKET_OPTIONS').'</a>';
		} else {
			$text = JText::_('HIKAMARKET_OPTIONS_EDIT');
		}
		return $text;
	}
}
fields/vendorsearchfields.php000064400000001651151166607730012414
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class JFormFieldVendorsearchfields extends JFormField
{
	public $type = 'help';

	public function getInput() {
		JHTML::_('behavior.modal','a.modal');
		$link =
'index.php?option=com_hikamarket&amp;tmpl=component&amp;ctrl=vendor&amp;task=searchfields&amp;values='.$this->value.'&amp;control=';
		$text = '<input class="inputbox" id="fields"
name="'.$this->name.'" type="text"
size="20"
value="'.$this->value.'">';
		$text .= '<a class="modal" id="linkfields"
title="Fields"  href="'.$link.'"
rel="{handler: \'iframe\', size: {x: 650, y:
375}}"><button class="btn" onclick="return
false">Select</button></a>';
		return $text;
	}
}
hikamarket.php000064400000005267151166607730007423 0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
jimport('joomla.application.component.controller');
jimport('joomla.application.component.view');

if(!defined('DS'))
	define('DS', DIRECTORY_SEPARATOR);
include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikamarket'.DS.'helpers'.DS.'helper.php');

hikaInput::get()->set('hikamarket_front_end_main', 1);

global $Itemid;
if(empty($Itemid)) {
	$urlItemid = hikaInput::get()->getInt('Itemid');
	if($urlItemid)
		$Itemid = $urlItemid;
}

$view = hikaInput::get()->getCmd('view');
if(!empty($view) && strlen($view) > 6 && substr($view,
-6) == 'market')
	$view = substr($view, 0, -6);
if(!empty($view) && !hikaInput::get()->getCmd('ctrl'))
{
	hikaInput::get()->set('ctrl', $view);
	$layout = hikaInput::get()->getCmd('layout');
	if(!empty($layout)) {
		hikaInput::get()->set('task', $layout);
	}
} else {
	$ctrl = hikaInput::get()->getCmd('ctrl');
	if(!empty($ctrl) && substr($ctrl, -6) == 'market')
		hikaInput::get()->set('ctrl', substr($ctrl, 0, -6));
}

if(HIKASHOP_J30) {
	$token = hikamarket::getFormToken();
	$isToken = hikaInput::get()->getString($token, '');
	if(!empty($isToken) && !JSession::checkToken('request'))
{
		$app = JFactory::getApplication();
		$app->input->request->set($token, 1);
	}
}

$session = JFactory::getSession();
if(is_null($session->get('registry'))) {
	jimport('joomla.registry.registry');
	$session->set('registry', new
JRegistry('session'));
}
$taskGroup = hikaInput::get()->getCmd('ctrl',
'vendor');
$className = ucfirst($taskGroup).'MarketController';
$overrideClassName =
ucfirst($taskGroup).'MarketControllerOverride';
if(class_exists($overrideClassName)) {
	$className = $overrideClassName;
}
elseif(file_exists(HIKAMARKET_CONTROLLER.$taskGroup.'.override.php'))
{
	include_once(HIKAMARKET_CONTROLLER.$taskGroup.'.override.php');
}

if(!class_exists($className) &&
(!file_exists(HIKAMARKET_CONTROLLER.$taskGroup.'.php') ||
!include_once(HIKAMARKET_CONTROLLER.$taskGroup.'.php'))) {
	if(!hikamarket::getPluginController($taskGroup)) {
		throw new Exception('Page not found : '.$taskGroup, 404);
		return;
	}
}

$classGroup = new $className();

hikaInput::get()->set('view', $classGroup->getName());

$classGroup->execute(hikaInput::get()->getCmd('task'));
$classGroup->redirect();
if(hikaInput::get()->getString('tmpl') !==
'component') {
	echo hikamarket::footer();
}

hikaInput::get()->set('hikamarket_front_end_main',0);
index.html000064400000000032151166607730006550
0ustar00<html><body></body></html>router.php000064400000012341151166607730006612
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php

function hikamarketBuildRoute(&$query) {
	$segments = array();
	if(!defined('DS'))
		define('DS', DIRECTORY_SEPARATOR);
	$config = null;
	$shopConfig = null;
	if(defined('HIKAMARKET_COMPONENT') ||
include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikamarket'.DS.'helpers'.DS.'helper.php'))
{
		$config = hikamarket::config();
		$shopConfig = hikamarket::config(false);
	}

	$controller = null;
	if(isset($query['ctrl'])) {
		if(substr($query['ctrl'], -6) == 'market')
			$query['ctrl'] = substr($query['ctrl'], 0, -6);
		$segments[] = $query['ctrl'];
		$controller = $query['ctrl'];
		unset( $query['ctrl'] );
		if (isset($query['task']) &&
strpos($query['task'], '-') === false) {
			$segments[] = $query['task'];
			unset($query['task']);
		}
	} elseif(isset($query['view'])) {
		if(substr($query['view'], -6) == 'market')
			$query['view'] = substr($query['view'], 0, -6);
		$segments[] = $query['view'];
		$controller = $query['view'];
		unset($query['view']);
		if(isset($query['layout'])) {
			$segments[] = $query['layout'];
			unset($query['layout']);
		}
	}

	if(count($segments) == 2 && $segments[0] == 'vendor'
&& $segments[1] == 'show' &&
isset($query['Itemid']) &&
$shopConfig->get('sef_remove_id',0)) {
		$segments = array();
	}

	if(isset($query['cid']) &&
isset($query['name'])) {
		if($controller == 'vendor' && !empty($shopConfig)
&& $shopConfig->get('sef_remove_id',0) &&
!empty($query['name'])) {
			$segments[] = $query['name'];
		} else {
			if(is_numeric($query['name'])) {
				$query['name'] = $query['name'] . '-';
			}
			$segments[] = $query['cid'] . ':' .
$query['name'];
		}
		unset($query['cid']);
		unset($query['name']);
	}

	if(!empty($query)) {
		foreach($query as $name => $value) {
			if(!in_array($name, array('option', 'Itemid',
'start', 'format', 'limitstart',
'lang'))) {
				$segments[] = $name . ':' . $value;
				unset($query[$name]);
			}
		}
	}
	return $segments;
}

function hikamarketParseRoute($segments) {
	$vars = array();
	if(!empty($segments)) {
		if(!defined('DS'))
			define('DS', DIRECTORY_SEPARATOR);
		$config = null;
		$shopConfig = null;
		if(defined('HIKAMARKET_COMPONENT') ||
include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikamarket'.DS.'helpers'.DS.'helper.php')){
			$config = hikamarket::config();
			$shopConfig = hikamarket::config(false);
		}
		if(count($segments) == 1 &&
$shopConfig->get('sef_remove_id',0)) {
			$vars['ctrl'] = 'vendor';
			$vars['task'] = 'show';
			if(hikmarket_retrieve_url_id($vars, $segments[0]))
				return $vars;
			unset($vars['ctrl']);
			unset($vars['task']);
		}
		$i = 0;
		foreach($segments as $name) {
			if(isset($vars['ctrl']) &&
isset($vars['task']) &&
$shopConfig->get('sef_remove_id',0) &&
hikmarket_retrieve_url_id($vars, $name))
				continue;
			if(strpos($name, ':')) {
				list($arg, $val) = explode(':',$name);
				if(is_numeric($arg) && !is_numeric($val)) {
					$vars['cid'] = $arg;
					$vars['name'] = $val;
				} else if(is_numeric($arg))
					$vars['Itemid'] = $arg;
				else
					$vars[$arg] = $val;
			} else {
				$i++;
				if($i == 1)
					$vars['ctrl'] = $name;
				elseif($i == 2)
					$vars['task'] = $name;
			}
		}
	}
	return $vars;
}

function hikmarket_retrieve_url_id(&$vars, $name) {
	if(@$vars['ctrl'] !== 'vendor' &&
@$vars['task'] !== 'show')
		return false;

	if(!empty($vars['cid']))
		return false;

	$db = JFactory::getDBO();
	$shopConfig = hikamarket::config(false);

	if($shopConfig->get('alias_auto_fill', 1)) {
		$db->setQuery('SELECT vendor_id FROM ' .
hikamarket::table('vendor').' WHERE vendor_alias =
'.$db->Quote(str_replace(':','-',$name)));
		$retrieved_id = $db->loadResult();
		if($retrieved_id) {
			$vars['cid'] = $retrieved_id;
			$vars['name'] = $name;
			return true;
		}
	}

	$name_regex = '^ *' . str_replace(array('-',
':'), '.+', $name) . ' *$';
	$db->setQuery('SELECT * FROM ' .
hikamarket::table('vendor') . ' WHERE vendor_alias REGEXP
' . $db->Quote($name_regex) . ' OR vendor_name REGEXP ' .
$db->Quote($name_regex));
	$retrieved = $db->loadObject();
	if($retrieved) {
		$vars['cid'] = $retrieved->vendor_id;
		$vars['name'] = $name;

		if($shopConfig->get('alias_auto_fill', 1) &&
empty($retrieved->vendor_alias)) {
			$retrieved->alias = $retrieved->vendor_name;
			if(!$shopConfig->get('unicodeslugs')) {
				$lang = JFactory::getLanguage();
				$retrieved->alias = $lang->transliterate($retrieved->alias);
			}

			$app = JFactory::getApplication();
			if(method_exists($app,'stringURLSafe'))
				$retrieved->alias = $app->stringURLSafe($retrieved->alias);
			else
				$retrieved->alias =
JFilterOutput::stringURLSafe($retrieved->alias);

			$vendorClass = hikamarket::get('class.vendor');
			$element = new stdClass();
			$element->vendor_id = $retrieved->vendor_id;
			$element->vendor_alias = $retrieved->alias;
			$vendorClass->save($element);
		}
		return true;
	}
	return false;
}
sef_ext.php000064400000003511151166607730006726 0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class sef_hikamarket {
	public function create($string) {
		$string = str_replace('&amp;', '&',
preg_replace('#(index\.php\??)#i', '', $string));
		$query = array();
		$allValues = explode('&',$string);
		foreach($allValues as $oneValue) {
			list($var,$val) = explode('=', $oneValue);
			$query[$var] = $val;
		}
		$segments = array();

		if(!defined('DS'))
			define('DS', DIRECTORY_SEPARATOR);
		if(class_exists('hikamarket') ||
include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikamarket'.DS.'helpers'.DS.'helper.php'))
{
			$shopConfig = hikamarket::config(false);
			if($shopConfig->get('activate_sef',1)) {

			}
		}

		if (isset($query['ctrl'])) {
			$segments[] = $query['ctrl'];
			unset($query['ctrl']);
			if(isset($query['task'])) {
				$segments[] = $query['task'];
				unset($query['task']);
			}
		} elseif(isset($query['view'])) {
			$segments[] = $query['view'];
			unset($query['view']);
			if(isset($query['layout'])){
				$segments[] = $query['layout'];
				unset($query['layout']);
			}
		}

		if(isset($query['cid']) &&
isset($query['name'])) {
			if(is_numeric($query['name'])) {
				$query['name'] = $query['name'] . '-';
			}
			$segments[] = $query['cid'] . ':' .
$query['name'];
			unset($query['cid']);
			unset($query['name']);
		}
		unset($query['option']);
		if(isset($query['Itemid']))
			unset($query['Itemid']);
		if(!empty($query)) {
			foreach($query as $name => $value){
				$segments[] = $name . ':' . $value;
			}
		}
		return implode('/', $segments);
	}
}
views/categorymarket/index.html000064400000000032151166607730012726
0ustar00<html><body></body></html>views/categorymarket/tmpl/edit_translation.php000064400000010403151166607740015765
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('category'); ?>"
name="hikamarket_translation_form"
id="hikamarket_translation_form" method="post"
enctype="multipart/form-data">
<?php
if(!empty($this->category->translations)) {
	foreach($this->category->translations as $language_id =>
$translation) {
?>
	<table class="hikam_blocks">
		<tr>
			<td class="hikam_block_r">
				<dl class="hikam_options">
<?php if(hikamarket::acl('category/edit/name')) { ?>
					<dt
class="hikamarket_category_name"><label><?php echo
JText::_('HIKA_NAME'); ?></label></dt>
					<dd class="hikamarket_category_name"><input
type="text" name="translation[category_name][<?php echo
$language_id; ?>]" value="<?php echo
@$translation->category_name->value; ?>"/></dd>

<?php } else { ?>
					<dt
class="hikamarket_category_name"><label><?php echo
JText::_('HIKA_NAME'); ?></label></dt>
					<dd class="hikamarket_category_name"><?php echo
@$this->category->category_name; ?></dd>
<?php }

		if(hikamarket::acl('category/edit/metadescription')) { ?>
					<dt
class="hikamarket_category_metadescription"><label><?php
echo JText::_('CATEGORY_META_DESCRIPTION');
?></label></dt>
					<dd
class="hikamarket_category_metadescription"><textarea
id="hikamarket_category_metadescription_textarea"
cols="35" rows="2"
name="translation[category_meta_description][<?php echo
$language_id; ?>]"><?php echo
$this->escape(@$translation->category_meta_description->value);
?></textarea></dd>
<?php
		}

		if(hikamarket::acl('category/edit/keywords')) { ?>
					<dt
class="hikamarket_category_keywords"><label><?php
echo JText::_('CATEGORY_KEYWORDS');
?></label></dt>
					<dd class="hikamarket_category_keywords"><textarea
id="hikamarket_category_keywords_textarea" cols="35"
rows="2" name="translation[category_keywords][<?php echo
$language_id; ?>]"><?php echo
$this->escape(@$translation->category_keywords->value);
?></textarea></dd>
<?php
		}

		if(hikamarket::acl('category/edit/pagetitle')) { ?>
					<dt
class="hikamarket_category_pagetitle"><label><?php
echo JText::_('PAGE_TITLE'); ?></label></dt>
					<dd class="hikamarket_category_pagetitle"><input
type="text" size="45"
name="translation[category_page_title][<?php echo $language_id;
?>]" value="<?php echo
$this->escape(@$translation->category_page_title->value);
?>" /></dd>
<?php
		}

		if(hikamarket::acl('category/edit/alias')) { ?>
					<dt
class="hikamarket_category_alias"><label><?php echo
JText::_('HIKA_ALIAS'); ?></label></dt>
					<dd class="hikamarket_category_alias"><input
type="text" size="45"
name="translation[category_alias][<?php echo $language_id;
?>]" value="<?php echo
$this->escape(@$translation->category_alias->value); ?>"
/></dd>
<?php
		}

		if(hikamarket::acl('category/edit/description') &&
$this->config->get('front_small_editor')) { ?>
					<dt
class="hikamarket_category_description"><label><?php
echo JText::_('PRODUCT_DESCRIPTION');
?></label></dt>
					<dd class="hikamarket_category_description"><div
class="hikam_options_nl"></div><?php
						$this->editor->name =
'translation_category_description_' . $language_id;
						$this->editor->content =
@$translation->category_description->value;
						echo $this->editor->display();
					?><div style="clear:both"></div></dd>
<?php } ?>
				</dl>
			</td>
		</tr>
<?php if(hikamarket::acl('category/edit/description')
&& !$this->config->get('front_small_editor')) {
?>
		<tr>
			<td><?php
				$this->editor->name =
'translation_category_description_' . $language_id;
				$this->editor->content =
@$translation->category_description->value;
				echo $this->editor->display();
			?><div style="clear:both"></div></td>
		</tr>
<?php } ?>
	</table>
<?php
	}
}
?>
	<input type="hidden" name="cid[]"
value="<?php echo @$this->category->category_id; ?>"
/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task" value=""
/>
	<input type="hidden" name="ctrl"
value="category" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
views/categorymarket/tmpl/form.php000064400000016307151166607740013376
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><script type="text/javascript">
window.categoryMgr = {};
window.categoryMgr.cpt = {};
</script>
<form action="<?php echo
hikamarket::completeLink('category');?>"
method="post" name="hikamarket_form"
id="hikamarket_categories_form"
enctype="multipart/form-data">
	<table class="hikam_blocks">
		<tr>
			<td class="hikam_block_l hikam_block_x150">
<?php
	if(hikamarket::acl('category/edit/images')) {
		echo $this->loadTemplate('image');
	}
?>
			</td>
			<td class="hikam_block_r">
				<dl class="hikam_options">
<?php if(hikamarket::acl('category/edit/name')) { ?>
					<dt
class="hikamarket_category_name"><label><?php echo
JText::_('HIKA_NAME'); ?></label></dt>
					<dd class="hikamarket_category_name"><input
type="text" name="data[category][category_name]"
value="<?php echo @$this->category->category_name;
?>"/></dd>

<?php } else { ?>
					<dt
class="hikamarket_category_name"><label><?php echo
JText::_('HIKA_NAME'); ?></label></dt>
					<dd class="hikamarket_category_name"><?php echo
@$this->category->category_name; ?></dd>
<?php }

	if(hikamarket::acl('category/edit/parent') &&
empty($this->isVendorRoot)) { ?>
					<dt
class="hikamarket_category_parent"><label><?php echo
JText::_('CATEGORY_PARENT'); ?></label></dt>
					<dd class="hikamarket_category_parent"><?php
						echo
$this->categoryType->displaySingle('data[category][category_parent_id]',
@$this->category->category_parent_id, '',
$this->rootCategory);
					?></dd>
<?php }

	if(hikamarket::acl('category/edit/published') &&
empty($this->isVendorRoot)) { ?>
					<dt
class="hikamarket_category_published"><label><?php
echo JText::_('HIKA_PUBLISHED'); ?></label></dt>
					<dd class="hikamarket_category_published"><?php
						echo
$this->radioType->booleanlist('data[category][category_published]',
'', @$this->category->category_published);
					?></dd>
<?php }

	if(hikamarket::acl('category/edit/customfields')) {
		if(!empty($this->fields)) {
?>
				</dl>
<?php
			foreach($this->fields as $fieldName => $oneExtraField) {
?>
				<dl id="hikashop_category_<?php echo $fieldName; ?>"
class="hikam_options">
					<dt class="hikamarket_category_<?php echo $fieldName;
?>"><?php echo
$this->fieldsClass->getFieldName($oneExtraField); ?></dt>
					<dd class="hikamarket_category_<?php echo $fieldName;
?>"><?php
						$onWhat = 'onchange';
						if($oneExtraField->field_type == 'radio')
							$onWhat = 'onclick';
						echo $this->fieldsClass->display($oneExtraField,
$this->category->$fieldName,
'data[category]['.$fieldName.']', false, '
'.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'category\',0);"');
					?></dd>
				</dl>
<?php
			}
?>
				<dl class="hikam_options">
<?php
		}
	}
?>
				</dl>
			</td>
		</tr>
<?php
	if(hikamarket::acl('category/edit/description')) {
		if(!$this->config->get('front_small_editor')) { ?>
		<tr class="hikamarket_category_description">
			<td colspan="2">
				<label
class="hikamarket_category_description_label"><?php echo
JText::_('HIKA_DESCRIPTION'); ?></label>
				<?php echo $this->editor->display();?>
				<div style="clear:both"></div>
			</td>
		</tr>
<?php	} else { ?>
		<tr>
			<td colspan="2">
				<dl class="hikam_options">
					<dt
class="hikamarket_category_description"><label><?php
echo JText::_('HIKA_DESCRIPTION');
?></label></dt>
					<dd class="hikamarket_category_description"><?php
echo $this->editor->display();?><div
style="clear:both"></div></dd>
				</dl>
			</td>
		</tr>
<?php	}
	}
?>
		<tr>
			<td colspan="2">
				<dl class="hikam_options">
<?php
		if(hikamarket::acl('category/edit/metadescription')) { ?>
					<dt
class="hikamarket_category_metadescription"><label><?php
echo JText::_('CATEGORY_META_DESCRIPTION');
?></label></dt>
					<dd
class="hikamarket_category_metadescription"><textarea
id="hikamarket_category_metadescription_textarea"
cols="35" rows="2"
name="data[category][category_meta_description]"><?php echo
$this->escape(@$this->category->category_meta_description);
?></textarea></dd>
<?php
		}

		if(hikamarket::acl('category/edit/keywords')) { ?>
					<dt
class="hikamarket_category_keywords"><label><?php
echo JText::_('CATEGORY_KEYWORDS');
?></label></dt>
					<dd class="hikamarket_category_keywords"><textarea
id="hikamarket_category_keywords_textarea" cols="35"
rows="2"
name="data[category][category_keywords]"><?php echo
$this->escape(@$this->category->category_keywords);
?></textarea></dd>
<?php
		}

		if(hikamarket::acl('category/edit/pagetitle')) { ?>
					<dt
class="hikamarket_category_pagetitle"><label><?php
echo JText::_('PAGE_TITLE'); ?></label></dt>
					<dd class="hikamarket_category_pagetitle"><input
type="text" size="45"
name="data[category][category_page_title]" value="<?php
echo $this->escape(@$this->category->category_page_title);
?>" /></dd>
<?php
		}

		if(hikamarket::acl('category/edit/alias')) { ?>
					<dt
class="hikamarket_category_alias"><label><?php echo
JText::_('HIKA_ALIAS'); ?></label></dt>
					<dd class="hikamarket_category_alias"><input
type="text" size="45"
name="data[category][category_alias]" value="<?php echo
$this->escape(@$this->category->category_alias); ?>"
/></dd>
<?php
		}

		if(hikamarket::acl('category/edit/translations')) {
			if(!empty($this->category->translations) &&
!empty($this->category->category_id)) {
?>					<dt
class="hikamarket_product_translations"><label><?php
echo JText::_('HIKA_TRANSLATIONS');
?></label></dt>
					<dd class="hikamarket_product_translations"><?php
					foreach($this->category->translations as $language_id =>
$translation){
						$lngName = $this->translationHelper->getFlag($language_id);
						echo '<div
class="hikamarket_multilang_button">' .
							$this->popup->display(
								$lngName, $lngName,
								hikamarket::completeLink('category&task=edit_translation&category_id='
.
@$this->category->category_id.'&language_id='.$language_id,
true),
								'hikamarket_category_translation_'.$language_id,
								760, 480, '', '', 'link'
							).
							'</div>';
					}
					?></dd>
<?php
			}
		}

		if(hikamarket::acl('category/edit/acl') &&
hikashop_level(2)) { ?>
					<dt
class="hikamarket_category_acl"><label><?php echo
JText::_('ACCESS_LEVEL'); ?></label></dt>
					<dd class="hikamarket_category_acl"><?php
						$category_access = 'all';
						if(isset($this->category->category_access))
							$category_access = $this->category->category_access;
						echo
$this->joomlaAcl->display('data[category][category_access]',
$category_access, true, true);
					?></dd>
<?php }
?>
				</dl>
			</td>
		</tr>
	</table>
	<input type="hidden" name="cancel_action"
value="<?php echo @$this->cancel_action; ?>"/>
	<input type="hidden" name="cid[]"
value="<?php echo @$this->category->category_id;
?>"/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
	<input type="hidden" name="task"
value=""/>
	<input type="hidden" name="ctrl"
value="category"/>
	<?php echo JHTML::_('form.token'); ?>
</form>
views/categorymarket/tmpl/form_image.php000064400000002720151166607740014532
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$upload = hikamarket::acl('category/edit/images/upload');
$ajax = false;
if(!empty($this->upload_ajax))
	$ajax = true;
$options = array(
	'classes' => array(
		'mainDiv' => 'hikamarket_main_image_div',
		'contentClass' => 'hikamarket_category_image',
		'btn_add' => 'hikam_add_btn',
		'btn_upload' => 'hikam_upload_btn'
	),
	'upload' => $upload,
	'upload_base_url' =>
'index.php?option=com_hikamarket&ctrl=upload',
	'gallery' => $upload,
	'text' => ($upload ?
JText::_('HIKAM_CATEGORY_IMAGE_EMPTY_UPLOAD') :
JText::_('HIKAM_CATEGORY_IMAGE_EMPTY')),
	'uploader' => array('category',
'category_image'),
	'vars' => array(
		'category_id' => $this->category->category_id,
		'file_type' => 'category'
	),
	'ajax' => $ajax
);

$content = '';
if(!empty($this->category->file_id) &&
!empty($this->category->file_path)) {
	$this->params = new stdClass();
	$this->params->file_id = $this->category->file_id;
	$this->params->file_path = $this->category->file_path;
	$this->params->file_ref_id = $this->category->file_ref_id;
	$content = $this->loadTemplate('image_entry');
}

echo
$this->uploaderType->displayImageSingle('hikamarket_category_image',
$content, $options);
views/categorymarket/tmpl/form_image_entry.php000064400000001456151166607740015760
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php $image =
$this->imageHelper->getThumbnail(@$this->params->file_path,
array(100, 100), array('default' => true)); ?>
<div>
	<a href="#delete" class="deleteImg"
onclick="return
window.hkUploaderList['hikamarket_category_image'].delImage(this);"><i
class="fas fa-trash-alt"></i></a>
	<div class="hikamarket_image">
		<img src="<?php echo $image->url; ?>"
alt="<?php echo $image->filename; ?>"/>
	</div><input type="hidden"
name="data[category][category_image]" value="<?php echo
@$this->params->file_id;?>"/>
</div>
views/categorymarket/tmpl/galleryimage.php000064400000010051151166607740015063
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><fieldset>
	<div class="toolbar" id="toolbar"
style="float: right;">
		<button class="hikabtn" type="button"
onclick="window.hikamarket.submitform('galleryselect','adminForm');"><i
class="far fa-save"></i> <?php echo
JText::_('OK'); ?></button>
	</div>
</fieldset>
<form action="<?php echo
hikamarket::completeLink('category&task=galleryimage', true);
?>" method="post" name="adminForm"
id="adminForm" enctype="multipart/form-data">
	<table width="100%" height="100%"
class="adminlist" style="width:100%;height:100%;">
		<thead>
			<tr>
				<th></th>
				<th>
					<?php echo JText::_('FILTER');?>:
					<input type="text" name="search"
value="<?php echo
$this->escape($this->pageInfo->search);?>"
class="text_area"
onchange="document.adminForm.submit();" />
					<button class="hikabtn"
onclick="document.adminForm.limitstart.value=0;this.form.submit();"><i
class="fas fa-search"></i></button>
					<button class="hikabtn"
onclick="document.adminForm.limitstart.value=0;document.getElementById('search').value='';this.form.submit();"><i
class="fas fa-times"></i></button>
				</th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td></td>
				<td>
					<?php echo $this->pagination->getListFooter(); ?>
					<?php echo $this->pagination->getResultsCounter(); ?>
				</td>
			</tr>
		</tfoot>
		<tr>
			<td width="130px" height="100%"
style="width:130px;vertical-align:top;">
				<div style="width:130px;height:100%;overflow:auto;">
<?php
echo $this->treeContent;
?>
<script type="text/javascript">
hikashopGallery.callbackSelection = function(tree,id) {
	var d = document, node = tree.get(id);
	if( node.value && node.name ) {
		var url = "<?php echo
hikamarket::completeLink('product&task=galleryimage&id='.hikaInput::get()->getInt('id').'&cid='.@$this->cid.'&product_id='.hikaInput::get()->getInt('product_id').'&folder={FOLDER}',
true, true) ;?>";
		document.location = url.replace('{FOLDER}',
node.value.replace('/', '|'));
	}
}
</script>
				</div>
			</td>
			<td>
				<ul id="hikaGallery">
<?php
if(!empty($this->dirContent)) {
	foreach($this->dirContent as $k => $content) {
		$chk_uid = 'hikaGalleryChk_' . $k . '_' . uniqid();
?>
	<li class="hikaGalleryItem">
		<a class="hikaGalleryPhoto" href="#"
onclick="return window.hikagallery.select(this, '<?php echo
$chk_uid; ?>');">
			<img src="<?php echo $content->thumbnail->url;
?>" alt="<?php echo $content->filename;
?>"/>
			<span style="display:none;"
class="hikaGalleryChk"><input type="checkbox"
id="<?php echo $chk_uid ;?>" name="files[]"
value="<?php echo $content->path; ?>"/></span>
			<div class="hikaGalleryCommand">
				<span class="photo_name"><?php echo
$content->filename; ?></span>
				<span><?php echo $content->width . 'x' .
$content->height; ?></span>
				<span style="float:right"><?php echo
$content->size; ?></span>
			</div>
		</a>
	</li>
<?php
	}
}
?>
				</ul>
			</td>
		</tr>
	</table>
<script type="text/javascript">
window.hikagallery = {};
window.hikagallery.select = function(el, id) {
	var d = document, w = window, o = w.Oby, chk = d.getElementById(id);
	if(chk) {
		if(chk.checked) {
			o.removeClass(el.parentNode, 'selected');
		} else {
			o.addClass(el.parentNode, 'selected');
		}
		chk.checked = !chk.checked;
	}
	return false;
}
</script>
	<div class="clr"></div>
	<input type="hidden" name="category_id"
value="<?php echo
hikaInput::get()->getInt('category_id'); ?>" />
	<input type="hidden" name="pid"
value="<?php echo hikaInput::get()->getInt('pid');
?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="task"
value="galleryimage" />
	<input type="hidden" name="ctrl"
value="category" />
	<?php echo JHTML::_('form.token'); ?>
</form>
views/categorymarket/tmpl/image.php000064400000004612151166607740013511
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><fieldset>
	<div class="toolbar" id="toolbar"
style="float: right;">
		<button class="hikabtn" type="button"
onclick="hikamarket.submitform('addimage','hikamarket_form');"><i
class="far fa-save"></i> <?php echo
JText::_('OK'); ?></button>
	</div>
</fieldset>
<form action="<?php echo
hikamarket::completeLink('category&task=image'); ?>"
method="post" name="hikamarket_form"
id="hikamarket_form" enctype="multipart/form-data">
	<table width="100%">
		<tr>
			<td class="key">
				<label for="file_name"><?php echo
JText::_('HIKA_NAME'); ?></label>
			</td>
			<td>
				<input type="text" name="data[file][file_name]"
value="<?php echo
$this->escape(@$this->element->file_name); ?>"/>
			</td>
		</tr>
		<tr>
<?php
	if(empty($this->element->file_path)){
		if(hikamarket::acl('category/edit/images/upload')) {
?>
			<td class="key">
				<label for="files"><?php echo
JText::_('HIKA_IMAGE'); ?></label>
			</td>
			<td>
				<input type="file" name="files[]"
size="30" />
				<?php echo
JText::sprintf('MAX_UPLOAD',(hikashop_bytes(ini_get('upload_max_filesize'))
> hikashop_bytes(ini_get('post_max_size'))) ?
ini_get('post_max_size') :
ini_get('upload_max_filesize')); ?>
			</td>
<?php
		}
	}else{
?>
			<td class="key">
				<label for="files"><?php echo
JText::_('HIKA_IMAGE'); ?></label>
			</td>
			<td><?php
				$image =
$this->imageHelper->getThumbnail($this->element->file_path,array(100,
100),array('default' => true));
			?><img src="<?php echo $image->url; ?>"
alt="<?php echo $image->filename; ?>"/></td>
<?php
	}
?>
		</tr>
	</table>
	<div class="clr"></div>
	<input type="hidden" name="data[file][file_type]"
value="category" />
	<input type="hidden" name="data[file][file_ref_id]"
value="<?php echo $this->category_id; ?>" />
	<input type="hidden" name="cid[]"
value="<?php echo @$this->cid; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="task"
value="addimage" />
	<input type="hidden" name="ctrl"
value="product" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
views/categorymarket/tmpl/index.html000064400000000032151166607740013703
0ustar00<html><body></body></html>views/categorymarket/tmpl/listing.php000064400000033140151166607740014076
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div class="">
<form action="<?php echo
hikamarket::completeLink('category&task=listing&cid='.$this->cid);
?>" method="post" name="adminForm"
id="adminForm">

<div class="hk-row-fluid">
	<div class="hkc-md-12 hikam_search_zone">
<?php
	echo $this->loadHkLayout('search', array(
		'id' => 'hikamarket_category_listing_search',
	));
?>
		<div class="hikam_sort_zone"><?php
			echo JHTML::_('select.genericlist', $this->ordering_values,
'filter_fullorder',
'onchange="this.form.submit();"', 'value',
'text', $this->full_ordering);
		?></div>
	</div>
</div>
<div class="hk-row-fluid">
	<div class="hkc-md-12">
		<div class="expand-filters"
style="width:auto;">
<?php
	echo $this->childdisplayType->display('filter_type',
$this->pageInfo->selectedType, false);
?>
		</div>
		<div style="clear:both"></div>
	</div>
</div>
<?php
if(!empty($this->breadcrumb)) {
?>
<div class="hikam_breadcrumb_explorer">
	<div class="hikam_breadcrumb"
onclick="window.Oby.toggleClass(this.parentNode,
'explorer_open');">
<?php
	foreach($this->breadcrumb as $i => $breadcrumb) {
		if($i > 0)
			echo '<span
class="breadcrumb_sep">/</span>';

		echo '<span class="breadcrumb_el">';
		if($breadcrumb->category_id != $this->cid) {
			echo '<a
href="'.hikamarket::completeLink('category&task=listing&cid='.$breadcrumb->category_id).'">'.JText::_($breadcrumb->category_name).'</a>';
		} else {
			echo JText::_($breadcrumb->category_name);
		}
		echo '</span>';
	}
?>
		<span class="breadcrumb_expand_icon"><i
class="fas fa-folder-open"></i></span>
	</div>
	<div class="hikam_category_explorer"><?php
		echo
$this->shopCategoryType->displayTree('hikam_categories',
$this->rootCategory, null, true, true, $this->cid,
hikamarket::completeLink('category&task=getTree', false,
true));
	?></div>
<script type="text/javascript">
window.hikashop.ready(function(){
var otreeCategories = window.oTrees['hikam_categories'];
otreeCategories.sel(otreeCategories.find(<?php echo $this->cid;
?>));
otreeCategories.callbackSelection = function(tree,id) {
	var d = document, node = tree.get(id);
	if(node.value && node.name) {
		var u = "<?php echo
hikamarket::completeLink('category&task=listing&cid=HIKACID',
false, false, true); ?>";
		window.location = u.replace('HIKACID', node.value);
	}
};
});
</script>
</div>
<?php
}

	$publish_content = '<i class="fas
fa-check"></i> ' .
JText::_('HIKA_PUBLISHED');
	$unpublish_content = '<i class="fas
fa-times"></i> ' .
JText::_('HIKA_UNPUBLISHED');

?>
<div id="hikam_product_main_listing">
<?php
if(!empty($this->categories)) {
	foreach($this->categories as $category) {
		$url = ($this->manage) ?
hikamarket::completeLink('category&task=edit&cid='.(int)$category->category_id)
: null;
		$browse_url =
hikamarket::completeLink('category&task=listing&cid='.(int)$category->category_id);
		$extra_classes = '';
?>
	<div class="hk-card hk-card-default hk-card-category<?php echo
$extra_classes; ?>" data-hkm-category="<?php echo
(int)$category->category_id; ?>">
		<div class="hk-card-header">
			<div class="hk-row-fluid">
				<a class="hkc-sm-6 hkm_category_name" href="<?php
echo $url; ?>"><?php
					echo $category->category_name;
				?></a>
				<a class="hkc-sm-6 hkm_category_children"
href="<?php echo $browse_url; ?>"><?php
					if(empty($category->children))
						echo '<i class="far fa-folder"></i>'
. JText::_('HIKAM_NO_CHILD_CATEGORY');
					else if($category->children == 1)
						echo '<i class="fas
fa-folder-open"></i>' .
JText::sprintf('HIKAM_X_CHILD_CATEGORY',
$category->children);
					else
						echo '<i class="fas
fa-folder-open"></i>' .
JText::sprintf('HIKAM_X_CHILD_CATEGORIES',
$category->children);
				?></a>
			</div>
		</div>
		<div class="hk-card-body">
			<div class="hk-row-fluid">
				<div class="hkc-sm-2 hkm_category_image">
					<a href="<?php echo $url; ?>"><?php
					$thumb =
$this->imageHelper->getThumbnail(@$category->file_path,
array(50,50), array('default' => 1, 'forcesize'
=> 1));
					if(!empty($thumb->path) && empty($thumb->external))
						echo '<img src="'.
$this->imageHelper->uploadFolder_url . str_replace('\\',
'/', $thumb->path).'" class=""
alt=""/>';
					else if(!empty($thumb->path) && !empty($thumb->url))
						echo '<img src="'. $thumb->url.'"
class="" alt="" width="50"
height="50"/>';
					?></a>
				</div>
				<div class="hkc-sm-5 hkm_category_details">
					<div class="hkm_category_stats">
						<i class="fas fa-cubes"></i> <?php
							if(empty($category->products))
								echo JText::_('HIKAM_NO_PRODUCTS');
							else if($category->products == 1)
								echo JText::sprintf('HIKAM_X_PRODUCT',
$category->products);
							else
								echo JText::sprintf('HIKAM_X_PRODUCTS',
$category->products);
						?>
					</div>
<?php
		if($this->category_action_sort) {
			if($this->category_action_publish) {
?>
					<div class="hkm_category_publish">
						<a class="hikabtn hikabtn-mini hikabtn-<?php echo
($category->category_published) ? 'success' :
'danger'; ?> hkm_publish_button"
data-toggle-state="<?php echo $category->category_published ? 1
: 0; ?>" data-toggle-id="<?php echo
$category->category_id; ?>" onclick="return
window.localPage.toggleCategory(this);"><?php
							echo ($category->category_published) ? $publish_content :
$unpublish_content;
						?></a>
					</div>
<?php
			} else {
?>
					<div class="hkm_category_publish">
						<span class="hkm_publish_state hk-label hk-label-<?php
echo ($category->category_published) ? 'green' :
'red'; ?>"><?php echo
($category->category_published) ? $publish_content : $unpublish_content;
?></span>
					</div>
<?php
			}
		}

		if(!empty($this->fields)) {
			$fields = array();
			foreach($this->fields as $fieldName => $oneExtraField) {
				$r = $this->fieldsClass->show($oneExtraField,
$category->$fieldName);
				if(empty($r))
					continue;
				$fields[] = '<dt
class="hkm_category_field_'.$fieldName.'">'.$this->fieldsClass->trans($oneExtraField->field_realname).'</dt><dd
class="hkm_category_field_'.$fieldName.'">'.$r.'</dd>';
			}
			if(!empty($fields)) {
?>
					<dl class="hikam_options
hkm_category_fields"><?php
						echo implode("\r\n", $fields);
						unset($fields);
					?></dl>
<?php
			}
		}
?>
				</div>
<?php
		if($this->category_action_sort) {
?>
				<div class="hkc-sm-3 hkm_category_order">
					<div class="hk-input-group">
						<div class="hk-input-group-prepend">
							<a class="hikabtn" href="#up"
data-ordering="-1" data-ordering-id="<?php echo
(int)$category->category_id; ?>" onclick="return
window.localPage.orderingCategory(this);"><i class="fas
fa-arrow-up"></i></a>
						</div>
						<input type="text" class="hk-form-control
hkm_order_value" size="3" name="order[<?php echo
$category->category_id; ?>]" value="<?php echo
(int)@$category->category_ordering; ?>" />
						<div class="hk-input-group-append">
							<a class="hikabtn" href="#down"
data-ordering="1" data-ordering-id="<?php echo
(int)$category->category_id; ?>" onclick="return
window.localPage.orderingCategory(this);"><i class="fas
fa-arrow-down"></i></a>
						</div>
					</div>
				</div>
<?php
		} else {
?>
				<div class="hkc-sm-3 hkm_category_publish">
<?php
			if($this->category_action_publish) {
?>
					<a class="hikabtn hikabtn-<?php echo
($category->category_published) ? 'success' :
'danger'; ?> hkm_publish_button"
data-toggle-state="<?php echo $category->category_published ? 1
: 0; ?>" data-toggle-id="<?php echo
$category->category_id; ?>" onclick="return
window.localPage.toggleCategory(this);"><?php
						echo ($category->category_published) ? $publish_content :
$unpublish_content;
					?></a>
<?php
			} else {
?>
					<span class="hkm_publish_state hk-label hk-label-<?php echo
($category->category_published) ? 'green' : 'red';
?>"><?php echo ($category->category_published) ?
$publish_content : $unpublish_content; ?></span>
<?php
			}
?>
				</div>
<?php
		}
?>
				<div class="hkc-sm-2 hkm_category_actions"><?php
		$data = array(
			'browse' => array(
				'name' => '<i class="fas
fa-folder-open"></i> ' .
JText::_('HIKA_BROWSE_CATEGORY', true),
				'link' => $browse_url
			)
		);
		if($this->manage) {
			$data['details'] = array(
				'name' => '<i class="fas
fa-search"></i> ' . JText::_('HIKA_DETAILS',
true),
				'link' => $url
			);
		}
		if($this->category_action_delete &&
hikamarket::isVendorCategory($category->category_id)) {
			$data[] = '-';
			$data['delete'] = array(
				'name' => '<i class="fas
fa-trash"></i> ' . JText::_('HIKA_DELETE',
true),
				'link' => '#delete',
				'click' => 'return
window.localPage.deleteCategory('.(int)$category->category_id.',
\''.urlencode(strip_tags($category->category_name)).'\');'
			);
		}
		if(!empty($data)) {
			echo $this->dropdownHelper->display(
				JText::_('HIKA_ACTIONS'),
				$data,
				array('type' => '', 'class' =>
'hikabtn-primary', 'right' => true, 'up'
=> false)
			);
		}
				?></div>
			</div>
		</div>
	</div>
<?php
	}
?>
	<div class="hikamarket_pagination">
		<?php echo $this->pagination->getListFooter(); ?>
		<?php echo $this->pagination->getResultsCounter(); ?>
	</div>
<?php
} else {
?>
	<div class="hk-well hikam_no_categories">
		<p><?php echo
JText::_('HIKAM_EMPTY_CATEGORY_LISTING');	?></p>
	</div>
<?php
}
?>
</div>
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="cid"
value="<?php echo $this->cid; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="listing" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php if($this->category_action_publish) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.toggleCategory = function(el) {
	var w=window, d=document, o=w.Oby,
		state = el.getAttribute('data-toggle-state'),
		id = el.getAttribute('data-toggle-id');
	if(!id) return false;
	var url="<?php echo
hikamarket::completeLink('toggle','ajax',true);?>",
		v = (state == 0) ? 1 : 0,
		data=o.encodeFormData({"task":"category_published-"+id,"value":v,"table":"category","<?php
echo hikamarket::getFormToken(); ?>":1});
	el.disabled = true;
	if(state == 1) el.innerHTML = "<i class=\"fas fa-spinner
fa-pulse\"></i> <?php echo
JText::_('HIKA_UNPUBLISHING', true); ?>";
	else el.innerHTML = "<i class=\"fas fa-spinner
fa-pulse\"></i> <?php echo
JText::_('HIKA_PUBLISHING', true); ?>";
	el.classList.remove("hikabtn-success",
"hikabtn-danger");
	o.xRequest(url,{mode:"POST",data:data},function(x,p){
		if(x.responseText && x.responseText == '1')
			state = v;
		el.disabled = false;
		el.setAttribute('data-toggle-state', v);
		if(state == 1) el.innerHTML = "<i class=\"fas
fa-check\"></i> <?php echo
JText::_('HIKA_PUBLISHED', true); ?>";
		else el.innerHTML = "<i class=\"fas
fa-times\"></i> <?php echo
JText::_('HIKA_UNPUBLISHED', true); ?>";
		el.classList.add( state ? "hikabtn-success" :
"hikabtn-danger" );
	});
};
</script>
<?php } ?>
<?php if($this->category_action_sort) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.orderingCategory = function(el) {
	var id = el.getAttribute('data-ordering-id'),
		direction = el.getAttribute('data-ordering') ==
'-1';
	if(!id) return false;
	var block =
document.querySelector('[data-hkm-category="'+id+'"]');
	if(!block) return false;
	var input =
block.querySelector('input[name="order['+id+']"]');
	if(!input) return false;
<?php if($this->pageInfo->filter->order->value ==
'category.category_ordering') { ?>
	var switchBlock = (direction) ? block.previousElementSibling :
block.nextElementSibling;
	if(!switchBlock) return false;
	var switchId = switchBlock.getAttribute('data-hkm-category'),
		switchInput =
switchBlock.querySelector('input[name="order['+switchId+']"]');
	if(direction)
		block.parentNode.insertBefore(block, switchBlock);
	else
		switchBlock.parentNode.insertBefore(switchBlock, block);
	var i = input.value;
	input.value = switchInput.value;
	switchInput.value = i;
<?php } else { ?>
	var value = parseInt(input.value);
	if(isNaN(value)) value = 1;
	value += (direction ? -1 : 1);
	if(value < 1) value = 1;
	input.value = value;
<?php } ?>
	return false;
};
</script>
<?php } ?>
<?php if($this->category_action_delete) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.deleteCategory = function(id, name) {
	var confirmMsg = "<?php echo
JText::_('CONFIRM_DELETE_CATEGORY_X'); ?>";
	if(!confirm(confirmMsg.replace('{CATEGORY}', decodeURI(name))))
		return false;
	var f = document.forms['hikamarket_delete_category_form'];
	if(!f) return false;
	f.category_id.value = id;
	f.submit();
	return false;
};
</script>
<form action="<?php echo
hikamarket::completeLink('category&task=delete'); ?>"
method="post" name="hikamarket_delete_category_form"
id="hikamarket_delete_category_form">
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="delete" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="category_id"
value="0" />
	<?php echo JHTML::_('form.token'); ?>
</form>
<?php } ?>
</div>
views/categorymarket/tmpl/listing.xml000064400000000706151166607740014111
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor Category listing</name>
		<params addpath="/components/com_hikamarket/params">
		</params>
	</state>
	<layout
title="COM_HIKAMARKET_CATEGORYMARKET_LISTING_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
		<fieldset name="basic" label="HikaMarket
Options">
		</fieldset>
	</fields>
</metadata>views/categorymarket/view.html.php000064400000060350151166607740013371
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class categorymarketViewcategorymarket extends HikamarketView {

	protected $ctrl = 'category';
	protected $icon = 'category';

	public function display($tpl = null, $params = array()) {
		$this->params =& $params;
		$fct = $this->getLayout();
		if(method_exists($this, $fct)) {
			if($this->$fct() === false)
				return;
		}
		parent::display($tpl);
	}

	public function listing() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);

		$singleSelection = hikaInput::get()->getInt('single', 0);
		$confirm = hikaInput::get()->getInt('confirm', 1);
		$defaultId = hikaInput::get()->getInt('default', 0);
		$type = hikaInput::get()->getString('type',
'product,vendor,manufacturer');
		$getRoot = true;

		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.listing';

		$cid = hikamarket::getCID();
		if(empty($cid))
			$cid = 1;
		$this->assignRef('cid', $cid);

		$this->loadRef(array(
			'imageHelper' => 'shop.helper.image',
			'toggleClass' => 'helper.toggle',
			'childdisplayType' => 'shop.type.childdisplay',
			'shopCategoryType' => 'type.shop_category',
			'dropdownHelper' => 'shop.helper.dropdown',
		));

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$vendorClass = hikamarket::get('class.vendor');
		$rootCategory = $vendorClass->getRootCategory($vendor);
		if(empty($rootCategory))
			$rootCategory = 1;
		$this->assignRef('rootCategory', $rootCategory);

		$this->manage = hikamarket::acl('category/edit');

		$category_parent_id = 0;

		$query = 'SELECT category_id, category_left, category_right,
category_depth, category_parent_id FROM
'.hikamarket::table('shop.category').' WHERE
category_id IN
('.(int)$cid.','.(int)$rootCategory.')';
		$db->setQuery($query);
		$categories = $db->loadObjectList('category_id');
		if(!isset($categories[$rootCategory]))
			return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ERR_ROOTCATEGORY_NOT_EXIST')));

		if(!isset($categories[$cid]) || (
			$categories[$cid]->category_left <
$categories[$rootCategory]->category_left
				||
			$categories[$cid]->category_left >
$categories[$rootCategory]->category_right
			)
		 ) {
			$cid = $rootCategory;
		}

		if($cid != $rootCategory)
			$category_parent_id = $categories[$cid]->category_parent_id;

		$query = 'SELECT cats.category_id, cats.category_depth,
cats.category_name, cats.category_parent_id '.
			' FROM '.hikamarket::table('shop.category').'
AS cats INNER JOIN
'.hikamarket::table('shop.category').' AS basecat ON
cats.category_left <= basecat.category_left AND cats.category_right
>= basecat.category_right '.
			' WHERE basecat.category_id = '.(int)$cid.' AND
cats.category_depth >=
'.$categories[$rootCategory]->category_depth.' ORDER BY
category_depth';
		$db->setQuery($query);
		$breadcrumb = $db->loadObjectList();
		$this->assignRef('breadcrumb', $breadcrumb);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid = '&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$cfg = array(
			'table' => 'shop.category',
			'main_key' => 'category_id',
			'order_sql_value' => 'category.category_id'
		);

		$default_sort_value =
trim($config->get('category_listing_default_sort_value',
$cfg['order_sql_value']));
		if(empty($default_sort_value))
			$default_sort_value = $cfg['order_sql_value'];
		$default_sort_dir =
trim($config->get('category_listing_default_sort_dir',
'asc'));
		if(empty($default_sort_dir) || !in_array($default_sort_dir,
array('asc', 'desc')))
			$default_sort_dir = 'asc';

		$pageInfo = $this->getPageInfo($default_sort_value,
$default_sort_dir);
		$filters = array();

		$pageInfo->selectedType =
$app->getUserStateFromRequest($this->paramBase.'.filter_type',
'filter_type', 0, 'int');

		$pageInfo->filter->order = new stdClass();
		$pageInfo->filter->order->value =
$app->getUserStateFromRequest($this->paramBase.'.filter_order',
'filter_order', $cfg['order_sql_value'],
'cmd');
		$pageInfo->filter->order->dir =
$app->getUserStateFromRequest($this->paramBase.'.filter_order_Dir',
'filter_order_Dir', 'asc', 'word');

		$pageInfo->limit = new stdClass();
		$pageInfo->limit->value =
$app->getUserStateFromRequest($this->paramBase.'.list_limit',
'limit', $app->getCfg('list_limit'), 'int'
);
		if(empty($pageInfo->limit->value))
			$pageInfo->limit->value = 500;
		if(hikaInput::get()->getString('search') !=
$app->getUserState($this->paramBase.'.search')) {
			$app->setUserState($this->paramBase.'.limitstart',0);
			$pageInfo->limit->start = 0;
		} else {
			$pageInfo->limit->start =
$app->getUserStateFromRequest($this->paramBase.'.limitstart',
'limitstart', 0, 'int');
		}

		$pageInfo->search =
HikaStringHelper::strtolower($app->getUserStateFromRequest($this->paramBase.'.search',
'search', '', 'string'));
		$this->assignRef('pageInfo', $pageInfo);

		$filters = array();
		$searchMap = array(
			'category.category_name',
			'category.category_id'
		);

		$filters[] = 'category.category_left >
'.$categories[$cid]->category_left.' AND
category.category_right < '.$categories[$cid]->category_right;
		if(!$pageInfo->selectedType) {
			$filters[] = 'category.category_depth =
'.($categories[$cid]->category_depth + 1);
		}

		if(!empty($type)) {
			$type = explode(',', $type);
			if($getRoot && !in_array('root', $type))
				$type[] = 'root';
			$types = array();
			foreach($type as $t) {
				$types[] = $db->Quote($t);
			}
			$filters[] = 'category.category_type IN
('.implode(',',$types).')';
		}

		$fieldsClass = hikamarket::get('shop.class.field');
		$parent_cat_ids = array();
		foreach($breadcrumb as $catElem) {
			$parent_cat_ids[] = $catElem->category_id;
		}
		$field_categories = array('originals' => array($cid),
'parents' => $parent_cat_ids);
		$fields =
$fieldsClass->getData('display:vendor_category_listing=1',
'category', false, $field_categories);
		$this->assignRef('fields', $fields);
		$this->assignRef('fieldsClass', $fieldsClass);

		foreach($fields as $fieldName => $oneExtraField) {
			$searchMap[] = 'category.' . $fieldName;
		}

		if(!empty($pageInfo->search)) {
			$searchVal = '\'%' .
$db->escape(HikaStringHelper::strtolower($pageInfo->search), true) .
'%\'';
			$filters[] = '(' . implode(' LIKE
'.$searchVal.' OR ',$searchMap).' LIKE
'.$searchVal . ')';
		}

		$order_by = ' ORDER BY category.category_left ASC';
		if(!empty($pageInfo->filter->order->value)) {
			$order_by = ' ORDER BY
'.$pageInfo->filter->order->value.'
'.$pageInfo->filter->order->dir;
		}

		$query = ' FROM
'.hikamarket::table('shop.category').' AS category
WHERE ' . implode(' AND ', $filters);
		$db->setQuery('SELECT category.*'.$query.$order_by,
$pageInfo->limit->start, $pageInfo->limit->value);
		$elements = $db->loadObjectList('category_id');
		if(!is_numeric($defaultId)) {
			$categoryClass = hikamarket::get('shop.class.category');
			$categoryClass->getMainElement($defaultId);
		}

		$db->setQuery('SELECT COUNT(*) '.$query);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($elements);

		if(!empty($elements)) {
			$ids = array();
			foreach($elements as $element) {
				$ids[] = $element->category_id;
			}
			$db->setQuery('SELECT * FROM
'.hikamarket::table('shop.file').' WHERE
file_type=\'category\' AND file_ref_id IN
('.implode(',',$ids).')');
			$images = $db->loadObjectList();
		} else {
			$images = array();
		}

		foreach($elements as &$element) {
			$element->file_path = '';
			foreach($images as $image) {
				if($image->file_ref_id == $element->category_id) {
					$element->file_path = $image->file_path;
					break;
				}
			}
			if(empty($element->value)){
				$val = str_replace(array('
',','),'_',strtoupper($element->category_name));
				$element->value = JText::_($val);
				if($val == $element->value) {
					$element->value = $element->category_name;
				}
			}
			$element->category_name = $element->value;

			if($element->category_namekey == 'root') {
				if(empty($defaultId)) {
					$defaultId = $element->category_id;
				}
				$element->category_parent_id = -1;
			}
			unset($element);
		}

		$this->assignRef('categories', $elements);
		$this->assignRef('elements', $elements); // Legacy
		$this->assignRef('singleSelection', $singleSelection);
		$this->assignRef('confirm', $confirm);

		if(!empty($elements)) {
			$category_ids = array_keys($elements);

			$query = 'SELECT category_parent_id, COUNT(*) as `children` FROM
'.hikamarket::table('shop.category').' WHERE
category_parent_id IN ('.implode(',', $category_ids).')
GROUP BY category_parent_id';
			$db->setQuery($query);
			$stats = $db->loadObjectList('category_parent_id');

			foreach($elements as $k => &$category) {
				$category->children = 0;
				if(!isset($stats[$k]))
					continue;
				$category->children = (int)$stats[$k]->children;
			}
			unset($category);

			$query = 'SELECT category_id, COUNT(product_id) as `products` FROM
'.hikamarket::table('shop.product_category').' WHERE
category_id IN ('.implode(',', $category_ids).') GROUP
BY category_id';
			$db->setQuery($query);
			$stats = $db->loadObjectList('category_id');

			foreach($elements as $k => &$category) {
				$category->products = 0;
				if(!isset($stats[$k]))
					continue;
				$category->products = (int)$stats[$k]->products;
			}
			unset($category);
		}

		$fieldsClass->handleZoneListing($fields, $elements);

		$display_edit_root = false;
		if($rootCategory > 1) {
			$categoryClass = hikamarket::get('shop.class.category');
			$cat = $categoryClass->get($rootCategory);
			$display_edit_root = ($cat->category_type == 'vendor'
&& $cat->category_namekey == 'vendor_' .
$vendor->vendor_id);
		}

		$sorting_possible = false;
		if($pageInfo->selectedType == 0) {
			$sorting_possible = true;
		} else if($category_explorer && isset($categories[$cid])) {
		}

		$this->category_explorer =
$this->config->get('show_category_explorer', 1);
		$this->category_action_publish =
hikamarket::acl('category/edit/published');
		$this->category_action_delete =
hikamarket::acl('category/delete');
		$this->category_action_sort = ($vendor->vendor_id == 0 ||
$vendor->vendor_id == 1) &&
hikamarket::acl('category/sort') &&
$this->category_explorer && $sorting_possible;

		$text_asc = JText::_('ASCENDING');
		$text_desc = JText::_('DESCENDING');
		$ordering_values = array(
			'category.category_ordering' =>
JText::_('SORT_ORDERING'),
			'category.category_id' => JText::_('SORT_ID'),
			'category.category_name' =>
JText::_('SORT_NAME'),
		);
		$this->ordering_values = array();
		foreach($ordering_values as $k => $v) {
			if($k == 'category.category_ordering' &&
!$this->category_action_sort)
				continue;
			$this->ordering_values[$k.' asc'] = $v . ' '
.$text_asc;
			$this->ordering_values[$k.' desc'] = $v . ' '
.$text_desc;
		}
		$this->full_ordering =
$this->pageInfo->filter->order->value . ' ' .
strtolower($this->pageInfo->filter->order->dir);

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' => hikamarket::completeLink('vendor')
			),
			'up' => array(
				'icon' => 'parent-category',
				'fa' => 'fa-folder-open',
				'name' => JText::_('CATEGORY_PARENT'),
				'url' =>
hikamarket::completeLink('category&task=listing&cid=' .
$category_parent_id),
				'display' => ($category_parent_id > 0)
			),
			'ordering' => array(
				'icon' => 'ordering',
				'fa' => 'fa-sort-amount-down',
				'name' => JText::_('HIKA_SAVE_ORDER'),
				'url' => '#',
				'linkattribs' => 'onclick="return
hikamarket.submitform(\'saveorder\',\'adminForm\')"',
				'pos' => 'right',
				'display' => $this->category_action_sort
			),
			'edit_main' => array(
				'icon' => 'category',
				'fa' => 'fa-folder',
				'name' => JText::_('HIKAM_EDIT_MAIN_CATEGORY'),
				'url' =>
hikamarket::completeLink('category&task=edit&cid='.$rootCategory),
				'pos' => 'right',
				'acl' => hikamarket::acl('category/edit'),
				'display' => $display_edit_root
			),
			'new' => array(
				'icon' => 'new',
				'fa' => 'fa-plus-circle',
				'name' => JText::_('HIKA_NEW'),
				'url' =>
hikamarket::completeLink('category&task=add&category_parent_id='.$cid),
				'pos' => 'right',
				'acl' => hikamarket::acl('category/add')
			)
		);

		if($pageInfo->limit->value == 500)
			$pageInfo->limit->value = 100;
		$pagination = hikamarket::get('shop.helper.pagination',
$pageInfo->elements->total, $pageInfo->limit->start,
$pageInfo->limit->value);
		$this->assignRef('pagination', $pagination);

		$doOrdering = !$pageInfo->selectedType;
		$this->assignRef('doOrdering', $doOrdering);
		if($doOrdering) {
			$ordering = new stdClass();
			$ordering->ordering = false;
			$ordering->orderUp = 'orderup';
			$ordering->orderDown = 'orderdown';
			$ordering->reverse = false;
			if($pageInfo->filter->order->value ==
'category.category_ordering') {
				$ordering->ordering = true;
				if($pageInfo->filter->order->dir == 'desc') {
					$ordering->orderUp = 'orderdown';
					$ordering->orderDown = 'orderup';
					$ordering->reverse = true;
				}
			}
			$this->assignRef('ordering', $ordering);
		}
	}

	public function form() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.edit';

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$this->loadRef(array(
			'toggleClass' => 'helper.toggle',
			'popup' => 'shop.helper.popup',
			'radioType' => 'shop.type.radio',
		));

		$category_id = hikamarket::getCID('product_id');
		$categoryClass = hikamarket::get('class.category');
		$vendorClass = hikamarket::get('class.vendor');

		$category = new stdClass();
		$category->category_description = '';
		$category->category_id = $category_id;
		$category->category_parent_id = 0;

		$category_parent_id =
hikaInput::get()->getInt('category_parent_id', 0);
		if($category_parent_id > 0)
			$category->category_parent_id = $category_parent_id;

		if(!empty($category_id)) {
			$category = $categoryClass->getRaw($category_id, true);

			$translationHelper =
hikamarket::get('shop.helper.translation');
			if($translationHelper && $translationHelper->isMulti()) {
				$translationHelper->load('hikashop_category',
@$category->category_id, $category);
				$this->assignRef('translationHelper',
$translationHelper);
			}
		}

		$editor = hikamarket::get('shop.helper.editor');
		$editor->setEditor($config->get('editor',
''));
		$editor->name = 'category_description';
		$editor->content = $category->category_description;
		$editor->height = 200;
		if($config->get('editor_disable_buttons', 0))
			$editor->options = false;
		$this->assignRef('editor', $editor);

		$this->assignRef('category', $category);

		$categoryType = hikamarket::get('type.shop_category');
		$this->assignRef('categoryType', $categoryType);

		if(hikashop_level(2)) {
			$joomlaAcl = hikamarket::get('type.joomla_acl');
			$this->assignRef('joomlaAcl', $joomlaAcl);
		}

		$imageHelper = hikamarket::get('shop.helper.image');
		$this->assignRef('imageHelper',$imageHelper);
		$uploaderType = hikamarket::get('shop.type.uploader');
		$this->assignRef('uploaderType',$uploaderType);

		$rootCategory = $vendorClass->getRootCategory($vendor);
		$this->assignRef('rootCategory', $rootCategory);

		$isVendorRoot = ($vendor->vendor_id > 1 &&
!empty($rootCategory) && (int)$rootCategory ==
(int)@$category->category_id);
		$this->assignRef('isVendorRoot', $isVendorRoot);

		$fieldsClass = hikamarket::get('shop.class.field');
		$fields =
$fieldsClass->getFields('display:vendor_category_edit=1',
$category, 'category', 'field&task=state');
		foreach($fields as $fieldName => $extraField) {
			if(empty($extraField->field_display) ||
strpos($extraField->field_display, ';vendor_category_edit=1;')
=== false) {
				unset($fields[$fieldName]);
			}
		}
		$null = array();
		$fieldsClass->addJS($null, $null, $null);
		$fieldsClass->jsToggle($fields, $category, 0);
		$this->assignRef('fieldsClass', $fieldsClass);
		$this->assignRef('fields', $fields);

		$this->toolbar = array(
			'cancel' => array(
				'url' =>
hikamarket::completeLink('category&task=listing&cid=' .
$category->category_parent_id),
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK')
			),
			'save2new' => array(
				'url' => '#save_and_new',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save2new\',\'hikamarket_categories_form\');"',
				'icon' => 'save',
				'fa' => 'fa-save',
				'name' => JText::_('HIKA_SAVE_NEW'),
'pos' => 'right'
			),
			'sep01' => array(
				'sep' => true, 'pos' => 'right',
				'display' => 1
			),
			'apply' => array(
				'url' => '#apply',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'apply\',\'hikamarket_categories_form\');"',
				'icon' => 'apply',
				'fa' => 'fa-check-circle',
				'name' => JText::_('HIKA_APPLY'),
'pos' => 'right'
			),
			'save' => array(
				'url' => '#save',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save\',\'hikamarket_categories_form\');"',
				'icon' => 'save',
				'fa' => 'fa-save',
				'name' => JText::_('HIKA_SAVE'), 'pos'
=> 'right'
			)
		);

		$cancel_action = hikaInput::get()->getCmd('cancel_action',
'');
		if(!empty($cancel_action)) {
			switch($cancel_action) {
				case 'category':
					if(!empty($product->product_id))
						$this->toolbar['cancel']['url'] =
hikamarket::completeLink('shop.category&task=listing&cid='.$category->category_id);
					break;
			}
		}
	}

	public function edit_translation() {
		$language_id = hikaInput::get()->getInt('language_id', 0);
		$this->assignRef('language_id', $language_id);

		$category_id = hikamarket::getCID('category_id');

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$categoryClass = hikamarket::get('class.category');
		$category = $categoryClass->getRaw($category_id);

		$translationHelper =
hikamarket::get('shop.helper.translation');
		if($translationHelper && $translationHelper->isMulti()) {
			$translationHelper->load('hikashop_category',
@$category->category_id, $category, $language_id);
			$this->assignRef('translationHelper', $translationHelper);
		}

		$editor = hikamarket::get('shop.helper.editor');
		$editor->setEditor($config->get('editor',
''));
		$editor->content = @$category->category_description;
		$editor->height = 300;
		if($config->get('editor_disable_buttons', 0))
			$editor->options = false;
		$this->assignRef('editor', $editor);

		$toggle = hikamarket::get('helper.toggle');
		$this->assignRef('toggle', $toggle);

		$this->assignRef('category', $category);

		$this->toolbar = array(
			array(
				'url' => '#save',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save_translation\',\'hikamarket_translation_form\');"',
				'icon' => 'save',
				'fa' => 'fa-save',
				'name' => JText::_('HIKA_SAVE'), 'pos'
=> 'right'
			)
		);
	}

	public function image() {
		$file_id = (int)hikamarket::getCID();
		$this->assignRef('cid', $file_id);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$element = null;
		if(!empty($file_id)){
			$fileClass = hikamarket::get('shop.class.file');
			$element = $fileClass->get($file_id);
		}
		$this->assignRef('element', $element);

		$category_id = hikaInput::get()->getInt('pid', 0);
		$this->assignRef('category_id', $category_id);

		$imageHelper = hikamarket::get('shop.helper.image');
		$this->assignRef('imageHelper', $imageHelper);

		$editor = hikamarket::get('shop.helper.editor');
		$editor->setEditor($config->get('editor',
''));
		$editor->name = 'file_description';
		$editor->content = @$element->file_description;
		$editor->height = 200;
		if($config->get('editor_disable_buttons', 0))
			$editor->options = false;
		$this->assignRef('editor', $editor);
	}

	public function galleryimage() {
		hikamarket::loadJslib('otree');

		$app = JFactory::getApplication();
		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.gallery';

		$vendor = hikamarket::loadVendor(true);

		$uploadFolder =
ltrim(JPath::clean(html_entity_decode($shopConfig->get('uploadfolder'))),DS);
		$uploadFolder = rtrim($uploadFolder,DS).DS;
		$basePath = JPATH_ROOT.DS.$uploadFolder.DS;
		if($vendor->vendor_id > 1) {
			$basePath .= 'vendor' . $vendor->vendor_id . DS;
		}

		$pageInfo = new stdClass();
		$pageInfo->limit = new stdClass();
		$pageInfo->limit->value = $app->getUserStateFromRequest(
$this->paramBase.'.list_limit', 'limit', 20,
'int' );
		$pageInfo->limit->start = $app->getUserStateFromRequest(
$this->paramBase.'.limitstart', 'limitstart', 0,
'int' );
		$pageInfo->search = $app->getUserStateFromRequest(
$this->paramBase.'.search', 'search', '',
'string');

		$this->assignRef('pageInfo', $pageInfo);

		jimport('joomla.filesystem.folder');
		if(!JFolder::exists($basePath))
			JFolder::create($basePath);

		$galleryHelper = hikamarket::get('shop.helper.gallery');
		$galleryHelper->setRoot($basePath);
		$this->assignRef('galleryHelper', $galleryHelper);

		$folder = str_replace('|', '/',
hikaInput::get()->getString('folder', ''));
		$destFolder = rtrim($folder, '/\\');
		if(!$galleryHelper->validatePath($destFolder))
			$destFolder = '';
		if(!empty($destFolder)) $destFolder .= '/';
		$this->assignRef('destFolder', $destFolder);

		$galleryOptions = array(
			'filter' => '.*' .
str_replace(array('.','?','*','$','^'),
array('\.','\?','\*','$','\^'),
$pageInfo->search) . '.*',
			'offset' => $pageInfo->limit->start,
			'length' => $pageInfo->limit->value
		);
		$this->assignRef('galleryOptions', $galleryOptions);

		$treeContent = $galleryHelper->getTreeList(null, $destFolder);
		$this->assignRef('treeContent', $treeContent);

		$dirContent = $galleryHelper->getDirContent($destFolder,
$galleryOptions);
		$this->assignRef('dirContent', $dirContent);

		jimport('joomla.html.pagination');
		$pagination = new JPagination( $galleryHelper->filecount,
$pageInfo->limit->start, $pageInfo->limit->value );
		$this->assignRef('pagination', $pagination);
	}

	public function form_image_entry() {
		$imageHelper = hikamarket::get('shop.helper.image');
		$this->assignRef('imageHelper', $imageHelper);
	}

	public function addimage() {
		$files_id = hikaInput::get()->get('cid', array(),
'array');
		$category_id = hikaInput::get()->getInt('category_id', 0);

		$output = '[]';
		if(!empty($files_id)) {
			hikamarket::toInteger($files_id);
			$query = 'SELECT * FROM
'.hikamarket::table('shop.file').' WHERE file_id IN
('.implode(',',$files_id).')';
			$db = JFactory::getDBO();
			$db->setQuery($query);
			$files = $db->loadObjectList();

			$helperImage = hikamarket::get('shop.helper.image');
			$ret = array();
			foreach($files as $file) {

				$params = new stdClass();
				$params->category_id = $category_id;
				$params->file_id = $file->file_id;
				$params->file_path = $file->file_path;
				$params->file_name = $file->file_name;

				$ret[] = hikamarket::getLayout('categorymarket',
'form_image_entry', $params, $js);
			}
			if(!empty($ret)) {
				$output = json_encode($ret);
			}
		}
		$js =
'window.hikashop.ready(function(){window.parent.hikashop.submitBox({images:'.$output.'});});';
		$doc = JFactory::getDocument();
		$doc->addScriptDeclaration($js);

		return false;
	}
}
views/characteristicmarket/index.html000064400000000032151166607740014102
0ustar00<html><body></body></html>views/characteristicmarket/tmpl/index.html000064400000000032151166607740015056
0ustar00<html><body></body></html>views/characteristicmarket/tmpl/listing.php000064400000012502151166607740015250
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div>
<form action="<?php echo
hikamarket::completeLink('characteristic&task=listing');
?>" method="post" id="adminForm"
name="adminForm">
	<div class="hk-row-fluid">
		<div class="hkc-md-12"><?php
	echo $this->loadHkLayout('search', array(
		'id' =>
'hikamarket_characteristic_listing_search',
	));
		?></div>
	</div>
	<div class="hk-row-fluid">
		<div class="hkc-md-12">
			<div class="expand-filters"
style="width:auto;">
<?php
	if(!empty($this->vendorType))
		echo $this->vendorType->display('filter_vendors',
@$this->pageInfo->filter->vendors);
?>
			</div>
			<div style="clear:both"></div>
		</div>
	</div>
	<table class="hikam_listing hikam_table"
style="width:100%">
		<thead>
			<tr>
				<th class="hikamarket_characteristic_name_title
title"><?php
					echo JHTML::_('grid.sort', JText::_('HIKA_NAME'),
'characteristic.characteristic_value',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value);
				?></th>
				<th class="hikamarket_characteristic_alias_title
title"><?php
					echo JHTML::_('grid.sort', JText::_('HIKA_ALIAS'),
'characteristic.characteristic_alias',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value);
				?></th>
<?php if($this->show_vendor) { ?>
				<th class="hikamarket_characteristic_brnfot_title
title"><?php
					echo JText::_('HIKA_VENDOR');
				?></th>
<?php } ?>
				<th class="hikamarket_characteristic_valuecounter_title title
titlenum"><?php
					echo JText::_('HIKAM_NB_OF_VALUES');
				?></th>
				<th class="hikamarket_characteristic_usedcounter_title title
titlenum"><?php
					echo JText::_('HIKAM_NB_OF_USED');
				?></th>
<?php if($this->characteristic_actions) { ?>
				<th class="hikamarket_characteristic_actions_title title
titlenum"><?php
					echo JText::_('HIKA_ACTIONS');
				?></th>
<?php } ?>
				<th class="hikamarket_characteristic_id_title title
titlenum">
					<?php echo JHTML::_('grid.sort', JText::_( 'ID'
), 'characteristic.characteristic_id',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value ); ?>
				</th>
			</tr>
		</thead>
<?php if(!isset($this->embbed)) {
	$columns = 5;
	if($this->characteristic_actions)
		$columns++;
	if($this->show_vendor)
		$columns++;
?>
		<tfoot>
			<tr>
				<td colspan="<?php echo $columns; ?>">
					<?php echo $this->pagination->getListFooter(); ?>
					<?php echo $this->pagination->getResultsCounter(); ?>
				</td>
			</tr>
		</tfoot>
<?php } ?>
		<tbody>
<?php
$k = 0;
$i = 0;
foreach($this->characteristics as $characteristic) {
	$rowId =
'market_characteristic_'.$characteristic->characteristic_id;
	if($this->manage)
		$url =
hikamarket::completeLink('characteristic&task=show&cid='.$characteristic->characteristic_id);
?>
			<tr class="row<?php echo $k; ?>" id="<?php
echo $rowId; ?>">
				<td
class="hikamarket_characteristic_name_value"><?php
					if(!empty($url)) echo '<a
href="'.$url.'"><i class="fas
fa-pencil-alt"
style="margin-right:4px;"></i>';
					echo $this->escape($characteristic->characteristic_value);
					if(!empty($url)) echo '</a>';
				?></td>
				<td
class="hikamarket_characteristic_alias_value"><?php
					if(!empty($url)) echo '<a
href="'.$url.'">';
					echo $this->escape($characteristic->characteristic_alias);
					if(!empty($url)) echo '</a>';
				?></td>
<?php if($this->show_vendor) { ?>
				<td
class="hikamarket_characteristic_vendor_value"><?php
					if(empty($characteristic->characteristic_vendor_id))
						echo
'<em>'.JText::_('HIKA_NONE').'</em>';
					else
						echo $characteristic->vendor;
				?></td>
<?php } ?>
				<td
class="hikamarket_characteristic_valuecounter_value"><?php
					echo (int)$characteristic->counter;
				?></td>
				<td
class="hikamarket_characteristic_usedcounter_value"><?php
					echo (int)$characteristic->used;
				?></td>
<?php if($this->characteristic_actions) { ?>
				<td
class="hikamarket_characteristic_actions_value"><?php
					if($this->characteristic_action_delete &&
($this->vendor->vendor_id <= 1 || $this->vendor->vendor_id
== $characteristic->characteristic_vendor_id) &&
empty($characteristic->used))
						echo $this->toggleClass->delete($rowId,
(int)$characteristic->characteristic_id, 'characteristic',
true);
					else
						echo '-';
				?></td>
<?php } ?>
				<td class="hikamarket_characteristic_id_value"><?php
echo $characteristic->characteristic_id; ?></td>
			</tr>
<?php
	$i++;
	$k = 1 - $k;
}
?>
		</tbody>
	</table>
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="listing" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="boxchecked"
value="0" />
	<input type="hidden" name="filter_order"
value="<?php echo
$this->pageInfo->filter->order->value; ?>" />
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->pageInfo->filter->order->dir;
?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>
views/characteristicmarket/tmpl/listing.xml000064400000001266151166607740015266
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor Characteristic listing</name>
		<params addpath="/components/com_hikamarket/params">
			<param name="options" type="selectoptions"
default="module" label="options"
description="HikaMarket options" />
		</params>
	</state>
	<layout
title="COM_HIKAMARKET_CHARACTERISTICMARKET_LISTING_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
		<fieldset name="basic" label="HikaMarket
Options">
			<field id="options" name="options"
type="selectoptions" label="options"
description="HikaMarket options" />
		</fieldset>
	</fields>
</metadata>views/characteristicmarket/tmpl/show.php000064400000037320151166607740014564
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><script type="text/javascript">
window.characteristicMgr = {};
window.characteristicMgr.cpt = {};
</script>
<form action="<?php echo
hikamarket::completeLink('characteristic');?>"
method="post" name="adminForm"
id="adminForm">
	<dl class="hikam_options large">
		<dt
class="hikamarket_characteristic_name"><label><?php
echo JText::_('HIKA_NAME'); ?></label></dt>
		<dd class="hikamarket_characteristic_name">
<?php if(hikamarket::acl('characteristic/edit/value')
&& $this->editable_characteristic) { ?>
			<input type="text" size="45"
name="data[characteristic][characteristic_value]"
value="<?php echo
$this->escape(@$this->characteristic->characteristic_value);
?>" />
<?php } else { ?>
			<span><?php echo
$this->escape(@$this->characteristic->characteristic_value);
?></span>
<?php } ?>
		</dd>
<?php if(hikamarket::acl('characteristic/edit/alias')
&& $this->editable_characteristic) { ?>
		<dt
class="hikamarket_characteristic_alias"><label><?php
echo JText::_('HIKA_ALIAS'); ?></label></dt>
		<dd class="hikamarket_characteristic_alias"><input
type="text" size="45"
name="data[characteristic][characteristic_alias]"
value="<?php echo
$this->escape(@$this->characteristic->characteristic_alias);
?>" /></dd>
<?php } ?>
<?php if($this->vendor->vendor_id <= 1 &&
hikamarket::acl('characteristic/edit/vendor')) { ?>
		<dt
class="hikamarket_characteristic_vendor"><label><?php
echo JText::_('HIKA_VENDOR'); ?></label></dt>
		<dd class="hikamarket_characteristic_vendor"><?php
			echo $this->nameboxType->display(
				'data[characteristic][characteristic_vendor_id]',
				@$this->characteristic->characteristic_vendor_id,
				hikamarketNameboxType::NAMEBOX_SINGLE,
				'vendor',
				array(
					'delete' => true,
					'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>'
				)
			);
		?></dd>
<?php } ?>
<?php if(hikamarket::acl('characteristic/edit/display')
&&
in_array($this->shopConfig->get('characteristic_display'),
array('dropdown','radio'))) { ?>
		<dt
class="hikamarket_characteristic_display"><label><?php
echo JText::_('CHARACTERISTIC_DISPLAY_MODE');
?></label></dt>
		<dd class="hikamarket_characteristic_display"><?php
			echo
$this->characteristicdisplayType->display('data[characteristic][characteristic_display_method]',
@$this->characteristic->characteristic_display_method,
'characteristic');
		?></dd>
<?php } ?>
<?php if(!empty($this->characteristic->characteristic_id)) {
?>
		<dt
class="hikamarket_characteristic_counter"><label><?php
echo JText::_('HIKAM_NB_OF_USED');
?></label></dt>
		<dd class="hikamarket_characteristic_counter"><?php
			if(empty($this->used_counter))
				echo '<span class="order-label
order-label-created">';
			else
				echo '<span class="order-label
order-label-confirmed">';
			echo (int)$this->used_counter;
			echo '</span>';
		?></dd>
<?php } ?>
	</dl>
	<h2><?php echo JText::_('CHARACTERISTIC_VALUES');
?></h2>
<?php
if(!empty($this->characteristic->characteristic_id)) {
	if(!HIKASHOP_RESPONSIVE) {
?>	<table class="hikam_filter">
		<tr>
			<td width="100%">
				<?php echo JText::_('FILTER'); ?>:
				<input type="text" name="search"
id="hikamarket_characteristic_listing_search"
value="<?php echo
$this->escape($this->pageInfo->search);?>"
class=""/>
				<button class="hikabtn"
onclick="this.form.submit();"><i class="fas
fa-search"></i></button>
				<button class="hikabtn"
onclick="document.getElementById('hikamarket_characteristic_listing_search').value='';this.form.submit();"><i
class="fas fa-times"></i></button>
			</td>
			<td nowrap="nowrap">
<?php } else {?>
	<div class="row-fluid">
		<div class="span8">
			<div class="input-prepend input-append">
				<span class="add-on"><i
class="icon-filter"></i></span>
				<input type="text" name="search"
id="hikamarket_characteristic_listing_search"
value="<?php echo
$this->escape($this->pageInfo->search);?>"
class=""/>
				<button class="hikabtn"
onclick="this.form.submit();"><i
class="icon-search"></i></button>
				<button class="hikabtn"
onclick="document.getElementById('hikamarket_characteristic_listing_search').value='';this.form.submit();"><i
class="icon-remove"></i></button>
			</div>
		</div>
		<div class="span4">
			<div class="expand-filters"
style="width:auto;float:right">
<?php }

	if(!empty($this->vendorType) && $this->show_vendor
&& ($this->vendor->vendor_id == 0 ||
$this->vendor->vendor_id == 1))
		echo $this->vendorType->display('filter_vendors',
@$this->pageInfo->filter->vendors);

	if(!HIKASHOP_RESPONSIVE) { ?>
			</td>
		</tr>
	</table>
<?php } else {?>
			</div>
			<div style="clear:both"></div>
		</div>
	</div>
<?php
	}
}

	if(hikamarket::acl('characteristic/values/edit')) {
?>
	<div>
		<button onclick="return
window.characteristicMgr.addValue(this);" class="hikabtn
hikabtn-success"><i class="fas fa-plus"></i>
<?php echo JText::_('HIKAM_ADD_VALUE'); ;?></button>
	</div>
<?php
		if(!empty($this->characteristic->characteristic_id)) {
//(int)$this->characteristic->characteristic_id > 0) {
?>
	<div id="market_characteristic_add_value"
style="display:none;">
		<dl>
			<dt><?php echo JText::_('HIKA_NAME');
?></dt>
			<dd><input type="text" size="30"
style="min-width:60%" name=""
id="market_characteristic_add_value_input"
value=""/></dd>
<?php if($this->show_vendor && $this->vendor->vendor_id
<= 1) { ?>
		<dt><?php echo JText::_('HIKA_VENDOR');
?></dt>
		<dd><?php
		echo $this->nameboxType->display(
			'',
			0,
			hikamarketNameboxType::NAMEBOX_SINGLE,
			'vendor',
			array(
				'delete' => true,
				'id' =>
'market_characteristic_add_value_vendor',
				'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>'
			)
		);
	?></dd>
<?php } ?>
		</dl>
		<div style="float:right">
			<button onclick="return
window.characteristicMgr.createValue();" class="hikabtn
hikabtn-success"><i class="fas fa-check"></i>
<?php echo JText::_('HIKA_SAVE'); ;?></button>
		</div>
		<button onclick="return
window.characteristicMgr.cancelAddValue();" class="hikabtn
hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
		<div style="clear:both"></div>
	</div>
<?php
		}
	}

	echo $this->loadTemplate('listing');

	if(hikamarket::acl('characteristic/values/edit') ||
hikamarket::acl('characteristic/values/add')) {
?>
	<div id="market_characteristic_value_edit_tpl"
style="display:none;">
		<div class="hk-input-group">
			<input type="text" size="30"
class="hk-form-control" style="min-width:60%"
name="{NAME}" id="{INPUT_ID}"
value="{VALUE}"/>
			<div class="hk-input-group-append">
				<a href="#save" class="hikabtn"
onclick="return
window.characteristicMgr.saveValue(this,{ID});"><i
class="fas fa-check"></i> <span
class="hikam_btn_text"><?php echo
JText::_('HIKA_SAVE'); ?></span></a>
				<a href="#cancel" class="hikabtn"
onclick="return
window.characteristicMgr.cancelValue(this,{ID});"><i
class="fas fa-times-circle"></i> <span
class="hikam_btn_text"><?php echo
JText::_('HIKA_CANCEL'); ?></span></a>
			</div>
		</div>
	</div>
<?php if($this->show_vendor && $this->vendor->vendor_id
<= 1) { ?>
	<div id="market_characteristic_vendor_edit_tpl"
style="display:none;"><?php
		echo $this->nameboxType->display(
			'{VENDOR_INPUT}',
			0,
			hikamarketNameboxType::NAMEBOX_SINGLE,
			'vendor',
			array(
				'delete' => true,
				'default_text' => JText::_('HIKA_NONE')
			)
		);
	?></div>
<?php } ?>
<script type="text/javascript">
window.characteristicMgr.edit = function(el, id) {
	var d = document, tpl =
d.getElementById('market_characteristic_value_edit_tpl'),
		e = d.getElementById('market_characteristic_value_' + id);
	if(!tpl || !e) return false;
	var ev = e.childNodes[0], ee = e.childNodes[1], value = '', html
= '';
	ev.style.display = 'none';
	for(var n in ev.childNodes[0].childNodes) {
		if(ev.childNodes[0].childNodes[n] &&
typeof(ev.childNodes[0].childNodes[n]) == 'object') {
			n = ev.childNodes[0].childNodes[n];
			if(n.tagName.toLowerCase() == 'span' && n.className ==
'value')
				value = n.innerHTML;
		}
	}
	var htmlblocks = {
		'{ID}': id,
		'{INPUT_ID}':
'market_characteristic_value_input_'+id,
		'{NAME}':
'data[characteristic_value]['+id+'][value]',
		'{VALUE}': value
	};
	html = tpl.innerHTML;
	for(var k in htmlblocks) {
		if(htmlblocks.hasOwnProperty(k))
			html = html.replace(new RegExp(k,"g"), htmlblocks[k]);
	}
	ee.innerHTML = html;
<?php if($this->show_vendor && $this->vendor->vendor_id
<= 1) { ?>
	tpl =
d.getElementById('market_characteristic_vendor_edit_tpl');
	e = d.getElementById('market_characteristic_vendor_' + id);
	if(!tpl || !e) return false;
	ev = e.childNodes[0]; ee = e.childNodes[1];
	var name = ''; value = 0;
	if(e.getAttribute('data-vendor_id')) {
		value = parseInt(e.getAttribute('data-vendor_id'));
		if(value !== NaN && value > 0) {
			name = ev.innerHTML;
		} else
			value = 0;
	}
	ev.style.display = 'none';
	htmlblocks = {
		'id="{VENDOR_INPUT}':
'id="data_vendor_value_'+id,
		'\'{VENDOR_INPUT}':
'\'data_vendor_value_'+id,
		'{VENDOR_INPUT}':
'data[characteristic_value]['+id+'][vendor]'
	};
	html = tpl.innerHTML;
	for(var k in htmlblocks) {
		if(htmlblocks.hasOwnProperty(k))
			html = html.replace(new RegExp(k,"g"), htmlblocks[k]);
	}
	ee.innerHTML = html;
	new window.oNamebox(
		'data_vendor_value_' + id,
		window.oNameboxes['{VENDOR_INPUT}'].data,
		window.oNameboxes['{VENDOR_INPUT}']._conf
	);
	if(value > 0)
		window.oNameboxes['data_vendor_value_' + id].set(name, value);
<?php } ?>
	return false;
};
window.characteristicMgr.cancelValue = function(el, id) {
	var d = document, e =
d.getElementById('market_characteristic_value_' + id);
	if(!e) return false;
	var ev = e.childNodes[0], ee = e.childNodes[1];
	ee.innerHTML = '';
	ev.style.display = '';
<?php if($this->show_vendor) { ?>
	e = d.getElementById('market_characteristic_vendor_' + id);
	if(!e) return false;
	if(window.oNameboxes &&
window.oNameboxes['data_vendor_value_' + id])
		window.oNameboxes['data_vendor_value_' + id].destroy();
	ev = e.childNodes[0]; ee = e.childNodes[1];
	if(ee) ee.innerHTML = '';
	if(ev) ev.style.display = '';
<?php } ?>
	return false;
};
<?php if(!empty($this->characteristic->characteristic_id)) {
?>
window.characteristicMgr.saveValue = function(el, id) {
	var d = document, w = window, o = w.Oby, data = null,
		e = d.getElementById('market_characteristic_value_' + id),
		url = '<?php echo
hikamarket::completeLink('characteristic&task=apply&characteristic_parent_id='.$this->characteristic->characteristic_id.'&characteristic_id={ID}&tmpl=json',
false, false, true); ?>';
	if(!e) return false;
	data = o.getFormData(e) + '&<?php echo
hikamarket::getFormToken(); ?>=1';
	o.xRequest(url.replace('{ID}', id), {mode:'POST',
data:data}, function(x){
		var data = o.evalJSON(x.responseText);
		if(data && !data.err && data.id && data.id >
0) {
			e = d.getElementById('market_characteristic_value_' + id);
			var ev = e.childNodes[0], n = null,
				input = d.getElementById('market_characteristic_value_input_'
+ id);
			for(var n in ev.childNodes[0].childNodes) {
				if(ev.childNodes[0].childNodes[n] &&
typeof(ev.childNodes[0].childNodes[n]) == 'object') {
					n = ev.childNodes[0].childNodes[n];
					if(n.tagName.toLowerCase() == 'span' && n.className
== 'value')
						n.innerHTML = input.value; //
.replace(/</g,'&lt;');
				}
			}
<?php if($this->show_vendor && $this->vendor->vendor_id
<= 1) { ?>
			e = d.getElementById('market_characteristic_vendor_' + id);
			if(!e) return;
			ev = e.childNodes[0];
			input =
d.getElementById('data_vendor_value_'+id+'_valuehidden');
			if(input && input.value != '0' && input.value
!= '') {
				var vendor_id = parseInt(input.value);
				if(vendor_id !== NaN) {
					input =
d.getElementById('data_vendor_value_'+id+'_valuetext');
					e.setAttribute('data-vendor_id', vendor_id);
					ev.innerHTML = input.innerHTML;
//.replace(/</g,'&lt;');
				}
			}
<?php } ?>
		}
		w.characteristicMgr.cancelValue(el,id);
	}, function(x){
	});
	return false;
};
window.characteristicMgr.addValue = function(el) {
	var e =
document.getElementById('market_characteristic_add_value');
	if(e) e.style.display = '';
	return false;
};
window.characteristicMgr.createValue = function(el) {
	var d = document, w = window, o = w.Oby,
		url = '<?php echo
hikamarket::completeLink('characteristic&task=addCharacteristic&characteristic_parent_id='
. $this->characteristic->characteristic_id .
'&characteristic_type=value&tmpl=json', false, false,
true); ?>',
		data = '<?php echo hikamarket::getFormToken(); ?>=1',
		el =
d.getElementById('market_characteristic_add_value_input');
	if(!el.value || el.value.length == 0)
		return false;
	data += '&value=' + encodeURI(el.value);
<?php if($this->show_vendor && $this->vendor->vendor_id
<= 1) { ?>
	el =
d.getElementById('market_characteristic_add_value_vendor_valuehidden');
	if(el && el.value && el.value.length > 0)
		data += '&characteristic_vendor_id=' +
encodeURI(el.value);
<?php } ?>
	o.xRequest(url, {mode:'POST',data:data}, function(xhr,params) {
		var data = o.evalJSON(xhr.responseText);
		if(data === false || data === null) return;
		if(data.err) return;
		var blocks = {
			'ID': data.value,
			'VALUE': data.name,
			'VENDOR_ID': 0,
			'VENDOR': ''
		};
		if(data.vendor_id) blocks['VENDOR_ID'] = data.vendor_id;
		if(data.vendor) blocks['VENDOR'] = data.vendor;
		w.hikashop.dup('market_characteristic_tpl', blocks,
'market_characteristic_' + data.value);
		var tpl = d.getElementById('market_characteristic_tpl');
		if(tpl) tpl.className = (tpl.className == 'row0') ?
'row1' : 'row0';
		w.characteristicMgr.cancelAddValue(el);
	});
	return false;
};
window.characteristicMgr.cancelAddValue = function(el) {
	var e =
document.getElementById('market_characteristic_add_value');
	if(e) e.style.display = 'none';
	return false;
};
<?php } else { ?>
window.characteristicMgr.addValue = function(el) {
	var d = document, w = window, tpl = null, uuid = Date.now(),
		blocks = {UUID: uuid, VENDOR:''};
<?php if($this->show_vendor && $this->vendor->vendor_id
<= 1) { ?>
	tpl =
d.getElementById('market_characteristic_vendor_edit_tpl');
	if(tpl) {
		var html = tpl.innerHTML;
		html = html.replace(new RegExp('id="{VENDOR_INPUT}',
'g'), 'id="data_vendor_value_'+uuid);
		html = html.replace(new RegExp('\'{VENDOR_INPUT}',
'g'), '\'data_vendor_value_'+uuid);
		html = html.replace(new RegExp('{VENDOR_INPUT}',
'g'), 'data[values][vendor][]');
		blocks['VENDOR'] = html;
	}
<?php } ?>
	w.hikashop.dup('market_characteristic_tpl', blocks,
'market_characteristic_'+uuid);
<?php if($this->show_vendor && $this->vendor->vendor_id
<= 1) { ?>
	new window.oNamebox(
		'data_vendor_value_' + uuid,
		window.oNameboxes['{VENDOR_INPUT}'].data,
		window.oNameboxes['{VENDOR_INPUT}']._conf
	);
<?php } ?>
	tpl = d.getElementById('market_characteristic_tpl');
	if(tpl) tpl.className = (tpl.className == 'row0') ?
'row1' : 'row0';
	return false;
};
<?php } ?>
</script>
<?php
	} // End ACL characteristic_values_edit || characteristic_values_add
?>
	<input type="hidden" name="cid"
value="<?php echo @$this->characteristic->characteristic_id;
?>"/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
	<input type="hidden" name="task"
value="show"/>
	<input type="hidden" name="ctrl"
value="characteristic"/>
	<input type="hidden" name="filter_order"
value="<?php echo
$this->pageInfo->filter->order->value; ?>" />
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->pageInfo->filter->order->dir;
?>" />
	<?php echo JHTML::_('form.token'); ?>
</form>
views/characteristicmarket/tmpl/show_listing.php000064400000015645151166607740016323
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><table class="hikam_listing <?php echo
(HIKASHOP_RESPONSIVE)?'table table-striped
table-hover':'hikam_table'; ?>"
style="width:100%">
	<thead>
		<tr>
			<th class="hikamarket_characteristic_name_title
title"><?php
				echo JHTML::_('grid.sort', JText::_('HIKA_NAME'),
'characteristic.characteristic_value',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value);
				if($this->show_vendor)
					echo ' / ' . JText::_('HIKA_VENDOR');
			?></th>
<?php if($this->characteristic_ordering) { ?>
			<th class="hikamarket_characteristic_ordering_title title
titlenum"><?php
				echo JHTML::_('grid.sort', JText::_('ORDERING'),
'characteristic.characteristic_ordering',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value );
			?></th>
<?php } ?>
			<th class="hikamarket_characteristic_usedcounter_title title
titlenum"><?php
				echo JText::_('HIKAM_NB_OF_USED');
			?></th>
<?php if($this->characteristic_actions) { ?>
			<th class="hikamarket_characteristic_actions_title title
titlenum"><?php
				echo JText::_('HIKA_ACTIONS');
			?></th>
<?php } ?>
			<th class="hikamarket_characteristic_id_title title
titlenum"><?php
				echo JHTML::_('grid.sort', JText::_('ID'),
'characteristic.characteristic_id',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value );
			?></th>
		</tr>
	</thead>
<?php ?>
	<tbody>
<?php
$k = 0;
$i = 0;
foreach($this->characteristic->values as $characteristic) {
	$rowId =
'market_characteristic_'.$characteristic->characteristic_id;
	$editable = ($this->vendor->vendor_id <= 1 ||
$characteristic->characteristic_vendor_id ==
$this->vendor->vendor_id);
?>
		<tr class="row<?php echo $k; ?>" id="<?php
echo $rowId; ?>">
			<td class="hikamarket_characteristic_name_value"
id="market_characteristic_value_<?php echo
(int)$characteristic->characteristic_id;
?>"><div><?php
	if($this->acl_edit_value && $editable) echo '<a
href="#edit" onclick="return
window.characteristicMgr.edit(this,
'.(int)$characteristic->characteristic_id.');"><i
class="fas fa-pencil-alt"
style="margin-right:4px;"></i>';
	echo '<span
class="value">'.$characteristic->characteristic_value.'</span>';
	if($this->acl_edit_value && $editable) echo
'</a>';
			?></div><div></div><?php
	if($this->show_vendor) {
		?><div data-vendor_id="<?php echo
(int)$characteristic->characteristic_vendor_id;?>"
id="market_characteristic_vendor_<?php echo
(int)$characteristic->characteristic_id;
?>"><div><?php
		if(!empty($characteristic->characteristic_vendor_id))
			echo @$characteristic->vendor;
		?></div><div></div></div><?php
	}
			?></td>
<?php if($this->characteristic_ordering) { ?>
			<td class="hikamarket_characteristic_ordering_value
order">
<?php if($editable) { ?>
				<input type="text" size="3"
name="data[values][ordering][]"
id="characteristic_ordering[<?php echo
(int)$characteristic->characteristic_id;?>]"
value="<?php echo
(int)$characteristic->characteristic_ordering;?>"/>
<?php } else { ?>
				<span><?php echo
(int)$characteristic->characteristic_ordering; ?></span>
<?php } ?>
			</td>
<?php } ?>
			<td
class="hikamarket_characteristic_usedcounter_value"><?php
				echo (int)@$characteristic->used;
			?></td>
<?php if($this->characteristic_actions) { ?>
			<td
class="hikamarket_characteristic_actions_value"><?php
				if($this->characteristic_action_delete && $editable
&& (int)@$characteristic->used == 0 &&
($this->vendor->vendor_id <= 1 || $this->vendor->vendor_id
== (int)$characteristic->characteristic_vendor_id))
					echo $this->toggleClass->delete($rowId,
(int)$characteristic->characteristic_id . '-' .
(int)$this->characteristic->characteristic_id,
'characteristic', true);
				else
					echo '-';
			?></td>
<?php } ?>
			<td class="hikamarket_characteristic_id_value">
				<?php echo (int)$characteristic->characteristic_id; ?>
<?php if($editable) { ?>
				<input type="hidden" name="data[values][id][]"
value="<?php echo
(int)$characteristic->characteristic_id;?>"/>
<?php } ?>
			</td>
		</tr>
<?php
	$i++;
	$k = 1 - $k;
}

if(!empty($this->characteristic->characteristic_id)) { //
(int)$this->characteristic->characteristic_id > 0) {
?>
		<tr class="row<?php echo $k; ?>"
id="market_characteristic_tpl"
style="display:none;">
			<td class="hikamarket_characteristic_name_value"
id="market_characteristic_value_{ID}"><div><?php
				if($this->acl_edit_value) echo '<a href="#edit"
onclick="return window.characteristicMgr.edit(this,
{ID});"><i class="fas fa-pencil-alt"
style="margin-right:4px;"></i>';
				echo '<span
class="value">{VALUE}</span>';
				if($this->acl_edit_value) echo '</a>';
			?></div><div></div>
<?php if($this->show_vendor) { ?>
			<div data-vendor_id="{VENDOR_ID}"
id="market_characteristic_vendor_{ID}"><div>{VENDOR}</div><div></div></div>
<?php } ?>
			</td>
<?php if($this->characteristic_ordering) { ?>
			<td class="hikamarket_characteristic_ordering_value
order">
				<input type="text" size="3"
name="data[values][ordering][]"
id="characteristic_ordering[{ID}]" value="0"/>
			</td>
<?php } ?>
			<td
class="hikamarket_characteristic_usedcounter_value">0</td>
<?php if($this->characteristic_actions) { ?>
			<td
class="hikamarket_characteristic_actions_value"><?php
				if($this->characteristic_action_delete)
					echo
$this->toggleClass->delete('market_characteristic_{ID}',
'{ID}', 'characteristic', true);
			?></td>
<?php } ?>
			<td class="hikamarket_characteristic_id_value">
				{ID}
				<input type="hidden" name="data[values][id][]"
value="{ID}"/>
			</td>
		</tr>
<?php
} else {
?>
		<tr class="row<?php echo $k; ?>"
id="market_characteristic_tpl"
style="display:none;">
			<td class="hikamarket_characteristic_name_value">
				<div>
					<input type="text" size="30"
style="min-width:60%" name="data[values][value][]"
value=""/>
				</div>
<?php if($this->show_vendor) { ?>
				<div>{VENDOR}</div>
<?php } ?>
			</td>
<?php if($this->characteristic_ordering) { ?>
			<td class="hikamarket_characteristic_ordering_value
order">
				<input type="text" size="3"
name="data[values][ordering][]" value="0"/>
			</td>
<?php } ?>
			<td
class="hikamarket_characteristic_usedcounter_value">0</td>
<?php if($this->characteristic_actions) { ?>
			<td
class="hikamarket_characteristic_actions_value"><?php
				if($this->characteristic_action_delete)
					echo '<a href="javascript:void(0);"
onclick="window.hikashop.deleteRow(\'market_characteristic_{UUID}\');
return false;"><i class="far
fa-trash"></i></a>';
				else
					echo '-';
			?></td>
<?php } ?>
			<td class="hikamarket_characteristic_id_value">
				-
				<input type="hidden" name="data[values][id][]"
value="0"/>
			</td>
		</tr>
<?php
}
?>
	</tbody>
</table>
views/characteristicmarket/view.html.php000064400000031424151166607740014544
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class characteristicmarketViewcharacteristicmarket extends hikamarketView
{

	protected $ctrl = 'characteristic';
	protected $icon = 'characteristic';
	protected $triggerView = true;

	public function display($tpl = null, $params = array()) {
		$this->params =& $params;
		$fct = $this->getLayout();
		if(method_exists($this, $fct)) {
			if($this->$fct() === false)
				return;
		}
		parent::display($tpl);
	}

	public function listing($tpl = null) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.listing';

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$toggleClass = hikamarket::get('helper.toggle');
		$this->assignRef('toggleClass', $toggleClass);

		$manage = hikamarket::acl('characteristic/edit') ||
hikamarket::acl('characteristic/show');
		$this->assignRef('manage', $manage);

		$show_vendor = hikamarket::level(1);
		$this->assignRef('show_vendor', $show_vendor);

		$characteristic_action_delete =
hikamarket::acl('characteristic/delete');
		$characteristic_actions = $characteristic_action_delete;
		$this->assignRef('characteristic_action_delete',
$characteristic_action_delete);
		$this->assignRef('characteristic_actions',
$characteristic_actions);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid = '&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$cfg = array(
			'table' => 'shop.characteristic',
			'main_key' => 'characteristic_id',
			'order_sql_value' =>
'characteristic.characteristic_id'
		);


		$pageInfo = $this->getPageInfo($cfg['order_sql_value']);
		$pageInfo->filter->vendors =
$app->getUserStateFromRequest($this->paramBase.'.filter_vendors',
'filter_vendors', -1, 'int');

		$filters = array(
			'characteristic.characteristic_parent_id = 0'
		);
		$searchMap = array(
			'characteristic.characteristic_value',
			'characteristic.characteristic_alias',
			'characteristic.characteristic_id'
		);
		$order = '';

		if($vendor->vendor_id > 1) {
			$filters[] = 'characteristic.characteristic_vendor_id IN (0, '
. (int)$vendor->vendor_id.')';
		} else {
			$vendorType = hikamarket::get('type.filter_vendor');
			$this->assignRef('vendorType', $vendorType);
			if($pageInfo->filter->vendors >= 0) {
				if($pageInfo->filter->vendors > 1)
					$filters[] = 'characteristic.characteristic_vendor_id =
'.(int)$pageInfo->filter->vendors;
				else
					$filters[] = 'characteristic.characteristic_vendor_id <=
1';
			}
		}

		$this->processFilters($filters, $order, $searchMap);

		$query = 'FROM
'.hikamarket::table($cfg['table']).' AS characteristic
'.$filters.$order;
		$db->setQuery('SELECT * '.$query,
(int)$pageInfo->limit->start, (int)$pageInfo->limit->value);

		$rows = $db->loadObjectList();
		$this->assignRef('characteristics', $rows);

		$db->setQuery('SELECT COUNT(*) '.$query);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($rows);

		if(!empty($rows)) {
			$characteristic_ids = array();
			$vendor_ids = array();

			foreach($rows as $row) {
				$characteristic_ids[] = (int)$row->characteristic_id;
				$vendor_ids[ (int)$row->characteristic_vendor_id ] =
(int)$row->characteristic_vendor_id;
			}

			$vendors = array();
			if(!empty($vendor_ids)) {
				$query = 'SELECT vendor_id, vendor_name FROM ' .
hikamarket::table('vendor') . ' WHERE vendor_id IN
('.implode(',', $vendor_ids).')';
				$db->setQuery($query);
				$vendors = $db->loadObjectList('vendor_id');
			}

			$filters = array(
				'characteristic_parent_id IN ('.implode(',',
$characteristic_ids).')'
			);
			if($vendor->vendor_id > 1) {
				$filters[] = 'characteristic_vendor_id IN (0, ' .
(int)$vendor->vendor_id.')';
			}
			$query = 'SELECT characteristic_parent_id, COUNT(*) as counter FROM
' . hikamarket::table('shop.characteristic') .
					' WHERE '.implode(' AND ', $filters).' GROUP
BY characteristic_parent_id';
			$db->setQuery($query);
			$value_counter =
$db->loadObjectList('characteristic_parent_id');

			$vendor_filter = '';
			$vendor_join = '';
			if($vendor->vendor_id > 1) {
				$vendor_filter = ' AND p.product_vendor_id = ' .
(int)$vendor->vendor_id;
				$vendor_join = ' INNER JOIN ' .
hikamarket::table('shop.product') . ' AS p ON
v.variant_product_id = p.product_id ';
			}
			$query = 'SELECT v.variant_characteristic_id,
COUNT(v.variant_product_id) as counter '.
					' FROM ' . hikamarket::table('shop.variant') .
' AS v ' . $vendor_join .
					' WHERE variant_characteristic_id IN
('.implode(',', $characteristic_ids).')' .
$vendor_filter .
					' GROUP BY variant_characteristic_id';
			$db->setQuery($query);
			$used_counter =
$db->loadObjectList('variant_characteristic_id');

			foreach($rows as &$row) {
				$i = (int)$row->characteristic_id;
				$row->vendor = '';
				if((int)$row->characteristic_vendor_id > 0 &&
isset($vendors[(int)$row->characteristic_vendor_id]))
					$row->vendor =
$vendors[(int)$row->characteristic_vendor_id]->vendor_name;
				$row->counter = 0;
				$row->used = 0;
				if(isset($value_counter[$i]))
					$row->counter = (int)$value_counter[$i]->counter;
				if(isset($used_counter[$i]))
					$row->used = (int)$used_counter[$i]->counter;
			}
			unset($row);
		}

		$this->toolbar = array(
			array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'), 'url'
=> hikamarket::completeLink('vendor')),
			array(
				'icon' => 'new',
				'fa' => 'fa-plus-circle',
				'name' => JText::_('HIKA_NEW'),
				'url' =>
hikamarket::completeLink('characteristic&task=add'),
				'pos' => 'right',
				'display' =>
hikamarket::acl('characteristic/add')
			)
		);

		$this->getPagination();
	}

	public function show() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.edit';

		JHTML::_('behavior.tooltip');

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$show_vendor = hikamarket::level(1);
		$this->assignRef('show_vendor', $show_vendor);

		$this->loadRef(array(
			'characteristicClass' => 'class.characteristic',
			'toggleClass' => 'helper.toggle',
			'nameboxType' => 'type.namebox',
			'characteristicdisplayType' =>
'shop.type.characteristicdisplay'
		));

		$cid = hikamarket::getCID('characteristic_id');

		$characteristic = $this->characteristicClass->get($cid);
		$this->assignRef('characteristic', $characteristic);

		$characteristic_action_delete =
hikamarket::acl('characteristic/values/delete');
		$this->assignRef('characteristic_action_delete',
$characteristic_action_delete);
		$characteristic_actions = $characteristic_action_delete;
		$this->assignRef('characteristic_actions',
$characteristic_actions);

		$characteristic_ordering =
hikamarket::acl('characteristic/values/ordering');
		$this->assignRef('characteristic_ordering',
$characteristic_ordering);

		$acl_edit_value =
hikamarket::acl('characteristic/values/edit');
		$this->assignRef('acl_edit_value', $acl_edit_value);

		$multi_language = false;
		$this->assignRef('multi_language', $multi_language);

		$editable_characteristic = true;
		$editable_characteristic = (empty($characteristic) ||
$vendor->vendor_id <= 1 ||
$characteristic->characteristic_vendor_id == $vendor->vendor_id);
		$this->assignRef('editable_characteristic',
$editable_characteristic);


		$used_counter = 0;
		if(!empty($characteristic)) {
			$vendor_filter = '';
			$vendor_join = '';
			if($vendor->vendor_id > 1) {
				$vendor_filter = ' AND p.product_vendor_id = ' .
(int)$vendor->vendor_id;
				$vendor_join = ' INNER JOIN ' .
hikamarket::table('shop.product') . ' AS p ON
v.variant_product_id = p.product_id ';
			}
			$query = 'SELECT COUNT(v.variant_product_id) as counter '.
					' FROM ' . hikamarket::table('shop.variant') .
' AS v ' . $vendor_join .
					' WHERE variant_characteristic_id = ' . (int)$cid .
$vendor_filter .
					' GROUP BY variant_characteristic_id';
			$db->setQuery($query);
			$used_counter = $db->loadResult('counter');
		} else
			$characteristic = new stdClass();
		$this->assignRef('used_counter', $used_counter);

		$rows = array();

		$pageInfo =
$this->getPageInfo('characteristic.characteristic_id');
		$pageInfo->limit->start = 0;
		$pageInfo->limit->value = 500;

		$pageInfo->filter->vendors =
$app->getUserStateFromRequest($this->paramBase.'.filter_vendors',
'filter_vendors', -1, 'int');

		$filters = array(
			'characteristic.characteristic_parent_id = ' . (int)$cid
		);
		$searchMap = array(
			'characteristic.characteristic_value',
			'characteristic.characteristic_alias',
			'characteristic.characteristic_id'
		);
		$order = '';

		if((int)$cid > 0) {
			if($vendor->vendor_id > 1) {
				$filters[] = 'characteristic.characteristic_vendor_id IN (0,
' . (int)$vendor->vendor_id . ')';
			} else {
				$vendorType = hikamarket::get('type.filter_vendor');
				$this->assignRef('vendorType', $vendorType);
				if($pageInfo->filter->vendors >= 0) {
					if($pageInfo->filter->vendors > 1)
						$filters[] = 'characteristic.characteristic_vendor_id =
'.(int)$pageInfo->filter->vendors;
					else
						$filters[] = 'characteristic.characteristic_vendor_id <=
1';
				}
			}

			$this->processFilters($filters, $order, $searchMap);

			$query = 'FROM
'.hikamarket::table('shop.characteristic').' AS
characteristic '.$filters.$order;
			$db->setQuery('SELECT * '.$query,
(int)$pageInfo->limit->start, (int)$pageInfo->limit->value);

			$rows = $db->loadObjectList();

			$db->setQuery('SELECT COUNT(*) '.$query);
			$pageInfo->elements = new stdClass();
			$pageInfo->elements->total = $db->loadResult();
			$pageInfo->elements->page = count($rows);
		}

		$characteristic->values = $rows;


		if(!empty($rows)) {
			$characteristic_ids = array();
			$vendor_ids = array();

			foreach($rows as $row) {
				$characteristic_ids[] = (int)$row->characteristic_id;
				$vendor_ids[ (int)$row->characteristic_vendor_id ] =
(int)$row->characteristic_vendor_id;
			}

			$vendors = array();
			if(!empty($vendor_ids)) {
				$query = 'SELECT vendor_id, vendor_name FROM ' .
hikamarket::table('vendor') . ' WHERE vendor_id IN
('.implode(',', $vendor_ids).')';
				$db->setQuery($query);
				$vendors = $db->loadObjectList('vendor_id');
			}

			$vendor_filter = '';
			if($vendor->vendor_id > 1)
				$vendor_filter = ' AND p.product_vendor_id = ' .
(int)$vendor->vendor_id;
			$query = 'SELECT v.variant_characteristic_id,
COUNT(v.variant_product_id) as counter '.
					' FROM ' . hikamarket::table('shop.variant') .
' AS v INNER JOIN ' . hikamarket::table('shop.product')
. ' AS p ON v.variant_product_id = p.product_id '.
					' WHERE variant_characteristic_id IN
('.implode(',', $characteristic_ids).') AND
p.product_type = ' . $db->Quote('variant') .
$vendor_filter .
					' GROUP BY variant_characteristic_id';
			$db->setQuery($query);
			$used_counter =
$db->loadObjectList('variant_characteristic_id');

			foreach($rows as &$row) {
				$i = (int)$row->characteristic_id;
				$row->vendor = '';
				if(isset($vendors[$row->characteristic_vendor_id]))
					$row->vendor =
$vendors[$row->characteristic_vendor_id]->vendor_name;
				$row->used = 0;
				if(isset($used_counter[$i]))
					$row->used = (int)$used_counter[$i]->counter;
			}
			unset($row);
		}

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' =>
hikamarket::completeLink('characteristic')
			),
			'apply' => array(
				'url' => '#apply',
				'fa' => 'fa-check-circle',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'apply\',\'adminForm\');"',
				'icon' => 'apply',
				'name' => JText::_('HIKA_APPLY'),
'pos' => 'right',
				'display' =>
hikamarket::acl('characteristic/edit')
			),
			'save' => array(
				'url' => '#save',
				'fa' => 'fa-save',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save\',\'adminForm\');"',
				'icon' => 'save',
				'name' => JText::_('HIKA_SAVE'), 'pos'
=> 'right',
				'display' =>
hikamarket::acl('characteristic/edit')
			)
		);
	}
}
views/checkoutmarket/index.html000064400000000032151166607740012717
0ustar00<html><body></body></html>views/checkoutmarket/tmpl/index.html000064400000000032151166607740013673
0ustar00<html><body></body></html>views/checkoutmarket/tmpl/terms.php000064400000004663151166607740013557
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikashop_checkout_terms"
class="hikashop_checkout_terms">
	<label>
		<input class="hikashop_checkout_terms_checkbox"
id="hikashop_checkout_terms_checkbox" type="checkbox"
name="hikashop_checkout_terms" value="1" <?php
if(!empty($this->terms['shop'])) { echo '
checked="checked"'; } ?> />
<?php
	$text = JText::_('PLEASE_ACCEPT_TERMS');
	$link = '';

	$width = (int)@$this->params->options['popup_width'];
	if(empty($width))
		$width = 450;
	$height = (int)@$this->params->options['popup_height'];
	if(empty($height))
		$height = 480;

	$terms_article =
(int)@$this->params->options['article_id'];
	if(empty($terms_article))
		$terms_article =
(int)$this->shopConfig->get('checkout_terms', 0);
	if(!empty($this->terms_content[1]->vendor_terms)) {
		$link =
hikamarket::completeLink('vendor&task=terms&cid=1',
true);
	} else if(!empty($terms_article)) {
		if(isset($this->step))
			$link =
hikamarket::completeLink('vendor&task=terms&cid=0&step='.$this->step.'&pos='.$this->module_position,
true);
		else
			$link =
hikamarket::completeLink('vendor&task=terms&cid=0',
true);
	}

	if(!empty($link)) {
		echo $this->popupHelper->display(
			$text,
			'HIKASHOP_CHECKOUT_TERMS',
			$link,
			'shop_terms_and_cond',
			$width, $height, '', '', 'link'
		);
	} else {
		echo $text;
	}
?>
	</label>
<?php
	foreach($this->vendors as $vendor) {
		if(!empty($this->terms_content[$vendor]->vendor_terms)) {
?>
	<br/><label>
		<input class="hikashop_checkout_terms_checkbox"
id="hikamarket_checkout_terms_checkbox_<?php echo $vendor;
?>" type="checkbox"
name="hikamarket_checkout_terms[<?php echo $vendor; ?>]"
value="1" <?php
if(!empty($this->terms['market'][$vendor])) { echo '
checked="checked"'; } ?> />
<?php
			echo $this->popupHelper->display(
				JText::sprintf('PLEASE_ACCEPT_TERMS_FOR_VENDOR',
$this->terms_content[$vendor]->vendor_name),
				'HIKASHOP_CHECKOUT_TERMS',
				hikamarket::completeLink('vendor&task=terms&cid=' .
$vendor, true),
				'shop_terms_and_cond_'.$vendor,
				$width, $height, '', '', 'link'
			);
?>
	</label>
<?php
		}
	}
?>
	<input type="hidden" value="1"
name="hikamarket_checkout_terms_block"/>
</div>
views/checkoutmarket/view.html.php000064400000004341151166607740013357
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class checkoutmarketViewcheckoutmarket extends hikamarketView {

	protected $ctrl = 'checkout';
	protected $icon = 'checkout';

	public function display($tpl = null, $params = array()) {
		$this->params =& $params;
		$fct = $this->getLayout();
		if(method_exists($this, $fct)) {
			if($this->$fct() === false)
				return;
		}
		parent::display($tpl);
	}

	public function terms() {
		$app = JFactory::getApplication();
		$shop_terms =
$app->getUserState(HIKASHOP_COMPONENT.'.checkout_terms');
		$market_terms =
$app->getUserState(HIKAMARKET_COMPONENT.'.checkout_terms');

		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$popupHelper = hikamarket::get('shop.helper.popup');
		$this->assignRef('popupHelper', $popupHelper);

		if(!class_exists('hikashopCheckoutHelper')) {
			$cart = $this->params->view->initCart();
		} else {
			$checkoutHelper = hikashopCheckoutHelper::get();
			$cart = $checkoutHelper->getCart();

			$this->step = $this->params->view->step;
			$this->module_position = $this->params->pos;
		}

		$vendors = array();
		foreach($cart->products as $product) {
			$vendor_id = (int)$product->product_vendor_id;
			$vendors[$vendor_id] = $vendor_id;
		}
		if(!isset($vendors[1]))
			$vendors[1] = 1;

		$db = JFactory::getDBO();
		$query = 'SELECT vendor_id, vendor_name, vendor_terms FROM
'.hikamarket::table('vendor').' WHERE vendor_published
= 1 AND vendor_id IN ('.implode(',',
$vendors).')';
		$db->setQuery($query);
		$terms_content = $db->loadObjectList('vendor_id');
		$this->assignRef('terms_content', $terms_content);

		if(isset($vendors[0])) unset($vendors[0]);
		if(isset($vendors[1])) unset($vendors[1]);
		$this->assignRef('vendors', $vendors);

		$terms = array(
			'shop' => $shop_terms,
			'market' => $market_terms
		);
		$this->assignRef('terms', $terms);
	}
}
views/discountmarket/index.html000064400000000032151166607740012742
0ustar00<html><body></body></html>views/discountmarket/tmpl/add.xml000064400000001247151166607740013204
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor discount creation</name>
		<params addpath="/components/com_hikamarket/params">
			<param name="options" type="selectoptions"
default="module" label="options"
description="HikaMarket options" />
		</params>
	</state>
	<layout
title="COM_HIKAMARKET_DISCOUNTMARKET_ADD_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
		<fieldset name="basic" label="HikaMarket
Options">
			<field id="options" name="options"
type="selectoptions" label="options"
description="HikaMarket options" />
		</fieldset>
	</fields>
</metadata>views/discountmarket/tmpl/index.html000064400000000032151166607740013716
0ustar00<html><body></body></html>views/discountmarket/tmpl/listing.php000064400000027714151166607740014123
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikamarket_discount_listing">
<form action="<?php echo
hikamarket::completeLink('discount&task=listing');
?>" method="post" id="adminForm"
name="adminForm">

<div class="hk-row-fluid">
	<div class="hkc-md-12">
<?php
	echo $this->loadHkLayout('search', array(
		'id' => 'hikamarket_discount_listing_search',
	));
?>
		<div class="hikam_sort_zone"><?php
			if(!empty($this->ordering_values))
				echo JHTML::_('select.genericlist',
$this->ordering_values, 'filter_fullorder',
'onchange="this.form.submit();"', 'value',
'text', $this->full_ordering);
		?></div>
	</div>
</div>
<div class="hk-row-fluid">
	<div class="hkc-md-12">
		<div class="expand-filters"
style="width:auto;">
<?php
	$discount_types = array(
		'' => JText::_('HIKA_ALL_DISCOUNTS'),
		'discount' => JText::_('DISCOUNTS'),
		'coupon' => JText::_('COUPONS'),
	);
	echo JHTML::_('select.genericlist', $discount_types,
'filter_type', 'data-search-reset=""
onchange="this.form.submit();"', 'value',
'text', $this->pageInfo->filter->type);

	$status_types = array(
		-1 => JText::_('HIKA_ALL_STATUSES'),
		1 => JText::_('HIKA_PUBLISHED'),
		0 => JText::_('HIKA_UNPUBLISHED'),
	);
	echo JHTML::_('select.genericlist', $status_types,
'filter_published', 'data-search-reset="-1"
onchange="this.form.submit();"', 'value',
'text', $this->pageInfo->filter->published);

	if(!empty($this->vendorType))
		echo $this->vendorType->display('filter_vendors',
@$this->pageInfo->filter->vendors);
?>
		</div>
		<div style="clear:both"></div>
	</div>
</div>

<div id="hikam_discount_main_listing">
<?php
hikamarket::loadJslib('tooltip');
$this->loadRef(array('dropdownHelper' =>
'shop.helper.dropdown'));

$now = time();
$publish_content = '<i class="fas fa-check"></i>
' . JText::_('HIKA_PUBLISHED');
$unpublish_content = '<i class="fas
fa-times"></i> ' .
JText::_('HIKA_UNPUBLISHED');

foreach($this->discounts as $discount) {
	$url = ($this->manage) ?
hikamarket::completeLink('discount&task=show&cid='.$discount->discount_id)
: null;
	$extra_classes = '';

	if(!empty($discount->discount_code)) {
		$discount_name = $discount->discount_code;
	} else {
		$discount_name = '<em>' . JText::_('HIKA_NONE')
. '</em>';
		if(isset($discount->discount_flat_amount) &&
$discount->discount_flat_amount > 0) {
			$discount_name = '<em>' .
$this->currencyClass->displayPrices(array($discount),'discount_flat_amount','discount_currency_id')
. '</em>';
		} elseif(isset($discount->discount_percent_amount) &&
$discount->discount_percent_amount > 0) {
			$discount_name = '<em>' . 
$discount->discount_percent_amount. '%</em>';
		}
	}
?>
	<div class="hk-card hk-card-default hk-card-discount<?php echo
$extra_classes; ?>" data-hkm-discount="<?php echo
(int)$discount->discount_id; ?>">
		<div class="hk-card-header">
			<a class="hk-row-fluid" href="<?php echo $url;
?>">
				<div class="hkc-sm-6 hkm_discount_name"><?php
	if($discount->discount_type == 'coupon') {
		echo '<i class="fas fa-receipt"></i> ';
	} else {
		echo '<i class="fas fa-percent"></i> ';
	}
	echo $discount_name;
				?></div>
				<div class="hkc-sm-6 hkm_discount_value"
style="text-align:right"><?php
	if(isset($discount->discount_flat_amount) &&
$discount->discount_flat_amount > 0) {
		echo
$this->currencyClass->displayPrices(array($discount),'discount_flat_amount','discount_currency_id');
	} elseif(isset($discount->discount_percent_amount) &&
$discount->discount_percent_amount > 0) {
		echo $discount->discount_percent_amount. '%';
	} else {
		echo JText::_('NO_DISCOUNT');
	}

				?></div>
			</a>
		</div>
		<div class="hk-card-body">
			<div class="hk-row-fluid">
				<div class="hkc-sm-7 hkm_discount_restrictions">
					<div class="hkm_discount_quota">
<?php
	if(empty($discount->discount_quota))
		echo '<i class="fas fa-infinity
hk-icon-green"></i> <strong>' .
JText::_('DISCOUNT_QUOTA').'</strong>
'.JText::_('UNLIMITED');
	else
		echo '<span
class="hk-label">'.$discount->discount_used_times.'
/ '.$discount->discount_quota. '</span>
<strong>' .
JText::_('DISCOUNT_QUOTA').'</strong>
'.JText::sprintf('X_LEFT', $discount->discount_quota -
$discount->discount_used_times);
?>
					</div>
<?php
	if(!empty($discount->discount_start)) {
		if(!empty($discount->discount_end) &&
((int)$discount->discount_start <= $now) &&
((int)$discount->discount_start < $now))
			$discount_enabled = 'far fa-calendar-alt';
		else
			$discount_enabled = ((int)$discount->discount_start <= $now) ?
'far fa-calendar-check hk-icon-green' : 'far
fa-calendar-times hk-icon-orange';
?>
					<div class="hkm_discount_start">
						<i class="<?php echo $discount_enabled;
?>"></i> <strong><?php echo
JText::_('DISCOUNT_START_DATE'); ?></strong>
						<span><?php echo
hikamarket::getDate($discount->discount_start, '%Y-%m-%d
%H:%M'); ?></span>
					</div>
<?php
	}
?>
<?php
	if(!empty($discount->discount_end)) {
		if(!empty($discount->discount_start) &&
((int)$discount->discount_start > $now))
			$discount_enabled = 'far fa-calendar-alt';
		else
			$discount_enabled = ((int)$discount->discount_end > $now) ?
'far fa-calendar-check hk-icon-green' : 'far
fa-calendar-times hk-icon-red';
?>
					<div class="hkm_discount_start">
						<i class="<?php echo $discount_enabled;
?>"></i> <strong><?php echo
JText::_('DISCOUNT_END_DATE'); ?></strong>
						<span><?php echo
hikamarket::getDate($discount->discount_end, '%Y-%m-%d
%H:%M'); ?></span>
					</div>
<?php
	}
?>
<?php
	if(hikashop_level(1)) {
		if(!empty($discount->discount_minimum_order) &&
hikamarket::toFloat($discount->discount_minimum_order) != 0)
			echo '<div class="hkm_discount_minorder"><i
class="far fa-money-bill-alt hk-icon-blue"></i>
<strong>'.JText::_('MINIMUM_ORDER_VALUE') .
'</strong> <span>' .
$this->currencyClass->displayPrices(array($discount),
'discount_minimum_order',
'discount_currency_id').'</span></div>';
		if(!empty($discount->product_name))
			echo '<div class="hkm_discount_onproduct"><i
class="fas fa-cubes hk-icon-blue"></i>
<strong>'.JText::_('PRODUCT') . '</strong>
<span>' . $discount->product_name .
'<span></div>';
		if(!empty($discount->category_name)) {
			echo '<div class="hkm_discount_oncategory"><i
class="fas fa-folder hk-icon-blue"></i>
<strong>'.JText::_('CATEGORY') . '</strong>
<span>' .
				$discount->category_name .
				(($discount->discount_category_childs) ? (' <em>' .
JText::_('INCLUDING_SUB_CATEGORIES') . '</em>') :
''). '</span></div>';
		}
		if(!empty($discount->discount_user_id) && hikashop_level(2))
			echo '<div class="hkm_discount_onuser"><i
class="fas fa-user hk-icon-blue"></i>
<span>'.JText::_('HIKA_COUPON_TARGET_USERS').'</span></div>';
// 'For specific users'
		if(!empty($discount->zone_name_english))
			echo '<div class="hkm_discount_onzone"><i
class="fas fa-map-marker-alt hk-icon-blue"></i>
<strong>'.JText::_('ZONE') . '</strong>
<span>' . $discount->zone_name_english .
'</span></div>';

		if($discount->discount_type == 'coupon') {
			if(!empty($discount->discount_coupon_product_only))
				 echo '<div
class="hkm_discount_percentproduct"><i class="far
fa-money-bill-alt hk-icon-blue"></i>
<span>'.JText::_('HIKA_COUPON_PRODUCT_ONLY').'</span></div>';
// 'Percentage for product only'
		}
	}
?>
				</div>
				<div class="hkc-sm-3">
<?php
	if($this->discount_action_publish) {
?>
					<a class="hikabtn hikabtn-<?php echo
($discount->discount_published) ? 'success' :
'danger'; ?> hkm_publish_button"
data-toggle-state="<?php echo $discount->discount_published ? 1
: 0; ?>" data-toggle-id="<?php echo
$discount->discount_id; ?>" onclick="return
window.localPage.toggleDiscount(this);"><?php
						echo ($discount->discount_published) ? $publish_content :
$unpublish_content;
					?></a>
<?php
	} else {
?>
					<span class="hkm_publish_state hk-label hk-label-<?php echo
($discount->discount_published) ? 'green' : 'red';
?>"><?php echo ($discount->discount_published) ?
$publish_content : $unpublish_content; ?></span>
<?php
	}
?>
				</div>
				<div class="hkc-sm-2">
<?php
	$data = array(
		'details' => array(
			'name' => '<i class="fas
fa-search"></i> ' . JText::_('HIKA_DETAILS',
true),
			'link' => $url
		)
	);
	if($this->discount_action_delete) {
		$data['delete'] = array(
			'name' => '<i class="fas
fa-trash"></i> ' . JText::_('HIKA_DELETE',
true),
			'link' => '#delete',
			'click' => 'return
window.localPage.deleteDiscount('.(int)$discount->discount_id.',
\''.urlencode(strip_tags($discount_name)).'\');'
		);
	}
	if(!empty($data)) {
		echo $this->dropdownHelper->display(
			JText::_('HIKA_ACTIONS'),
			$data,
			array('type' => '', 'class' =>
'hikabtn-primary', 'right' => true, 'up'
=> false)
		);
	}
?>
				</div>
			</div>
		</div>
	</div>
<?php
}
?>
	<div class="hikashop_discounts_footer">
		<div class="hikamarket_pagination">
			<?php echo $this->pagination->getListFooter(); ?>
			<?php echo $this->pagination->getResultsCounter(); ?>
		</div>
	</div>
</div>
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="listing" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="boxchecked"
value="0" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>
<?php if($this->discount_action_publish) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.toggleDiscount = function(el) {
	var w=window, d=document, o=w.Oby,
		state = el.getAttribute('data-toggle-state'),
		id = el.getAttribute('data-toggle-id');
	if(!id) return false;
	var url="<?php echo
hikamarket::completeLink('toggle','ajax',true);
?>",
		v = (state == 0) ? 1 : 0,
		data=o.encodeFormData({"task":"discount_published-"+id,"value":v,"table":"discount","<?php
echo hikamarket::getFormToken(); ?>":1});
	el.disabled = true;
	if(state == 1) el.innerHTML = "<i class=\"fas fa-spinner
fa-pulse\"></i> <?php echo
JText::_('HIKA_UNPUBLISHING', true); ?>";
	else el.innerHTML = "<i class=\"fas fa-spinner
fa-pulse\"></i> <?php echo
JText::_('HIKA_PUBLISHING', true); ?>";
	el.classList.remove("hikabtn-success",
"hikabtn-danger");
	o.xRequest(url,{mode:"POST",data:data},function(x,p){
		if(x.responseText && x.responseText == '1')
			state = v;
		el.disabled = false;
		el.setAttribute('data-toggle-state', v);
		if(state == 1) el.innerHTML = "<i class=\"fas
fa-check\"></i> <?php echo
JText::_('HIKA_PUBLISHED', true); ?>";
		else el.innerHTML = "<i class=\"fas
fa-times\"></i> <?php echo
JText::_('HIKA_UNPUBLISHED', true); ?>";
		el.classList.add( state ? "hikabtn-success" :
"hikabtn-danger" );
	});
};
</script>
<?php } ?>
<?php if($this->discount_action_delete) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.deleteDiscount = function(id, name) {
	var confirmMsg = "<?php echo
JText::_('CONFIRM_DELETE_DISCOUNT_X'); ?>";
	if(!confirm(confirmMsg.replace('{DISCOUNT}', decodeURI(name))))
		return false;
	var f = document.forms['hikamarket_delete_discount_form'];
	if(!f) return false;
	f.discount_id.value = id;
	f.submit();
	return false;
};
</script>
<form action="<?php echo
hikamarket::completeLink('discount&task=delete'); ?>"
method="post" name="hikamarket_delete_discount_form"
id="hikamarket_delete_discount_form">
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="delete" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="discount_id"
value="0" />
	<?php echo JHTML::_('form.token'); ?>
</form>
<?php }
views/discountmarket/tmpl/listing.xml000064400000001252151166607740014121
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor discount listing</name>
		<params addpath="/components/com_hikamarket/params">
			<param name="options" type="selectoptions"
default="module" label="options"
description="HikaMarket options" />
		</params>
	</state>
	<layout
title="COM_HIKAMARKET_DISCOUNTMARKET_LISTING_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
		<fieldset name="basic" label="HikaMarket
Options">
			<field id="options" name="options"
type="selectoptions" label="options"
description="HikaMarket options" />
		</fieldset>
	</fields>
</metadata>views/discountmarket/tmpl/show.php000064400000037227151166607740013432
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><script type="text/javascript">
window.discountMgr = {};
window.discountMgr.cpt = {};
</script>
<form action="<?php echo
hikamarket::completeLink('discount');?>"
method="post" name="hikamarket_form"
id="hikamarket_discount_form">
	<dl class="hikam_options large">
<?php
	if(hikamarket::acl('discount/edit/code')) { ?>
		<dt
class="hikamarket_discount_code"><label><?php echo
JText::_('DISCOUNT_CODE'); ?></label></dt>
		<dd class="hikamarket_discount_code"><input
type="text" size="45"
name="data[discount][discount_code]" value="<?php echo
$this->escape(@$this->discount->discount_code); ?>"
/></dd>
<?php }

	if(hikamarket::acl('discount/edit/type')) { ?>
		<dt
class="hikamarket_discount_type"><label><?php echo
JText::_('DISCOUNT_TYPE'); ?></label></dt>
		<dd class="hikamarket_discount_type">
<?php
			$options = array(
				JHTML::_('select.option', 'coupon',
JText::_('COUPONS')),
				JHTML::_('select.option', 'discount',
JText::_('DISCOUNTS')),
			);
			echo JHTML::_('select.genericlist', $options,
'data[discount][discount_type]',
'onchange="hikashopToggleDiscount(this.value);"',
'value', 'text',
@$this->discount->discount_type);
?>
<script type="text/javascript">
function hikashopToggleDiscount(value) {
	var els = document.querySelectorAll("[data-discount-display]");
	for(var i = els.length - 1; i >= 0; i--) { els[i].style.display =
(els[i].getAttribute("data-discount-display") == value) ?
"" : "none"; }
}
window.hikashop.ready(function(){ hikashopToggleDiscount('<?php
echo !empty($this->discount->discount_type) ?
$this->escape($this->discount->discount_type) :
'coupon'; ?>'); });
</script>
		</dd>
<?php }

	if(hikamarket::acl('discount/edit/flatamount')) { ?>
		<dt
class="hikamarket_discount_flatamount"><label><?php
echo JText::_('DISCOUNT_FLAT_AMOUNT');
?></label></dt>
		<dd class="hikamarket_discount_flatamount">
			<input type="text" size="30"
name="data[discount][discount_flat_amount]" value="<?php
echo $this->escape(@$this->discount->discount_flat_amount);
?>" />
			<?php echo
$this->currencyType->display('data[discount][discount_currency_id]',
@$this->discount->discount_currency_id); ?>
		</dd>
<?php }

	if(hikamarket::acl('discount/edit/percentamount')) { ?>
		<dt
class="hikamarket_discount_percentamount"><label><?php
echo JText::_('DISCOUNT_PERCENT_AMOUNT');
?></label></dt>
		<dd class="hikamarket_discount_percentamount"><input
type="text" size="30"
name="data[discount][discount_percent_amount]"
value="<?php echo
$this->escape(@$this->discount->discount_percent_amount);
?>" /></dd>
<?php }

	if(hikamarket::acl('discount/edit/taxcategory')) { ?>
		<dt data-discount-display="coupon"
class="hikamarket_discount_tax"><label><?php echo
JText::_('AUTOMATIC_TAXES'); ?></label></dt>
		<dd data-discount-display="coupon"
class="hikamarket_discount_tax">
			<?php echo
$this->radioType->booleanlist('data[discount][discount_tax]',
'onchange="hikashopToggleTax(this.value);"',
@$this->discount->discount_tax); ?>
<script type="text/javascript">
function hikashopToggleTax(value) {
	var els = document.querySelectorAll("[data-tax-display]");
	for(var i = els.length - 1; i >= 0; i--) { els[i].style.display =
(els[i].getAttribute("data-tax-display") == value) ?
"none" : ""; }
}
window.hikashop.ready(function(){ hikashopToggleTax('<?php echo
(int)@$this->discount->discount_tax; ?>'); });
</script>
		</dd>

		<dt data-discount-display="coupon"
data-tax-display="1"
class="hikamarket_discount_taxcategory"><label><?php
echo JText::_('TAXATION_CATEGORY');
?></label></dt>
		<dd data-discount-display="coupon"
data-tax-display="1"
class="hikamarket_discount_taxcategory"><?php echo
$this->categoryType->display('data[discount][discount_tax_id]',
@$this->discount->discount_tax_id, 'tax');
?></dd>
<?php }

	if(hikamarket::acl('discount/edit/usedtimes')) { ?>
		<dt
class="hikamarket_discount_usedtimes"><label><?php
echo JText::_('DISCOUNT_USED_TIMES');
?></label></dt>
		<dd class="hikamarket_discount_usedtimes"><input
type="text" size="30"
name="data[discount][discount_used_times]" value="<?php
echo $this->escape(@$this->discount->discount_used_times);
?>" /></dd>
<?php }

	if(hikamarket::acl('discount/edit/published')) { ?>
		<dt
class="hikamarket_discount_publish"><label><?php echo
JText::_('HIKA_PUBLISHED'); ?></label></dt>
		<dd class="hikamarket_discount_publish"><?php
			echo
$this->radioType->booleanlist('data[discount][discount_published]',
'', @$this->discount->discount_published);
		?></dd>
<?php }

	if(hikamarket::acl('discount/edit/dates')) { ?>
		<dt
class="hikamarket_discount_dates"><label><?php echo
JText::_('HIKA_DATES'); ?></label></dt>
		<dd class="hikamarket_discount_dates"><?php
			echo JHTML::_('calendar',
hikamarket::getDate((@$this->discount->discount_start?@$this->discount->discount_start:''),'%Y-%m-%d
%H:%M'),
'data[discount][discount_start]','discount_start','%Y-%m-%d
%H:%M',array('size' => '20'));
			echo ' <span class="calendar-separator">' .
JText::_('HIKA_RANGE_TO') . '</span> ';
			echo JHTML::_('calendar',
hikamarket::getDate((@$this->discount->discount_end?@$this->discount->discount_end:''),'%Y-%m-%d
%H:%M'),
'data[discount][discount_end]','discount_end','%Y-%m-%d
%H:%M',array('size' => '20'));
		?></dd>
<?php }

	if(hikashop_level(1)) {
		if(hikamarket::acl('discount/edit/minorder')) { ?>
		<dt data-discount-display="coupon"
class="hikamarket_discount_minorder"><label><?php
echo JText::_('MINIMUM_ORDER_VALUE');
?></label></dt>
		<dd data-discount-display="coupon"
class="hikamarket_discount_minorder"><input
type="text" size="30"
name="data[discount][discount_minimum_order]"
value="<?php echo
$this->escape(@$this->discount->discount_minimum_order);
?>" /></dd>
<?php	}

		if(hikamarket::acl('discount/edit/minproducts')) { ?>
		<dt data-discount-display="coupon"
class="hikamarket_discount_minproducts"><label><?php
echo JText::_('MINIMUM_NUMBER_OF_PRODUCTS');
?></label></dt>
		<dd data-discount-display="coupon"
class="hikamarket_discount_minproducts"><input
type="text" size="30"
name="data[discount][discount_minimum_products]"
value="<?php echo
$this->escape(@$this->discount->discount_minimum_products);
?>" /></dd>
<?php	}

		if(hikamarket::acl('discount/edit/quota')) { ?>
		<dt
class="hikamarket_discount_quota"><label><?php echo
JText::_('DISCOUNT_QUOTA'); ?></label></dt>
		<dd class="hikamarket_discount_quota"><input
type="text" size="30"
name="data[discount][discount_quota]" value="<?php echo
$this->escape(@$this->discount->discount_quota); ?>"
/></dd>
<?php	}

		if(hikamarket::acl('discount/edit/peruser')) { ?>
		<dt data-discount-display="coupon"
class="hikamarket_discount_peruser"><label><?php echo
JText::_('DISCOUNT_QUOTA_PER_USER');
?></label></dt>
		<dd data-discount-display="coupon"
class="hikamarket_discount_peruser"><input
type="text" size="30"
name="data[discount][discount_quota_per_user]"
value="<?php echo
$this->escape(@$this->discount->discount_quota_per_user);
?>" /></dd>
<?php	}

		if(hikamarket::acl('discount/edit/product')) { ?>
		<dt
class="hikamarket_discount_product"><label><?php echo
JText::_('PRODUCT'); ?></label></dt>
		<dd class="hikamarket_discount_product"><?php
			$product_id = null;
			if(!empty($this->discount->discount_product_id))
				$product_id = explode(',',
trim($this->discount->discount_product_id, ','));
			echo $this->nameboxType->display(
				'data[discount][discount_product_id]',
				$product_id,
				hikamarketNameboxType::NAMEBOX_MULTIPLE,
				'product',
				array(
					'delete' => true,
					'root' => $this->rootCategory,
					'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
					'variants' => 2,
					'url_params' => array('VARIANTS' => 2)
				)
			);
		?></dd>
<?php	}

		if(hikamarket::acl('discount/edit/category')) { ?>
		<dt
class="hikamarket_discount_category"><label><?php
echo JText::_('CATEGORY'); ?></label></dt>
		<dd class="hikamarket_discount_category"><?php
			$category_id = null;
			if(!empty($this->discount->discount_category_id))
				$category_id = explode(',',
trim($this->discount->discount_category_id, ','));
			echo $this->nameboxType->display(
				'data[discount][discount_category_id]',
				$category_id,
				hikamarketNameboxType::NAMEBOX_MULTIPLE,
				'category',
				array(
					'delete' => true,
					'root' => $this->rootCategory,
					'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
				)
			);
		?></dd>
<?php	}

		if(hikamarket::acl('discount/edit/categorychild')) { ?>
		<dt
class="hikamarket_discount_categorychild"><label><?php
echo JText::_('INCLUDING_SUB_CATEGORIES');
?></label></dt>
		<dd class="hikamarket_discount_categorychild"><?php
echo
$this->radioType->booleanlist('data[discount][discount_category_childs]'
, '', @$this->discount->discount_category_childs);
?></dd>
<?php	}

		if(hikamarket::acl('discount/edit/zone')) { ?>
		<dt
class="hikamarket_discount_zone"><label><?php echo
JText::_('ZONE'); ?></label></dt>
		<dd class="hikamarket_discount_zone"><?php
			$zone_id = null;
			if(!empty($this->discount->discount_zone_id))
				$zone_id = explode(',',
trim($this->discount->discount_zone_id, ','));
			echo $this->nameboxType->display(
				'data[discount][discount_zone_id]',
				$zone_id,
				hikamarketNameboxType::NAMEBOX_MULTIPLE,
				'zone',
				array(
					'delete' => true,
					'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
				)
			);
		?></dd>
<?php	}

		if(hikashop_level(2) &&
hikamarket::acl('discount/edit/user')) { ?>
		<dt
class="hikamarket_discount_user"><label><?php echo
JText::_('USERS'); ?></label></dt>
		<dd class="hikamarket_discount_user"><?php
			$discount_user_id = null;
			if(!empty($this->discount->discount_user_id))
				$discount_user_id = explode(',',
trim($this->discount->discount_user_id, ','));
			echo $this->nameboxType->display(
				'data[discount][discount_user_id]',
				$discount_user_id,
				hikamarketNameboxType::NAMEBOX_MULTIPLE,
				'user',
				array(
					'delete' => true,
					'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
				)
			);
		?></dd>
<?php	}

		if($this->vendor->vendor_id == 1 && hikamarket::level(1)
&& hikamarket::acl('discount/edit/targetvendor')) {
?>
	<dt
class="hikamarket_discount_targetvendor"><label><?php
echo JText::_('DISCOUNT_TARGET_VENDOR');
?></label></dt>
	<dd class="hikamarket_discount_targetvendor"><?php
		$discount_vendor_id =
(int)@$this->discount->discount_target_vendor;
		if($discount_vendor_id > 1) {
			$vendorClass = hikamarket::get('class.vendor');
			$discountVendor = $vendorClass->get($discount_vendor_id);
			$discount_vendor_name = $discount_vendor_id . ' - ' .
$discountVendor->vendor_name;
		} else {
			$discount_vendor_id = -1;
			$discount_vendor_name = JText::_('HIKAM_SELECT_VENDOR');
		}
		$values = array(
			JHTML::_('select.option', '0',
JText::_('HIKASHOP_NO')),
			JHTML::_('select.option', '1',
JText::_('HIKASHOP_YES')),
			JHTML::_('select.option', $discount_vendor_id,
$discount_vendor_name)
		);

		echo $this->radioType->radiolist($values,
'data[discount][discount_target_vendor]',
'onchange="window.discountMgr.setVendor(this,
false);"', 'value', 'text',
@$this->discount->discount_target_vendor);

		$popup = hikamarket::get('shop.helper.popup');
		echo $this->popup->display(
			'', //$popupLinkData,
			'EDIT',
			hikamarket::completeLink('vendor&task=selection&single=1',
true),
			'market_discount_set_vendor',
			760, 480, 'onclick="return
window.discountMgr.changeVendor(this);"', '',
'link'
		);
?>
<script type="text/javascript">
window.discountMgr.current_vendor = <?php echo $discount_vendor_id;
?>;
window.discountMgr.setVendor = function(el, c) {
	var v = 0;
	if(el.value) v = parseInt(el.value);
	if(v == -1 || (c && v > 1 && v ==
window.discountMgr.current_vendor && el.checked)) {
		var p = document.getElementById("market_discount_set_vendor");
		window.discountMgr.changeVendor(p);
	}
	if(c)
		window.discountMgr.current_vendor = v;
}
window.discountMgr.changeVendor = function(el) {
	window.hikamarket.submitFct = function(data) {
		var d = document, w = window, o = w.Oby,
			el =
d.getElementById("data[discount][discount_target_vendor]-1"),
			lbl =
d.getElementById("data[discount][discount_target_vendor]-1-lbl");
		if(!data.id && data[0]) data = data[0];
		if(!el) el =
d.getElementById("data_discount_discount_target_vendor-1");
		if(el) el.value = data.id;
		if(el && !el.checked) el.checked = "checked";
		if(!lbl) { lbl = el; while(lbl && lbl.nodeName.toLowerCase() !=
"label") { lbl = lbl.nextSibling; } }
		if(lbl) lbl.innerHTML = data.id + " - " + data.vendor_name;
	};
	window.hikamarket.openBox(el,null,(el.getAttribute("rel") ==
null));
	return false;
}
</script>
<?php
		}

		if(hikamarket::acl('discount/edit/autoload')) { ?>
		<dt data-discount-display="coupon"
class="hikamarket_discount_autoload"><label><?php
echo JText::_('COUPON_AUTO_LOAD');
?></label></dt>
		<dd data-discount-display="coupon"
class="hikamarket_discount_autoload"><?php echo
$this->radioType->booleanlist('data[discount][discount_auto_load]'
, '', @$this->discount->discount_auto_load);
?></dd>
<?php	}

		if(hikamarket::acl('discount/edit/percenttoproduct')) { ?>
		<dt data-discount-display="coupon"
class="hikamarket_discount_percenttoproduct"><label><?php
echo JText::_('COUPON_APPLIES_TO_PRODUCT_ONLY');
?></label></dt>
		<dd data-discount-display="coupon"
class="hikamarket_discount_percenttoproduct"><?php echo
$this->radioType->booleanlist('data[discount][discount_coupon_product_only]'
, '', @$this->discount->discount_coupon_product_only);
?></dd>
<?php	}

		if(hikamarket::acl('discount/edit/nodoubling')) { ?>
		<dt data-discount-display="coupon"
class="hikamarket_discount_nodoubling"><label><?php
echo JText::_('COUPON_HANDLING_OF_DISCOUNTED_PRODUCTS');
?></label></dt>
		<dd data-discount-display="coupon"
class="hikamarket_discount_nodoubling"><?php
			$options = array(
				JHTML::_('select.option', 0,
JText::_('STANDARD_BEHAVIOR')),
				JHTML::_('select.option', 1,
JText::_('IGNORE_DISCOUNTED_PRODUCTS')),
				JHTML::_('select.option', 2,
JText::_('OVERRIDE_DISCOUNTED_PRODUCTS'))
			);
			echo JHTML::_('hikaselect.genericlist', $options,
'data[discount][discount_coupon_nodoubling]', '',
'value', 'text',
@$this->discount->discount_coupon_nodoubling);
		?></dd>
<?php	}
	}

	JPluginHelper::importPlugin('hikashop');
	$html = array();
	JFactory::getApplication()->triggerEvent('onDiscountFrontBlocksDisplay',
array(&$this->discount, &$html));
	if(!empty($html))
		echo implode("\r\n", $html);

	if(hikashop_level(2) &&
hikamarket::acl('discount/edit/acl')) {
?>
		<dt class="hikamarket_discount_acl"><label><?php
echo JText::_('ACCESS_LEVEL'); ?></label></dt>
		<dd class="hikamarket_discount_acl"><?php
			$discount_access = 'all';
			if(isset($this->discount->discount_access))
				$discount_access = $this->discount->discount_access;
			echo
$this->joomlaAcl->display('data[discount][discount_access]',
$discount_access, true, true);
		?></dd>
<?php
	}
?>
	</dl>
	<input type="hidden" name="cancel_action"
value="<?php echo @$this->cancel_action; ?>"/>
	<input type="hidden" name="cid"
value="<?php echo @$this->discount->discount_id;
?>"/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
	<input type="hidden" name="task"
value="show"/>
	<input type="hidden" name="ctrl"
value="discount"/>
	<?php echo JHTML::_('form.token'); ?>
</form>
<script type="text/javascript">
window.hikashop.ready(function(){
window.hikamarket.dlTitle('hikamarket_discount_form'); });
</script>
views/discountmarket/view.html.php000064400000025640151166607740013407
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class discountmarketViewdiscountmarket extends hikamarketView {

	protected $ctrl = 'discount';
	protected $icon = 'discount';

	public function display($tpl = null, $params = array()) {
		$this->params =& $params;
		$fct = $this->getLayout();
		if(method_exists($this, $fct)) {
			if($this->$fct() === false)
				return;
		}
		parent::display($tpl);
	}

	public function listing($tpl = null) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.listing';

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$toggleClass = hikamarket::get('helper.toggle');
		$this->assignRef('toggleClass', $toggleClass);

		$currencyClass = hikamarket::get('shop.class.currency');
		$this->assignRef('currencyClass', $currencyClass);

		$manage = hikamarket::acl('discount/edit') ||
hikamarket::acl('discount/show');
		$this->assignRef('manage', $manage);

		$discount_action_publish =
hikamarket::acl('discount/edit/published');
		$discount_action_delete = hikamarket::acl('discount/delete');
		$discount_actions = $discount_action_publish || $discount_action_delete;
		$this->assignRef('discount_action_publish',
$discount_action_publish);
		$this->assignRef('discount_action_delete',
$discount_action_delete);
		$this->assignRef('discount_actions', $discount_actions);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid = '&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$cfg = array(
			'table' => 'shop.discount',
			'main_key' => 'discount_id',
			'order_sql_value' => 'discount.discount_id'
		);
		$default_sort_dir = 'asc';

		$listing_filters = array(
			'vendors' => -1,
			'published' => -1,
			'type' => '',
		);

		$pageInfo = $this->getPageInfo($cfg['order_sql_value'],
$default_sort_dir, $listing_filters);

		$filters = array();
		$searchMap = array(
			'discount.discount_code',
			'discount.discount_id'
		);
		$order = '';

		if($vendor->vendor_id > 1) {
			$filters[] = 'discount.discount_target_vendor = ' .
(int)$vendor->vendor_id;
		} else {
			$vendorType = hikamarket::get('type.filter_vendor');
			$this->assignRef('vendorType', $vendorType);
			if($pageInfo->filter->vendors >= 0) {
				if($pageInfo->filter->vendors > 1)
					$filters[] = 'discount.discount_target_vendor =
'.(int)$pageInfo->filter->vendors;
				else
					$filters[] = 'discount.discount_target_vendor <= 1';
			}
		}
		if(!empty($pageInfo->filter->type) &&
in_array($pageInfo->filter->type, array('discount',
'coupon'))) {
			$filters['discount_type'] = 'discount.discount_type =
' . $db->Quote($pageInfo->filter->type);
		}
		if($pageInfo->filter->published >= 0) {
			$filters['published'] = 'discount.discount_published =
' . ($pageInfo->filter->published ? '1' :
'0');
		}

		$this->processFilters($filters, $order, $searchMap);

		$query = 'FROM
'.hikamarket::table($cfg['table']).' AS discount
'.$filters.$order;
		$db->setQuery('SELECT * '.$query,
(int)$pageInfo->limit->start, (int)$pageInfo->limit->value);

		$rows = $db->loadObjectList();
		$this->assignRef('discounts', $rows);

		$db->setQuery('SELECT COUNT(*) '.$query);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($rows);

		if($pageInfo->elements->page) {
			$productIds = array();
			$categoryIds = array();
			$zoneNamekeys = array();

			foreach($rows as $row) {
				if(!empty($row->discount_product_id)) {
					if(strpos($row->discount_product_id, ',') === false)
						$productIds[] = (int)$row->discount_product_id;
					else
						$productIds = array_merge($productIds, explode(',',
trim($row->discount_product_id, ',')));
				}
				if(!empty($row->discount_category_id)) {
					if(strpos($row->discount_category_id, ',') === false)
						$categoryIds[] = (int)$row->discount_category_id;
					else
						$categoryIds = array_merge($categoryIds, explode(',',
trim($row->discount_category_id, ',')));
				}
				if(!empty($row->discount_zone_id)) {
					if(strpos($row->discount_zone_id, ',') === false)
						$zoneNamekeys[] = $row->discount_zone_id;
					else
						$zoneNamekeys = explode(',',
trim($row->discount_zone_id, ','));
				}
			}

			if(!empty($productIds)) {
				hikamarket::toInteger($productIds);
				$query = 'SELECT * FROM
'.hikamarket::table('shop.product').' WHERE product_id
IN ('.implode(',',$productIds).')';
				$db->setQuery($query);
				$products = $db->loadObjectList();
				foreach($rows as &$row) {
					if(empty($row->discount_product_id))
						continue;

					$pid = explode(',', trim($row->discount_product_id,
','));
					$row->product_name = array();
					foreach($products as $product) {
						if(in_array($product->product_id, $pid))
							$row->product_name[] = $product->product_name;
					}
					if(!empty($row->product_name)) {
						$row->product_name = implode(', ',
$row->product_name);
					} else
						$row->product_name = JText::_('PRODUCT_NOT_FOUND');
				}
				unset($row);
			}

			if(!empty($categoryIds)) {
				hikamarket::toInteger($categoryIds);
				$query = 'SELECT * FROM
'.hikamarket::table('shop.category').' WHERE
category_id IN ('.implode(',',$categoryIds).')';
				$db->setQuery($query);
				$categories = $db->loadObjectList();
				foreach($rows as &$row){
					if(empty($row->discount_category_id))
						continue;

					$pid = explode(',', trim($row->discount_category_id,
','));
					$row->category_name = array();
					foreach($categories as $category) {
						if(in_array($category->category_id, $pid))
							$row->category_name[] = $category->category_name;
					}
					if(!empty($row->category_name)) {
						$row->category_name = implode(', ',
$row->category_name);
					} else
						$row->category_name = JText::_('CATEGORY_NOT_FOUND');
				}
				unset($row);
			}

			if(!empty($zoneNamekeys)) {
				foreach($zoneNamekeys as &$zoneNamekey) {
					$zoneNamekey = $db->Quote($zoneNamekey);
				}
				unset($zoneNamekey);
				$query = 'SELECT * FROM
'.hikamarket::table('shop.zone').' WHERE zone_namekey
IN ('.implode(',',$zoneNamekeys).')';
				$db->setQuery($query);
				$zones = $db->loadObjectList();
				foreach($rows as &$row){
					if(empty($row->discount_zone_id))
						continue;

					$pid = explode(',', trim($row->discount_zone_id,
','));
					$row->zone_name_english = array();
					foreach($zones as $zone) {
						if(in_array($zone->zone_namekey, $pid))
							$row->zone_name_english[] = $zone->zone_name_english;
					}
					if(!empty($row->zone_name_english)) {
						$row->zone_name_english = implode(', ',
$row->zone_name_english);
					} else
						$row->zone_name_english = JText::_('ZONE_NOT_FOUND');
				}
				unset($row);
			}
		}
		$text_asc = JText::_('ASCENDING');
		$text_desc = JText::_('DESCENDING');
		$ordering_values = array(
			'discount.discount_id' => JText::_('SORT_ID'),
			'discount.discount_code' =>
JText::_('SORT_NAME'),
			'discount.discount_type' =>
JText::_('SORT_TYPE'),
			'discount.discount_start' =>
JText::_('SORT_START_DATE'),
			'discount.discount_end' =>
JText::_('SORT_END_DATE'),
		);
		$this->ordering_values = array();
		foreach($ordering_values as $k => $v) {
			$this->ordering_values[$k.' asc'] = $v . ' '
.$text_asc;
			$this->ordering_values[$k.' desc'] = $v . ' '
.$text_desc;
		}
		$this->full_ordering =
$this->pageInfo->filter->order->value . ' ' .
strtolower($this->pageInfo->filter->order->dir);

		$this->toolbar = array(
			array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'), 'url'
=> hikamarket::completeLink('vendor')
			),
			array(
				'icon' => 'new',
				'fa' => 'fa-plus-circle',
				'name' => JText::_('HIKA_NEW'),
				'url' =>
hikamarket::completeLink('discount&task=add'),
				'pos' => 'right',
				'display' => hikamarket::acl('discount/add')
			)
		);

		$this->getPagination();
	}

	public function show() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.edit';

		hikamarket::loadJslib('tooltip');

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$toggleClass = hikamarket::get('helper.toggle');
		$this->assignRef('toggleClass', $toggleClass);
		$popup = hikamarket::get('shop.helper.popup');
		$this->assignRef('popup', $popup);

		$discount_id = hikamarket::getCID('discount_id');
		$this->loadRef(array(
			'discountClass' => 'shop.class.discount',
			'productClass' => 'shop.class.product',
			'categoryClass' => 'shop.class.category',
			'currencyClass' => 'shop.class.currency',
			'vendorClass' => 'class.vendor',
			'categoryType' => 'type.shop_category',
			'nameboxType' => 'type.namebox',
			'currencyType' => 'shop.type.currency',
			'radioType' => 'shop.type.radio',
		));

		$main_currency = $shopConfig->get('main_currency',1);
		$this->assignRef('main_currency_id', $main_currency);

		$discount = $this->discountClass->get($discount_id);
		$this->assignRef('discount', $discount);

		if(hikashop_level(1)) {
			$rootCategory = $this->vendorClass->getRootCategory($vendor);
			$this->assignRef('rootCategory', $rootCategory);

			$this->loadRef(array(
				'categoryType' => 'type.shop_category',
				'productsType' => 'type.products'
			));
		}

		if(hikashop_level(2)) {
			hikamarket::loadJslib('otree');
			$joomlaAcl = hikamarket::get('type.joomla_acl');
			$this->assignRef('joomlaAcl', $joomlaAcl);
		}

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' => hikamarket::completeLink('discount')
			),
			'apply' => array(
				'url' => '#apply',
				'fa' => 'fa-check-circle',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'apply\',\'hikamarket_discount_form\');"',
				'icon' => 'apply',
				'name' => JText::_('HIKA_APPLY'),
'pos' => 'right',
				'display' => hikamarket::acl('discount/edit')
			),
			'save' => array(
				'url' => '#save',
				'fa' => 'fa-save',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save\',\'hikamarket_discount_form\');"',
				'icon' => 'save',
				'name' => JText::_('HIKA_SAVE'), 'pos'
=> 'right',
				'display' => hikamarket::acl('discount/edit')
			)
		);
	}
}
views/index.html000064400000000032151166607740007706
0ustar00<html><body></body></html>views/layouts/index.html000064400000000032151166607740011406
0ustar00<html><body></body></html>views/layouts/tmpl/index.html000064400000000032151166607740012362
0ustar00<html><body></body></html>views/layouts/tmpl/search.php000064400000002443151166607740012353
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$value = $this->params->get('value',
$this->pageInfo->search);
$map = $this->params->get('map', 'search');
$id = $this->params->get('id', $map);
$filter_btn = $this->params->get('filter_btn',
'');
?>
<div class="hikamarket_search_block">
	<div class="hk-input-group">
		<input type="text" name="<?php echo $map
;?>" id="<?php echo $id; ?>" value="<?php
echo $this->escape($value); ?>"
class="hk-form-control" placeholder="<?php echo
JText::_('HIKA_SEARCH'); ?>"/>
		<div class="hk-input-group-append">
			<button class="hikabtn"
onclick="hikamarket.searchSubmit(this);"><i class="fas
fa-search"></i></button>
			<button class="hikabtn"
onclick="hikamarket.searchReset(this);"><i class="fas
fa-times"></i></button>
		</div>
	</div>
<?php if(!empty($filter_btn)) { ?>
	<button class="hikabtn hikam_toggle" onclick="return
hikamarket.searchFilters(this, '<?php echo
$this->escape($filter_btn); ?>');"><i class="fas
fa-filter"></i> <?php echo
JText::_('HIKAM_TOGGLE_FILTERS'); ?></button>
<?php } ?>
</div>
views/ordermarket/index.html000064400000000032151166607740012225
0ustar00<html><body></body></html>views/ordermarket/tmpl/create.php000064400000002716151166607750013174
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('order');?>"
method="post" name="hikamarket_form"
id="hikamarket_order_create_form">

	<dl class="hikam_options">
		<dt
class="hikamarket_order_customer"><label><?php echo
JText::_('CUSTOMER'); ?></label></dt>
		<dd class="hikamarket_order_customer"><?php
			echo $this->nameboxType->display(
				'data[order][order_user_id]',
				'',
				hikamarketNameboxType::NAMEBOX_SINGLE,
				'user',
				array(
					'customer' => true,
					'delete' => true,
					'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
					'id' =>
'hikamarket_order_create_customer_namebox'
				)
			);
		?></dd>

		<dt
class="hikamarket_order_currency"><label><?php echo
JText::_('CURRENCY'); ?></label></dt>
		<dd class="hikamarket_order_currency"><?php
			echo
$this->currencyType->display('data[order][order_currency_id]',
$this->main_currency);
		?></dd>
	</dl>

	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="create" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<?php echo JHTML::_('form.token'); ?>
</form>
views/ordermarket/tmpl/customer_set.php000064400000006320151166607750014440
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('order&task=customer_save')
;?>" method="post" name="hikamarket_form"
id="hikamarket_form">
<div class="hikam_confirm">
	<?php echo JText::_('HIKA_CONFIRM_USER')?><br/>
	<table class="hikam_options">
		<tbody>
			<tr>
				<td class="key"><label><?php echo
JText::_('HIKA_NAME'); ?></label></td>
				<td id="hikamarket_order_customer_name"><?php echo
$this->rows->name; ?></td>
			</tr>
			<tr>
				<td class="key"><label><?php echo
JText::_('HIKA_EMAIL'); ?></label></td>
				<td id="hikamarket_order_customer_email"><?php echo
$this->rows->email; ?></td>
			</tr>
			<tr>
				<td class="key"><label><?php echo
JText::_('ID'); ?></label></td>
				<td id="hikamarket_order_customer_id"><?php echo
$this->rows->user_id; ?></td>
			</tr>
<?php if(hikamarket::acl('order/edit/billingaddress')) {
?>
			<tr>
				<td class="key"><label><?php echo
JText::_('SET_USER_ADDRESS'); ?></label></td>
				<td><?php echo JHTML::_('hikaselect.booleanlist',
'set_user_address', '', 0); ?></td>
			</tr>
<?php } ?>
<?php if(hikamarket::acl('order/edit/history')) { ?>
			<tr>
				<td class="key"><label><?php echo
JText::_('HISTORY'); ?></label></td>
				<td>
					<span><input
onchange="window.orderMgr.orderadditional_history_changed(this);"
type="checkbox"
id="hikamarket_history_orderadditional_store"
name="data[history][store_data]"
value="1"/><label
for="hikamarket_history_orderadditional_store"
style="display:inline-block"><?php echo
JText::_('SET_HISTORY_MESSAGE');?></label></span><br/>
					<textarea id="hikamarket_history_orderadditional_msg"
name="data[history][history_data]"
style="display:none;"></textarea>
				</td>
			</tr>
<?php } ?>
		</tbody>
	</table>
	<input type="hidden"
name="data[order][order_user_id]" value="<?php echo
$this->rows->user_id; ?>"/>
	<input type="hidden" name="cid"
value="<?php echo $this->order_id; ?>"/>
	<input type="hidden" name="order_id"
value="<?php echo $this->order_id; ?>"/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="customer_save" />
	<input type="hidden" name="finalstep"
value="1" />
	<input type="hidden" name="single"
value="1" />
	<input type="hidden" name="ctrl"
value="order" />
	<input type="hidden" name="tmpl"
value="component" />
	<?php echo JHTML::_('form.token'); ?>
	<div class="hikam_confirm_btn">
		<button onclick="hikamarket.submitform('customer_save',
'hikamarket_form');" class="hikabtn
hikabtn-success"><i class="fas fa-check"></i>
<span><?php echo Jtext::_('HIKA_OK');
?></span></button>
	</div>
</div>
<script type="text/javascript">
if(!window.orderMgr)
	window.orderMgr = {};
window.orderMgr.orderadditional_history_changed = function(el) {
	var fields = ['hikamarket_history_orderadditional_msg'],
displayValue = '';
	if(!el.checked) displayValue = 'none';
	window.hikamarket.setArrayDisplay(fields, displayValue);
}
</script>
</form>
views/ordermarket/tmpl/edit_additional.php000064400000025164151166607750015050
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('order&task=save&subtask=additional&tmpl=component');
?>" name="hikamarket_order_additional_form"
id="hikamarket_order_additional_form" method="post"
enctype="multipart/form-data">
	<dl class="hikam_options">
		<dt
class="hikamarket_order_additional_subtotal"><label><?php
echo JText::_('SUBTOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_additional_subtotal"><span><?php
echo
$this->currencyHelper->format($this->order->order_subtotal,$this->order->order_currency_id);
?></span></dd>
<?php if(isset($this->edit) && $this->edit === true
&& hikamarket::acl('order/edit/coupon')) { ?>
		<dt
class="hikamarket_order_additional_coupon"><label><?php
echo JText::_('HIKASHOP_COUPON'); ?></label></dt>
		<dd class="hikamarket_order_additional_coupon">
			<input type="text"
name="data[order][order_discount_code]" value="<?php echo
$this->escape(@$this->order->order_discount_code); ?>"
/><br/>
			<input type="text"
name="data[order][order_discount_price]" value="<?php
echo @$this->order->order_discount_price; ?>"
/><br/>
			<input type="text"
name="data[order][order_discount_tax]" value="<?php echo
@$this->order->order_discount_tax; ?>" />
			<?php echo $this->ratesType->display(
"data[order][order_discount_tax_namekey]" ,
@$this->order->order_discount_tax_namekey ); ?>
		</dd>
<?php } else { ?>
		<dt
class="hikamarket_order_additional_coupon"><label><?php
echo JText::_('HIKASHOP_COUPON'); ?></label></dt>
		<dd
class="hikamarket_order_additional_coupon"><span><?php
echo
$this->currencyHelper->format($this->order->order_discount_price*-1.0,$this->order->order_currency_id);
?> <?php echo $this->order->order_discount_code;
?></span></dd>
<?php }

	if(isset($this->edit) && $this->edit === true &&
hikamarket::acl('order/edit/shipping')) { ?>
		<dt
class="hikamarket_order_additional_shipping"><label><?php
echo JText::_('SHIPPING'); ?></label></dt>
		<dd class="hikamarket_order_additional_shipping">
<?php if(strpos($this->order->order_shipping_id, ';')
=== false) { ?>
			<?php echo
$this->shippingPlugins->display('data[order][shipping]',$this->order->order_shipping_method,$this->order->order_shipping_id);
?><br/>
<?php } ?>
			<input type="text"
name="data[order][order_shipping_price]" value="<?php
echo $this->order->order_shipping_price; ?>"
/><br/>
			<input type="text"
name="data[order][order_shipping_tax]" value="<?php echo
@$this->order->order_shipping_tax; ?>" />
			<?php echo $this->ratesType->display(
"data[order][order_shipping_tax_namekey]" ,
@$this->order->order_shipping_tax_namekey ); ?><br/>
<?php
		if(strpos($this->order->order_shipping_id, ';') !==
false) {
?>
			<table class="hikam_table table table-striped">
				<thead>
					<tr>
						<th><?php echo JText::_('WAREHOUSE');
?></th>
						<th><?php echo
JText::_('HIKASHOP_SHIPPING_METHOD'); ?></th>
						<th><?php echo JText::_('PRICE');
?></th>
						<th><?php echo JText::_('SHIPPING_TAX');
?></th>
					</tr>
				</thead>
				<tbody>
<?php
			$warehouses = array(
				JHTML::_('select.option', 0,
JText::_('HIKA_NONE'))
			);
			$shipping_ids = explode(';',
$this->order->order_shipping_id);
			foreach($shipping_ids as $shipping_key) {
				$shipping_warehouse = 0;
				if(strpos($shipping_key, '@') !== false)
					list($shipping_id, $shipping_warehouse) = explode('@',
$shipping_key, 2);
				else
					$shipping_id = (int)$shipping_key;
				$warehouses[] = JHTML::_('select.option',
$shipping_warehouse, $shipping_warehouse);
				$shipping_method = '';
				foreach($this->order->shippings as $s) {
					if((int)$s->shipping_id == $shipping_id) {
						$shipping_method = $s->shipping_type;
						break;
					}
				}
				$k = $shipping_id.'_'.$shipping_warehouse;
				$prices =
@$this->order->order_shipping_params->prices[$shipping_key];
?>
					<tr>
						<td><?php echo $shipping_warehouse; ?></td>
						<td><?php echo
$this->shippingPlugins->display('data[order][shipping]['.$shipping_warehouse.']',
$shipping_method,$shipping_id, true, '
style="max-width:160px;"'); ?></td>
						<td><input type="text"
name="data[order][order_shipping_prices][<?php echo
$shipping_warehouse; ?>]" value="<?php echo
@$prices->price_with_tax; ?>" /></td>
						<td><input type="text"
name="data[order][order_shipping_taxs][<?php echo
$shipping_warehouse; ?>]" value="<?php echo
@$prices->tax; ?>" /></td>
					</tr>
<?php
			}
?>				</tbody>
			</table>
			<table class="hikam_table table table-striped">
				<thead>
					<tr>
						<th><?php echo JText::_('PRODUCT');
?></th>
						<th><?php echo JText::_('WAREHOUSE');
?></th>
					</tr>
				</thead>
				<tbody>
<?php
			foreach($this->order->products as $k => $product) {
				$map =
'data[order][warehouses]['.$product->order_product_id.']';
				$value = 0;
				if(strpos($product->order_product_shipping_id, '@') !==
false)
					$value = substr($product->order_product_shipping_id,
strpos($product->order_product_shipping_id, '@')+1);
?>
					<tr>
						<td><?php echo $product->order_product_name;
?></td>
						<td><?php echo JHTML::_('select.genericlist',
$warehouses, $map, 'class="inputbox"',
'value', 'text', $value); ?></td>
					</tr>
<?php
			}
?>
				</tbody>
			</table>
<?php
	} ?>
		</dd>
<?php } else { ?>
		<dt
class="hikamarket_order_additional_shipping"><label><?php
echo JText::_('SHIPPING'); ?></label></dt>
		<dd
class="hikamarket_order_additional_shipping"><span><?php
echo
$this->currencyHelper->format($this->order->order_shipping_price,
$this->order->order_currency_id); ?> - <?php
			if(empty($this->order->order_shipping_method))
				echo
'<em>'.JText::_('NONE').'</em>';
			else
				echo $this->order->order_shipping_method;
			?></span></dd>
<?php }

	if(isset($this->edit) && $this->edit === true &&
hikamarket::acl('order/edit/payment')) { ?>
		<dt
class="hikamarket_order_additional_payment"><label><?php
echo JText::_('HIKASHOP_PAYMENT');
?></label></dt>
		<dd class="hikamarket_order_additional_payment">
			<?php echo
$this->paymentPlugins->display('data[order][payment]',$this->order->order_payment_method,$this->order->order_payment_id);
?><br/>
			<input type="text"
name="data[order][order_payment_price]" value="<?php echo
$this->order->order_payment_price; ?>" /><br/>
			<input type="text"
name="data[order][order_payment_tax]" value="<?php echo
@$this->order->order_payment_tax; ?>" />
			<?php echo $this->ratesType->display(
"data[order][order_payment_tax_namekey]" ,
@$this->order->order_payment_tax_namekey); ?>
		</dd>
<?php } else { ?>
		<dt
class="hikamarket_order_additional_payment_fee"><label><?php
echo JText::_('HIKASHOP_PAYMENT');
?></label></dt>
		<dd
class="hikamarket_order_additional_payment_fee"><span><?php
echo
$this->currencyHelper->format($this->order->order_payment_price,
$this->order->order_currency_id); ?> - <?php
			if(empty($this->order->order_payment_method))
				echo
'<em>'.JText::_('NONE').'</em>';
			else
				echo $this->order->order_payment_method;
			?></span></dd>
<?php }

	if(!empty($this->order->additional)) {
		foreach($this->order->additional as $additional) {
?>
		<dt
class="hikamarket_order_additional_additional"><label><?php
echo JText::_($additional->order_product_name);
?></label></dt>
		<dd
class="hikamarket_order_additional_additional"><span><?php
			if(!empty($additional->order_product_price)) {
				$additional->order_product_price =
(float)$additional->order_product_price;
			}
			if(!empty($additional->order_product_price) ||
empty($additional->order_product_options)) {
				echo
$this->currencyHelper->format($additional->order_product_price,
$this->order->order_currency_id);
			} else {
				echo $additional->order_product_options;
			}
		?></span></dd>
<?php
		}
	}
?>
		<dt
class="hikamarket_order_additional_total"><label><?php
echo JText::_('HIKASHOP_TOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_additional_total"><span><?php
echo
$this->currencyHelper->format($this->order->order_full_price,$this->order->order_currency_id);
?></span></dd>
<?php
	if(!empty($this->fields['order'])) {
		$editCustomFields = false;
		if(isset($this->edit) && $this->edit === true &&
hikamarket::acl('order/edit/customfields')) {
			$editCustomFields = true;
		}
		foreach($this->fields['order'] as $fieldName =>
$oneExtraField) {
?>
		<dt class="hikamarket_order_additional_customfield
hikamarket_order_additional_customfield_<?php echo $fieldName;
?>"><?php echo
$this->fieldsClass->getFieldName($oneExtraField);?></dt>
		<dd class="hikamarket_order_additional_customfield
hikamarket_order_additional_customfield_<?php echo $fieldName;
?>"><span><?php
			if($editCustomFields) {
				echo $this->fieldsClass->display($oneExtraField,
@$this->order->$fieldName,
'data[orderfields]['.$fieldName.']');
			} else {
				echo $this->fieldsClass->show($oneExtraField,
@$this->order->$fieldName);
			}
		?></span></dd>
<?php
		}
	}

	if(hikamarket::acl('order/edit/history')) {
?>
		<dt
class="hikamarket_orderadditional_history"><label><?php
echo JText::_('HISTORY'); ?></label></dt>
		<dd class="hikamarket_orderadditional_history">
			<span><input
onchange="window.orderMgr.orderadditional_history_changed(this);"
type="checkbox"
id="hikamarket_history_orderadditional_store"
name="data[history][store_data]"
value="1"/><label
for="hikamarket_history_orderadditional_store"
style="display:inline-block"><?php echo
JText::_('SET_HISTORY_MESSAGE');?></label></span><br/>
			<textarea id="hikamarket_history_orderadditional_msg"
name="data[history][msg]"
style="display:none;"></textarea>
		</dd>
<script type="text/javascript">
if(!window.orderMgr)
	window.orderMgr = {};
window.orderMgr.orderadditional_history_changed = function(el) {
	var fields = ['hikamarket_history_orderadditional_msg'],
displayValue = '';
	if(!el.checked) displayValue = 'none';
	window.hikamarket.setArrayDisplay(fields, displayValue);
}
</script>
<?php
	}
?>
	</dl>
	<input type="hidden" name="data[additional]"
value="1" />
	<input type="hidden" name="data[customfields]"
value="1" />
	<input type="hidden" name="cid[]"
value="<?php echo @$this->order->order_id; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="save" />
	<input type="hidden" name="subtask"
value="additional" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="ctrl"
value="order" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
views/ordermarket/tmpl/edit_products.php000064400000014441151166607750014577
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('order&task=save&subtask=product&tmpl=component');
?>" name="hikamarket_order_product_form"
id="hikamarket_order_product_form" method="post"
enctype="multipart/form-data">
	<dl class="hikam_options">
		<dt
class="hikamarket_order_product_id"><label><?php echo
JText::_('PRODUCT'); ?></label></dt>
		<dd class="hikamarket_order_product_id"><?php echo
(int)@$this->orderProduct->product_id; ?> - <?php echo
@$this->originalProduct->product_name; ?></dd>

		<dt
class="hikamarket_order_product_name"><label><?php
echo JText::_('HIKA_NAME'); ?></label></dt>
		<dd class="hikamarket_order_product_name">
			<input type="text"
name="data[order][product][order_product_name]"
value="<?php echo
$this->escape(@$this->orderProduct->order_product_name);
?>" />
		</dd>

		<dt
class="hikamarket_order_product_code"><label><?php
echo JText::_('PRODUCT_CODE'); ?></label></dt>
		<dd class="hikamarket_order_product_code">
			<input type="text"
name="data[order][product][order_product_code]"
value="<?php echo
$this->escape(@$this->orderProduct->order_product_code);
?>" />
		</dd>

		<dt
class="hikamarket_order_product_price"><label><?php
echo JText::_('UNIT_PRICE'); ?></label></dt>
		<dd class="hikamarket_order_product_price">
			<input type="text"
name="data[order][product][order_product_price]"
value="<?php echo @$this->orderProduct->order_product_price;
?>" />
		</dd>

		<dt
class="hikamarket_order_product_vat"><label><?php
echo JText::_('VAT'); ?></label></dt>
		<dd class="hikamarket_order_product_vat">
			<input type="text"
name="data[order][product][order_product_tax]"
value="<?php echo @$this->orderProduct->order_product_tax;
?>" />
			<?php echo $this->ratesType->display(
"data[order][product][tax_namekey]" ,
@$this->orderProduct->order_product_tax_info[0]->tax_namekey );
?>
		</dd>

		<dt
class="hikamarket_order_product_quantity"><label><?php
echo JText::_('PRODUCT_QUANTITY');
?></label></dt>
		<dd class="hikamarket_order_product_quantity">
			<input type="text"
name="data[order][product][order_product_quantity]"
value="<?php echo
@$this->orderProduct->order_product_quantity; ?>" />
		</dd>

<?php
	if(!empty($this->fields['item'])) {
		$editCustomFields = false;
			$editCustomFields = true;
		foreach($this->fields['item'] as $fieldName =>
$oneExtraField) {
?>
		<dt class="hikamarket_order_product_customfield
hikamarket_order_product_customfield_<?php echo $fieldName;
?>"><?php echo
$this->fieldsClass->getFieldName($oneExtraField);?></dt>
		<dd class="hikamarket_order_product_customfield
hikamarket_order_product_customfield_<?php echo $fieldName;
?>"><span><?php
			if($editCustomFields) {
				echo $this->fieldsClass->display($oneExtraField,
@$this->orderProduct->$fieldName,
'data[order][product]['.$fieldName.']',false,'',true);
			} else {
				echo $this->fieldsClass->show($oneExtraField,
@$this->orderProduct->$fieldName);
			}
		?></span></dd>
<?php
		}
	}

	if(hikamarket::level(1) && $this->vendor->vendor_id <= 1
&& hikamarket::acl('order/edit/vendor') &&
!empty($this->orderProduct->vendor_data)) {
?>
		<dt
class="hikamarket_orderproduct_vendor"><label><?php
echo JText::_('HIKA_VENDOR'); ?></label></dt>
		<dd class="hikamarket_orderproduct_vendor"><?php
			if(!empty($this->orderProduct->vendor_data->order_vendor_id))
{
				echo $this->orderProduct->vendor_data->order_vendor_id;
				echo ' - ';
				if(isset($this->orderProduct->vendor_data->vendor_name))
					echo $this->orderProduct->vendor_data->vendor_name;
				else
					echo $this->orderProduct->vendor->vendor_name;
			} else
				echo '-';
		?><input type="hidden"
name="data[market][product][order_product_vendor_id]"
value="<?php echo
@$this->orderProduct->vendor_data->order_vendor_id;
?>"/></dd>
		<dt
class="hikamarket_orderproduct_vendorprice"><label><?php
echo JText::_('HIKAM_VENDOR_UNIT_PRICE');
?></label></dt>
		<dd class="hikamarket_orderproduct_vendorprice">
			<input type="text"
name="data[order][product][order_product_vendor_price]"
value="<?php echo
@$this->orderProduct->vendor_data->order_product_vendor_price;
?>"/>
		</dd>
<?php
	}

	if(hikamarket::acl('order/edit/history')) {
?>
		<dt
class="hikamarket_orderproduct_history"><label><?php
echo JText::_('HISTORY'); ?></label></dt>
		<dd class="hikamarket_orderproduct_history">
			<span><input
onchange="window.orderMgr.orderproduct_history_changed(this);"
type="checkbox"
id="hikamarket_history_orderproduct_store"
name="data[history][store_data]"
value="1"/><label
for="hikamarket_history_orderproduct_store"
style="display:inline-block"><?php echo
JText::_('SET_HISTORY_MESSAGE');?></label></span><br/>
			<textarea id="hikamarket_history_orderproduct_msg"
name="data[history][msg]"
style="display:none;"></textarea>
		</dd>
<script type="text/javascript">
if(!window.orderMgr)
	window.orderMgr = {};
window.orderMgr.orderproduct_history_changed = function(el) {
	var fields = ['hikamarket_history_orderproduct_msg'],
displayValue = '';
	if(!el.checked) displayValue = 'none';
	window.hikamarket.setArrayDisplay(fields, displayValue);
}
</script>
<?php
	}
?>
	</dl>
	<input type="hidden"
name="data[order][history][history_type]"
value="modification" />
	<input type="hidden"
name="data[order][product][order_product_id]"
value="<?php echo
@$this->orderProduct->order_product_id;?>" />
	<input type="hidden"
name="data[order][product][product_id]" value="<?php echo
@$this->orderProduct->product_id;?>" />
	<input type="hidden"
name="data[order][product][order_id]" value="<?php echo
@$this->orderProduct->order_id;?>" />
	<input type="hidden" name="data[products]"
value="1" />
	<input type="hidden" name="cid[]"
value="<?php echo @$this->orderProduct->order_id; ?>"
/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="save" />
	<input type="hidden" name="subtask"
value="products" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="ctrl"
value="order" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
views/ordermarket/tmpl/export.php000064400000004101151166607750013240
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
while(ob_get_level() > 1)
	ob_end_clean();

$separator = $this->shopConfig->get('csv_separator',
';');
$force_text = $this->shopConfig->get('csv_force_text',
false);
$decimal_separator =
$this->shopConfig->get('csv_decimal_separator','.');

$this->export->init($this->export_format,
'order_export', $separator, true, $decimal_separator,
$force_text);

if(!empty($this->orders)){
	$maxProd = 0;
	$productFields = null;
	foreach($this->orders as $order){
		$nbProd = count($order->products);
		if($maxProd < $nbProd){
			$maxProd = $nbProd;
			if(empty($productFields)){
				$productFields =
array_keys(get_object_vars(reset($order->products)));
			}
		}
	}

	if($maxProd && !empty($productFields)) {
		$first = array();
		$o = reset($this->orders);
		foreach($o as $key => $val) {
			if(is_array($val))
				continue;
			$first[] = $key;
		}
		$o = null;
		for($i=1;$i<=$maxProd;$i++){
			foreach($productFields as $field){
				$first[] = 'item'.$i.'_'.$field;
			}
		}
	} else {
		$first = array_keys(get_object_vars(reset($this->orders)));
	}
	$this->export->writeLine($first);

	foreach($this->orders as $row){
		if(!empty($row->user_created)) $row->user_created =
hikashop_getDate($row->user_created,'%Y-%m-%d %H:%M:%S');
		if(!empty($row->order_created)) $row->order_created =
hikashop_getDate($row->order_created,'%Y-%m-%d %H:%M:%S');
		if(!empty($row->order_modified)) $row->order_modified =
hikashop_getDate($row->order_modified,'%Y-%m-%d %H:%M:%S');

		if($maxProd && !empty($productFields)){
			for($i=1;$i<=$maxProd;$i++){
				$prod =& $row->products[$i-1];
				foreach($productFields as $field){
					$n = 'item_'.$i.'_'.$field;
					$row->$n = @$prod->$field;
				}
			}
		}

		$this->export->writeLine($row);
	}
}

$this->export->send();
exit;
views/ordermarket/tmpl/export_show.php000064400000006537151166607750014317
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('order'); ?>"
method="post" id="hikamarket_order_export_form"
name="hikamarket_order_export_form">
	<dl class="hikam_options">
		<dt
class="hikamarket_order_export_search"><label><?php
echo JText::_('FILTER'); ?></label></dt>
		<dd class="hikamarket_order_export_search">
<?php if(!HIKASHOP_RESPONSIVE) { ?>
			<input type="text" name="search"
id="hikamarket_order_listing_search" value="<?php echo
$this->escape($this->pageInfo->search);?>"
class=""/>
<?php } else { ?>
			<div class="input-prepend input-append">
				<span class="add-on"><i
class="icon-filter"></i></span>
				<input type="text" name="search"
id="hikamarket_order_listing_search" value="<?php echo
$this->escape($this->pageInfo->search);?>"
class=""/>
			</div>
<?php } ?>
		</dd>
		<dt
class="hikamarket_order_export_status"><label><?php
echo JText::_('ORDER_STATUS'); ?></label></dt>
		<dd class="hikamarket_order_export_status"><?php
			echo $this->orderStatusType->display('filter_status',
$this->pageInfo->filter->filter_status, '', true);
		?></dd>
		<dt
class="hikamarket_order_export_payment"><label><?php
echo JText::_('HIKASHOP_PAYMENT_METHOD');
?></label></dt>
		<dd class="hikamarket_order_export_payment"><?php
			echo $this->paymentType->display('filter_payment',
$this->pageInfo->filter->filter_payment, false);
		?></dd>
		<dt
class="hikamarket_order_export_startdate"><label><?php
echo JText::_('START_DATE'); ?></label></dt>
		<dd class="hikamarket_order_export_startdate"><?php
			echo JHTML::_('calendar',
hikamarket::getDate((!empty($this->pageInfo->filter->filter_startdate)?$this->pageInfo->filter->filter_startdate:''),'%Y-%m-%d
%H:%M'),
'filter_startdate','start_date','%Y-%m-%d
%H:%M',array('size' => '20'));
		?></dd>
		<dt
class="hikamarket_order_export_enddate"><label><?php
echo JText::_('END_DATE'); ?></label></dt>
		<dd class="hikamarket_order_export_enddate"><?php
			echo JHTML::_('calendar',
hikamarket::getDate((!empty($this->pageInfo->filter->filter_enddate)?$this->pageInfo->filter->filter_enddate:''),'%Y-%m-%d
%H:%M'),
'filter_enddate','end_date','%Y-%m-%d
%H:%M',array('size' => '20'));
		?></dd>
		<dt
class="hikamarket_order_export_format"><label><?php
echo JText::_('EXPORT_FORMAT'); ?></label></dt>
		<dd class="hikamarket_order_export_format"><?php
			$values = array(
				JHTML::_('select.option', 'csv',
JText::_('HIKAM_EXPORT_CSV')),
				JHTML::_('select.option', 'xls',
JText::_('HIKAM_EXPORT_XLS'))
			);
			echo JHTML::_('hikaselect.radiolist', $values,
'data[export][format]', '', 'value',
'text', 'csv');
		?></dd>
	</dl>
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="export" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
<script type="text/javascript">
window.hikashop.ready(function(){
window.hikamarket.dlTitle('hikamarket_order_export_form'); });
</script>
views/ordermarket/tmpl/history.php000064400000021504151166607750013426
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->history))
	return;

?>
<div class="hikamarket_order">
	<dl class="hikam_options">
		<dt
class="hikamarket_order_history_type"><label><?php
echo JText::_('HIKA_TYPE'); ?></label></dt>
		<dd
class="hikamarket_order_history_type"><span><?php
			if(!empty($this->history->history_type))
				echo $this->escape($this->history->history_type);
			else
				echo '<em>' . JText::_('HIKA_NONE') .
'</em>';
		?></span></dd>

		<dt
class="hikamarket_order_history_date"><label><?php
echo JText::_('DATE'); ?></label></dt>
		<dd
class="hikamarket_order_history_date"><span><?php
			echo hikamarket::getDate($this->history->history_created,
'%Y-%m-%d %H:%M');
		?></span></dd>

		<dt
class="hikamarket_order_history_user"><label><?php
echo JText::_('HIKA_USER'); ?></label></dt>
		<dd
class="hikamarket_order_history_user"><span><?php
			echo $this->escape($this->history->user->name) . '
(' . $this->escape($this->history->user->user_email) .
')';
		?></span></dd>

		<dt
class="hikamarket_order_history_status"><label><?php
echo JText::_('ORDER_STATUS'); ?></label></dt>
		<dd
class="hikamarket_order_history_status"><span><?php
			echo hikamarket::orderStatus($this->history->history_new_status);
		?></span></dd>

<?php if(!empty($this->history->history_reason)) { ?>
		<dt
class="hikamarket_order_history_reason"><label><?php
echo JText::_('REASON'); ?></label></dt>
		<dd
class="hikamarket_order_history_reason"><span><?php
			echo $this->escape($this->history->history_reason);
		?></span></dd>
<?php } ?>

<?php if(!empty($this->history->history_ip)) { ?>
		<dt
class="hikamarket_order_history_ip"><label><?php echo
JText::_('IP'); ?></label></dt>
		<dd
class="hikamarket_order_history_ip"><span><?php
			echo $this->escape($this->history->history_ip);
		?></span></dd>
<?php } ?>

<?php if(!empty($this->history->history_data) &&
is_string($this->history->history_data)) { ?>
		<dt
class="hikamarket_order_history_data"><label><?php
echo JText::_('DATA'); ?></label></dt>
		<dd
class="hikamarket_order_history_data"><span><?php
			echo $this->escape($this->history->history_data);
		?></span></dd>
<?php } ?>

	</dl>
<?php if(!empty($this->history->history_data) &&
!is_string($this->history->history_data)) { ?>
	<div class="hikamarket_order_history_data"><?php

	if(isset($this->history->history_data['customer'])) {
		$data = $this->history->history_data['customer'];
		$userClass = hikamarket::get('shop.class.user');
		$old_customer = $new_customer = null;
		if(!empty($data['old']))
			$old_customer = $userClass->get( (int)$data['old'] );
		if(!empty($data['new']))
			$new_customer = $userClass->get( (int)$data['new'] );
?>
	<h3><?php echo JText::_('HIKAM_HISTORY_CUSTOMER');
?></h3>
	<h4><?php echo JText::_('HIKAM_HISTORY_OLD');
?></h4>
	<dl class="hikam_options">
		<dt class="history_data_customer_name"><?php echo
JText::_('HIKA_NAME'); ?></dt>
		<dd class="history_data_customer_name"><?php
			if(empty($old_customer))
				echo JText::_('HIKAM_USER_DOES_NOT_EXIST_ANYMORE');
			elseif(!empty($old_customer->name))
				echo $old_customer->name;
			else
				echo '<em>' . JText::_('HIKA_NONE') .
'</em>';
		?></dd>
<?php if(!empty($old_customer)) { ?>
		<dt
class="history_data_customer_email"><label><?php echo
JText::_('HIKA_EMAIL');?></label></dt>
		<dd class="history_data_customer_email"><?php echo
$this->escape(@$new_customer->user_email); ?></dd>
<?php } ?>
	</dl>
	<h4><?php echo JText::_('HIKAM_HISTORY_NEW');
?></h4>
	<dl class="hikam_options">
		<dt class="history_data_customer_name"><?php echo
JText::_('HIKA_NAME'); ?></dt>
		<dd class="history_data_customer_name"><?php
			if(empty($new_customer))
				echo JText::_('HIKAM_USER_DOES_NOT_EXIST_ANYMORE');
			elseif(!empty($new_customer->name))
				echo $new_customer->name;
			else
				echo '<em>' . JText::_('HIKA_NONE') .
'</em>';
		?></dd>
<?php if(!empty($new_customer)) { ?>
		<dt
class="history_data_customer_email"><label><?php echo
JText::_('HIKA_EMAIL');?></label></dt>
		<dd class="history_data_customer_email"><?php echo
$this->escape(@$new_customer->user_email); ?></dd>
<?php } ?>
	</dl>
<?php
	}

	if(isset($this->history->history_data['coupon'])) {
		$data = $this->history->history_data['coupon'];
?>
	<h3><?php echo JText::_('HIKAM_HISTORY_COUPON');
?></h3>
	<h4><?php echo JText::_('HIKAM_HISTORY_OLD');
?></h4>
	<dl class="hikam_options">
<?php if(isset($data['old']['code'])) { ?>
		<dt
class="history_data_coupon_code"><label><?php echo
JText::_('COUPON_CODE');?></label></dt>
		<dd class="history_data_coupon_code"><?php echo
$this->escape($data['old']['code']);
?></dd>
<?php } ?>
<?php if(isset($data['old']['value'])) { ?>
		<dt
class="history_data_coupon_value"><label><?php echo
JText::_('COUPON_VALUE');?></label></dt>
		<dd class="history_data_coupon_value"><?php
			echo
(float)hikamarket::toFloat($data['old']['value']);
		?></dd>
<?php } ?>
<?php if(isset($data['old']['tax'])) { ?>
		<dt class="history_data_coupon_tax"><label><?php
echo JText::_('COUPON_TAX');?></label></dt>
		<dd class="history_data_coupon_tax"><?php
			echo
(float)hikamarket::toFloat($data['old']['tax']);
		?></dd>
<?php } ?>
<?php if(isset($data['old']['tax_namekey'])) {
?>
		<dt
class="history_data_coupon_taxnamekey"><label><?php
echo JText::_('COUPON_TAX');?></label></dt>
		<dd class="history_data_coupon_taxnamekey"><?php echo
$this->escape($data['old']['tax_namekey']);
?></dd>
<?php } ?>
	</dl>
	<h4><?php echo JText::_('HIKAM_HISTORY_NEW');
?></h4>
	<dl class="hikam_options">
<?php if(isset($data['new']['code'])) { ?>
		<dt
class="history_data_coupon_code"><label><?php echo
JText::_('COUPON_CODE');?></label></dt>
		<dd class="history_data_coupon_code"><?php echo
$this->escape($data['new']['code']);
?></dd>
<?php } ?>
<?php if(isset($data['new']['value'])) { ?>
		<dt
class="history_data_coupon_value"><label><?php echo
JText::_('COUPON_VALUE');?></label></dt>
		<dd class="history_data_coupon_value"><?php
			echo
(float)hikamarket::toFloat($data['new']['value']);
		?></dd>
<?php } ?>
<?php if(isset($data['new']['tax'])) { ?>
		<dt class="history_data_coupon_tax"><label><?php
echo JText::_('COUPON_TAX');?></label></dt>
		<dd class="history_data_coupon_tax"><?php
			echo
(float)hikamarket::toFloat($data['new']['tax']);
		?></dd>
<?php } ?>
<?php if(isset($data['new']['tax_namekey'])) {
?>
		<dt
class="history_data_coupon_taxnamekey"><label><?php
echo JText::_('COUPON_TAX');?></label></dt>
		<dd class="history_data_coupon_taxnamekey"><?php echo
$this->escape($data['new']['tax_namekey']);
?></dd>
<?php } ?>
	</dl>
<?php
	}

	if(isset($this->history->history_data['shipping'])) {
		$data = $this->history->history_data['shipping'];
	}

	if(isset($this->history->history_data['payment'])) {
		$data = $this->history->history_data['payment'];
	}

	if(isset($this->history->history_data['fields'])) {
		$data = $this->history->history_data['fields'];
	}

	if(isset($this->history->history_data['billing_address']))
{
		$data = $this->history->history_data['billing_address'];
	}

	if(isset($this->history->history_data['shipping_address']))
{
		$data =
$this->history->history_data['shipping_address'];
	}

	if(isset($this->history->history_data['product'])) {
		$data = $this->history->history_data['product'];
	}

	if(isset($this->history->history_data['product_delete']))
{
		$data = $this->history->history_data['product_delete'];
?>
	<h3><?php echo
JText::_('HIKAM_HISTORY_PRODUCT_DELETE'); ?></h3>
	<dl class="hikam_options">
		<dt
class="history_data_productdelete_id"><label><?php
echo JText::_('ID');?></label></dt>
		<dd class="history_data_productdelete_id"><?php echo
(int)$data['product']['id']; ?></dd>

		<dt
class="history_data_productdelete_name"><label><?php
echo JText::_('PRODUCT_NAME');?></label></dt>
		<dd class="history_data_productdelete_name"><?php echo
$this->escape($data['product']['name']);
?></dd>

		<dt
class="history_data_productdelete_code"><label><?php
echo JText::_('PRODUCT_CODE');?></label></dt>
		<dd class="history_data_productdelete_code"><?php echo
$this->escape($data['product']['code']);
?></dd>

		<dt
class="history_data_productdelete_qty"><label><?php
echo JText::_('PRODUCT_QUANTITY');?></label></dt>
		<dd class="history_data_productdelete_qty"><?php echo
(int)$data['product']['qty']; ?></dd>

		<dt
class="history_data_productdelete_price"><label><?php
echo JText::_('PRICE');?></label></dt>
		<dd class="history_data_productdelete_price"><?php
			echo
(float)hikamarket::toFloat($data['product']['price']);
		?></dd>
	</dl>
<?php
	}
	?></div>
<?php } ?>
</div>
views/ordermarket/tmpl/index.html000064400000000032151166607750013202
0ustar00<html><body></body></html>views/ordermarket/tmpl/invoice.php000064400000035431151166607750013365
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikamarket_invoice_main_div">
	<div id="print" style="float:right">
		<a href="#"
onclick="document.getElementById('print').style.visibility='hidden';window.focus();window.print();return
false;">
			<img src="<?php echo HIKASHOP_IMAGES;
?>print.png"/>
		</a>
	</div>
	<br/>
	<table width="100%">
		<tr>
			<td>
				<h1 style="text-align:center"><?php
				if($this->invoice_type=='full') {
					echo JText::_('INVOICE');
				} else {
					echo JText::_('SHIPPING_INVOICE');
				}
				?></h1>
			</td>
		</tr>
		<tr>
			<td>
				<div style="float:right;width:100px;padding-top:20px">
					<?php
						$date = (!empty($this->element->order_invoice_created)) ?
$this->element->order_invoice_created :
@$this->element->order_created;
						echo JText::_('DATE') . ': ' .
hikamarket::getDate($date, '%d %B %Y ');
					?>
					<br/>
					<?php echo JText::_('INVOICE') . ': ' .
@$this->element->order_invoice_number; ?>
				</div>
				<p><?php
if($this->vendor->vendor_id == 0 || $this->vendor->vendor_id ==
1) {
	echo $this->store_address;
} else {
	$params = null; $js = null;
	$html = hikamarket::getLayout('shop.address',
'address_template', $params, $js);
	foreach($this->extraFields['vendor'] as $field) {
		$fieldname = $field->field_namekey;
		$html = str_replace('{' . str_replace('vendor_',
'', $fieldname) . '}',
$this->fieldsClass->show($field, $this->vendor->$fieldname),
$html);
	}
	echo
str_replace("\n","<br/>\n",trim(str_replace("\n\n","\n",preg_replace('#{(?:(?!}).)*}#i','',$html)),"\n"));
}
				?></p>
			</td>
		</tr>
		<tr>
			<td>
				<table width="100%">
					<tr>
<?php if($this->invoice_type=='full' &&
!empty($this->element->billing_address)){ ?>
						<td>
							<fieldset class="adminform"
id="htmlfieldset_billing">
							<legend style="background-color: #FFFFFF;"><?php
echo JText::_('HIKASHOP_BILLING_ADDRESS'); ?></legend>
<?php
	$params = null; $js = null;
	$html = hikamarket::getLayout('shop.address',
'address_template', $params, $js);
	foreach($this->element->fields as $field) {
		$fieldname = $field->field_namekey;
		$html = str_replace('{'.$fieldname.'}',
$this->fieldsClass->show($field,
$this->element->billing_address->$fieldname), $html);
	}
	echo
str_replace("\n","<br/>\n",trim(str_replace("\n\n","\n",preg_replace('#{(?:(?!}).)*}#i','',$html)),"\n"));
?>
							</fieldset>
						</td>
<?php } ?>
						<td>
<?php if(!empty($this->element->order_shipping_id) &&
!empty($this->element->shipping_address)) { ?>
							<fieldset class="adminform"
id="htmlfieldset_shipping">
								<legend style="background-color: #FFFFFF;"><?php
echo JText::_('HIKASHOP_SHIPPING_ADDRESS'); ?></legend>
<?php
	if(empty($this->element->override_shipping_address)) {
		$params = null; $js = null;
		$html = hikamarket::getLayout('shop.address',
'address_template', $params, $js);
		foreach($this->element->fields as $field){
			$fieldname = $field->field_namekey;
			$html = str_replace('{'.$fieldname.'}',
$this->fieldsClass->show($field,
$this->element->shipping_address->$fieldname), $html);
		}
		echo str_replace("\n", "<br/>\n",
trim(str_replace("\n\n", "\n",
preg_replace('#{(?:(?!}).)*}#i', '',
$html)),"\n"));
	} else {
		echo $this->element->override_shipping_address;
	}
?>
							</fieldset>
<?php } ?>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<fieldset class="adminform"
id="htmlfieldset_products">
					<legend style="background-color: #FFFFFF;"><?php
echo JText::_('PRODUCT_LIST'); ?></legend>
					<table class="adminlist table table-striped"
cellpadding="1" width="100%">
						<thead>
							<tr>
								<th class="title" width="60%">
									<?php echo JText::_('PRODUCT'); ?>
								</th>
<?php if ($this->shopConfig->get('show_code')) { ?>
								<th class="title" ><?php echo
JText::_('CART_PRODUCT_CODE'); ?></th>
<?php } ?>
<?php if($this->invoice_type == 'full') { ?>
								<th class="title">
									<?php echo JText::_('UNIT_PRICE'); ?>
								</th>
<?php } ?>
								<th class="title titletoggle">
									<?php echo JText::_('PRODUCT_QUANTITY'); ?>
								</th>
<?php if($this->invoice_type == 'full') { ?>
								<th class="title titletoggle">
									<?php echo JText::_('PRICE'); ?>
								</th>
<?php } ?>
							</tr>
						</thead>
						<tbody>
<?php
	$k = 0;
	$group = $this->shopConfig->get('group_options', 0);

	foreach($this->order->products as $product) {
		if($group && $product->order_product_option_parent_id)
			continue;
?>
							<tr class="row<?php echo $k;?>">
								<td>
									<?php echo $product->order_product_name.'
'.$product->order_product_code; ?>
									<p
class="hikashop_order_product_custom_item_fields">
<?php
		if($group) {
			$display_item_price = false;
			foreach($this->order->products as $j => $optionElement) {
				if($optionElement->order_product_option_parent_id !=
$product->order_product_id)
					continue;
				if($optionElement->order_product_price > 0) {
					$display_item_price = true;
				}

			}
			if($display_item_price) {
				if($this->shopConfig->get('price_with_tax')) {
					echo '
'.$this->currencyHelper->format($product->order_product_price+$product->order_product_tax,$this->order->order_currency_id);
				} else {
					echo '
'.$this->currencyHelper->format($product->order_product_price,$this->order->order_currency_id);
				}
			}
		}

		if(hikashop_level(2) &&
!empty($this->fields['item'])) {
			foreach($this->fields['item'] as $field) {
				$namekey = $field->field_namekey;
				if(empty($product->$namekey))
					continue;

				echo '<p
class="hikashop_order_item_'.$namekey.'">'.$this->fieldsClass->getFieldName($field).':
'.$this->fieldsClass->show($field,$product->$namekey).'</p>';
			}
		}
		if($group) {
			foreach($this->order->products as $j => $optionElement) {
				if($optionElement->order_product_option_parent_id !=
$product->order_product_id) continue;

				$product->order_product_price
+=$optionElement->order_product_price;
				$product->order_product_tax +=$optionElement->order_product_tax;
				$product->order_product_total_price+=$optionElement->order_product_total_price;
				$product->order_product_total_price_no_vat+=$optionElement->order_product_total_price_no_vat;

?>
										<p class="hikashop_order_option_name">
<?php
				echo $optionElement->order_product_name;
				if($optionElement->order_product_price > 0) {
					if($this->shopConfig->get('price_with_tax')) {
						echo ' ( +
'.$this->currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$this->order->order_currency_id).'
)';
					} else {
						echo ' ( +
'.$this->currencyHelper->format($optionElement->order_product_price,$this->order->order_currency_id).'
)';
					}
				}
?>
										</p>
<?php
			}
		}
?>
									</p>
								</td>
<?php if ($this->shopConfig->get('show_code')) { ?>
										<td><p
class="hikashop_product_code_invoice"><?php echo
$product->order_product_code; ?></p></td>
<?php } ?>

<?php if($this->invoice_type == 'full') {?>
								<td>
<?php
			if($this->shopConfig->get('price_with_tax')) {
				echo
$this->currencyHelper->format($product->order_product_price+$product->order_product_tax,$this->order->order_currency_id);
			} else {
				echo
$this->currencyHelper->format($product->order_product_price,$this->order->order_currency_id);
			}
?>
								</td>
<?php } ?>
								<td align="center"><?php echo
$product->order_product_quantity;?></td>
<?php if($this->invoice_type == 'full') { ?>
								<td>
<?php
			if($this->shopConfig->get('price_with_tax')) {
				echo
$this->currencyHelper->format($product->order_product_total_price,$this->order->order_currency_id);
			} else {
				echo
$this->currencyHelper->format($product->order_product_total_price_no_vat,$this->order->order_currency_id);
			}
?>
								</td>
<?php } ?>
							</tr>
<?php
		$k = 1 - $k;
	}
?>
<?php if($this->invoice_type == 'full') { ?>
							<tr>
								<td style="border-top:2px solid #B8B8B8;"
colspan="2"></td>
								<td style="border-top:2px solid #B8B8B8;"
class="key">
									<label><?php echo JText::_('SUBTOTAL');
?></label>
								</td>
								<td style="border-top:2px solid #B8B8B8;">
<?php
	if($this->shopConfig->get('price_with_tax')) {
		echo
$this->currencyHelper->format($this->order->order_subtotal,$this->order->order_currency_id);
	} else {
		echo
$this->currencyHelper->format($this->order->order_subtotal_no_vat,$this->order->order_currency_id);
	}
?>
								</td>
							</tr>
<?php
	$taxes = $this->order->order_subtotal -
$this->order->order_subtotal_no_vat +
$this->order->order_shipping_tax -
$this->order->order_discount_tax -
$this->order->order_payment_tax;
	if($taxes != 0) {
		if($this->shopConfig->get('detailed_tax_display')
&& !empty($this->order->order_tax_info)) {
			foreach($this->order->order_tax_info as $tax) {
?>
							<tr>
								<td colspan="2">
								</td>
								<td class="hikashop_order_tax_title key">
									<label><?php
										echo $tax->tax_namekey;
									?></label>
								</td>
								<td class="hikashop_order_tax_value"><?php
									echo $this->currencyHelper->format($tax->tax_amount,
$this->order->order_currency_id);
								?></td>
							</tr>
<?php
			}
		} else {
?>
							<tr>
								<td colspan="2">
								</td>
								<td class="hikashop_order_tax_title key">
									<label><?php
										echo JText::_('VAT');
									?></label>
								</td>
								<td class="hikashop_order_tax_value"><?php
									echo $this->currencyHelper->format($taxes,
$this->order->order_currency_id);
								?></td>
							</tr>

<?php
		}
	}
	if($this->order->order_discount_price != 0) {
?>
							<tr>
								<td colspan="2">
								</td>
								<td class="key">
									<label><?php
										echo JText::_('HIKASHOP_COUPON');
									?></label>
								</td>
								<td>
<?php
		if($this->shopConfig->get('price_with_tax')) {
			echo
$this->currencyHelper->format($this->order->order_discount_price
* -1.0, $this->order->order_currency_id);
		} else {
			echo
$this->currencyHelper->format(($this->order->order_discount_price
- @$this->order->order_discount_tax) * -1.0,
$this->order->order_currency_id);
		}
?>
								</td>
							</tr>
<?php }
	if(!empty($this->order->additional)) {
		$exclude_additionnal = explode(',',
$this->shopConfig->get('order_additional_hide',
''));
		foreach($this->order->additional as $additional) {
			if(in_array($additional->order_product_name, $exclude_additionnal))
				continue;
?>
							<tr>
								<td colspan="2">
								</td>
								<td class="hikashop_order_additionall_title key">
									<label><?php
										echo JText::_($additional->order_product_name);
									?></label>
								</td>
								<td><?php
									if(!empty($additional->order_product_price)) {
										$additional->order_product_price =
(float)$additional->order_product_price;
									}
									if(!empty($additional->order_product_price) ||
empty($additional->order_product_options)) {
										echo
$this->currencyHelper->format($additional->order_product_price,
$this->order->order_currency_id);
									} else {
										echo $additional->order_product_options;
									}
								?></td>
							</tr>
<?php
		}
	}
	if($this->order->order_shipping_price != 0) {
?>
							<tr>
								<td colspan="2">
								</td>
								<td class="key">
									<label><?php echo JText::_( 'SHIPPING' );
?></label>
								</td>
								<td>
<?php
		if($this->shopConfig->get('price_with_tax')) {
			echo
$this->currencyHelper->format($this->order->order_shipping_price,
$this->order->order_currency_id);
		} else {
			echo
$this->currencyHelper->format($this->order->order_shipping_price
- @$this->order->order_shipping_tax,
$this->order->order_currency_id);
		}
?>
								</td>
							</tr>
<?php
	}
	if($this->order->order_payment_price != 0 ||
($this->shopConfig->get('price_with_tax') &&
$this->order->order_payment_tax != 0)) {
?>
							<tr>
								<td colspan="2">
								</td>
								<td class="key">
									<label><?php echo JText::_( 'HIKASHOP_PAYMENT'
); ?></label>
								</td>
								<td><?php
		if($this->shopConfig->get('price_with_tax')) {
			echo
$this->currencyHelper->format($this->order->order_payment_price,
$this->order->order_currency_id);
		} else {
			echo
$this->currencyHelper->format($this->order->order_payment_price
- @$this->order->order_payment_tax,
$this->order->order_currency_id);
		}
								?></td>
							</tr>
<?php } ?>
							<tr>
								<td colspan="2">
								</td>
								<td class="key">
									<label><?php echo JText::_( 'HIKASHOP_TOTAL' );
?></label>
								</td>
								<td><?php echo
$this->currencyHelper->format($this->order->order_full_price,
$this->order->order_currency_id); ?></td>
							</tr>
<?php } ?>
						</tbody>
					</table>
				</fieldset>
			</td>
		</tr>
<?php
	JPluginHelper::importPlugin('hikashop');
	JPluginHelper::importPlugin('hikamarket');
	JFactory::getApplication()->triggerEvent('onAfterOrderProductsListingDisplay',
array(&$this->order, 'order_frontvendor_invoice'));

	if($this->invoice_type == 'full') {
		if(!empty($this->fields['order']) &&
hikashop_level(2)) {
?>
		<tr>
			<td>
				<fieldset
class="hikashop_order_custom_fields_fieldset">
					<legend><?php echo
JText::_('ADDITIONAL_INFORMATION'); ?></legend>
					<table class="hikashop_order_custom_fields_table
adminlist" cellpadding="1" width="100%">
<?php foreach($this->fields['order'] as $fieldName =>
$oneExtraField) { ?>
						<tr class="hikashop_order_custom_field_<?php echo
$fieldName;?>_line">
							<td class="key"><?php echo
$this->fieldsClass->getFieldName($oneExtraField);?></td>
							<td><?php echo
$this->fieldsClass->show($oneExtraField,
@$this->order->$fieldName); ?></td>
						</tr>
<?php } ?>
					</table>
				</fieldset>
			</td>
		</tr>
<?php } ?>
		<tr>
			<td>
<?php
	if(!empty($this->shipping)) {
		echo JText::_('HIKASHOP_SHIPPING_METHOD').' : ';
		if(is_string($this->order->order_shipping_method))
			echo
$this->shipping->getName($this->order->order_shipping_method,
$this->order->order_shipping_id);
		else
			echo implode(', ',
$this->order->order_shipping_method);
		echo '<br/>';
	}
	if(!empty($this->payment)) {
		echo JText::_('HIKASHOP_PAYMENT_METHOD').' :
'.$this->payment->getName($this->order->order_payment_method,
$this->order->order_payment_id);
	}
?>
			</td>
		</tr>
<?php } ?>
		<tr>
			<td>
			</td>
		</tr>
	</table>
</div>
<div style="page-break-after:always"></div>
views/ordermarket/tmpl/listing.php000064400000022246151166607750013402
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikam_product_listing">
<form action="<?php echo
hikamarket::completeLink('order&task=listing'); ?>"
method="post" id="adminForm"
name="adminForm">

<div class="hk-row-fluid">
	<div class="hkc-md-12">
<?php
	echo $this->loadHkLayout('search', array(
		'id' => 'hikamarket_order_listing_search'
	));
?>
		<div class="hikam_sort_zone"><?php
			if(!empty($this->ordering_values))
				echo JHTML::_('select.genericlist',
$this->ordering_values, 'filter_fullorder',
'onchange="this.form.submit();"', 'value',
'text', $this->full_ordering);
		?></div>
	</div>
	<div class="hkc-md-12">
		<div class="expand-filters">
<?php

echo $this->orderStatusType->display('filter_status',
$this->pageInfo->filter->filter_status, '
onchange="document.adminForm.submit();"', true);

if(!empty($this->pageInfo->filter->filter_user)) {
	$userClass = hikamarket::get('shop.class.user');
	$user_filter =
$userClass->get($this->pageInfo->filter->filter_user);
?>
	<input type="hidden" name="filter_user"
value="<?php echo
(int)$this->pageInfo->filter->filter_user; ?>"
id="hikamarket_order_listing_filter_user" />
	<button class="hikabtn" onclick="var el =
document.getElementById('hikamarket_order_listing_filter_user');
if(el) el.value = ''; document.adminForm.submit(); return
false;"><?php echo $user_filter->user_email; ?> <i
class="far fa-trash-alt"></i></button>
<?php
}

foreach($this->extrafilters as $name => $filterObj) {
	echo $filterObj->displayFilter($name, $this->pageInfo->filter);
}

?>
		</div>
		<div style="clear:both"></div>
	</div>
</div>
<?php
	if(!empty($this->order_stats)) {
?><table class="order_statistics hikam_table
hikam_bordered" style="width:100%">
	<tr>
<?php
		$width = floor(100 / (count($this->order_stats)+1));
		$total_orders = 0;
		foreach($this->order_stats as $status => $obj) {
			if(empty($status))
				continue;
			$total = (int)$obj->total;
			$total_orders += $total;

			$class = ($this->pageInfo->filter->filter_status == $status) ?
'order_statistics_active' : '';

?>		<td style="width:<?php echo $width;?>%"
class="<?php echo $class; ?>">
			<a href="<?php echo
hikamarket::completeLink('order&task=listing&filter_status='.$status);
?>">
				<span class="value"><?php echo $total;
?></span>
				<span class="order-label order-label-<?php echo
preg_replace('#[^a-z_0-9]#i', '_', str_replace('
','_',$status)); ?>"><?php
					echo hikamarket::orderStatus($status);
				?></span>
			</a>
		</td>
<?php
		}
?>
		<td style="width:<?php echo $width;?>%">
			<a href="<?php echo
hikamarket::completeLink('order&task=listing&filter_status=');
?>">
				<span class="value"><?php echo $total_orders;
?></span>
				<span class="order-label order-label-all"><?php echo
JText::_('HIKAM_STAT_ALL'); ?></span>
			</a>
		</td>
	</tr>
</table>
<?php
	}
?>

<div id="hikam_order_main_listing">
<?php
$manage = hikamarket::acl('order/show');
$extra_classes = '';

foreach($this->orders as $order) {
	$url = ($manage) ?
hikamarket::completeLink('order&task=show&cid='.$order->order_id)
: null;
?>
	<div class="hk-card hk-card-default hk-card-vendor-order<?php
echo $extra_classes; ?>" data-hkm-order="<?php echo
(int)$order->order_id; ?>">
		<div class="hk-card-header">
<?php if(!empty($url)) { ?>
			<a class="hk-row-fluid" href="<?php echo $url;
?>">
<?php } else { ?>
			<div class="hk-row-fluid">
<?php } ?>
				<div class="hkc-sm-6 hkm_order_date">
					<i class="fa fa-clock"></i>
					<?php echo hikashop_getDate((int)$order->order_created,
'%Y-%m-%d %H:%M'); ?>
				</div>
				<div class="hkc-sm-6 hkm_order_price">
					<i class="fa fa-credit-card"></i>
					<?php echo
$this->currencyHelper->format($order->order_full_price,
$order->order_currency_id); ?>
				</div>
<?php if(!empty($url)) { ?>
			</a>
<?php } else { ?>
			</div>
<?php } ?>
		</div>
		<div class="hk-card-body">
			<div class="hk-row-fluid">
				<div class="hkc-sm-4 hkm_order_number">
<?php
	if(!empty($url)) {
					?><a href="<?php echo $url; ?>"><?php
	}
					?><i class="far fa-file-alt"
style="margin-right:4px;"></i><span
class="hika_order_number_value"><?php echo
$order->order_number; ?></span><?php
	if(!empty($url)) {
					?></a><?php
	}
?>
<?php if(!empty($order->order_invoice_number)) { ?>
					<span class="hkm_order_number_invoice_separator"> -
</span>
					<span class="hkm_invoice_number_value"><?php echo
$order->order_invoice_number; ?></span>
<?php } ?>
<?php if(hikamarket::acl('order/show/customer')) { ?>
					<div class="hkm_order_customer">
						<i class="fas fa-user"></i> <?php echo
$this->escape($order->user_email); ?>
					</div>
<?php } ?>
				</div>
				<div class="hkc-sm-2 hkm_order_status">
					<span class="order-label order-label-<?php echo
preg_replace('#[^a-z_0-9]#i', '_', str_replace('
','_',$order->order_status)); ?>"><?php
						echo hikamarket::orderStatus($order->order_status);
					?></span>
				</div>
				<div class="hkc-sm-3 hkm_order_billing">
<?php
	if(hikamarket::acl('order/show/billingaddress') &&
!empty($order->order_billing_address_id)) {
		$full_address =
$this->addressClass->maxiFormat($this->addresses[(int)$order->order_billing_address_id],
$this->address_fields, true);
		$country =
$this->addressClass->miniFormat($this->addresses[(int)$order->order_billing_address_id],
$this->address_fields, '{address_city}, {address_state_code_3}
{address_country_code_3}');
		echo hikamarket::tooltip($full_address,
JText::_('HIKASHOP_BILLING_ADDRESS'), '', $country,
'', 0);

		if(!empty($order->order_payment_method))
			echo '<br/>';
	}

	if(!empty($order->order_payment_method)) {
		$payment_price =
$this->currencyHelper->format($order->order_payment_price,
$order->order_currency_id);
		if(!empty($this->payments[$order->order_payment_id]))
			$payment_name =
$this->payments[$order->order_payment_id]->payment_name;
		else
			$payment_name = $order->order_payment_method;

		echo '<span class="hk-label hk-label-blue">' .
			hikamarket::tooltip($payment_price, '', '',
$payment_name, '', 0) .
			'</span>';
	}
?>
				</div>
				<div class="hkc-sm-3 hkm_order_shipping">
<?php
	if(hikamarket::acl('order/show/shippingaddress') &&
!empty($order->order_shipping_address_id) &&
!empty($order->order_shipping_id)) {
		$full_address =
$this->addressClass->maxiFormat($this->addresses[(int)$order->order_shipping_address_id],
$this->address_fields, true);
		$country =
$this->addressClass->miniFormat($this->addresses[(int)$order->order_shipping_address_id],
$this->address_fields, '{address_city}, {address_state_code_3}
{address_country_code_3}');
		echo hikamarket::tooltip($full_address,
JText::_('HIKASHOP_SHIPPING_ADDRESS'), '', $country,
'', 0);

		if(!empty($order->shipping_name))
			echo '<br/>';
	}

	if(!empty($order->shipping_name)) {
		if($this->shopConfig->get('price_with_tax'))
			$shipping_price =
$this->currencyHelper->format($order->order_shipping_price,
$order->order_currency_id);
		else
			$shipping_price =
$this->currencyHelper->format($order->order_shipping_price -
@$order->order_shipping_tax, $order->order_currency_id);

		echo '<span class="hk-label hk-label-blue">';
		if(is_string($order->shipping_name)) {
			echo hikamarket::tooltip($shipping_price, '', '',
$order->shipping_name, '', 0);
		} else
			echo hikamarket::tooltip('- '.implode('<br/>-
',$order->shipping_name),
JText::_('SHIPPING_PRICE').': '.$shipping_price,
'',
'<em>'.JText::_('HIKAM_SEVERAL_SHIPPING').'
&raquo;</em>', '', 0);
		echo '</span>';
	}
?>
				</div>
<?php
	if(!empty($this->fields)) {
?>
				<div class="hkc-sm-12 hkm_order_fields">
<?php
		$field_cpt = 0;
		foreach($this->fields as $field) {
			$namekey = $field->field_namekey;
			if($field->field_type == 'customtext' ||
empty($order->$namekey))
				continue;
			if(empty($field_cpt))
				echo '<dl>';
			$field_cpt++;
			echo
'<dt>'.$this->fieldClass->trans($field->field_realname)
. '</dt>'.
				'<dd>'.$this->fieldClass->show($field,
$order->$namekey).'</dd>';
		}
		if($field_cpt > 0)
			echo '</dl>';
?>
			</div>
<?php
	}
?>
			</div>
		</div>
	</div>
<?php
}
?>
	<div class="hikamarket_orders_footer">
		<div class="hikamarket_pagination">
			<?php $this->pagination->form = '_bottom'; echo
$this->pagination->getListFooter(); ?>
			<?php echo $this->pagination->getResultsCounter(); ?>
		</div>
	</div>
</div>

	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="listing" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="boxchecked"
value="0" />
	<input type="hidden" name="filter_order"
value="<?php echo
$this->pageInfo->filter->order->value; ?>" />
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->pageInfo->filter->order->dir;
?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>
views/ordermarket/tmpl/listing.xml000064400000001244151166607750013406
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor order listing</name>
		<params addpath="/components/com_hikamarket/params">
			<param name="options" type="selectoptions"
default="module" label="options"
description="HikaMarket options" />
		</params>
	</state>
	<layout
title="COM_HIKAMARKET_ORDERMARKET_LISTING_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
		<fieldset name="basic" label="HikaMarket
Options">
			<field id="options" name="options"
type="selectoptions" label="options"
description="HikaMarket options" />
		</fieldset>
	</fields>
</metadata>views/ordermarket/tmpl/mail.php000064400000005604151166607750012652
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('order', true); ?>"
method="post" name="hikamarket_mail_form"
id="hikamarket_mail_form">

<div id="hikamarket_email_preview_settings">
<dl class="hikam_options large">

	<dt><label for="data[mail][dst_email]"><?php echo
JText::_('TO_ADDRESS'); ?></label></dt>
	<dd><?php
		$values = array(
			0 => JText::_('CUSTOMER'),
			1 => JText::_('HIKA_VENDOR'),
		);
		echo JHTML::_('select.genericlist', $values,
'data[mail][dst_email]', '', 'value',
'text', 0);
	?></dd>

	<dt><label for="data[mail][subject]"><?php echo
JText::_('EMAIL_SUBJECT'); ?></label></dt>
	<dd>
		<input type="text" name="data[mail][subject]"
size="80" style="width:90%" value="<?php echo
$this->escape($this->element->mail->subject); ?>"
/>
	</dd>

<?php
	foreach($this->element->mail_params_config as $k => $v) {
?>
	<dt><label for="data[mail][params][<?php echo $k;
?>]"><?php echo JText::_($v[1]);
?></label></dt>
	<dd><?php
		switch($v[0]) {
			case 'textarea':
				$placeholder = !empty($v[3]) ? JText::_($v[3], true) :
JText::_('HIKA_INHERIT', true);
				echo '<textarea
name="data[mail][params]['.$k.']"
style="width:90%;height:6em;"
placeholder="'.$placeholder.'"
onblur="window.localPage.refreshMail()">'.@$this->element->mail_params[$k].'</textarea>';
				break;
			case 'boolean':
				echo
$this->radioType->booleanlist('data[mail][params]['.$k.']',
'onchange="window.localPage.refreshMail()"',
@$this->element->mail_params[$k]);
				break;
		}
	?></dd>
<?php
	}
?>
</dl>
</div>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="order_id"
value="<?php echo (int)$this->element->order_id; ?>"
/>
	<input type="hidden" name="task"
value="mail" />
	<input type="hidden" name="ctrl"
value="order" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>

<script>
if(!window.localPage) window.localPage = {};
window.localPage.refreshMail = function() {
	var w = window, d = document, o = w.Oby, el =
d.getElementById('hikamarket_mail_preview'),
		data = o.getFormData('hikamarket_email_preview_settings',
true);
	o.addClass(el, "hikamarket_ajax_loading");
	o.xRequest("<?php echo
hikamarket::completeLink('order&task=previewmail&order_id='.(int)$this->element->order_id);
?>",
{mode:'POST',data:data,update:'hikamarket_mail_preview'},
function(xhr){
		o.removeClass(el, "hikamarket_ajax_loading");
	});
};
</script>

<h4><?php echo JText::_('PREVIEW_EMAIL');
?></h4>
<div id="hikamarket_mail_preview"
class="hikamarket_mail_preview">
<?php
	$this->setLayout('previewmail');
	echo $this->loadTemplate();
?>
</div>
views/ordermarket/tmpl/payments.php000064400000010310151166607750013556
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikam_product_listing">
<form action="<?php echo
hikamarket::completeLink('order&task=payments'); ?>"
method="post" id="adminForm"
name="adminForm">

<div class="hk-row-fluid">
	<div class="hkc-md-12">
<?php
	echo $this->loadHkLayout('search', array(
		'id' => 'hikamarket_order_listing_search'
	));
?>
		<div class="hikam_sort_zone"><?php
			if(!empty($this->ordering_values))
				echo JHTML::_('select.genericlist',
$this->ordering_values, 'filter_fullorder',
'onchange="this.form.submit();"', 'value',
'text', $this->full_ordering);
		?></div>
	</div>
	<div class="hkc-md-12">
		<div class="expand-filters">
<?php

echo $this->orderStatusType->display('filter_status',
$this->pageInfo->filter->filter_status, '
onchange="document.adminForm.submit();"', true);

foreach($this->extrafilters as $name => $filterObj) {
	echo $filterObj->displayFilter($name, $this->pageInfo->filter);
}

?>
		</div>
		<div style="clear:both"></div>
	</div>
</div>

<div id="hikam_payments_main_listing">
<?php
$manage = false; // hikamarket::acl('order/show');
$extra_classes = '';

foreach($this->orders as $order) {
	$url = ($manage) ?
hikamarket::completeLink('order&task=show&cid='.$order->order_id)
: null;
?>
	<div class="hk-card hk-card-default hk-card-vendor-order<?php
echo $extra_classes; ?>" data-hkm-order="<?php echo
(int)$order->order_id; ?>">
		<div class="hk-card-header">
<?php if(!empty($url)) { ?>
			<a class="hk-row-fluid" href="<?php echo $url;
?>">
<?php } else { ?>
			<div class="hk-row-fluid">
<?php } ?>
				<div class="hkc-sm-6 hkm_order_date">
					<i class="fa fa-clock"></i>
					<?php echo hikashop_getDate((int)$order->order_created,
'%Y-%m-%d %H:%M'); ?>
				</div>
				<div class="hkc-sm-6 hkm_order_price">
					<i class="fa fa-credit-card"></i>
					<?php echo
$this->currencyHelper->format($order->order_full_price,
$order->order_currency_id); ?>
				</div>
<?php if(!empty($url)) { ?>
			</a>
<?php } else { ?>
			</div>
<?php } ?>
		</div>
		<div class="hk-card-body">
			<div class="hk-row-fluid">
				<div class="hkc-sm-4 hkm_order_number">
<?php
	if(!empty($url)) {
					?><a href="<?php echo $url; ?>"><?php
	}
					?><i class="far fa-file-alt"
style="margin-right:4px;"></i><span
class="hika_order_number_value"><?php echo
$order->order_number; ?></span><?php
	if(!empty($url)) {
					?></a><?php
	}
?>
<?php if(!empty($order->order_invoice_number)) { ?>
					<span class="hkm_order_number_invoice_separator"> -
</span>
					<span class="hkm_invoice_number_value"><?php echo
$order->order_invoice_number; ?></span>
<?php } ?>
				</div>
				<div class="hkc-sm-2 hkm_order_status">
					<span class="order-label order-label-<?php echo
preg_replace('#[^a-z_0-9]#i', '_', str_replace('
','_',$order->order_status)); ?>"><?php
						echo hikamarket::orderStatus($order->order_status);
					?></span>
				</div>
				<div class="hkc-sm-6 hkm_payment_details"><?php
					echo JText::sprintf('PAYMENT_X_TRANSACTIONS',
(int)$order->counter);
				?></div>
			</div>
		</div>
	</div>
<?php
}
?>
	<div class="hikamarket_orders_footer">
		<div class="hikamarket_pagination">
			<?php $this->pagination->form = '_bottom'; echo
$this->pagination->getListFooter(); ?>
			<?php echo $this->pagination->getResultsCounter(); ?>
		</div>
	</div>
</div>

	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="payments" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="boxchecked"
value="0" />
	<input type="hidden" name="filter_order"
value="<?php echo
$this->pageInfo->filter->order->value; ?>" />
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->pageInfo->filter->order->dir;
?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>
views/ordermarket/tmpl/previewmail.php000064400000001051151166607750014244
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>	<div
class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
<?php

$pattern  = '/(src=")(?!https?:\/\/)/i';
$replacement = '$1';
echo preg_replace($pattern, $replacement.HIKASHOP_LIVE,
@$this->element->mail->body);
views/ordermarket/tmpl/request.php000064400000003751151166607750013421
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('order'); ?>"
method="post" id="hikamarket_order_request_form"
name="hikamarket_order_request_form">
<?php
if(count($this->data) <= 1) {
?>

<dl class="hikam_options">
	<dt><?php echo JText::_('HIKAM_STATS_TOTAL_ORDERS');
?></dt>
	<dd><?php echo $this->total->count; ?></dd>

	<dt><?php echo JText::_('HIKASHOP_TOTAL');
?></dt>
	<dd><?php echo
$this->currencyHelper->format($this->total->value,
$this->total->currency); ?></dd>
</dl>

<?php
} else {
?>
	<table class="hikam_listing <?php echo
(HIKASHOP_RESPONSIVE)?'table table-striped table-hover
table-bordered':'hikam_table'; ?>"
style="width:100%">
		<thead>
			<tr>
				<th><?php echo JText::_('HIKAM_STATS_TOTAL_ORDERS');
?></th>
				<th><?php echo JText::_('HIKASHOP_TOTAL');
?></th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td><?php echo $this->total->count; ?></td>
				<td><?php echo
$this->currencyHelper->format($this->total->value,
$this->total->currency); ?></td>
			</tr>
		</tfoot>
		<tbody>
<?php
	foreach($this->data as $data) {
?>
			<tr>
				<td><?php echo (int)$data->count; ?></td>
				<td><?php echo
$this->currencyHelper->format($data->value, $data->currency);
?></td>
			</tr>
<?php
	}
?>
		</tbody>
	</table>
<?php
}
?>
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task" value=""
/>
	<input type="hidden" name="data[request]"
value="1" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
<?php
	if($this->total->value != 0)
		echo JHTML::_( 'form.token' );
?>
</form>
views/ordermarket/tmpl/show.php000064400000016513151166607750012711
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><script type="text/javascript">
<!--
if(!window.orderMgr)
	window.orderMgr = {};
window.orderMgr.customer_id = <?php echo
(int)$this->order->order_user_id; ?>;
window.orderMgr.showEl = function(el, sel) {
	window.hikamarket.submitFct = function(data) {
window.hikamarket.closeBox(); };
	var href = el.getAttribute('data-popup-href');
	if(!href) href = el.getAttribute('href');
	window.hikamarket.openBox(sel, href);
	return false;
};
window.orderMgr.toggleDisplay = function(el) {
	var d = document, block =
el.getAttribute('data-toggle-display'), e =
d.getElementById(block);
	if(!e) return false;
	e.style.display = (e.style.display == 'none') ? '' :
'none';
	el.blur();
	return false;
};
window.orderMgr.refreshBlock = function(type, edit, prefix) {
	var d = document, w = window, o = w.Oby, el = null;
	if(prefix !== undefined) el =
d.getElementById("hikamarket_order_" + prefix + "_" +
type);
	if(edit && !el) el =
d.getElementById("hikamarket_order_edit_" + type);
	if(!el) el = d.getElementById("hikamarket_order_block_" +
type);
	if(!el) return false;
	o.addClass(el, "hikamarket_ajax_loading");
	var url = '<?php echo
hikamarket::completeLink('order&task=showblock&block=HIKATYPE&cid='.(int)$this->order->order_id.'&tmpl=ajax',
false, false, true); ?>'.replace("HIKATYPE", (edit ?
'edit_' : '') + type);
	o.xRequest(url, {update: el}, function(x,p) {
		o.removeClass(el, "hikamarket_ajax_loading");
	});
	return false;
};
window.orderMgr.submitBlock = function(type, opt, cb, prefix) {
	var url = null, formData = '', d = document, w = window, o =
w.Oby, el = null;
	if(prefix !== undefined) el =
d.getElementById("hikamarket_order_" + prefix + "_" +
type);
	if(!el) el = d.getElementById("hikamarket_order_edit_" + type);
	if(!el) el = d.getElementById("hikamarket_order_block_" +
type);
	if(!el) return false;

	if(!opt || opt.data === undefined || !opt.data) {
		formData = o.getFormData(el);
	} else if(opt.data) {
		formData = o.encodeFormData(opt.data);
	}
	o.addClass(el, "hikamarket_ajax_loading");
	url = '<?php echo
hikamarket::completeLink('order&task=submitblock&block=HIKATYPE&cid='.(int)$this->order->order_id.'&'.hikamarket::getFormToken().'=1&tmpl=ajax',
false, false, true); ?>'.replace("HIKATYPE", type);
	var params = {mode:"POST", data:formData};
	if(opt && opt.update) {
		params.update = (opt.update === true) ? el : opt.update;
	}
	o.xRequest(url, params, function(x,p) {
		o.removeClass(el, "hikamarket_ajax_loading");
		if(cb) cb(x,p);
	});
	return false;
};
window.orderMgr.updateTaxValueFields = function(key) {
	var d = document, rate = 0.0, v = 0.0,
		el = d.getElementById(key+'_value'),
		s = d.getElementById(key+'tax_namekey');

	if(!s) s = d.getElementById(key+'_tax_namekey');
	if(!s) return;
	rate = s.options[ s.selectedIndex ];
	if(!rate) return;
	try {
		rate = parseFloat(rate.getAttribute('data-rate'));
	} catch(e) { return; }

	try {
		v = parseFloat( Oby.trim(el.value) );
		if(isNaN(v)) v = 0.0;
	} catch(e) { v = 0.0; }

	var n = v - (v / (1 + rate));
	s = d.getElementById(key+'_tax');
	if(s) s.value = parseFloat(n.toFixed(5));

	s = d.getElementById(key+'_value_tax');
	if(s) s.innerHTML = parseFloat(n.toFixed(5));

	n = (v / (1 + rate));
	s = d.getElementById(key+'_value_price');
	if(s) s.innerHTML = parseFloat(n.toFixed(5));
};
window.orderMgr.editOrderStatus = function(el) {
	window.hikamarket.submitFct = function(data) {
		var orderstatus =
document.getElementById('hikamarket_order_status');
		if(orderstatus) {
			orderstatus.innerHTML = data.name;
			orderstatus.className = 'order-label order-label-' +
data.order_status.replace(/[^a-z_0-9]/i, '_');
		}
		window.hikamarket.closeBox();
	};
	var href = el.getAttribute('href');
	if(href == '' || href == null || href == '#')
		href = null;
	window.hikamarket.openBox('hikamarket_order_status_popup',
href);
	return false;
};
//-->
</script>
<div class="hikamarket_order">
	<h2 style="display:inline-block"><?php
		echo JText::sprintf('HIKAM_ORDER',
$this->order->order_number);
	?></h2>
	<span id="hikamarket_order_status"
style="margin-left:7px;font-size:1.2em;line-height:1.3em;"
class="order-label order-label-<?php echo
preg_replace('#[^a-z_0-9]#i', '_', str_replace('
','_',$this->order->order_status));
?>"><?php echo
hikamarket::orderStatus($this->order->order_status);
?></span>

<!-- GENERAL -->
<?php
echo $this->loadTemplate('block_general');
?>

<!-- ADDITIONAL -->
	<h3 style="display:inline-block"><?php echo
JText::_('ORDER_DETAILS')?></h3>
<?php

echo $this->loadTemplate('block_details');

if(!empty($this->fields['order']) &&
hikamarket::acl('order/show/customfields')) {
	echo $this->loadTemplate('block_fields');
}

?>

<!-- CUSTOMER -->
<?php if(hikamarket::acl('order/show/customer')) { ?>
	<h3 style="display:inline-block"><?php echo
JText::_('CUSTOMER')?></h3>
<?php
	if($this->editable_order &&
hikamarket::acl('order/edit/customer')) {
		echo $this->loadTemplate('block_edit_customer');
	}

	echo $this->loadTemplate('block_customer');
}
?>

<!-- ADDRESSES -->
<?php
if(hikamarket::acl('order/show/billingaddress') ||
hikamarket::acl('order/show/shippingaddress')) {
	$acl_billing = hikamarket::acl('order/show/billingaddress');
	$acl_shipping = hikamarket::acl('order/show/shippingaddress');
	$cell_class = ($acl_billing && $acl_shipping) ?
'hkc-md-6' : 'hkc-md-12';
?>
	<div class="hk-row-fluid hikamarket_order_addresses">
<?php
	if($acl_billing) {
?>
		<div class="<?php echo $cell_class; ?>
hikamarket_order_billing_address">
			<h3 style="display:inline-block;"><?php echo
JText::_('HIKASHOP_BILLING_ADDRESS')?></h3>
<?php
		$this->block_edit_address = 'billing';
		echo $this->loadTemplate('block_edit_address');

		$this->block_show_address = 'billing';
		echo $this->loadTemplate('block_address');
?>
		</div>
<?php
	}
?>

<?php
	if($acl_shipping) {
		$display_shipping_addr = empty($this->order->order_shipping_id) ?
'display:none;' : '';
?>
		<div class="<?php echo $cell_class; ?>
hikamarket_order_shipping_address" style="<?php echo
$display_shipping_addr; ?>">
			<h3 style="display:inline-block;"><?php echo
JText::_('HIKASHOP_SHIPPING_ADDRESS')?></h3>
<?php
		if(empty($this->order->override_shipping_address)) {
			$this->block_edit_address = 'shipping';
			echo $this->loadTemplate('block_edit_address');
		}

		$this->block_show_address = 'shipping';
		echo $this->loadTemplate('block_address');
?>
		</div>
<?php
	}
?>
	</div>
<?php } ?>

<!-- PRODUCTS -->
	<h3 style="display:inline-block"><?php echo
JText::_('PRODUCT_LIST')?></h3>
<?php
echo $this->loadTemplate('block_products');
?>

<?php
if(hikamarket::level(1) && $this->order->order_type ==
'sale' &&
hikamarket::acl('order/show/vendors')) {
	echo $this->loadTemplate('block_vendors');
}
?>

<!-- OTHER COMPONENTS -->
<?php
JFactory::getApplication()->triggerEvent('onAfterOrderProductsListingDisplay',
array(&$this->order, 'order_frontmarket_show'));
?>

<!-- HISTORY -->
<?php
if(hikamarket::acl('order/show/history')) {
	echo $this->loadTemplate('block_history');
}
?>
</div>
views/ordermarket/tmpl/show_additional.php000064400000024601151166607750015076
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>	<legend><?php echo JText::_('ORDER_ADD_INFO');
?></legend>
<?php if(hikamarket::acl('order/edit/additional') &&
($this->vendor->vendor_id == 0 || $this->vendor->vendor_id ==
1)) { ?>
		<div class="hikam_edit"><?php
			echo $this->popup->display(
				'<i class="fas
fa-pencil-alt"></i><span>'.
JText::_('HIKA_EDIT') .'</span>',
				'HIKAM_SET_ORDER_ADDITIONALS',
				hikamarket::completeLink('order&task=edit&subtask=additional&cid='.$this->order->order_id,
true),
				'hikamarket_editadditional_popup',
				750, 460, 'onclick="return
window.orderMgr.setAdditionals(this);"', '',
'link'
			);
		?></div>
<script type="text/javascript">
<!--
window.orderMgr.setAdditionals = function(el) {
	window.hikamarket.submitFct = function(data) {
		var w = window, o = w.Oby;
		w.hikashop.closeBox();
		w.orderMgr.updateAdditionals();
	};
	window.hikashop.openBox(el);
	return false;
}
window.orderMgr.updateAdditionals = function() {
	window.Oby.xRequest('<?php echo
hikamarket::completeLink('order&task=show&subtask=additional&cid='.$this->order->order_id,
true, false, true); ?>', {update:
'hikashop_order_field_additional'});
}
//-->
</script>
<?php } ?>
	<dl class="hikam_options">
		<dt
class="hikamarket_order_additional_subtotal"><label><?php
echo JText::_('SUBTOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_additional_subtotal"><span><?php
			if($this->shopConfig->get('price_with_tax'))
				echo
$this->currencyHelper->format($this->order->order_subtotal,
$this->order->order_currency_id);
			else
				echo
$this->currencyHelper->format($this->order->order_subtotal_no_vat,
$this->order->order_currency_id);
		?></span></dd>

		<dt
class="hikamarket_order_additional_coupon"><label><?php
echo JText::_('HIKASHOP_COUPON'); ?></label></dt>
		<dd
class="hikamarket_order_additional_coupon"><span><?php
			if($this->shopConfig->get('price_with_tax'))
				echo
$this->currencyHelper->format($this->order->order_discount_price
* -1.0, $this->order->order_currency_id);
			else
				echo
$this->currencyHelper->format(($this->order->order_discount_price
- @$this->order->order_discount_tax) * -1.0,
$this->order->order_currency_id);
		?> <?php echo $this->order->order_discount_code;
?></span></dd>

		<dt
class="hikamarket_order_additional_shipping"><label><?php
echo JText::_('SHIPPING'); ?></label></dt>
		<dd
class="hikamarket_order_additional_shipping"><span><?php
			if($this->shopConfig->get('price_with_tax'))
				echo
$this->currencyHelper->format($this->order->order_shipping_price,
$this->order->order_currency_id);
			else
				echo
$this->currencyHelper->format($this->order->order_shipping_price
- @$this->order->order_shipping_tax,
$this->order->order_currency_id);

			if(empty($this->order->order_shipping_method) &&
empty($this->order->shippings)) {
				echo '-
<em>'.JText::_('NONE').'</em>';
			} else if(!empty($this->order->order_shipping_method)) {
				if(!is_numeric($this->order->order_shipping_id)){
					$shipping_name =
$this->getShippingName($this->order->order_shipping_method,
$this->order->order_shipping_id);
					echo ' - ' . $shipping_name;
				} else {
					$shipping =
$this->shippingClass->get($this->order->order_shipping_id);
					echo ' - ' . $shipping->shipping_name;
				}
			} else {
				$shippings_data = array();
				$shipping_ids = explode(';',
$this->order->order_shipping_id);
				foreach($shipping_ids as $key) {
					$shipping_data = '';
					list($k, $w) = explode('@', $key);
					$shipping_id = $k;
					if(isset($this->order->shippings[$shipping_id])) {
						$shipping = $this->order->shippings[$shipping_id];
						$shipping_data = $shipping->shipping_name;
					} else {
						foreach($this->order->products as $order_product) {
							if($order_product->order_product_shipping_id == $key) {
								if(!is_numeric($order_product->order_product_shipping_id)) {
									$shipping_name =
$this->getShippingName($order_product->order_product_shipping_method,
$shipping_id);
									$shipping_data = $shipping_name;
								} else {
									$shipping_method_data =
$this->shippingClass->get($shipping_id);
									$shipping_data = $shipping_method_data->shipping_name;
								}
								break;
							}
						}
						if(empty($shipping_data))
							$shipping_data = '[ ' . $key . ' ]';
					}
					if(isset($this->order->order_shipping_params->prices[$key]))
{
						$price_params =
$this->order->order_shipping_params->prices[$key];
						if($this->shopConfig->get('price_with_tax'))
							$shipping_data .= ' (' .
$this->currencyHelper->format($price_params->price_with_tax,
$this->order->order_currency_id) . ')';
						else
							$shipping_data .= ' (' .
$this->currencyHelper->format($price_params->price_with_tax -
@$price_params->tax, $this->order->order_currency_id) .
')';
					}
					$shippings_data[] = $shipping_data;
				}
				if(!empty($shippings_data))
					echo
'<ul><li>'.implode('</li><li>',
$shippings_data).'</li></ul>';
			}
			?></span></dd>

		<dt
class="hikamarket_order_additional_payment_fee"><label><?php
echo JText::_('HIKASHOP_PAYMENT');
?></label></dt>
		<dd
class="hikamarket_order_additional_payment_fee"><span><?php
echo
$this->currencyHelper->format($this->order->order_payment_price,
$this->order->order_currency_id); ?> - <?php
			if(empty($this->order->order_payment_method) ||
$this->order->order_payment_method == 'market-')
				echo
'<em>'.JText::_('NONE').'</em>';
			else {
				if(!is_numeric($this->order->order_payment_id)){
					echo $this->order->order_payment_method.'
'.$this->order->order_payment_id;
				} else if((int)$this->order->order_payment_id > 0) {
					$payment =
$this->paymentClass->get($this->order->order_payment_id);
					echo @$payment->payment_name;
				}
			}
			?></span></dd>
<?php
	if(!empty($this->order->additional)) {
		foreach($this->order->additional as $additional) {
?>
		<dt
class="hikamarket_order_additional_additional"><label><?php
echo JText::_($additional->order_product_name);
?></label></dt>
		<dd
class="hikamarket_order_additional_additional"><span><?php
			if(!empty($additional->order_product_price)) {
				$additional->order_product_price =
(float)$additional->order_product_price;
			}
			if(!empty($additional->order_product_price) ||
empty($additional->order_product_options)) {
				echo
$this->currencyHelper->format($additional->order_product_price,
$this->order->order_currency_id);
			} else {
				echo $additional->order_product_options;
			}
		?></span></dd>
<?php
		}
	}

	if($this->shopConfig->get('detailed_tax_display')
&& !empty($this->order->order_tax_info)) {
		foreach($this->order->order_tax_info as $tax){
?>
		<dt
class="hikamarket_order_additional_tax"><label><?php
echo $tax->tax_namekey; ?></label></dt>
		<dd
class="hikamarket_order_additional_tax"><span><?php
			echo
$this->currencyHelper->format($tax->tax_amount,$this->order->order_currency_id);
		?></span></dd>
<?php
		}
	}
?>
		<dt
class="hikamarket_order_additional_total"><label><?php
			if((int)$this->order->order_vendor_id <= 1)
				echo JText::_('HIKASHOP_TOTAL');
			else
				echo JText::_('HIKAM_USER_TOTAL');
		?></label></dt>
		<dd
class="hikamarket_order_additional_total"><span><?php
echo
$this->currencyHelper->format($this->order->order_full_price,$this->order->order_currency_id);
?></span></dd>

<?php
	if((int)$this->order->order_vendor_id > 1) {
		$fixed_fees = 0.0;
		if(!empty($this->order->order_vendor_params->fees->fixed)) {
			foreach($this->order->order_vendor_params->fees->fixed as
$fixed_fee) {
				$fixed_fees += $fixed_fee;
			}
		}
		if(bccomp($fixed_fees, 0, 5) !== 0) {
?>
	<!-- Vendor fixed fees -->
		<dt
class="hikamarket_order_vendor_fixed_fees"><label><?php
echo JText::_('HIKAM_VENDOR_FIXED_FEES');
?></label></dt>
		<dd
class="hikamarket_order_vendor_fixed_fees"><span><?php
			echo $this->currencyHelper->format($fixed_fees,
$this->order->order_currency_id);
		?></span></dd>
<?php
		}

		if(!empty($this->order->order_vendor_params->fees->shipping))
{
?>
	<!-- Vendor shipping fees -->
		<dt
class="hikamarket_order_vendor_shipping_fees"><label><?php
echo JText::_('HIKAM_VENDOR_SHIPPING_FEES');
?></label></dt>
		<dd
class="hikamarket_order_vendor_shipping_fees"><span><?php
			echo
$this->currencyHelper->format($this->order->order_vendor_params->fees->shipping,
$this->order->order_currency_id);
		?></span></dd>
<?php
		}

		if($this->order->order_vendor_paid > 0) {
			$total = $this->order->order_vendor_price;
			$paid = $this->order->order_vendor_price;
			if(!empty($this->order->refunds)) {
				foreach($this->order->refunds as $refund) {
					$total += (float)hikamarket::toFloat($refund->order_vendor_price);
					if($refund->order_vendor_paid > 0)
						$paid += (float)hikamarket::toFloat($refund->order_vendor_price);
				}
			}
?>
	<!-- Vendor shipping fees -->
		<dt
class="hikamarket_order_vendor_paid"><label><?php
echo JText::_('VENDOR_TOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_vendor_paid"><span><?php
			echo $this->currencyHelper->format($total,
$this->order->order_currency_id);

			if($total == $paid)
				echo ' ' .
hikamarket::tooltip(JText::_('HIKAM_ORDER_IS_PAID'),
'', '', '<img
src="'.HIKAMARKET_IMAGES.'icon-16/save2.png"
style="vertical-align:top;"
alt="('.JText::_('PAID').')" />',
'', 0);
		?></span></dd>
<?php
		} else {
?>
	<!-- Vendor total -->
		<dt
class="hikamarket_order_vendor_total"><label><?php
echo JText::_('VENDOR_TOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_vendor_total"><span><?php
			echo
$this->currencyHelper->format($this->order->order_vendor_price,
$this->order->order_currency_id);
		?></span></dd>
<?php
		}
	}

	if(!empty($this->fields['order'])) {
		foreach($this->fields['order'] as $fieldName =>
$oneExtraField) {
?>
		<dt class="hikamarket_order_additional_customfield
hikamarket_order_additional_customfield_<?php echo $fieldName;
?>"><?php echo
$this->fieldsClass->getFieldName($oneExtraField);?></dt>
		<dd class="hikamarket_order_additional_customfield
hikamarket_order_additional_customfield_<?php echo $fieldName;
?>"><span><?php
			echo $this->fieldsClass->show($oneExtraField,
@$this->order->$fieldName);
		?></span></dd>
<?php
		}
	}
?>
	</dl>
views/ordermarket/tmpl/show_address.php000064400000011506151166607750014413
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><legend><?php echo
JText::_('HIKASHOP_'.strtoupper($this->type).'_ADDRESS');
?></legend>
<?php

$name = $this->type.'_address';
$fields_type = $this->type.'_fields';
if(!isset($this->order->$fields_type))
	$fields_type = 'fields';
$show_url =
'order&task=show&subtask='.$name.'&cid='.$this->order->order_id;
$save_url =
'order&task=save&subtask='.$name.'&cid='.$this->order->order_id;
$update_url =
'order&task=edit&subtask='.$name.'&cid='.$this->order->order_id;

if(hikamarket::acl('order/edit/'.$name) &&
($this->vendor->vendor_id == 0 || $this->vendor->vendor_id ==
1)) {
	if(!isset($this->edit) || $this->edit !== true ) {
?>		<div class="hikam_edit"><a href="<?php
echo hikamarket::completeLink($update_url, true);?>"
onclick="return
window.hikamarket.get(this,'hikamarket_order_field_<?php echo
$name; ?>');"><i class="fas
fa-pencil-alt"></i><span><?php echo
JText::_('HIKA_EDIT'); ?></span></a></div>
<?php
	} else {
?>		<div class="hikam_edit">
			<a href="<?php echo hikamarket::completeLink($save_url,
true);?>" onclick="return
window.hikamarket.form(this,'hikamarket_order_field_<?php echo
$name; ?>');"><i class="far
fa-times-circle"></i><span><?php echo
JText::_('HIKA_SAVE'); ?></span></a>
			<a href="<?php echo hikamarket::completeLink($show_url,
true);?>" onclick="return
window.hikamarket.get(this,'hikamarket_order_field_<?php echo
$name; ?>');"><i class="fas
fa-check"></i><span><?php echo
JText::_('HIKA_CANCEL'); ?></span></a>
		</div>
<?php
	}
}

$address =& $this->order->$name;
$display = 'field_backend';
if(isset($this->edit) && $this->edit === true ) {
	if(hikamarket::acl('order/edit/'.$name)) {
		foreach($this->order->$fields_type as $field) {
			if(!$field->$display)
				continue;

			$fieldname = $field->field_namekey;
?>
	<dl id="hikashop_<?php echo
$this->type;?>order_address_<?php echo $fieldname;?>"
class="hikam_options">
		<dt class="hikamarket_<?php echo
$this->type;?>order_address_<?php echo
$fieldname;?>"><label><?php echo
$this->fieldsClass->trans($field->field_realname);?></label></dt>
		<dd class="hikamarket_<?php echo
$this->type;?>order_address_<?php echo
$fieldname;?>"><?php
			$onWhat = 'onchange';
			if($field->field_type == 'radio')
				$onWhat = 'onclick';

			$field->table_name = 'order';
			echo $this->fieldsClass->display(
					$field,
					@$address->$fieldname,
					'data['.$name.']['.$fieldname.']',
					false,
					' ' . $onWhat .
'="hikashopToggleFields(this.value,\''.$fieldname.'\',\''.$name.'\',0);"',
					false,
					$this->order->$fields_type,
					$address
			);
		?></dd>
	</dl>
<?php
		}
	}

	if(hikamarket::acl('order/edit/history')) {
?>
	<dl class="hikam_options">
		<dt class="hikamarket_<?php echo
$this->type;?>_history"><label><?php echo
JText::_('HISTORY'); ?></label></dt>
		<dd class="hikamarket_<?php echo
$this->type;?>_history">
			<span><input onchange="window.orderMgr.<?php echo
$this->type;?>_history_changed(this);" type="checkbox"
id="hikamarket_history_<?php echo $this->type;?>_store"
name="data[history][store_data]"
value="1"/><label for="hikamarket_history_<?php
echo $this->type;?>_store"
style="display:inline-block"><?php echo
JText::_('SET_HISTORY_MESSAGE');?></label></span><br/>
			<textarea id="hikamarket_history_<?php echo
$this->type;?>_msg" name="data[history][msg]"
style="display:none;"></textarea>
		</dd>
	</dl>
<script type="text/javascript">
window.orderMgr.<?php echo $this->type;?>_history_changed =
function(el) {
	var fields = ['hikamarket_history_<?php echo
$this->type;?>_msg'], displayValue = '';
	if(!el.checked) displayValue = 'none';
	window.hikamarket.setArrayDisplay(fields, displayValue);
}
</script>
<?php
	}

	echo JHTML::_( 'form.token' );
} else {
	foreach($this->order->$fields_type as $field){
		if($field->$display){
			$fieldname = $field->field_namekey;
?>
	<dl class="hikam_options">
		<dt class="hikamarket_<?php echo
$this->type;?>order_address_<?php echo
$fieldname;?>"><label><?php echo
$this->fieldsClass->trans($field->field_realname);?></label></dt>
		<dd class="hikamarket_<?php echo
$this->type;?>order_address_<?php echo
$fieldname;?>"><span><?php echo
$this->fieldsClass->show($field,
@$address->$fieldname);?></span></dd>
	</dl>
<?php
		}
	}
}
?>
<script type="text/javascript">
window.orderMgr.update<?php echo ucfirst($this->type);?> =
function() {
	window.Oby.xRequest('<?php echo
hikamarket::completeLink('order&task=show&subtask='.$this->type.'_address&cid='.$this->order->order_id,true,false,true);
?>',{update:'hikashop_order_field_<?php echo
$this->type; ?>_address'});
}
</script>
views/ordermarket/tmpl/show_block_address.php000064400000004170151166607750015564
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$type = @$this->block_show_address;
if(!in_array($type, array('shipping', 'billing')))
	return;
if(!hikamarket::acl('order/show/'.$type.'address'))
	return;

if(empty($this->ajax)) { ?>
<div id="hikamarket_order_block_<?php echo $type;
?>address">
<?php } ?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
<?php

if($type == 'billing' ||
empty($this->order->override_shipping_address)) {
	$address = ($type == 'billing') ?
@$this->addresses[(int)$this->order->order_billing_address_id] :
@$this->addresses[(int)$this->order->order_shipping_address_id];

	if($this->address_mode == 0) {
		echo $this->addressClass->maxiFormat($address,
$this->address_fields, true);
	} else {
?>
	<dl class="hikam_options dl_glue">
<?php
		$fields = (isset($this->order->{$type.'_fields'}) ?
$this->order->{$type.'_fields'} :
$this->order->fields);
		foreach($fields as $field) {
			if(empty($field->field_frontcomp) &&
strpos($field->field_display, ';vendor_order_show=1;') ===
false)
				continue;

			$fieldname = $field->field_namekey;
?>
		<dt class="hikamarket_<?php echo $type;
?>order_address_<?php echo
$fieldname;?>"><label><?php echo
$this->fieldsClass->trans($field->field_realname);?></label></dt>
		<dd class="hikamarket_<?php echo $type;
?>order_address_<?php echo
$fieldname;?>"><span><?php echo
$this->fieldsClass->show($field,
@$address->$fieldname);?></span></dd>
<?php
		}
?>
	</dl>
<?php
	}
} else {
	echo $this->order->override_shipping_address;
}

if(!empty($this->ajax))
	return;
?>
</div>
<script type="text/javascript">
window.Oby.registerAjax('orderMgr.<?php echo $type;
?>address',function(params){
	if(params && params.src && params.src == '<?php
echo $type; ?>address') return;
	window.orderMgr.refreshBlock('<?php echo $type;
?>address');
});
</script>
views/ordermarket/tmpl/show_block_customer.php000064400000004364151166607750016005
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!hikamarket::acl('order/show/customer'))
	return;

if(empty($this->ajax)) { ?>
<div id="hikamarket_order_block_customer">
<?php } ?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>

	<dl class="hikam_options large">
		<dt
class="hikamarket_order_customer_name"><label><?php
echo JText::_('HIKA_NAME');?></label></dt>
		<dd class="hikamarket_order_customer_name"><span
id="hikamarket_order_customer_name"><?php
			$customer_name = @$this->order->customer->name;
			if(empty($customer_name))
				$customer_name = '<em>' .
JText::_('HIKA_NONE') . '</em>';

			if($this->order->order_user_id > 0 &&
hikamarket::acl('user/show')) {
				?><a onclick="return
window.orderMgr.showCustomer(this);" data-popup-href="<?php
echo
hikamarket::completeLink('user&task=show&cid='.$this->order->order_user_id,
true); ?>" href="<?php echo
hikamarket::completeLink('user&task=show&cid='.$this->order->order_user_id);
?>"><?php
					echo $customer_name;
				?></a><?php
			} else
				echo $customer_name;
		?></span></dd>

		<dt
class="hikamarket_order_customer_email"><label><?php
echo JText::_('HIKA_EMAIL');?></label></dt>
		<dd class="hikamarket_order_customer_email"><span
id="hikamarket_order_customer_email"><?php echo
@$this->order->customer->user_email;
?></span></dd>
	</dl>
<?php

if(!empty($this->ajax))
	return;
?>
</div>
<?php
if(hikamarket::acl('user/show')) {
	echo $this->popup->display(
		'',
		'HIKAM_CUSTOMER_DETAILS',
		hikamarket::completeLink('user&task=show&cid=0',
true),
		'hikamarket_showcustomer_popup',
		750, 460, 'style="display:none;"', '',
'link'
	);
}
?>
<script type="text/javascript">
window.Oby.registerAjax('orderMgr.customer',function(params){
	if(params && params.src && params.src ==
'customer') return;
	window.orderMgr.refreshBlock('customer');
});
window.orderMgr.showCustomer = function(el) { return this.showEl(el,
'hikamarket_showcustomer_popup'); };
</script>
views/ordermarket/tmpl/show_block_details.php000064400000026570151166607750015574
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->order))
	return;

if(empty($this->ajax)) {

	if(hikamarket::acl('order/edit')) {
		$dropData = array();

		if($this->editable_order &&
hikamarket::acl('order/edit/coupon')) {
			$dropData['coupon'] = array(
				'name' => '<i class="fas
fa-percentage"></i> ' .
JText::_('HIKAM_EDIT_COUPON'),
				'link' => '#coupon',
				'click' => 'return
window.orderMgr.showEditDetails(this, \'coupon\', true);'
			);
		}
		if($this->editable_order &&
hikamarket::acl('order/edit/shipping')) {
			$dropData['shipping'] = array(
				'name' => '<i class="fas
fa-shipping-fast"></i> ' .
JText::_('HIKAM_EDIT_SHIPPING'),
				'link' => '#shipping',
				'click' => 'return
window.orderMgr.showEditDetails(this, \'shipping\', true);'
			);
		}
		if($this->editable_order &&
hikamarket::acl('order/edit/payment')) {
			$dropData['payment'] = array(
				'name' => '<i class="far
fa-credit-card"></i> ' .
JText::_('HIKAM_EDIT_PAYMENT'),
				'link' => '#payment',
				'click' => 'return
window.orderMgr.showEditDetails(this, \'payment\', true);'
			);
		}
		if(!empty($this->fields['order']) &&
$this->editable_order &&
hikamarket::acl('order/show/customfields') &&
hikamarket::acl('order/edit/customfields')) {
			$dropData[] = array(
				'name' => '<i class="fas
fa-clipboard-list"></i> ' .
JText::_('HIKAM_EDIT_CUSTOM_FIELDS'),
				'link' => '#fields',
				'click' => 'return
window.orderMgr.refreshBlock(\'fields\', true);'
			);
		}

		if(!empty($dropData)) {
			echo
$this->dropdownHelper->display(JText::_('HIKAM_EDIT'),
$dropData, array('type' => '', 'mini'
=> true, 'class' => 'hikabtn-primary',
'right' => false, 'up' => false));
?>
<script type="text/javascript">
window.orderMgr.showEditDetails = function(el, type, show) {
	if(type != 'coupon' && type != 'payment'
&& type != 'shipping')
		return false;

	var d = document,
		block = d.getElementById('hikamarket_order_edit_' + type),
		marker = false,
		showing = ((show === undefined && block.style.display ==
'none') || show == true);
	if(!block)
		return false;
	block.style.display = showing ? '' : 'none';

	if(!marker && showing)
		this.refreshBlock(type, true);
	return false;
};
window.orderMgr.submitDetails = function(el, type) {
	var d = document, w = window, o = w.Oby,
		block = document.getElementById('hikamarket_order_edit_' +
type);
	if(block)
		o.addClass(el, "hikamarket_ajax_loading");
	this.submitBlock(type, {data:false, update:false}, function(x,p){
		if(block) {
			o.removeClass(el, "hikamarket_ajax_loading");
			if(x.responseText.length > 1)
				return window.Oby.updateElem(block, x.responseText);
		}
		window.Oby.fireAjax('orderMgr.details', null);
	});
	return this.showEditDetails(el, type, false);
};
</script>
<?php
		}

		if($this->editable_order &&
hikamarket::acl('order/edit/coupon')) {
?>
<div class="hikamarket_order_edit_block"
id="hikamarket_order_edit_coupon"
style="display:none;">
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
</div>
<?php
		}

		if($this->editable_order &&
hikamarket::acl('order/edit/shipping')) {
?>
<div class="hikamarket_order_edit_block"
id="hikamarket_order_edit_shipping"
style="display:none;">
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
</div>
<?php
		}

		if($this->editable_order &&
hikamarket::acl('order/edit/payment')) {
?>
<div class="hikamarket_order_edit_block"
id="hikamarket_order_edit_payment"
style="display:none;">
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
</div>
<?php
		}
	}
?>
<div id="hikamarket_order_block_details">
<?php } ?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>

	<dl class="hikam_options large">
		<dt
class="hikamarket_order_additional_subtotal"><label><?php
echo JText::_('SUBTOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_additional_subtotal"><span><?php
			if($this->shopConfig->get('price_with_tax'))
				echo
$this->currencyHelper->format($this->order->order_subtotal,
$this->order->order_currency_id);
			else
				echo
$this->currencyHelper->format($this->order->order_subtotal_no_vat,
$this->order->order_currency_id);
		?></span></dd>

<?php if(!empty($this->order->order_discount_code) ||
bccomp($this->order->order_discount_price, 0, 5) !== 0) { ?>
		<dt
class="hikamarket_order_additional_coupon"><label><?php
echo JText::_('HIKASHOP_COUPON'); ?></label></dt>
		<dd
class="hikamarket_order_additional_coupon"><span><?php
			if($this->shopConfig->get('price_with_tax'))
				echo
$this->currencyHelper->format($this->order->order_discount_price
* -1.0, $this->order->order_currency_id);
			else
				echo
$this->currencyHelper->format(($this->order->order_discount_price
- @$this->order->order_discount_tax) * -1.0,
$this->order->order_currency_id);
		?> <span class="label label-default"><?php echo
$this->order->order_discount_code;
?></span></span></dd>
<?php } ?>

	<!-- Shipping -->
<?php if(!empty($this->order->order_shipping_id) ||
bccomp($this->order->order_shipping_price, 0, 5) !== 0) { ?>
		<dt
class="hikamarket_order_additional_shipping"><label><?php
echo JText::_('SHIPPING'); ?></label></dt>
		<dd
class="hikamarket_order_additional_shipping"><span><?php
			if($this->shopConfig->get('price_with_tax'))
				echo
$this->currencyHelper->format($this->order->order_shipping_price,
$this->order->order_currency_id);
			else
				echo
$this->currencyHelper->format($this->order->order_shipping_price
- @$this->order->order_shipping_tax,
$this->order->order_currency_id);
		?> <span class="hk-label hk-label-blue"><?php
			if(empty($this->order->shipping_name))
				echo
'<em>'.JText::_('HIKA_NONE').'</em>';
			else if(is_string($this->order->shipping_name))
				echo $this->order->shipping_name;
			else if(!empty($this->order->shipping_data))
				echo implode('</span> <span class="hk-label
hk-label-blue">', $this->order->shipping_data);
			else
				echo implode('</span> <span class="hk-label
hk-label-blue">', $this->order->shipping_name);
		?></span></dd>
<?php
	}
?>

	<!-- Payment -->
<?php if(!empty($this->order->order_payment_id) ||
bccomp($this->order->order_payment_price, 0, 5) !== 0) { ?>
		<dt
class="hikamarket_order_additional_payment"><label><?php
echo JText::_('HIKASHOP_PAYMENT');
?></label></dt>
		<dd
class="hikamarket_order_additional_payment"><span><?php
			echo
$this->currencyHelper->format($this->order->order_payment_price,
$this->order->order_currency_id);
		?> <span class="hk-label hk-label-blue"><?php echo
@$this->order->payment_name; ?></span></dd>
<?php
	}
?>
	<!-- Additional -->
<?php
	if(!empty($this->order->additional)) {
		foreach($this->order->additional as $additional) {
?>
		<dt
class="hikamarket_order_additional_additional"><label><?php
echo JText::_($additional->order_product_name);
?></label></dt>
		<dd
class="hikamarket_order_additional_additional"><span><?php
			if(!empty($additional->order_product_price))
				$additional->order_product_price =
(float)$additional->order_product_price;

			if(!empty($additional->order_product_price) ||
empty($additional->order_product_options))
				echo
$this->currencyHelper->format($additional->order_product_price,
$this->order->order_currency_id);
			else
				echo $additional->order_product_options;
		?></span></dd>
<?php
		}
	}
?>
	<!-- Taxes -->
<?php
	if($this->shopConfig->get('detailed_tax_display')
&& !empty($this->order->order_tax_info)) {
		foreach($this->order->order_tax_info as $tax) {
?>
			<dt
class="hikamarket_order_additional_tax"><label><?php
				echo $tax->tax_namekey;
			?></label></dt>
			<dd
class="hikamarket_order_additional_tax"><span><?php
				echo
$this->currencyHelper->format($tax->tax_amount,$this->order->order_currency_id);
			?></span></dd>
<?php
		}
	}
?>
	<!-- Total -->
		<dt
class="hikamarket_order_additional_total"><label><?php
			if((int)$this->order->order_vendor_id <= 1)
				echo JText::_('HIKASHOP_TOTAL');
			else
				echo JText::_('HIKAM_USER_TOTAL');
		?></label></dt>
		<dd
class="hikamarket_order_additional_total"><span><?php
echo
$this->currencyHelper->format($this->order->order_full_price,
$this->order->order_currency_id); ?></span></dd>

<?php
	if((int)$this->order->order_vendor_id > 1) {
		$fixed_fees = 0.0;
		if(!empty($this->order->order_vendor_params->fees->fixed)) {
			foreach($this->order->order_vendor_params->fees->fixed as
$fixed_fee) {
				$fixed_fees += $fixed_fee;
			}
		}
		if(bccomp($fixed_fees, 0, 5) !== 0) {
?>
	<!-- Vendor fixed fees -->
		<dt
class="hikamarket_order_vendor_fixed_fees"><label><?php
echo JText::_('HIKAM_VENDOR_FIXED_FEES');
?></label></dt>
		<dd
class="hikamarket_order_vendor_fixed_fees"><span><?php
			echo $this->currencyHelper->format($fixed_fees,
$this->order->order_currency_id);
		?></span></dd>
<?php
		}

		if(!empty($this->order->order_vendor_params->fees->shipping))
{
?>
	<!-- Vendor shipping fees -->
		<dt
class="hikamarket_order_vendor_shipping_fees"><label><?php
echo JText::_('HIKAM_VENDOR_SHIPPING_FEES');
?></label></dt>
		<dd
class="hikamarket_order_vendor_shipping_fees"><span><?php
			echo
$this->currencyHelper->format($this->order->order_vendor_params->fees->shipping,
$this->order->order_currency_id);
		?></span></dd>
<?php
		}

		if($this->order->order_vendor_paid > 0) {
			$total = $this->order->order_vendor_price;
			$paid = $this->order->order_vendor_price;
			if(!empty($this->order->refunds)) {
				foreach($this->order->refunds as $refund) {
					$total += (float)hikamarket::toFloat($refund->order_vendor_price);
					if($refund->order_vendor_paid > 0)
						$paid += (float)hikamarket::toFloat($refund->order_vendor_price);
				}
			}
?>
	<!-- Vendor total -->
		<dt
class="hikamarket_order_vendor_paid"><label><?php
echo JText::_('VENDOR_TOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_vendor_paid"><span><?php
			echo $this->currencyHelper->format($total,
$this->order->order_currency_id);

			if($total == $paid) {
				echo ' ' .
hikamarket::tooltip(JText::_('HIKAM_ORDER_IS_PAID'),
'', '', '<img
src="'.HIKAMARKET_IMAGES.'icon-16/save2.png"
style="vertical-align:top;"
alt="('.JText::_('PAID').')" />',
'', 0);
			} elseif($total > $paid) {
				echo ' ' .
JText::sprintf('HIKAM_ORDER_PARTIAL_PAID',
$this->currencyHelper->format($total - $paid,
$this->order->order_currency_id));
			} else {
				echo ' ' .
JText::sprintf('HIKAM_ORDER_PARTIAL_REFUND',
$this->currencyHelper->format($paid - $total,
$this->order->order_currency_id));
			}
		?></span></dd>
<?php
		} else {
?>
	<!-- Vendor total -->
		<dt
class="hikamarket_order_vendor_total"><label><?php
echo JText::_('VENDOR_TOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_vendor_total"><span><?php
			echo
$this->currencyHelper->format($this->order->order_vendor_price,
$this->order->order_currency_id);
		?></span></dd>
<?php
		}
?>
<?php } ?>
	</dl>
<?php

if(!empty($this->ajax))
	return;
?>
</div>
<script type="text/javascript">
window.Oby.registerAjax('orderMgr.details',function(params){
window.orderMgr.refreshBlock('details'); });
</script>
views/ordermarket/tmpl/show_block_edit_address.php000064400000022646151166607750016601
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$type = @$this->block_edit_address;
if(!in_array($type, array('shipping', 'billing')))
	return;

if(!empty($this->ajax) && ( empty($this->edit_address_mode)
|| !in_array($this->edit_address_mode, array('select',
'edit'))) )
	return;

$address_edit = $this->editable_order &&
hikamarket::acl('order/edit/'.$type.'address');

if(empty($this->ajax)) {
	$data = array(
		array(
			'name' => '<i class="fas
fa-map-marked-alt"></i> ' .
JText::_('HIKAM_SHOW_DEFAULT'),
			'link' => '#select_'.$type.'_address',
			'click' => 'return
window.orderMgr.refreshAddressBlock(\''.$type.'\',
0);'
		),
		array(
			'name' => '<i class="fas
fa-address-card"></i> ' .
JText::_('HIKAM_SHOW_DETAILS'),
			'link' => '#select_'.$type.'_address',
			'click' => 'return
window.orderMgr.refreshAddressBlock(\''.$type.'\',
1);'
		)
	);

	if($address_edit) {
		$data = array_merge($data, array(
			'-',
			array(
				'name' => '<i class="fas
fa-pencil-alt"></i> ' .
JText::_('HIKAM_EDIT_ADDRESS'),
				'link' => '#edit_'.$type.'_address',
				'click' => 'return
window.orderMgr.refreshAddressEditBlock(\''.$type.'\',
\'edit\');'
			),
		));
		if(hikamarket::acl('user/show/address')) {
			$data[] = array(
				'name' => '<i class="fas
fa-location-arrow"></i> ' .
JText::_('HIKAM_SELECT_ADDRESS'),
				'link' =>
'#select_'.$type.'_address',
				'click' => 'return
window.orderMgr.refreshAddressEditBlock(\''.$type.'\',
\'select\');'
			);
		}
	}

	echo $this->dropdownHelper->display(
		JText::_('HIKAM_MORE'),
		$data,
		array('type' => '', 'mini' => true,
'class' => 'hikabtn-primary', 'right'
=> true, 'up' => false)
	);

?>
<script type="text/javascript">
window.orderMgr.refreshAddressBlock = function(type, mode) {
	if(type != 'billing' && type != 'shipping')
		return false;
	var d = document, w = window, o = w.Oby,
		el = d.getElementById("hikamarket_order_block_" + type +
"address");
	if(!el) return false;
	mode = parseInt(mode);
	if(mode == NaN) mode = 0;
	o.addClass(el, "hikamarket_ajax_loading");
	var url = '<?php echo
hikamarket::completeLink('order&task=showblock&block=HIKATYPE&address_mode=HIKAADDRMODE&cid='.(int)$this->order->order_id.'&tmpl=ajax',
false, false, true); ?>'.replace("HIKATYPE", type +
'address').replace("HIKAADDRMODE", mode);
	o.xRequest(url, {update: el}, function(x,p) {
		o.removeClass(el, "hikamarket_ajax_loading");
	});
	return false;
};
</script>
<?php

	if(!$address_edit)
		return;
?>
	<div class="hikamarket_order_edit_block"
id="hikamarket_order_edit_<?php echo $type; ?>address"
style="display:none;">
		<div class="hikamarket_ajax_loading_elem"></div>
		<div
class="hikamarket_ajax_loading_spinner"></div>
<?php
	hikamarket::loadJslib('otree');
?>
	</div>
<script type="text/javascript">
window.orderMgr.refreshAddressEditBlock = function(type, mode) {
	if(type != 'billing' && type != 'shipping')
		return false;
	if(mode != 'select' && mode != 'edit')
		return false;
	var d = document, w = window, o = w.Oby, el = null,
		url = '<?php echo
hikamarket::completeLink('order&task=showblock&block=HIKATYPE&address_mode=HIKAADDRMODE&cid='.(int)$this->order->order_id.'&tmpl=ajax',
false, false, true); ?>'.replace("HIKATYPE",
'edit_' + type +
'address').replace("HIKAADDRMODE", mode)
		box = window.oNameboxes['hikamarket_order_edit_' + type +
'_address_namebox'];

	if(mode == 'select')
		el = d.getElementById('hikamarket_order_edit_' + type +
'address');
	if(mode == 'edit')
		el = d.getElementById('hikamarket_order_block_' + type +
'address');

	if(!el)
		return false;

	if(box)
		box.clear();
	if(mode == 'select')
		el.style.display = '';
	o.addClass(el, "hikamarket_ajax_loading");
	o.xRequest(url, {update: el}, function(x,p) {
		o.removeClass(el, "hikamarket_ajax_loading");
	});
	return false;
};
window.orderMgr.selectAddress = function(type) {
	if(type != 'billing' && type != 'shipping')
		return false;
	var d = document, addr =
d.getElementById('hikamarket_order_block_' + type +
'address');
	window.orderMgr.submitBlock(type + 'address', {update: addr},
function(x,p){
		window.orderMgr.hideSelectAddress(type);
	});
	return false;
};
window.orderMgr.submitAddress = function(type) {
	if(type != 'billing' && type != 'shipping')
		return false;
	window.orderMgr.submitBlock(type + 'address', {update:true},
null, 'block');
	return false;
};
window.orderMgr.hideSelectAddress = function(type) {
	if(type != 'billing' && type != 'shipping')
		return false;
	var d = document,
		block = d.getElementById('hikamarket_order_edit_' + type +
'address'),
		box = window.oNameboxes['hikamarket_order_edit_' + type +
'_address_namebox'];
	if(box) box.clear();
	if(block) block.style.display = 'none';
	return false;
};
</script>
<?php
	return;
}


if($address_edit && $this->edit_address_mode ==
'select') {
?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
	<div>
<?php
	echo $this->nameboxType->display(
		'order['.$type.'address][address_id]',
		'',
		hikamarketNameboxType::NAMEBOX_SINGLE,
		'address',
		array(
			'url_params' => array(
				'USER_ID' => (int)@$this->order->order_user_id,
				'ADDR_TYPE' => $type,
			),
			'delete' => true,
			'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
			'id' =>
'hikamarket_order_edit_'.$type.'_address_namebox'
		)
	);
?>
		<input type="hidden" name="order[<?php echo $type;
?>address][addrselect]" value="1"/>
		<div>
			<label for="hikamarket_order_select_<?php echo $type;
?>_address_addrlink"><input type="checkbox"
value="1" id="hikamarket_order_select_<?php echo $type;
?>_address_addrlink" name="order[<?php echo $type;
?>address][addrlink]" /><span><?php
				$key = ($type == 'billing') ?
'SET_SHIPPING_ADDRESS_TOO' :
'SET_BILLING_ADDRESS_TOO';
				echo JText::_($key);
			?></span></label>
		</div>
		<div style="clear:both;margin-top:4px;"></div>
		<div style="float:right">
			<button onclick="return
window.orderMgr.selectAddress('<?php echo $type;
?>');" class="hikabtn hikabtn-success"><i
class="fas fa-check"></i> <?php echo
JText::_('HIKAM_SELECT_ADDRESS'); ;?></button>
		</div>
		<button onclick="return
window.orderMgr.hideSelectAddress('<?php echo $type;
?>');" class="hikabtn hikabtn-danger"><i
class="far fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
		<div style="clear:both"></div>
	</div>
	<script type="text/javascript">
	window.Oby.registerAjax('orderMgr.customer',function(params){
		if(!params || !params.id) return;
		var u = '<?php echo
hikamarket::completeLink('user&task=getAddressList&address_type='.$type.'&user_id=HIKA_USER_ID',
true, false, true); ?>';
		window.oNameboxes['hikamarket_order_edit_<?php echo $type;
?>_address_namebox'].changeUrl(u.replace('HIKA_USER_ID',
params.id));
	});
	</script>
<?php
	return;
}

if($address_edit && $this->edit_address_mode ==
'edit') {
?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
	<div class="hikamarket_order_edit_block">

		<dl>
<?php
	$address = (($type == 'billing') ?
$this->order->billing_address :
$this->order->shipping_address);

	$fields = (isset($this->order->{$type.'_fields'}) ?
$this->order->{$type.'_fields'} :
$this->order->fields);
	foreach($fields as $field) {
		if(empty($field->field_frontcomp) &&
strpos($field->field_display, ';vendor_order_show=1;') ===
false)
			continue;
		$fieldname = $field->field_namekey;
?>
			<dt class="hikamarket_<?php echo $type;
?>order_address_<?php echo
$fieldname;?>"><label><?php
				echo $this->fieldsClass->trans($field->field_realname);
				if(!empty($field->field_required))
					echo ' *';
			?></label></dt>
			<dd class="hikamarket_<?php echo $type;
?>order_address_<?php echo $fieldname;?>"><?php
				echo $this->fieldsClass->display(
						$field,
						@$address->$fieldname,
						'order['.$type.'address]['.$fieldname.']',
						false,
						'',
						false,
						$fields,
						$address,
						false
					);
			?></dd>
<?php
	}
?>
		</dl>
		<input type="hidden" name="order[<?php echo $type;
?>address][address_id]" value="<?php echo
(int)$this->order->{'order_'.$type.'_address_id'};
?>"/>
<?php if($this->order->order_billing_address_id ==
$this->order->order_shipping_address_id) { ?>
		<div>
			<label for="hikamarket_order_select_<?php echo $type;
?>_address_addrlink"><input type="checkbox"
value="1" id="hikamarket_order_select_<?php echo $type;
?>_address_addrlink" name="order[<?php echo $type;
?>address][addrlink]" /><span><?php
				$key = ($type == 'billing') ?
'SET_SHIPPING_ADDRESS_TOO' :
'SET_BILLING_ADDRESS_TOO';
				echo JText::_($key);
			?></span></label>
		</div>
<?php } ?>
		<div style="clear:both;margin-top:4px;"></div>
		<div style="float:right">
			<button onclick="return
window.orderMgr.submitAddress('<?php echo $type;
?>');" class="hikabtn hikabtn-success"><i
class="fas fa-check"></i> <?php echo
JText::_('HIKA_OK'); ;?></button>
		</div>
		<button onclick="return
window.orderMgr.refreshAddressBlock('<?php echo $type; ?>',
0);" class="hikabtn hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
		<div style="clear:both"></div>
	</div>
<?php
}
views/ordermarket/tmpl/show_block_edit_coupon.php000064400000004373151166607750016454
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!$this->editable_order ||
!hikamarket::acl('order/edit/coupon'))
	return;
?>
<div class="hikamarket_ajax_loading_elem"></div>
<div class="hikamarket_ajax_loading_spinner"></div>

<dl class="hikam_options">
	<dt><label><?php echo JText::_('COUPON_CODE');
?></label></dt>
	<dd><input type="text"
name="order[coupon][code]" value="<?php echo
$this->escape(@$this->order->order_discount_code);
?>"/></dd>

	<dt><label><?php echo JText::_('COUPON_TAX');
?></label></dt>
	<dd><?php
		echo
$this->ratesType->display('order[coupon][tax_namekey]',
@$this->order->order_discount_tax_namekey,
@$this->order->order_discount_tax_rate,
'onchange="window.orderMgr.updateTaxValueFields(\'ordercoupon\');"');
	?></dd>

	<dt><label><?php echo JText::_('COUPON_VALUE');
?></label></dt>
	<dd>
		<input type="text" id="ordercoupon_value"
name="order[coupon][value]"
onchange="window.orderMgr.updateTaxValueFields('ordercoupon');"
value="<?php echo $this->order->order_discount_price;
?>"/> <?php echo
$this->order->currency->currency_symbol . ' (' .
$this->order->currency->currency_code . ')';
?><br/>
		<div>
			<span id="ordercoupon_value_price"><?php echo
($this->order->order_discount_price -
$this->order->order_discount_tax); ?></span>
			+
			<span id="ordercoupon_value_tax"><?php echo
$this->order->order_discount_tax; ?></span>
		</div>
		<input type="hidden" id="ordercoupon_tax"
name="order[coupon][tax]" value="<?php echo
(float)$this->order->order_discount_tax; ?>"/>
	</dd>
</dl>

	<div style="clear:both;margin-top:4px;"></div>
	<div style="float:right">
		<button onclick="return window.orderMgr.submitDetails(this,
'coupon');" class="hikabtn
hikabtn-success"><i class="fas fa-check"></i>
<?php echo JText::_('HIKA_OK'); ;?></button>
	</div>
	<button onclick="return window.orderMgr.showEditDetails(this,
'coupon', false);" class="hikabtn
hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
<div style="clear:both"></div>
views/ordermarket/tmpl/show_block_edit_customer.php000064400000006205151166607750017006
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!$this->editable_order ||
!hikamarket::acl('order/edit/customer'))
	return;

if(empty($this->ajax)) {
	echo $this->dropdownHelper->display(
		JText::_('HIKAM_EDIT'),
		array(
			'customer' => array(
				'name' => '<i class="fas
fa-user"></i> ' .
JText::_('HIKAM_CHANGE_CUSTOMER'),
				'link' => '#customer',
				'click' => 'return
window.orderMgr.showSelectCustomer(this, true);'
			)
		),
		array('type' => '', 'mini' => true,
'class' => 'hikabtn-primary', 'right'
=> false, 'up' => false)
	);
?>
	<div class="hikamarket_order_edit_block"
id="hikamarket_order_edit_customer"
style="display:none;">
		<div class="hikamarket_ajax_loading_elem"></div>
		<div
class="hikamarket_ajax_loading_spinner"></div>
<?php
	hikamarket::loadJslib('otree');
?>
	</div>
<script type="text/javascript">
window.orderMgr.showSelectCustomer = function(el, show) {
	var d = document,
		block = d.getElementById('hikamarket_order_edit_customer'),
		box =
window.oNameboxes['hikamarket_order_edit_customer_namebox'];
	if(!block)
		return false;
	block.style.display = ((show === undefined && block.style.display
== 'none') || show == true) ? '' : 'none';

	if(box) {
		box.clear();
	} else {
		this.refreshBlock('customer', true);
	}
	return false;
};
window.orderMgr.selectCustomer = function(el) {
	var d = document, w = window, o = w.Oby,
		block =
document.getElementById('hikamarket_order_block_customer');
	if(block) o.addClass(el, "hikamarket_ajax_loading");
	this.submitBlock("customer", {data:false, update:false},
function(x,p){
		if(el) {
			o.removeClass(block, "hikamarket_ajax_loading");
			if(x.responseText.length > 1)
				return window.Oby.updateElem(block, x.responseText);
		}
		window.Oby.fireAjax('orderMgr.customer', null);
	});
	return this.showSelectCustomer(el, false);
};
</script>
<?php
	return;
}

echo $this->nameboxType->display(
	'order[customer][user_id]',
	'',
	hikamarketNameboxType::NAMEBOX_SINGLE,
	'user',
	array(
		'customer' => true,
		'delete' => true,
		'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
		'id' => 'hikamarket_order_edit_customer_namebox'
	)
);
?>
	<div>
		<label
for="hikamarket_order_edit_customer_addrlink"><input
type="checkbox" value="1"
name="order[customer][addrlink]"
id="hikamarket_order_edit_customer_addrlink"
/><span><?php echo JText::_('SET_USER_ADDRESS');
?></span></label>
	</div>
	<div style="clear:both;margin-top:4px;"></div>
	<div style="float:right">
		<button onclick="return
window.orderMgr.selectCustomer(this);" class="hikabtn
hikabtn-success"><i class="fas fa-check"></i>
<?php echo JText::_('HIKAM_SELECT_CUSTOMER');
;?></button>
	</div>
	<button onclick="return window.orderMgr.showSelectCustomer(this,
false);" class="hikabtn hikabtn-danger"><i
class="far fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
	<div style="clear:both"></div>
views/ordermarket/tmpl/show_block_edit_fields.php000064400000003611151166607750016411
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->fields['order']) || !$this->editable_order
|| !hikamarket::acl('order/show/customfields') ||
!hikamarket::acl('order/edit/customfields'))
	return;

if(empty($this->ajax)) { ?>
<div id="hikamarket_order_block_fields">
<?php } ?>
<div class="hikamarket_order_edit_block">
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>

	<dl class="hikam_options large dl_glue">
<?php
		foreach($this->fields['order'] as $fieldName =>
$oneExtraField) {
?>
		<dt class="hikamarket_order_additional_customfield
hikamarket_order_additional_customfield_<?php echo $fieldName;
?>"><?php
			echo $this->fieldsClass->getFieldName($oneExtraField, true);
		?></dt>
		<dd class="hikamarket_order_additional_customfield
hikamarket_order_additional_customfield_<?php echo $fieldName;
?>"><span><?php
			echo $this->fieldsClass->display($oneExtraField,
@$this->order->$fieldName,
'order[field]['.$fieldName.']', false, '',
false, $this->fields['order'], $this->order, false);
		?></span></dd>
<?php
		}
?>
	</dl>

	<div style="clear:both;margin-top:4px;"></div>
	<div style="float:right">
		<button onclick="return
window.orderMgr.submitBlock('fields', {update:true});"
class="hikabtn hikabtn-success"><i class="fas
fa-check"></i> <?php echo JText::_('HIKA_OK');
;?></button>
	</div>
	<button onclick="return
window.orderMgr.refreshBlock('fields', false);"
class="hikabtn hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
	<div style="clear:both">
</div>
<?php

if(!empty($this->ajax))
	return;
?>
</div>
views/ordermarket/tmpl/show_block_edit_payment.php000064400000005067151166607750016627
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!$this->editable_order ||
!hikamarket::acl('order/edit/payment'))
	return;
?>
<div class="hikamarket_ajax_loading_elem"></div>
<div class="hikamarket_ajax_loading_spinner"></div>

<dl class="hikam_options">
	<dt><label><?php echo JText::_('PAYMENT_METHOD');
?></label></dt>
	<dd><?php
		$payment_namekey = '';
		if(!empty($this->order->order_payment_method))
			$payment_namekey = $this->order->order_payment_method .
'_' . $this->order->order_payment_id;
		echo $this->nameboxType->display(
			'order[payment][namekey]',
			$payment_namekey,
			hikamarketNameboxType::NAMEBOX_SINGLE,
			'payment_methods',
			array(
				'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>'
			)
		);
	?></dd>

	<dt><label><?php echo JText::_('PAYMENT_TAX');
?></label></dt>
	<dd><?php
		echo
$this->ratesType->display('order[payment][tax_namekey]',
@$this->order->order_payment_tax_namekey,
@$this->order->order_payment_tax_rate,
'onchange="window.orderMgr.updateTaxValueFields(\'orderpayment\');"');
	?></dd>

	<dt><label><?php echo
JText::_('HIKASHOP_PAYMENT'); ?></label></dt>
	<dd>
		<input type="text" id="orderpayment_value"
name="order[payment][value]"
onchange="window.orderMgr.updateTaxValueFields('orderpayment');"
value="<?php echo $this->order->order_payment_price;
?>"/> <?php echo
$this->order->currency->currency_symbol . ' (' .
$this->order->currency->currency_code . ')';
?><br/>
		<div>
			<span id="orderpayment_value_price"><?php echo
($this->order->order_payment_price -
$this->order->order_payment_tax); ?></span>
			+
			<span id="orderpayment_value_tax"><?php echo
$this->order->order_payment_tax; ?></span>
		</div>
		<input type="hidden" id="orderpayment_tax"
name="order[payment][tax]" value="<?php echo
(float)$this->order->order_payment_tax; ?>"/>
	</dd>
</dl>

	<div style="clear:both;margin-top:4px;"></div>
	<div style="float:right">
		<button onclick="return window.orderMgr.submitDetails(this,
'payment');" class="hikabtn
hikabtn-success"><i class="fas fa-check"></i>
<?php echo JText::_('HIKA_OK'); ;?></button>
	</div>
	<button onclick="return window.orderMgr.showEditDetails(this,
'payment', false);" class="hikabtn
hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
<div style="clear:both"></div>
views/ordermarket/tmpl/show_block_edit_product.php000064400000017033151166607750016626
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!$this->editable_order ||
!hikamarket::acl('order/edit/products'))
	return false;

$orderProduct = $this->product;
$pid = isset($this->pid) ? $this->pid :
(int)$product->order_product_id;
$showVendor = (hikamarket::level(1) &&
$this->order->order_type == 'sale' &&
$this->vendor->vendor_id <= 1);

$colspan = 4;
if($showVendor) $colspan++;

?>
<td colspan="<?php echo $colspan; ?>"
data-order-product-id="<?php $pid; ?>">

	<dl class="hikam_options">
		<dt
class="hikamarket_order_product_id"><label><?php echo
JText::_('PRODUCT'); ?></label></dt>
		<dd class="hikamarket_order_product_id">
<?php
	echo $this->nameboxType->display(
		'order[products]['.$pid.'][id]',
		(int)@$orderProduct->product_id,
		hikamarketNameboxType::NAMEBOX_SINGLE,
		'product',
		array(
			'default_text' => '<em>' .
JText::_('HIKA_NONE') . '</em>',
			'root' => $this->rootCategory,
			'variants' => true,
			'delete' => true,
		)
	);
?>
<?php if($pid == 0) { ?>
<script type="text/javascript">
(function() {
	var n = window.oNameboxes['order_products_0_id'];
	if(!n) return;
	n.register('set', function(p){
window.orderMgr.loadProductData(<?php echo (int)$pid; ?>, p.value);
});
})();
</script>
<?php } else { ?>
	<a href="#load" onclick="return
window.orderMgr.loadProductData(<?php echo (int)$pid; ?>,
null);"><?php echo
JText::_('HIKAM_LOAD_PRODUCT_DATA'); ?></a>
<?php } ?>
		</dd>

		<dt
class="hikamarket_order_product_name"><label><?php
echo JText::_('HIKA_NAME'); ?></label></dt>
		<dd class="hikamarket_order_product_name">
			<input type="text" name="order[products][<?php echo
$pid; ?>][name]" id="hikamarket_order_<?php echo
$this->order->order_id; ?>_orderproduct_<?php echo $pid;
?>_name" value="<?php echo
$this->escape(@$orderProduct->order_product_name); ?>" />
		</dd>

		<dt
class="hikamarket_order_product_code"><label><?php
echo JText::_('PRODUCT_CODE'); ?></label></dt>
		<dd class="hikamarket_order_product_code">
			<input type="text" name="order[products][<?php echo
$pid; ?>][code]" id="hikamarket_order_<?php echo
$this->order->order_id; ?>_orderproduct_<?php echo $pid;
?>_code" value="<?php echo
$this->escape(@$orderProduct->order_product_code); ?>" />
		</dd>

		<dt
class="hikamarket_order_product_tax"><label><?php
echo JText::_('VAT'); ?></label></dt>
		<dd class="hikamarket_order_product_tax"><?php
			echo
$this->ratesType->display('order[products]['.$pid.'][tax_namekey]',
@$orderProduct->order_product_tax_info[0]->tax_namekey,
@$orderProduct->tax_rate,
'onchange="window.orderMgr.updateTaxValueFields(\'hikamarket_order_'.$this->order->order_id.'_orderproduct_'.$pid.'\');"',
'hikamarket_order_'.$this->order->order_id.'_orderproduct_'.$pid.'_tax_namekey');
		?></dd>

		<dt
class="hikamarket_order_product_price"><label><?php
echo JText::_('UNIT_PRICE'); ?></label></dt>
		<dd class="hikamarket_order_product_price">
			<input type="text" name="order[products][<?php echo
$pid; ?>][value]" id="hikamarket_order_<?php echo
$this->order->order_id; ?>_orderproduct_<?php echo $pid;
?>_value"
onchange="window.orderMgr.updateTaxValueFields('hikamarket_order_<?php
echo $this->order->order_id; ?>_orderproduct_<?php echo $pid;
?>');" value="<?php echo
@$orderProduct->order_product_price +
@$orderProduct->order_product_tax; ?>"/> <?php echo
$this->order->currency->currency_symbol . ' (' .
$this->order->currency->currency_code . ')';
?><br/>
			<div>
				<span id="hikamarket_order_<?php echo
$this->order->order_id; ?>_orderproduct_<?php echo $pid;
?>_value_price"><?php echo
round((float)hikamarket::toFloat(@$orderProduct->order_product_price));
?></span>
				+
				<span id="hikamarket_order_<?php echo
$this->order->order_id; ?>_orderproduct_<?php echo $pid;
?>_value_tax"><?php echo
round((float)hikamarket::toFloat(@$orderProduct->order_product_tax));
?></span>
			</div>
			<input type="hidden" id="hikamarket_order_<?php
echo $this->order->order_id; ?>_orderproduct_<?php echo $pid;
?>_tax" name="order[products][<?php echo $pid;
?>][tax]" value="<?php echo
(float)@$orderProduct->order_product_tax; ?>"/>
		</dd>

		<dt
class="hikamarket_order_product_quantity"><label><?php
echo JText::_('PRODUCT_QUANTITY');
?></label></dt>
		<dd class="hikamarket_order_product_quantity">
			<input type="text" name="order[products][<?php echo
$pid; ?>][qty]" id="hikamarket_order_<?php echo
$this->order->order_id; ?>_orderproduct_<?php echo $pid;
?>_qty" value="<?php
				if(empty($pid)) {
					echo 1;
				} elseif(isset($orderProduct->order_product_quantity)) {
					echo (int)$orderProduct->order_product_quantity;
				}
			?>" />
		</dd>

<?php
	if(!empty($this->fields['item'])) {
		$editCustomFields = false;
		if(hikamarket::acl('order/edit/customfields'))
			$editCustomFields = true;

		foreach($this->fields['item'] as $fieldName =>
$oneExtraField) {
?>
		<dt class="hikamarket_order_product_customfield
hikamarket_order_product_customfield_<?php echo $fieldName;
?>"><?php echo
$this->fieldsClass->getFieldName($oneExtraField);?></dt>
		<dd class="hikamarket_order_product_customfield
hikamarket_order_product_customfield_<?php echo $fieldName;
?>"><span><?php
			if($editCustomFields) {
				echo $this->fieldsClass->display($oneExtraField,
@$orderProduct->$fieldName,
'order[products]['.$pid.'][field]['.$fieldName.']',false,'',true,$this->fields['item'],
$orderProduct);
			} else {
				echo $this->fieldsClass->show($oneExtraField,
@$orderProduct->$fieldName);
			}
		?></span></dd>
<?php
		}
	}

	if(hikamarket::level(1) && $this->vendor->vendor_id <= 1
&& hikamarket::acl('order/edit/vendor') &&
(!empty($orderProduct->vendor_data) || $pid == 0)) {
		$vendor_data = new stdClass();
		if(!empty($orderProduct))
			$vendor_data = is_array($orderProduct->vendor_data) ?
reset($orderProduct->vendor_data) : $orderProduct->vendor_data;
?>
		<dt
class="hikamarket_orderproduct_vendor"><label><?php
echo JText::_('HIKA_VENDOR'); ?></label></dt>
		<dd class="hikamarket_orderproduct_vendor"><?php
			echo $this->nameboxType->display(
				'order[products]['.$pid.'][vendor_id]',
				(int) @$vendor_data->order_vendor_id,
				hikamarketNameboxType::NAMEBOX_SINGLE,
				'vendor',
				array(
					'id' =>
'hikamarket_order_'.$this->order->order_id.'_orderproduct_'.$pid.'_vendor',
					'default_text' => '<em>' .
JText::_('HIKA_NONE') . '</em>',
					'delete' => true,
				)
			);
		?></dd>
		<dt
class="hikamarket_orderproduct_vendorprice"><label><?php
echo JText::_('HIKAM_VENDOR_UNIT_PRICE');
?></label></dt>
		<dd class="hikamarket_orderproduct_vendorprice">
			<input type="text" name="order[products][<?php echo
$pid; ?>][vendor_price]" id="hikamarket_order_<?php echo
$this->order->order_id; ?>_orderproduct_<?php echo $pid;
?>_vendorprice" value="<?php echo
@$vendor_data->order_product_vendor_price; ?>"/>
		</dd>
<?php
	}
?>
	</dl>
	<div style="clear:both;margin-top:4px;"></div>
	<div style="float:right">
		<button onclick="return window.orderMgr.submitProduct(this,
<?php echo $pid; ?>);" class="hikabtn
hikabtn-success"><i class="fas fa-check"></i>
<?php echo JText::_('HIKA_OK'); ;?></button>
	</div>
	<button onclick="return window.orderMgr.refreshProduct(this,
<?php echo $pid; ?>);" class="hikabtn
hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
	<div style="clear:both"></div>
</td>
views/ordermarket/tmpl/show_block_edit_shipping.php000064400000012170151166607750016764
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!$this->editable_order ||
!hikamarket::acl('order/edit/shipping'))
	return;
?>
<div class="hikamarket_ajax_loading_elem"></div>
<div class="hikamarket_ajax_loading_spinner"></div>
<?php
if(empty($this->order->warehouses) ||
count($this->order->warehouses) == 1) {
?>
<dl class="hikam_options">
	<dt><label><?php echo
JText::_('HIKASHOP_SHIPPING_METHOD');
?></label></dt>
	<dd><?php
		$shipping_namekey = '';
		if(!empty($this->order->order_shipping_method))
			$shipping_namekey = $this->order->order_shipping_method .
'_' . $this->order->order_shipping_id;
		echo $this->nameboxType->display(
			'order[shipping][namekey]',
			$shipping_namekey,
			hikamarketNameboxType::NAMEBOX_SINGLE,
			'shipping_methods',
			array(
				'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>'
			)
		);
	?></dd>

	<dt><label><?php echo JText::_('SHIPPING_TAX');
?></label></dt>
	<dd><?php
		echo
$this->ratesType->display('order[shipping][tax_namekey]',
@$this->order->order_shipping_tax_namekey,
@$this->order->order_shipping_tax_rate,
'onchange="window.orderMgr.updateTaxValueFields(\'ordershipping\');"');
	?></dd>

	<dt><label><?php echo
JText::_('HIKASHOP_SHIPPING'); ?></label></dt>
	<dd>
		<input type="text" id="ordershipping_value"
name="order[shipping][value]"
onchange="window.orderMgr.updateTaxValueFields('ordershipping');"
value="<?php echo $this->order->order_shipping_price;
?>"/> <?php echo
$this->order->currency->currency_symbol . ' (' .
$this->order->currency->currency_code . ')';
?><br/>
		<div>
			<span id="ordershipping_value_price"><?php echo
($this->order->order_shipping_price -
$this->order->order_shipping_tax); ?></span>
			+
			<span id="ordershipping_value_tax"><?php echo
$this->order->order_shipping_tax; ?></span>
		</div>
		<input type="hidden" id="ordershipping_tax"
name="order[shipping][tax]" value="<?php echo
(float)$this->order->order_shipping_tax; ?>"/>
	</dd>
</dl>
<?php
} else {
	foreach($this->order->warehouses as $key => $warehouse) {
		$price = $this->order->order_shipping_params->prices[$key];
		list($shipping_id, $key) = explode('@', $key, 2);

		$tax_namekey = array_keys($price->taxes);
		$tax_namekey = reset($tax_namekey);
		if(empty($tax_namekey))
			$tax_namekey = @$this->order->order_shipping_tax_namekey;

		$tax_rate = @$this->order->order_shipping_tax_rate;
		if(!empty($price->tax) && ($price->price_with_tax -
$price->tax) != 0)
			$tax_rate = $price->tax / ($price->price_with_tax -
$price->tax);
?>
<div class="order_shipping_warehouse">
	<h4><?php
		if(!empty($warehouse->name))
			echo $warehouse->name;
		else
			echo $warehouse->warehouse_name;
	?></h4>
	<dl class="hikam_options">
		<dt><label><?php echo
JText::_('HIKASHOP_SHIPPING_METHOD');
?></label></dt>
		<dd><?php
			$shipping_namekey = '';
			if(isset($this->order->shippings[(int)$shipping_id]))
				$shipping_namekey =
$this->order->shippings[(int)$shipping_id]->shipping_type .
'_' . $shipping_id;
			echo $this->nameboxType->display(
				'order[shippings]['.$key.'][namekey]',
				$shipping_namekey,
				hikamarketNameboxType::NAMEBOX_SINGLE,
				'shipping_methods',
				array(
					'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>'
				)
			);
		?></dd>

		<dt><label><?php echo JText::_('SHIPPING_TAX');
?></label></dt>
		<dd><?php
			echo
$this->ratesType->display('order[shippings]['.$key.'][tax_namekey]',
$tax_namekey, $tax_rate,
'onchange="window.orderMgr.updateTaxValueFields(\'ordershippings'.$key.'\');"');
		?></dd>

		<dt><label><?php echo
JText::_('HIKASHOP_SHIPPING'); ?></label></dt>
		<dd>
			<input type="text" id="ordershippings<?php echo
$key; ?>_value" name="order[shippings][<?php echo $key;
?>][value]"
onchange="window.orderMgr.updateTaxValueFields('ordershippings<?php
echo $key; ?>');" value="<?php echo
$price->price_with_tax; ?>"/> <?php echo
$this->order->currency->currency_symbol . ' (' .
$this->order->currency->currency_code . ')';
?><br/>
			<div>
				<span id="ordershippings<?php echo $key;
?>_value_price"><?php echo ($price->price_with_tax -
$price->tax); ?></span>
				+
				<span id="ordershippings<?php echo $key;
?>_value_tax"><?php echo $price->tax; ?></span>
			</div>
			<input type="hidden" id="ordershippings<?php echo
$key; ?>_tax" name="order[shippings][<?php echo $key;
?>][tax]" value="<?php echo (float)$price->tax;
?>"/>
		</dd>
	</dl>
</div>
<?php
	}
}
?>
	<div style="clear:both;margin-top:4px;"></div>
	<div style="float:right">
		<button onclick="return window.orderMgr.submitDetails(this,
'shipping');" class="hikabtn
hikabtn-success"><i class="fas fa-check"></i>
<?php echo JText::_('HIKA_OK'); ;?></button>
	</div>
	<button onclick="return window.orderMgr.showEditDetails(this,
'shipping', false);" class="hikabtn
hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
<div style="clear:both"></div>
views/ordermarket/tmpl/show_block_fields.php000064400000002475151166607750015413
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->fields['order']) ||
!hikamarket::acl('order/show/customfields'))
	return;

if(empty($this->ajax)) { ?>
<div id="hikamarket_order_block_fields">
<?php } ?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>

	<dl class="hikam_options large">
<?php
		foreach($this->fields['order'] as $fieldName =>
$oneExtraField) {
?>
		<dt class="hikamarket_order_additional_customfield
hikamarket_order_additional_customfield_<?php echo $fieldName;
?>"><?php echo
$this->fieldsClass->getFieldName($oneExtraField);?></dt>
		<dd class="hikamarket_order_additional_customfield
hikamarket_order_additional_customfield_<?php echo $fieldName;
?>"><span><?php
			echo $this->fieldsClass->show($oneExtraField,
@$this->order->$fieldName);
		?></span></dd>
<?php
		}
?>
	</dl>
<?php

if(!empty($this->ajax))
	return;
?>
</div>
<script type="text/javascript">
window.Oby.registerAjax('orderMgr.fields',function(params){
window.orderMgr.refreshBlock('fields'); });
</script>
views/ordermarket/tmpl/show_block_general.php000064400000005003151166607750015550
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->order))
	return;

if(empty($this->ajax)) { ?>
<div id="hikamarket_order_block_general">
<?php } ?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>

	<dl class="hikam_options large">
<?php if(empty($this->order->order_invoice_created) ||
$this->order->order_invoice_created !=
$this->order->order_created) { ?>
		<dt
class="hikamarket_order_created"><label><?php echo
JText::_('DATE_ORDER_CREATED');?></label></dt>
		<dd class="hikamarket_order_created"><?php echo
hikamarket::getDate($this->order->order_created, '%Y-%m-%d
%H:%M'); ?></dd>
<?php } ?>

		<dt
class="hikamarket_order_invoicenumber"><label><?php
echo JText::_('INVOICE_NUMBER'); ?></label></dt>
		<dd
class="hikamarket_order_invoicenumber"><span><?php
echo @$this->order->order_invoice_number;
?></span></dd>

<?php if(!empty($this->order->order_invoice_created)) { ?>
		<dt
class="hikamarket_order_created"><label><?php echo
JText::_('DATE_ORDER_PAID');?></label></dt>
		<dd class="hikamarket_order_created"><?php echo
hikamarket::getDate($this->order->order_invoice_created,
'%Y-%m-%d %H:%M');?></dd>
<?php } ?>

<?php if((int)$this->order->order_vendor_id > 1 &&
(int)$this->vendor->vendor_id <= 1 &&
!empty($this->order->hikamarket->vendor)) { ?>
		<dt class="hikamarket_order_vendor"><label><?php
echo JText::_('HIKA_VENDOR');?></label></dt>
		<dd class="hikamarket_order_vendor"><?php echo
$this->escape($this->order->hikamarket->vendor->vendor_name);
?></dd>
<?php } ?>
<?php if((int)$this->vendor->vendor_id <= 1 &&
$this->order->order_parent_id > 0 &&
isset($this->order->hikamarket->parent)) { ?>
		<dt class="hikamarket_order_parent"><label><?php
echo
JText::_('HIKAM_PARENT_ORDER');?></label></dt>
		<dd class="hikamarket_order_parent"><a
href="<?php echo
hikamarket::completeLink('order&task=show&cid='.(int)$this->order->order_parent_id);
?>"><?php
			echo
$this->escape($this->order->hikamarket->parent->order_number);
		?></a></dd>
<?php } ?>
	</dl>
<?php

if(!empty($this->ajax))
	return;
?>
</div>
<script type="text/javascript">
window.Oby.registerAjax(['orderMgr.general','orderMgr.order_status'],function(params){
window.orderMgr.refreshBlock('general'); });
</script>
views/ordermarket/tmpl/show_block_history.php000064400000006445151166607750015647
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!hikamarket::acl('order/show/history'))
	return;

$acl_history_data = hikamarket::acl('order/show/historydata');

if(empty($this->ajax)) { ?>
<div id="hikamarket_order_block_history">
<?php
}

if(!empty($this->order->history)) {
?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>

<h3 style="display:inline-block"><?php echo
JText::_('HISTORY')?></h3>
<div class="hikamarket_history_container">
<table id="hikamarket_order_history_listing"
class="hikam_listing <?php echo (HIKASHOP_RESPONSIVE)?'table
table-striped table-hover table-bordered':'hikam_table';
?>">
	<thead>
		<tr>
			<th class="title"><?php
				echo JText::_('HIKA_TYPE');
			?></th>
			<th class="title"><?php
				echo JText::_('ORDER_STATUS');
			?></th>
			<th class="title"><?php
				echo JText::_('REASON');
			?></th>
			<th class="title"><?php
				echo JText::_('DATE');
			?></th>
<?php if($acl_history_data) { ?>
			<th class="title"
style="width:2%;min-width:20px;"></th>
<?php } ?>
		</tr>
	</thead>
	<tbody>
<?php
$k = 0;
foreach($this->order->history as $i => $history) {
?>
		<tr class="row<?php echo $k; ?>">
			<td><?php
				if(!empty($history->history_type)) {
					$val =
preg_replace('#[^a-z0-9]#i','_',strtoupper($history->history_type));
					$trans = JText::_($val);
					if($val != $trans)
						$history->history_type = $trans;
				} else {
					$history->history_type =
'<em>'.JText::_('HIKA_NONE').'</em>';
				}
				echo $history->history_type;
			?></td>
			<td>
				<span class="order-label order-label-<?php echo
preg_replace('#[^a-z_0-9]#i', '_', str_replace('
','_',$history->history_new_status));
?>"><?php echo
hikamarket::orderStatus($history->history_new_status);
?></span>
			</td>
			<td><?php
				if(!empty($history->history_reason))
					echo $history->history_reason;
				else
					echo
'<em>'.JText::_('HIKA_NONE').'</em>';
			?></td>
			<td><?php
				echo hikamarket::getDate($history->history_created,'%Y-%m-%d
%H:%M');
			?></td>
<?php if($acl_history_data) { ?>
			<td>
				<a onclick="return window.orderMgr.showHistory(this);"
data-popup-href="<?php echo
hikamarket::completeLink('order&task=history&order_id='.$this->order->order_id.'&cid='.$history->history_id,
true); ?>" href="#"><i class="fas
fa-info-circle"></i></a>
			</td>
<?php } ?>
		</tr>
<?php
	$k = 1 - $k;
}
?>
	</tbody>
</table>
</div>
<?php
}

if(!empty($this->ajax))
	return;

?>
</div>
<?php

if($acl_history_data) {
	echo $this->popup->display(
		'',
		'HIKAM_HISTORY_DETAILS',
		hikamarket::completeLink('order&task=history&order_id='.$this->order->order_id.'&cid=0',
true),
		'hikamarket_showhistory_popup',
		750, 460, 'style="display:none;"', '',
'link'
	);
?>
<script type="text/javascript">
window.Oby.registerAjax('orderMgr.history',function(params){
window.orderMgr.refreshBlock('history'); });
window.orderMgr.showHistory = function(el) { return this.showEl(el,
'hikamarket_showhistory_popup'); };
</script>
<?php
}
views/ordermarket/tmpl/show_block_product.php000064400000016503151166607750015622
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$product = $this->product;
$pid = isset($this->pid) ? $this->pid :
(int)$product->order_product_id;
$showVendor = (hikamarket::level(1) &&
$this->order->order_type == 'sale' &&
$this->vendor->vendor_id <= 1);

$td_class = !empty($product->order_product_option_parent_id) ? '
hikamarket_order_item_option' : '';

?>
<td class="hikamarket_order_item_name_value<?php echo $td_class;
?>" data-order-product-id="<?php echo $pid;
?>">
<?php
if( $this->editable_order &&
hikamarket::acl('order/edit/products') ) {
	$product_hash = md5((int)$product->order_product_id . '#' .
(int)$product->order_id . '#' .
(int)$this->order->order_modified);

	$dropData = array(
		array(
			'name' => '<i class="fas
fa-pencil-alt"></i> ' .
JText::_('HIKAM_EDIT_PRODUCT'),
			'link' => '#edit-product',
			'click' => 'return
window.orderMgr.refreshProduct(this, ' .
(int)$product->order_product_id . ', true);'
		),
		'-',
		array(
			'name' => '<i class="far
fa-trash-alt"></i> ' .
JText::_('HIKAM_DELETE_PRODUCT'),
			'link' => '#delete-product',
			'click' => 'return window.orderMgr.deleteProduct(this,
' . (int)$product->order_product_id . ', \'' .
$product_hash . '\');'
		)
	);
	echo '<div style="float:right">' .
		$this->dropdownHelper->display(JText::_('HIKAM_EDIT'),
$dropData, array('type' => '', 'mini'
=> true, 'class' => 'hikabtn-primary',
'right' => false, 'up' => false)) .
		'</div>';
}

if(!empty($product->product_id)) {
?>
	<a onclick="return window.orderMgr.showProduct(this);"
data-popup-href="<?php echo
hikamarket::completeLink('shop.product&task=show&cid='.$product->product_id,
true); ?>" href="<?php echo
hikamarket::completeLink('shop.product&task=show&cid='.$product->product_id);
?>"><?php
		if(!empty($product->images)) {
			$img = reset($product->images);
			$thumb = $this->imageHelper->getThumbnail(@$img->file_path,
array(50,50), array('default' => 1, 'forcesize'
=> 1));
			if(!empty($thumb->path) && empty($thumb->external))
				echo '<img src="'.
$this->imageHelper->uploadFolder_url . str_replace('\\',
'/', $thumb->path).'" alt=""
class="hikam_imglist"/>';
			else if(!empty($thumb->path) && !empty($thumb->url))
				echo '<img src="'. $thumb->url.'"
alt="" width="50" height="50"
class="hikam_imglist"/>';
		}
		echo $product->order_product_name;
	?></a>
<?php
} else {
	echo $product->order_product_name;
}
?>
	<br/>
<?php
echo $product->order_product_code;

if(hikashop_level(2) && !empty($this->fields['item']))
{
?>
	<p class="hikamarket_order_product_custom_item_fields">
<?php
	foreach($this->fields['item'] as $field) {
		$namekey = $field->field_namekey;
		if(empty($product->$namekey) &&
!strlen($product->$namekey))
			continue;
		echo '<p
class="hikamarket_order_item_'.$namekey.'">' .
			$this->fieldsClass->trans($field->field_realname) . ':
' . $this->fieldsClass->show($field,$product->$namekey) .
			'</p>';
	}
?>
	</p>
<?php
}

if(!empty($product->files) &&
hikamarket::acl('order/show/files')) {
?>
	<div class="hikamarket_order_product_files"
style="clear:left;">
		<a href="#files"
data-toggle-display="hikamarket_order_product_files_<?php echo
(int)$product->order_product_id; ?>" onclick="return
window.orderMgr.toggleDisplay(this);"><?php
			echo JText::_('HIKAM_SHOW_FILES');
		?></a>
		<ul id="hikamarket_order_product_files_<?php echo
(int)$product->order_product_id;?>"
style="display:none;">
<?php
	foreach($product->files as $file) {
		echo '<li
class="hikamarket_order_product_file">';

		if(empty($file->file_name))
			$file->file_name = $file->file_path;

		echo $file->file_name;

		if(!empty($this->order_status_for_download) &&
!in_array($this->order->order_status,
explode(',',$this->order_status_for_download)))
			echo $fileHtml .= ' /
<b>'.JText::_('BECAUSE_STATUS_NO_DOWNLOAD').'</b>';

		if(!empty($this->download_time_limit)) {
			$time_limit = ($this->download_time_limit +
(!empty($this->order->order_invoice_created) ?
$this->order->order_invoice_created :
$this->order->order_created));
			if($time_limit < time()) {
				echo ' / <b>' .
JText::_('TOO_LATE_NO_DOWNLOAD') . '</b>';
			} else {
				echo ' / ' . JText::sprintf('UNTIL_THE_DATE',
hikashop_getDate($time_limit));
			}
		}

		if(!empty($file->file_limit) && (int)$file->file_limit !=
0) {
			$download_number_limit = $file->file_limit;
			if($download_number_limit < 0)
				$download_number_limit = 0;
		} else {
			$download_number_limit = $this->download_number_limit;
		}

		if(!empty($download_number_limit)) {
			if($download_number_limit <= $file->download_number) {
				echo ' /
<b>'.JText::_('MAX_REACHED_NO_DOWNLOAD').'</b>';
			} else {
				echo ' / '.JText::sprintf('X_DOWNLOADS_LEFT',
$download_number_limit - $file->download_number);
			}
		} else {
			echo ' / ' . JText::sprintf('X_DOWNLOADS_MADE',
$file->download_number);
		}
		echo '</li>';
	}
?>
		</ul>
	</div>
<?php
}

if(hikashop_level(1) && !empty($product->bundle)) {
?>
	<div style="clear:both"></div>
<?php
	foreach($product->bundle as $bundle) {
		$desc = '<strong>'.$bundle->order_product_name .
'</strong><br/>'.
			JText::_('CART_PRODUCT_QUANTITY').'
'.(int)$bundle->order_product_options['related_quantity'];

		$img = new stdClass();
		if(!empty($bundle->images))
			$img = reset($bundle->images);
		$thumb = $this->imageHelper->getThumbnail(@$img->file_path,
array(35,35), array('default' => 0, 'forcesize'
=> 1));
		if(!empty($thumb->success)) {
			echo '<img src="'. $thumb->url.'"
alt="" class="hikam_bundlelist"
alt="'.$this->escape($bundle->order_product_name).'"
data-toggle="hk-tooltip" data-title="' .
htmlspecialchars($desc, ENT_COMPAT, 'UTF-8') . '"/>
';
		} else {
			echo hikamarket::tooltip($desc, '', '',
$bundle->order_product_name). ' ';
		}
	}
}

if(!empty($product->extraData)) {
	if(!is_array($product->extraData))
		$product->extraData = array($product->extraData);
	echo implode("\r\n", $product->extraData);
}

?>
</td>
<td class="hikamarket_order_item_price_value"><?php
	echo $this->currencyHelper->format($product->order_product_price,
$this->order->order_currency_id);
	if(bccomp($product->order_product_tax, 0, 5))
		echo '<br/>'.JText::sprintf('PLUS_X_OF_VAT',
$this->currencyHelper->format($product->order_product_tax,
$this->order->order_currency_id));
?></td>
<?php if($showVendor) { ?>
<td class="hikamarket_order_item_vendor_value"><?php
	$vendor_display = false;
	if(!empty($product->vendor_data) &&
is_array($product->vendor_data)) {
		foreach($product->vendor_data as $vendor_data) {
			if((int)$vendor_data->vendor_id <= 1)
				continue;
			$vendor_display = true;
			echo
'<p>'.$vendor_data->vendor_name.'<br/>'.
				$this->currencyHelper->format($vendor_data->order_product_vendor_price,
$this->order->order_currency_id).'</p>';
		}
	}

	if(!$vendor_display)
		echo '-';
?></td>
<?php } ?>
<td class="hikamarket_order_item_quantity_value"><?php
	echo (int)$product->order_product_quantity;
?></td>
<td
class="hikamarket_order_item_total_price_value"><?php
	echo
$this->currencyHelper->format($product->order_product_total_price,
$this->order->order_currency_id);
?></td>
views/ordermarket/tmpl/show_block_products.php000064400000021053151166607750016001
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->ajax)) {
	if($this->editable_order &&
hikamarket::acl('order/edit/products')) {
		$dropData = array(
			array(
				'name' => '<i class="fas
fa-plus"></i> ' .
JText::_('HIKAM_ADD_NEW_PRODUCT'),
				'link' => '#new-product',
				'click' => 'return
window.orderMgr.addProduct(this);'
			)
		);
		echo
$this->dropdownHelper->display(JText::_('HIKAM_EDIT'),
$dropData, array('type' => '', 'mini'
=> true, 'class' => 'hikabtn-primary',
'right' => false, 'up' => false));

		hikamarket::loadJslib('otree');
	}
?>
<div id="hikamarket_order_block_products">
<?php
}

$showVendor = (hikamarket::level(1) &&
$this->order->order_type == 'sale' &&
$this->vendor->vendor_id <= 1);
?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>

	<table class="hikam_listing <?php echo
(HIKASHOP_RESPONSIVE)?'table table-striped table-hover
table-bordered':'hikam_table'; ?>"
id="hikamarket_order_product_listing"
style="width:100%">
		<thead>
			<tr>
				<th class="hikamarket_order_item_name_title
title"><?php echo JText::_('PRODUCT');
?></th>
				<th class="hikamarket_order_item_price_title
title"><?php echo JText::_('UNIT_PRICE');
?></th>
<?php if($showVendor){ ?>
				<th class="hikamarket_order_item_vendor_title
title"><?php echo JText::_('HIKA_VENDOR');
?></th>
<?php } ?>
				<th class="hikamarket_order_item_quantity_title
title"><?php echo
hikamarket::tooltip(JText::_('PRODUCT_QUANTITY'), '',
'', JText::_('CART_PRODUCT_QUANTITY'), '',
0); ?></th>
				<th class="hikamarket_order_item_total_price_title
title"><?php echo JText::_('PRICE'); ?></th>
			</tr>
		</thead>
		<tbody id="hikamarket_order_product_listing_content">
<?php

foreach($this->order->products as $k => $product) {

?>
		<tr id="hikamarket_order_product_<?php echo
(int)$product->order_product_id; ?>"><?php
			$this->product = $product;
			echo $this->loadTemplate('block_product');
		?></tr>
<?php
}
?>
		</tbody>
	</table>
<?php

if(!empty($this->ajax))
	return;
?>
</div>
<?php

echo $this->popup->display(
	'',
	'HIKAM_SHOW_ORDER_PRODUCT',
	hikamarket::completeLink('shop.product&task=show&cid=0',
true),
	'hikamarket_showproduct_popup',
	750, 460, 'style="display:none;"', '',
'link'
);
?>
<script type="text/javascript">
window.Oby.registerAjax('orderMgr.products',function(params){
window.orderMgr.refreshBlock('products'); });

window.orderMgr.showProduct = function(el) { return this.showEl(el,
'hikamarket_showproduct_popup'); };
<?php if(hikamarket::acl('order/edit/products')) { ?>
window.orderMgr.updateProductLine = function(e, data) {
	var tr = document.createElement('tr'), cell = null;
	tr.innerHTML = data;
	e.innerHTML = '';
	for(var i = tr.cells.length - 1; i >= 0; i--) {
		cell = tr.cells[0];
		tr.removeChild(cell);
		e.appendChild(cell);
		cell = null;
	}
	window.Oby.updateElem(tr, data);
	tr = null;
};
window.orderMgr.refreshProduct = function(el, id, edit) {
	var d = document, o = window.Oby,
		c = null, e = d.getElementById('hikamarket_order_product_' +
id);
	if(!e) return false;

	if(id == 0) {
		e.parentNode.removeChild(e);
		return false;
	}

	c = d.getElementById('hikamarket_order_block_products');
	if(c) o.addClass(c, "hikamarket_ajax_loading");

	var url = '<?php echo
hikamarket::completeLink('order&task=showblock&cid='.(int)$this->order->order_id.'&tmpl=ajax',
false, false, true); ?>',
		params = { mode: "POST", data:
o.encodeFormData({'block': edit ? 'edit_product' :
'product', 'pid': id}) };
	o.xRequest(url, params, function(x,p) {
		window.orderMgr.updateProductLine(e, x.responseText);
		if(c) o.removeClass(c, "hikamarket_ajax_loading");
	});
	return false;
};
window.orderMgr.submitProduct = function(el, id) {
	var d = document, o = window.Oby,
		c = null, e = d.getElementById('hikamarket_order_product_' +
id);
	if(!e) return false;

	c = d.getElementById('hikamarket_order_block_products');
	if(c) o.addClass(c, "hikamarket_ajax_loading");
	var url = '<?php echo
hikamarket::completeLink('order&task=submitblock&block=product&cid='.(int)$this->order->order_id.'&pid=HIKAPID&'.hikamarket::getFormToken().'=1&tmpl=ajax',
false, false, true); ?>'.replace("HIKAPID", id),
		formData = o.getFormData(e);
	o.xRequest(url, {mode:"POST", data: formData}, function(x,p) {
		if(x.responseText != "0") {
			window.orderMgr.updateProductLine(e, x.responseText);

			if(id == 0) {
				var cell = e.firstChild, pid = 0;
				if(cell) pid =
parseInt(cell.getAttribute('data-order-product-id'));
				if(pid !== null && pid !== NaN)
					e.id = "hikamarket_order_product_" + pid;
			}
		}
		if(c) o.removeClass(c, "hikamarket_ajax_loading");
	});
	return false;
};
window.orderMgr.addProduct = function(el) {
	var d = document, o = window.Oby,
		c = null, e = d.getElementById('hikamarket_order_product_0');
	if(e) return false;

	e =
d.getElementById('hikamarket_order_product_listing_content');
	if(!e) return false;

	c = d.getElementById('hikamarket_order_block_products');
	if(c) o.addClass(c, "hikamarket_ajax_loading");

	var url = '<?php echo
hikamarket::completeLink('order&task=showblock&block=edit_product&cid='.(int)$this->order->order_id.'&pid=0&tmpl=ajax',
false, false, true); ?>';
	o.xRequest(url, null, function(x,p) {
		var tr = document.createElement('tr');
		tr.id = 'hikamarket_order_product_0';
		e.appendChild(tr);

		e = d.getElementById('hikamarket_order_product_0');
		window.orderMgr.updateProductLine(e, x.responseText);
		if(c) o.removeClass(c, "hikamarket_ajax_loading");
	});
	return false;

};
window.orderMgr.deleteProduct = function(el, id, hash) {
	var d = document, o = window.Oby,
		c = null, e = d.getElementById('hikamarket_order_product_' +
id);
	if(!e) return false;

	if(!confirm('<?php echo
JText::_('HIKAM_CONFIRM_DELETE_ORDER_PRODUCT', true);
?>'))
		return false;

	c = d.getElementById('hikamarket_order_block_products');
	if(c) o.addClass(c, "hikamarket_ajax_loading");

	var url = '<?php echo
hikamarket::completeLink('order&task=submitblock&block=delete_product&cid='.(int)$this->order->order_id.'&'.hikamarket::getFormToken().'=1&tmpl=ajax',
false, false, true); ?>',
		params = { mode: "POST", data:
o.encodeFormData({'pid': id, 'product_hash': hash}) };
	o.xRequest(url, params, function(x,p) {
		if(x.responseText == '1') {
			e.parentNode.removeChild(e);
			o.fireAjax('orderMgr.details');
			o.fireAjax('orderMgr.history');
		} else {
			console.log(['product delete error', x.responseText]);
		}
		if(c) o.removeClass(c, "hikamarket_ajax_loading");
	});

	return false;
};
window.orderMgr.loadProductData = function(id, product) {
	var d = document, o = window.Oby,
		c = null, e = d.getElementById('hikamarket_order_product_' +
id);
	if(!e) return false;

	if(product === undefined || product === null) {
		var n = window.oNameboxes['order_products_' + id +
'_id'];
		if(!n)
			return false;
		var data = n.get();
		if(data && data.value)
			product = data.value
	}
	if(!product || product <= 0)
		return false;

	var url = '<?php echo
hikamarket::completeLink('order&task=product_data&cid='.(int)$this->order->order_id.'&'.hikamarket::getFormToken().'=1&tmpl=ajax',
false, false, true); ?>',
		field_name = 'hikamarket_order_<?php echo
$this->order->order_id; ?>_orderproduct_' + id +
'_',
		params = { mode: "POST", data:
o.encodeFormData({'order_product': id, 'product':
product}) },
		field = d.getElementById(field_name + 'qty'), qty = 0,
		setField = function(k, v) {
			var el = d.getElementById(field_name + k);
			if(!el) return;
			el.value = v;
			if(k == 'value') o.fireEvent(el, 'change');
		};
	if(field && field.value)
		qty = parseInt(field.value);
	if(qty !== NaN && qty > 0)
		params.data = o.encodeFormData({'order_product': id,
'product': product, 'qty': qty});

	o.xRequest(url, params, function(x,p) {
		var ret = o.evalJSON( x.responseText );
		if(!ret) return;
		if(ret.name) setField('name', ret.name);
		if(ret.code) setField('code', ret.code);
		if(ret.tax) setField('tax_namekey', ret.tax);
		if(ret.price) setField('value', ret.price);
		if(ret.vendor) {
			var n = window.oNameboxes[field_name + 'vendor'];
			if(n) n.set(ret.vendor.name, ret.vendor.id);
		}
		if(ret.vendorprice) setField('vendorprice', ret.vendorprice);
	});

	return false;
};
<?php } ?>
</script>
views/ordermarket/tmpl/show_block_vendors.php000064400000006426151166607750015625
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->ajax)) {
	$display = '';
	if(empty($this->order->hikamarket->children))
		$display = 'display:none;';
?>
<!-- VENDORS -->
<div id="hikamarket_order_block_vendors" style="<?php
echo $display; ?>">
<?php
}
?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>

	<h3 style="display:inline-block"><?php echo
JText::_('HIKAM_VENDOR_ORDERS')?></h3>

	<table class="hikam_listing <?php echo
(HIKASHOP_RESPONSIVE)?'table table-striped table-hover
table-bordered':'hikam_table'; ?>"
id="hikamarket_order_subsales" style="width:100%">
		<thead>
			<tr>
				<th class="hikamarket_order_item_name_title
title"><?php echo
JText::_('ORDER_NUMBER');?></th>
				<th class="hikamarket_order_item_name_title
title"><?php echo
JText::_('HIKA_VENDOR');?></th>
				<th class="hikamarket_order_item_name_title
title"><?php echo
JText::_('ORDER_STATUS');?></th>
				<th class="hikamarket_order_item_name_title
title"><?php echo
JText::_('HIKASHOP_TOTAL');?></th>
				<th class="hikamarket_order_item_name_title
title"><?php echo
JText::_('VENDOR_TOTAL');?></th>
			</tr>
		</thead>
		<tbody id="hikamarket_order_product_listing_content">
<?php
if(!empty($this->order->hikamarket->children)) {
	foreach($this->order->hikamarket->children as $subOrder) {
?>
			<tr>
				<td>
<?php
		if($subOrder->order_type == 'subsale') {
?>
					<a href="<?php echo
hikamarket::completeLink('order&task=show&cid='.(int)$subOrder->order_id);?>"><?php
echo $subOrder->order_number; ?></a>
<?php
		} else {
			echo
'<em>'.JText::_('HIKAM_ORDER_ADJUSTMENT').'</em>';
		}
?>
				</td>
				<td><?php
					echo $this->escape($subOrder->vendor_name);
				?></td>
				<td><?php echo
hikamarket::orderStatus($subOrder->order_status); ?></td>
				<td><?php
					echo
$this->currencyHelper->format($subOrder->order_full_price,
$subOrder->order_currency_id);
				?></td>
				<td><?php
					echo
$this->currencyHelper->format($subOrder->order_vendor_price,
$subOrder->order_currency_id);
					if(isset($subOrder->order_vendor_price_with_refunds) &&
$subOrder->order_vendor_price_with_refunds !== null) {
						echo ' (' .
$this->currencyHelper->format($subOrder->order_vendor_price_with_refunds,
$subOrder->order_currency_id) . ')';
					}
					if(!empty($subOrder->order_vendor_paid))
						echo ' ' .
hikamarket::tooltip(JText::_('HIKAM_ORDER_IS_PAID'),
'', '', '<img
src="'.HIKAMARKET_IMAGES.'icon-16/save2.png"
style="vertical-align:top;"
alt="('.JText::_('PAID').')" />',
'', 0);
				?></td>
			</tr>
<?php
	}
}
?>
		</tbody>
	</table>
<?php if(empty($this->ajax)) { ?>
</div>
<script type="text/javascript">
window.Oby.registerAjax('orderMgr.details',function(params){
window.orderMgr.refreshBlock('vendors'); });
</script>
<?php } elseif(!empty($this->order->hikamarket->children)) {
?>
<script type="text/javascript">
(function(){
	var el =
document.getElementById('hikamarket_order_block_vendors');
	if(el) el.style.display = '';
})();
</script>
<?php }
views/ordermarket/tmpl/show_general.php000064400000011527151166607750014406
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>	<legend><?php echo JText::_('MAIN_INFORMATION');
?></legend>
<?php
$show_url =
'order&task=show&subtask=general&cid='.$this->order->order_id;
$save_url =
'order&task=save&subtask=general&cid='.$this->order->order_id;
$update_url =
'order&task=edit&subtask=general&cid='.$this->order->order_id;
if(!isset($this->edit) || $this->edit !== true ) {
	if(hikamarket::acl('order/edit/general')) {
?>		<div class="hikam_edit"><a href="<?php
echo hikamarket::completeLink($update_url, true);?>"
onclick="return
window.hikamarket.get(this,'hikamarket_order_field_general');"><i
class="fas fa-pencil-alt"></i><span><?php echo
JText::_('HIKA_EDIT'); ?></span></a></div>
<?php
	}
} else {
?>		<div class="hikam_edit">
			<a href="<?php echo hikamarket::completeLink($save_url,
true);?>" onclick="return
window.hikamarket.form(this,'hikamarket_order_field_general');"><i
class="fas fa-check"></i><span><?php echo
JText::_('HIKA_SAVE'); ?></span></a>
			<a href="<?php echo hikamarket::completeLink($show_url,
true);?>" onclick="return
window.hikamarket.get(this,'hikamarket_order_field_general');"><i
class="far fa-times-circle"></i><span><?php
echo JText::_('HIKA_CANCEL'); ?></span></a>
		</div>
<?php
}
?>
	<dl class="hikam_options">
		<dt class="hikamarket_order_number"><label><?php
echo JText::_('ORDER_NUMBER'); ?></label></dt>
		<dd class="hikamarket_order_number"><span><?php
echo $this->order->order_number; ?></span></dd>

		<dt
class="hikamarket_order_invoicenumber"><label><?php
echo JText::_('INVOICE_NUMBER'); ?></label></dt>
		<dd
class="hikamarket_order_invoicenumber"><span><?php
echo @$this->order->order_invoice_number;
?></span></dd>

		<dt class="hikamarket_order_status"><label
for="data[order][order_status]"><?php echo
JText::_('ORDER_STATUS'); ?></label></dt>
		<dd class="hikamarket_order_status"><?php
			if(!isset($this->edit) || $this->edit !== true ) {
				?><span><?php echo
hikamarket::orderStatus($this->order->order_status);
?></span><?php
			} else {
				$extra =
'onchange="window.orderMgr.status_changed(this);"';
				echo
$this->order_status->display('data[order][order_status]',
$this->order->order_status, $extra);
			}
		?></dd>
<?php
if(isset($this->edit) && $this->edit === true &&
($this->vendor->vendor_id == 0 || $this->vendor->vendor_id ==
1) && hikamarket::acl('order/edit/notify')) {
?>
		<dt id="hikamarket_order_notify_lbl"
style="display:none;"
class="hikamarket_order_notify"><label
for="data[notify]"><?php echo
JText::_('NOTIFICATION'); ?></label></dt>
		<dd id="hikamarket_order_notify_val"
style="display:none;"
class="hikamarket_order_notify"><input
type="checkbox" id="data[notify]"
name="data[notify]"/><label
style="display:inline-block"
for="data[notify]"><?php echo
JText::_('NOTIFY_CUSTOMER'); ?></label></dd>
<?php
}
?>
		<dt
class="hikamarket_order_created"><label><?php echo
JText::_('DATE'); ?></label></dt>
		<dd class="hikamarket_order_created"><span><?php
echo hikamarket::getDate($this->order->order_created,'%Y-%m-%d
%H:%M');?></span></dd>

		<dt class="hikamarket_order_id"><label><?php
echo JText::_('ID'); ?></label></dt>
		<dd class="hikamarket_order_id"><span><?php echo
$this->order->order_id; ?></span></dd>
<?php
if(isset($this->edit) && $this->edit === true ) {
?>
		<dt
class="hikamarket_order_history"><label><?php echo
JText::_('HISTORY'); ?></label></dt>
		<dd class="hikamarket_order_history">
			<span><input
onchange="window.orderMgr.general_history_changed(this);"
type="checkbox" id="hikamarket_history_general_store"
name="data[history][store_data]"
value="1"/><label
for="hikamarket_history_general_store"
style="display:inline-block"><?php echo
JText::_('SET_HISTORY_MESSAGE');?></label></span><br/>
			<textarea id="hikamarket_history_general_msg"
name="data[history][msg]"
style="display:none;"></textarea>
		</dd>
<?php
}
?>
	</dl>
<?php
if(isset($this->edit) && $this->edit === true ) {
?>
<script type="text/javascript">
if(!window.orderMgr)
	window.orderMgr = {};
window.orderMgr.status_changed = function(el) {
	var fields = ['hikamarket_order_notify_lbl',
'hikamarket_order_notify_val'], displayValue = '';
	if(el.value == '<?php echo $this->order->order_status;
?>')
		displayValue = 'none';
	window.hikamarket.setArrayDisplay(fields, displayValue);
};
window.orderMgr.general_history_changed = function(el) {
	var fields = ['hikamarket_history_general_msg'], displayValue =
'';
	if(!el.checked) displayValue = 'none';
	window.hikamarket.setArrayDisplay(fields, displayValue);
};
</script>

	<input type="hidden" name="data[general]"
value="1"/>
	<?php echo JHTML::_('form.token')."\r\n";
}
views/ordermarket/tmpl/show_history.php000064400000003604151166607750014467
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><legend><?php echo JText::_('HISTORY');
?></legend>
<div class="hikamarket_history_container">
<table id="hikamarket_order_history_listing"
class="hikam_listing hikam_table table table-striped
table-hover">
	<thead>
		<tr>
			<th class="title"><?php
				echo JText::_('HIKA_TYPE');
			?></th>
			<th class="title"><?php
				echo JText::_('ORDER_STATUS');
			?></th>
			<th class="title"><?php
				echo JText::_('REASON');
			?></th>
			<th class="title"><?php
				echo JText::_('HIKA_USER').' /
'.JText::_('IP');
			?></th>
			<th class="title"><?php
				echo JText::_('DATE');
			?></th>
			<th class="title"><?php
				echo JText::_('INFORMATION');
			?></th>
		</tr>
	</thead>
	<tbody>
<?php
$userClass = hikamarket::get('shop.class.user');
foreach($this->order->history as $k => $history) {
?>
		<tr>
			<td><?php
				$val =
preg_replace('#[^a-z0-9]#i','_',strtoupper($history->history_type));
				$trans = JText::_($val);
				if($val != $trans)
					$history->history_type = $trans;
				echo $history->history_type;
			?></td>
			<td><?php
				echo hikamarket::orderStatus($history->history_new_status);
			?></td>
			<td><?php
				echo $history->history_reason;
			?></td>
			<td><?php
				if(!empty($history->history_user_id)){
					$user = $userClass->get($history->history_user_id);
					echo $user->username.' / ';
				}
				echo $history->history_ip;
			?></td>
			<td><?php
				echo hikamarket::getDate($history->history_created,'%Y-%m-%d
%H:%M');
			?></td>
			<td><?php
				echo $history->history_data;
			?></td>
		</tr>
<?php
}
?>
	</tbody>
</table>
</div>
views/ordermarket/tmpl/show_legacy.php000064400000011015151166607750014225
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><script type="text/javascript">
<!--
window.orderMgr = {
	updateAdditionnals: function(){},
	updateHistory: function(){},
	updateShipping: function(){},
	updateBilling: function(){}
};
//-->
</script>
<table class="hikam_blocks">
	<tr>
		<td style="width:50%" class="hikam_block_l">
<fieldset class="hikam_field"
id="hikamarket_order_field_general">
<?php
echo $this->loadTemplate('general');
?>
</fieldset>
			<fieldset class="hikam_field">
				<legend><?php echo
JText::_('CUSTOMER')?></legend>
<?php if(hikamarket::acl('order/edit/customer') &&
($this->vendor->vendor_id == 0 || $this->vendor->vendor_id ==
1)) { ?>
				<div class="hikam_edit">
					<?php
						echo $this->popup->display(
							'<img src="'. HIKAMARKET_IMAGES
.'icon-16/edit.png" alt=""/><span>'.
JText::_('HIKA_EDIT') .'</span>',
							'HIKAM_SET_ORDER_CUSTOMER',
							hikamarket::completeLink('user&task=selection&single=1&confirm=0&after=order|customer_set&afterParams=order_id|'.$this->order->order_id,
true),
							'hikamarket_setcustomer_popup',
							750, 460, 'onclick="return
window.orderMgr.setCustomer(this);"', '',
'link'
						);
					?>
				</div>
<script type="text/javascript">
<!--
window.orderMgr.setCustomer = function(el) {
	var w = window;
	w.hikamarket.submitFct = function(data) {
		var d = document, input = null, inputs =
{id:'hikamarket_order_customer_id',name:'hikamarket_order_customer_name',email:'hikamarket_order_customer_email'};
		for(var i in inputs) {
			input = d.getElementById(inputs[i]);
			if(input)
				input.innerHTML = data[i];
		}
		if(data['updates']) {
			for(var i = 0; i < data['updates'].length; i++) {
				var up = data['updates'][i];
				if(up == 'history') window.orderMgr.updateHistory();
				if(up == 'billing') window.orderMgr.updateBilling();
			}
		}
	};
	w.hikashop.openBox(el);
	return false;
}
//-->
</script>
<?php } ?>
				<dl class="hikam_options">
					<dt
class="hikamarket_order_customer_name"><label><?php
echo JText::_('HIKA_NAME');?></label></dt>
					<dd class="hikamarket_order_customer_name"><span
id="hikamarket_order_customer_name"><?php echo
@$this->order->customer->name; ?></span></dd>
				</dl>
				<dl class="hikam_options">
					<dt
class="hikamarket_order_customer_email"><label><?php
echo JText::_('HIKA_EMAIL');?></label></dt>
					<dd class="hikamarket_order_customer_email"><span
id="hikamarket_order_customer_email"><?php echo
@$this->order->customer->user_email;
?></span></dd>
				</dl>
				<dl class="hikam_options">
					<dt
class="hikamarket_order_customer_id"><label><?php
echo JText::_('ID');?></label></dt>
					<dd class="hikamarket_order_customer_id"><span
id="hikamarket_order_customer_id"><?php echo
@$this->order->customer->user_id; ?></span></dd>
				</dl>
			</fieldset>
		</td>
		<td style="width:50%;" class="hikam_block_r">
			<fieldset class="hikam_field"
id="hikamarket_order_field_additional">
<?php
echo $this->loadTemplate('additional');
?>
			</fieldset>
		</td>
	</tr>
	<tr>
		<td class="hikam_block_l">
			<fieldset class="hikam_field"
id="hikamarket_order_field_billing_address">
<?php
	$this->type = 'billing';
	echo $this->loadTemplate('address');
?>
			</fieldset>
		</td>
		<td class="hikam_block_r">
			<fieldset class="hikam_field"
id="hikamarket_order_field_shipping_address">
<?php
	if(empty($this->order->override_shipping_address)) {
		$this->type = 'shipping';
		echo $this->loadTemplate('address');
	} else {
		echo $this->order->override_shipping_address;
	}
?>
			</fieldset>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<fieldset class="hikam_field"
id="hikamarket_order_products">
<?php
echo $this->loadTemplate('products');
?>
			</fieldset>
		</td>
	</tr>
	<tr>
		<td colspan="2">
<?php
	JPluginHelper::importPlugin('hikashop');
	JPluginHelper::importPlugin('hikamarket');
	JFactory::getApplication()->triggerEvent('onAfterOrderProductsListingDisplay',
array(&$this->order, 'order_frontvendor_show'));
?>
		</td>
	</tr>
<?php if(hikamarket::acl('order/edit/history') &&
!empty($this->order->history)) { ?>
	<tr>
		<td colspan="2">
			<fieldset class="hikam_field"
id="hikamarket_order_field_history">
<?php
echo $this->loadTemplate('history');
?>
			</fieldset>
		</td>
	</tr>
<?php }?>
</table>
views/ordermarket/tmpl/show_products.php000064400000021114151166607750014625
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><legend><?php echo JText::_('PRODUCT_LIST');
?></legend>
<?php
	$editProduct = false;
	$showVendor = (hikamarket::level(1) &&
$this->order->order_type == 'sale' &&
$this->vendor->vendor_id <= 1);
	if(hikamarket::acl('order/edit/products') &&
$this->vendor->vendor_id <= 1) {
		$editProduct = true;
		$url =
hikamarket::completeLink('product&task=selection&single=1&confirm=0&after=order|product_add&afterParams=order_id|'.$this->order->order_id,
true);
?>
<div class="hikam_edit"><?php
	echo $this->popup->display(
		'<img src="'. HIKAMARKET_IMAGES
.'icon-16/plus.png" alt=""/><span>'.
JText::_('HIKA_EDIT') .'</span>',
		'HIKAM_ADD_ORDER_PRODUCT',
		hikamarket::completeLink('order&task=product_add&order_id='.$this->order->order_id,
true),
		'hikamarket_addproduct_popup',
		750, 460, 'onclick="return
window.orderMgr.addProduct(this);"', '',
'link'
	);
	echo ' ';
	echo $this->popup->display(
		'<img src="'. HIKAMARKET_IMAGES
.'icon-16/product.png" alt=""/><span>'.
JText::_('HIKA_EDIT') .'</span>',
		'HIKAM_ADD_ORDER_PRODUCT',
		hikamarket::completeLink('product&task=selection&single=1&confirm=0&after=order|product_add&afterParams=order_id|'.$this->order->order_id,
true),
		'hikamarket_selectproduct_popup',
		750, 460, 'onclick="return
window.orderMgr.selectProduct(this);"', '',
'link'
	);
?></div>
<script type="text/javascript">
<!--
window.orderMgr.addProduct = function(el) {
	window.hikamarket.submitFct = function(data) {
		var d = document, o = window.Oby;
		o.xRequest('<?php echo
hikamarket::completeLink('order&task=show&subtask=products&cid='.$this->order->order_id,
true); ?>', {update: 'hikamarket_order_products'});
		window.orderMgr.updateAdditionals();
		window.orderMgr.updateHistory();
		window.hikashop.closeBox();
	};
	window.hikashop.openBox(el);
	return false;
}
window.orderMgr.selectProduct = function(el) {
	window.hikamarket.submitFct = function(data) {
		var d = document, o = window.Oby;
		o.xRequest('<?php echo
hikamarket::completeLink('order&task=show&subtask=products&cid='.$this->order->order_id,
true); ?>', {update: 'hikamarket_order_products'});
		window.orderMgr.updateAdditionals();
		window.orderMgr.updateHistory();
		window.hikashop.closeBox();
	};
	window.hikashop.openBox(el);
	return false;
}
//-->
</script>
<?php
	}
?>
<table class="hikam_listing <?php echo
(HIKASHOP_RESPONSIVE)?'table table-striped
table-hover':'hikam_table'; ?>"
id="hikamarket_order_product_listing"
style="width:100%">
	<thead>
		<tr>
			<th class="hikamarket_order_item_name_title
title"><?php echo JText::_('PRODUCT');
?></th>
			<th class="hikamarket_order_item_price_title
title"><?php echo JText::_('UNIT_PRICE');
?></th>
			<th class="hikamarket_order_item_quantity_title
title"><?php echo JText::_('PRODUCT_QUANTITY');
?></th>
			<th class="hikamarket_order_item_total_price_title
title"><?php echo JText::_('PRICE'); ?></th>
<?php if($showVendor){ ?>
			<th class="hikamarket_order_item_vendor_title
title"><?php echo JText::_('HIKA_VENDOR');
?></th>
<?php } ?>
<?php if($editProduct){ ?>
			<th colspan="2"
class="hikamarket_order_item_remove_title title"><?php echo
JText::_('ACTIONS'); ?></th>
<?php } ?>
		</tr>
	</thead>
	<tbody>
<?php
foreach($this->order->products as $k => $product) {
	$td_class = '';
	if(!empty($product->order_product_option_parent_id))
		$td_class = ' hikamarket_order_item_option';
?>
		<tr>
			<td class="hikamarket_order_item_name_value<?php echo
$td_class; ?>">
<?php
if(!empty($product->product_id)) {
?>
				<a onclick="return window.orderMgr.showProduct(this);"
href="<?php echo
hikamarket::completeLink('shop.product&task=show&cid='.$product->product_id,
true); ?>"><?php
					echo $product->order_product_name;
				?></a>
<?php
	} else {
		echo $product->order_product_name;
	}
?>
				<br/><?php
	echo $product->order_product_code;
	if(hikashop_level(2) &&
!empty($this->fields['item'])) {
?>				<p
class="hikamarket_order_product_custom_item_fields">
<?php
		foreach($this->fields['item'] as $field) {
			$namekey = $field->field_namekey;
			if(empty($product->$namekey) &&
!strlen($product->$namekey))
				continue;
			echo '<p
class="hikamarket_order_item_'.$namekey.'">' .
				$this->fieldsClass->trans($field->field_realname) . ':
' . $this->fieldsClass->show($field,$product->$namekey) .
				'</p>';
		}
?>
				</p>
<?php
	}
?>
			</td>
			<td class="hikamarket_order_item_price_value"><?php
				echo
$this->currencyHelper->format($product->order_product_price,
$this->order->order_currency_id);
				if(bccomp($product->order_product_tax,0,5)) {
					echo '<br/>'.JText::sprintf('PLUS_X_OF_VAT',
$this->currencyHelper->format($product->order_product_tax,
$this->order->order_currency_id));
				}
			?></td>
			<td
class="hikamarket_order_item_quantity_value"><?php echo
$product->order_product_quantity;?></td>
			<td
class="hikamarket_order_item_total_price_value"><?php echo
$this->currencyHelper->format($product->order_product_total_price,
$this->order->order_currency_id);?></td>
<?php if($showVendor) { ?>
			<td class="hikamarket_order_item_vendor_value"><?php
				if(!empty($product->vendor_data) &&
(int)$product->vendor_data->vendor_id > 1) {
					echo
$product->vendor_data->vendor_name.'<br/>'.
						$this->currencyHelper->format($product->vendor_data->order_product_vendor_price,
$this->order->order_currency_id);
				} else
					echo '-';
			?></td>
<?php } ?>
<?php if($editProduct){ ?>
			<td class="hikamarket_order_item_edit_value"
style="text-align:center">
				<a onclick="return window.orderMgr.setProduct(this);"
href="<?php
					echo
hikamarket::completeLink('order&task=edit&subtask=products&order_id='.$this->order->order_id.'&order_product_id='.$product->order_product_id,
true);
				?>"><img src="<?php echo
HIKAMARKET_IMAGES?>icon-16/edit.png" alt="<?php echo
JText::_('HIKA_EDIT'); ?>"/></a>
			</td>
			<td class="hikamarket_order_item_remove_value"
style="text-align:center">
				<a onclick="return window.orderMgr.delProduct(this, <?php
echo $product->order_product_id; ?>);" href="<?php echo
hikamarket::completeLink('order&task=product_delete&order_id='.$this->order->order_id.'&order_product_id='.$product->order_product_id);
?>"><img src="<?php echo
HIKAMARKET_IMAGES?>icon-16/delete.png" alt="<?php echo
JText::_('HIKA_DELETE'); ?>"/></a>
			</td>
<?php } ?>
		</tr>
<?php
}
?>
	</tbody>
</table>
<?php
echo $this->popup->display(
	'',
	'HIKAM_SHOW_ORDER_PRODUCT',
	hikamarket::completeLink('shop.product&task=show&cid=0',
true),
	'hikamarket_showproduct_popup',
	750, 460, 'style="display:none;"', '',
'link'
);
?>
<script type="text/javascript">
<!--
window.orderMgr.showProduct = function(el) {
	window.hikamarket.submitFct = function(data) { window.hikashop.closeBox();
};
	window.hikashop.openBox('hikamarket_showproduct_popup',
el.getAttribute('href'));
	return false;
}
</script>
<?php
if($editProduct) {
	echo $this->popup->display(
		'',
		'HIKAM_MODIFY_ORDER_PRODUCT',
		hikamarket::completeLink('order&task=edit&subtask=products&order_id='.$this->order->order_id.'&order_product_id=0',
true),
		'hikamarket_editproduct_popup',
		550, 350, 'style="display:none;"', '',
'link'
	);
?>
<script type="text/javascript">
<!--
window.orderMgr.setProduct = function(el) {
	window.hikamarket.submitFct = function(data) {
		var w = window, o = w.Oby;
		w.hikashop.closeBox();
		o.xRequest('<?php echo
hikamarket::completeLink('order&task=show&subtask=products&cid='.$this->order->order_id,
true); ?>', {update: 'hikamarket_order_products'},
function() {
			window.orderMgr.updateAdditionals();
			window.orderMgr.updateHistory();
		});
	};
	window.hikashop.openBox('hikamarket_editproduct_popup',
el.getAttribute('href'));
	return false;
}
window.orderMgr.delProduct = function(el, id) {
	if(confirm("<?php echo
JText::_('HIKAM_CONFIRM_DELETE_ORDER_PRODUCT'); ?>")) {
		var w = window, o = w.Oby;
		el.parentNode.innerHTML = '<img src="<?php echo
HIKAMARKET_IMAGES?>icon-16/loading.gif"
alt="loading..."/>';
		o.xRequest('<?php echo
hikamarket::completeLink('order&task=product_delete&order_id='.$this->order->order_id.'&order_product_id=HKMPRODID',
true, false, true); ?>'.replace('HKMPRODID',id), {update:
'hikamarket_order_products'}, function() {
			window.orderMgr.updateAdditionals();
			window.orderMgr.updateHistory();
		});
	}
	return false;
}
//-->
</script>
<?php
}
views/ordermarket/tmpl/show_vendor.php000064400000040236151166607750014265
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div class="hikamarket_order">
	<h2 style="display:inline-block"><?php
		echo JText::sprintf('HIKAM_ORDER',
$this->order->order_number);
	?></h2>
	<span id="hikamarket_order_status"
style="margin-left:7px;font-size:1.2em;line-height:1.3em;"
class="order-label order-label-<?php echo
preg_replace('#[^a-z_0-9]#i', '_', str_replace('
','_',$this->order->order_status));
?>"><?php echo
hikamarket::orderStatus($this->order->order_status);
?></span>

<!-- GENERAL -->
	<dl class="hikam_options large">
<?php if(empty($this->order->order_invoice_created) ||
$this->order->order_invoice_created !=
$this->order->order_created) { ?>
		<dt
class="hikamarket_order_created"><label><?php echo
JText::_('DATE_ORDER_CREATED');?></label></dt>
		<dd class="hikamarket_order_created"><?php echo
hikamarket::getDate($this->order->order_created, '%Y-%m-%d
%H:%M'); ?></dd>
<?php } ?>

		<dt
class="hikamarket_order_invoicenumber"><label><?php
echo JText::_('INVOICE_NUMBER'); ?></label></dt>
		<dd
class="hikamarket_order_invoicenumber"><span><?php
echo @$this->order->order_invoice_number;
?></span></dd>

<?php if(!empty($this->order->order_invoice_created)) { ?>
		<dt
class="hikamarket_order_created"><label><?php echo
JText::_('DATE_ORDER_PAID');?></label></dt>
		<dd class="hikamarket_order_created"><?php echo
hikamarket::getDate($this->order->order_invoice_created,
'%Y-%m-%d %H:%M');?></dd>
<?php } ?>
	</dl>

<!-- ADDITIONAL -->
	<h3><?php echo
JText::_('ORDER_DETAILS')?></h3>
	<dl class="hikam_options large">
		<dt
class="hikamarket_order_additional_subtotal"><label><?php
echo JText::_('SUBTOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_additional_subtotal"><span><?php
			if($this->shopConfig->get('price_with_tax'))
				echo
$this->currencyHelper->format($this->order->order_subtotal,
$this->order->order_currency_id);
			else
				echo
$this->currencyHelper->format($this->order->order_subtotal_no_vat,
$this->order->order_currency_id);
		?></span></dd>

<?php if(!empty($this->order->order_discount_code) ||
bccomp($this->order->order_discount_price, 0, 5) !== 0) { ?>
		<dt
class="hikamarket_order_additional_coupon"><label><?php
echo JText::_('HIKASHOP_COUPON'); ?></label></dt>
		<dd
class="hikamarket_order_additional_coupon"><span><?php
			if($this->shopConfig->get('price_with_tax'))
				echo
$this->currencyHelper->format($this->order->order_discount_price
* -1.0, $this->order->order_currency_id);
			else
				echo
$this->currencyHelper->format(($this->order->order_discount_price
- @$this->order->order_discount_tax) * -1.0,
$this->order->order_currency_id);
		?> <span class="label label-default"><?php echo
$this->order->order_discount_code;
?></span></span></dd>
<?php } ?>

	<!-- Shipping -->
<?php if(!empty($this->order->order_shipping_id) ||
bccomp($this->order->order_shipping_price, 0, 5) !== 0) { ?>
		<dt
class="hikamarket_order_additional_shipping"><label><?php
echo JText::_('SHIPPING'); ?></label></dt>
		<dd
class="hikamarket_order_additional_shipping"><span><?php
			if($this->shopConfig->get('price_with_tax'))
				echo
$this->currencyHelper->format($this->order->order_shipping_price,
$this->order->order_currency_id);
			else
				echo
$this->currencyHelper->format($this->order->order_shipping_price
- @$this->order->order_shipping_tax,
$this->order->order_currency_id);
		?> <span class="hk-label hk-label-blue"><?php
			if(empty($this->order->shipping_name))
				echo
'<em>'.JText::_('HIKA_NONE').'</em>';
			else if(is_string($this->order->shipping_name))
				echo $this->order->shipping_name;
			else
				echo implode('</span> <span class="hk-label
hk-label-blue">', $this->order->shipping_name);
		?></span></dd>
<?php
	}
?>

	<!-- Payment -->
<?php if(!empty($this->order->order_payment_id) ||
bccomp($this->order->order_payment_price, 0, 5) !== 0) { ?>
		<dt
class="hikamarket_order_additional_payment"><label><?php
echo JText::_('HIKASHOP_PAYMENT');
?></label></dt>
		<dd
class="hikamarket_order_additional_payment"><span><?php
			echo
$this->currencyHelper->format($this->order->order_payment_price,
$this->order->order_currency_id);
		?> <span class="hk-label hk-label-blue"><?php echo
@$this->order->payment_name; ?></span></dd>
<?php
	}
?>
	<!-- Additional -->
<?php
	if(!empty($this->order->additional)) {
		foreach($this->order->additional as $additional) {
?>
		<dt
class="hikamarket_order_additional_additional"><label><?php
echo JText::_($additional->order_product_name);
?></label></dt>
		<dd
class="hikamarket_order_additional_additional"><span><?php
			if(!empty($additional->order_product_price))
				$additional->order_product_price =
(float)$additional->order_product_price;

			if(!empty($additional->order_product_price) ||
empty($additional->order_product_options))
				echo
$this->currencyHelper->format($additional->order_product_price,
$this->order->order_currency_id);
			else
				echo $additional->order_product_options;
		?></span></dd>
<?php
		}
	}
?>
	<!-- Taxes -->
<?php
	if($this->shopConfig->get('detailed_tax_display')
&& !empty($this->order->order_tax_info)) {
		foreach($this->order->order_tax_info as $tax){
?>
			<dt
class="hikamarket_order_additional_tax"><label><?php
echo $tax->tax_namekey; ?></label></dt>
			<dd
class="hikamarket_order_additional_tax"><span><?php
				echo
$this->currencyHelper->format($tax->tax_amount,$this->order->order_currency_id);
			?></span></dd>
<?php
		}
	}
?>
	<!-- Total -->
		<dt
class="hikamarket_order_additional_total"><label><?php
			if((int)$this->order->order_vendor_id <= 1)
				echo JText::_('HIKASHOP_TOTAL');
			else
				echo JText::_('HIKAM_USER_TOTAL');
		?></label></dt>
		<dd
class="hikamarket_order_additional_total"><span><?php
echo
$this->currencyHelper->format($this->order->order_full_price,
$this->order->order_currency_id); ?></span></dd>

<?php
	if((int)$this->order->order_vendor_id > 1) {
		$fixed_fees = 0.0;
		if(!empty($this->order->order_vendor_params->fees->fixed)) {
			foreach($this->order->order_vendor_params->fees->fixed as
$fixed_fee) {
				$fixed_fees += $fixed_fee;
			}
		}
		if(bccomp($fixed_fees, 0, 5) !== 0) {
?>
	<!-- Vendor fixed fees -->
		<dt
class="hikamarket_order_vendor_fixed_fees"><label><?php
echo JText::_('HIKAM_VENDOR_FIXED_FEES');
?></label></dt>
		<dd
class="hikamarket_order_vendor_fixed_fees"><span><?php
			echo $this->currencyHelper->format($fixed_fees,
$this->order->order_currency_id);
		?></span></dd>
<?php
		}

		if(!empty($this->order->order_vendor_params->fees->shipping))
{
?>
	<!-- Vendor shipping fees -->
		<dt
class="hikamarket_order_vendor_shipping_fees"><label><?php
echo JText::_('HIKAM_VENDOR_SHIPPING_FEES');
?></label></dt>
		<dd
class="hikamarket_order_vendor_shipping_fees"><span><?php
			echo
$this->currencyHelper->format($this->order->order_vendor_params->fees->shipping,
$this->order->order_currency_id);
		?></span></dd>
<?php
		}

		if($this->order->order_vendor_paid > 0) {
			$total = $this->order->order_vendor_price;
			$paid = $this->order->order_vendor_price;
			if(!empty($this->order->refunds)) {
				foreach($this->order->refunds as $refund) {
					$total += (float)hikamarket::toFloat($refund->order_vendor_price);
					if($refund->order_vendor_paid > 0)
						$paid += (float)hikamarket::toFloat($refund->order_vendor_price);
				}
			}
?>
	<!-- Vendor total -->
		<dt
class="hikamarket_order_vendor_paid"><label><?php
echo JText::_('VENDOR_TOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_vendor_paid"><span><?php
			echo $this->currencyHelper->format($total,
$this->order->order_currency_id);

			if($total == $paid)
				echo ' ' .
hikamarket::tooltip(JText::_('HIKAM_ORDER_IS_PAID'),
'', '', '<img
src="'.HIKAMARKET_IMAGES.'icon-16/save2.png"
style="vertical-align:top;"
alt="('.JText::_('PAID').')" />',
'', 0);
		?></span></dd>
<?php
		} else {
?>
	<!-- Vendor total -->
		<dt
class="hikamarket_order_vendor_total"><label><?php
echo JText::_('VENDOR_TOTAL'); ?></label></dt>
		<dd
class="hikamarket_order_vendor_total"><span><?php
			echo
$this->currencyHelper->format($this->order->order_vendor_price,
$this->order->order_currency_id);
		?></span></dd>
<?php
		}
?>
<?php } ?>
	</dl>
<?php
	if(!empty($this->fields['order']) &&
hikamarket::acl('order/show/customfields')) {
?>
	<dl class="hikam_options large">
<?php
		foreach($this->fields['order'] as $fieldName =>
$oneExtraField) {
?>
		<dt class="hikamarket_order_additional_customfield
hikamarket_order_additional_customfield_<?php echo $fieldName;
?>"><?php echo
$this->fieldsClass->getFieldName($oneExtraField);?></dt>
		<dd class="hikamarket_order_additional_customfield
hikamarket_order_additional_customfield_<?php echo $fieldName;
?>"><span><?php
			echo $this->fieldsClass->show($oneExtraField,
@$this->order->$fieldName);
		?></span></dd>
<?php
		}
?>
	</dl>
<?php
	}
?>

<!-- CUSTOMER -->
<?php if(hikamarket::acl('order/show/customer')){ ?>
	<h3><?php echo JText::_('CUSTOMER')?></h3>
	<dl class="hikam_options large">
		<dt
class="hikamarket_order_customer_name"><label><?php
echo JText::_('HIKA_NAME');?></label></dt>
		<dd class="hikamarket_order_customer_name"><span
id="hikamarket_order_customer_name"><?php echo
@$this->order->customer->name; ?></span></dd>

		<dt
class="hikamarket_order_customer_email"><label><?php
echo JText::_('HIKA_EMAIL');?></label></dt>
		<dd class="hikamarket_order_customer_email"><span
id="hikamarket_order_customer_email"><?php echo
@$this->order->customer->user_email;
?></span></dd>
	</dl>
<?php } ?>

<!-- ADDRESSES -->
<?php
	if(hikamarket::acl('order/show/billingaddress') ||
hikamarket::acl('order/show/shippingaddress')) {
		$acl_billing = hikamarket::acl('order/show/billingaddress');
		$acl_shipping = hikamarket::acl('order/show/shippingaddress');
		$row_class = '';
		$cell_class = '';
		if($acl_billing && $acl_shipping) {
			$row_class = 'hk-row-fluid';
			$cell_class = 'hkc-md-6';
		}
?>
	<div class="<?php echo $row_class; ?>
hikamarket_order_addresses">
<?php if($acl_billing) { ?>
		<div class="<?php echo $cell_class; ?>
hikamarket_order_billing_address">
			<h3><?php echo
JText::_('HIKASHOP_BILLING_ADDRESS')?></h3>
			<?php
				echo
$this->addressClass->maxiFormat($this->addresses[(int)$this->order->order_billing_address_id],
$this->address_fields, true);
			?>
		</div>
<?php } ?>
<?php if($acl_shipping) { ?>
		<div class="<?php echo $cell_class; ?>
hikamarket_order_shipping_address">
			<h3><?php echo
JText::_('HIKASHOP_SHIPPING_ADDRESS')?></h3>
			<?php
				if(empty($this->order->override_shipping_address))
					echo
$this->addressClass->maxiFormat($this->addresses[(int)$this->order->order_shipping_address_id],
$this->address_fields, true);
				else
					echo $this->order->override_shipping_address;
			?>
		</div>
<?php } ?>
	</div>
<?php } ?>

<!-- PRODUCTS -->
	<h3><?php echo
JText::_('PRODUCT_LIST')?></h3>
	<table class="hikam_listing <?php echo
(HIKASHOP_RESPONSIVE)?'table table-striped table-hover
table-bordered':'hikam_table'; ?>"
id="hikamarket_order_product_listing"
style="width:100%">
		<thead>
			<tr>
				<th class="hikamarket_order_item_name_title
title"><?php echo JText::_('PRODUCT');
?></th>
				<th class="hikamarket_order_item_price_title
title"><?php echo JText::_('UNIT_PRICE');
?></th>
				<th class="hikamarket_order_item_quantity_title
title"><?php echo JText::_('PRODUCT_QUANTITY');
?></th>
				<th class="hikamarket_order_item_total_price_title
title"><?php echo JText::_('PRICE'); ?></th>
			</tr>
		</thead>
		<tbody>
<?php

foreach($this->order->products as $k => $product) {
	$td_class = '';
	if(!empty($product->order_product_option_parent_id))
		$td_class = ' hikamarket_order_item_option';

?>
		<tr>
			<td class="hikamarket_order_item_name_value<?php echo
$td_class; ?>"><?php
	if(!empty($product->product_id)) {
?>
				<a onclick="return window.orderMgr.showProduct(this);"
data-popup-href="<?php echo
hikamarket::completeLink('shop.product&task=show&cid='.$product->product_id,
true); ?>" href="<?php echo
hikamarket::completeLink('shop.product&task=show&cid='.$product->product_id);
?>"><?php
		if(!empty($product->images)) {
			$img = reset($product->images);
			$thumb = $this->imageHelper->getThumbnail(@$img->file_path,
array(50,50), array('default' => 1, 'forcesize'
=> 1));
			if(!empty($thumb->path))
				echo '<img src="'.
$this->imageHelper->uploadFolder_url . str_replace('\\',
'/', $thumb->path).'" alt=""
class="hikam_imglist" />';
		}
		echo $product->order_product_name;
				?></a>
<?php
	} else {
		echo $product->order_product_name;
	}
			?></td>
			<td class="hikamarket_order_item_price_value"><?php
				echo
$this->currencyHelper->format($product->order_product_price,
$this->order->order_currency_id);
				if(bccomp($product->order_product_tax, 0, 5))
					echo '<br/>'.JText::sprintf('PLUS_X_OF_VAT',
$this->currencyHelper->format($product->order_product_tax,
$this->order->order_currency_id));
			?></td>
			<td
class="hikamarket_order_item_quantity_value"><?php
				echo (int)$product->order_product_quantity;
			?></td>
			<td
class="hikamarket_order_item_total_price_value"><?php
				echo
$this->currencyHelper->format($product->order_product_total_price,
$this->order->order_currency_id);
			?></td>
		</tr>
<?php
}
?>
		</tbody>
	</table>
<?php
echo $this->popup->display(
	'',
	'HIKAM_SHOW_ORDER_PRODUCT',
	hikamarket::completeLink('shop.product&task=show&cid=0',
true),
	'hikamarket_showproduct_popup',
	750, 460, 'style="display:none;"', '',
'link'
);
?>
<!-- OTHER COMPONENTS -->
<?php
	JPluginHelper::importPlugin('hikashop');
	JPluginHelper::importPlugin('hikamarket');
	JFactory::getApplication()->triggerEvent('onAfterOrderProductsListingDisplay',
array(&$this->order, 'order_frontvendor_vendor_show'));
?>

<!-- HISTORY -->
<?php if(hikamarket::acl('order/show/history') &&
!empty($this->order->history)) { ?>
	<h3><?php echo JText::_('HISTORY')?></h3>
	<div class="hikamarket_history_container">
	<table id="hikamarket_order_history_listing"
class="hikam_listing hikam_table table table-striped
table-hover">
		<thead>
			<tr>
				<th class="title"><?php  echo
JText::_('HIKA_TYPE'); ?></th>
				<th class="title"><?php echo
JText::_('ORDER_STATUS'); ?></th>
				<th class="title"><?php echo
JText::_('REASON'); ?></th>
				<th class="title"><?php echo
JText::_('DATE'); ?></th>
			</tr>
		</thead>
		<tbody>
<?php
	$userClass = hikamarket::get('shop.class.user');
	foreach($this->order->history as $k => $history) {
?>
			<tr>
				<td><?php
					$val =
preg_replace('#[^a-z0-9]#i','_',strtoupper($history->history_type));
					$trans = JText::_($val);
					if($val != $trans)
						$history->history_type = $trans;
					echo $history->history_type;
				?></td>
				<td><?php
					echo hikamarket::orderStatus($history->history_new_status);
				?></td>
				<td><?php
					echo $history->history_reason;
				?></td>
				<td><?php
					echo hikamarket::getDate($history->history_created,'%Y-%m-%d
%H:%M');
				?></td>
			</tr>
<?php
	}
?>
		</tbody>
	</table>
	</div>
<?php } ?>
</div>
<script type="text/javascript">
<!--
if(!window.orderMgr)
	window.orderMgr = {};
window.orderMgr.showProduct = function(el) {
	window.hikashop.submitFct = function(data) { window.hikashop.closeBox();
};
	var href = el.getAttribute('data-popup-href');
	if(!href)
		href = el.getAttribute('href');
	window.hikashop.openBox('hikamarket_showproduct_popup', href);
	return false;
};
window.orderMgr.editOrderStatus = function(el) {
	window.hikamarket.submitFct = function(data) {
		var orderstatus =
document.getElementById('hikamarket_order_status');
		if(orderstatus) {
			orderstatus.innerHTML = data.name;
			orderstatus.className = 'order-label order-label-' +
data.order_status.replace(/[^a-z_0-9]/i, '_');
		}
		window.hikamarket.closeBox();
	};
	var href = el.getAttribute('href');
	if(href == '' || href == null || href == '#')
		href = null;
	window.hikamarket.openBox('hikamarket_order_status_popup',
href);
	return false;
};
// -->
</script>
views/ordermarket/tmpl/status.php000064400000005335151166607750013254
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('order&task=save&cid='.$this->order->order_id);
?>" method="post" name="adminForm"
id="adminForm">
<dl class="hikam_options">
	<dt><?php echo JText::_('ORDER_STATUS');
?></dt>
	<dd><span class="order-label order-label-<?php echo
preg_replace('#[^a-z_0-9]#i', '_', str_replace('
','_',$this->order->order_status));
?>"><?php
		echo hikamarket::orderStatus($this->order->order_status);
	?></span></dd>
	<dt><?php echo JText::_('ORDER_NEW_STATUS');
?></dt>
	<dd><?php
		echo
$this->order_status->display('order[general][order_status]',
$this->order->order_status,
'onchange="window.orderMgr.status_changed(this);"',
false, @$this->order_status_filters);
	?></dd>
<?php
if(($this->vendor->vendor_id == 0 || $this->vendor->vendor_id
== 1) && hikamarket::acl('order/edit/notify')) {
?>
	<dt id="hikamarket_order_notify_lbl"
style="display:none;"
class="hikamarket_order_notify"><label
for="order[notify]"><?php echo
JText::_('NOTIFICATION'); ?></label></dt>
	<dd id="hikamarket_order_notify_val"
style="display:none;"
class="hikamarket_order_notify"><input
type="checkbox" id="order[notify]" value="1"
name="order[notify]"/><label
style="display:inline-block"
for="order[notify]"><?php echo
JText::_('NOTIFY_CUSTOMER'); ?></label></dd>
<?php
}
?>
</dl>
<script type="text/javascript">
if(!window.orderMgr)
	window.orderMgr = {};
window.orderMgr.status_changed = function(el) {
	var fields = ['hikamarket_order_notify_lbl',
'hikamarket_order_notify_val'], displayValue = '';
	if(el.value == '<?php echo $this->order->order_status;
?>')
		displayValue = 'none';
	window.hikamarket.setArrayDisplay(fields, displayValue);
};
window.orderMgr.general_history_changed = function(el) {
	var fields = ['hikamarket_history_general_msg'], displayValue =
'';
	if(!el.checked) displayValue = 'none';
	window.hikamarket.setArrayDisplay(fields, displayValue);
};
</script>
	<input type="hidden" name="closepopup"
value="1"/>
	<input type="hidden" name="cid"
value="<?php echo (int)$this->order->order_id; ?>"
/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="save" />
	<input type="hidden" name="ctrl"
value="order" />
<?php if(hikaInput::get()->getCmd('tmpl', '') !=
'') { ?>
	<input type="hidden" name="tmpl"
value="<?php echo
$this->escape(hikaInput::get()->getCmd('tmpl'));
?>" />
<?php } ?>
	<?php echo JHTML::_('form.token'); ?>
</form>
views/ordermarket/view.html.php000064400000215277151166607750012702
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class ordermarketViewordermarket extends HikamarketView {

	protected $ctrl = 'order';
	protected $icon = 'order';
	protected $triggerView = true;

	public function display($tpl = null, $params = array()) {
		$this->params =& $params;
		$fct = $this->getLayout();
		if(method_exists($this, $fct) && $this->$fct($tpl) === false)
			return false;
		parent::display($tpl);
	}

	public function listing($tpl = null) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.listing';

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid='&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$this->loadRef(array(
			'toggleClass' => 'helper.toggle',
			'paymentType' => 'type.paymentmethods',
			'orderStatusType' => 'type.order_status',
			'addressClass' => 'class.address',
			'currencyHelper' => 'shop.class.currency',
			'shopAddressClass' => 'shop.class.address',
			'fieldClass' => 'shop.class.field',
			'searchType' => 'type.search',
		));

		$filterType =
$app->getUserStateFromRequest($this->paramBase.'.filter_type',
'filter_type', 0, 'int');

		$cfg = array(
			'table' => 'shop.order',
			'main_key' => 'order_id',
			'order_sql_value' => 'hkorder.order_id'
		);

		$pageInfo = $this->getPageInfo($cfg['order_sql_value'],
'desc');
		$pageInfo->filter->filter_status =
$app->getUserStateFromRequest($this->paramBase.'.filter_status',
'filter_status', '', 'string');
		$pageInfo->filter->filter_payment =
$app->getUserStateFromRequest($this->paramBase.'.filter_payment',
'filter_payment', '', 'string');
		$pageInfo->filter->filter_user =
$app->getUserStateFromRequest($this->paramBase.'.filter_user',
'filter_user', '', 'string');

		$filters = array();
		$searchMap = array(
			'hkorder.order_id',
			'hkorder.order_number',
			'hkuser.user_email'
		);
		$orderingAccept = array('hkorder.','hkuser.');
		$order = '';

		$fields = array();
		if(hikashop_level(2)) {
			$null = null;
			$fields = 
$this->fieldClass->getFields('display:vendor_order_listing=1',
$null, 'order');
			foreach($fields as $field) {
				if($field->field_type == 'customtext')
					continue;
				$searchMap[] = 'hkorder.'.$field->field_namekey;
			}
		}
		$this->assignRef('fields', $fields);

		if(!empty($pageInfo->filter->filter_status))
			$filters['order_status'] = 'hkorder.order_status = '
. $db->Quote($pageInfo->filter->filter_status);
		if(!empty($pageInfo->filter->filter_payment))
			$filters['order_payment_id'] = 'hkorder.order_payment_id
= ' . (int)$pageInfo->filter->filter_payment;
		if(!empty($pageInfo->filter->filter_user) &&
(int)$pageInfo->filter->filter_user > 0)
			$filters['order_user_id'] = 'hkorder.order_user_id =
' . (int)$pageInfo->filter->filter_user;

		if($vendor->vendor_id > 1) {
			$filters['order_vendor_id'] = 'hkorder.order_vendor_id =
' . $vendor->vendor_id;
			$filters['order_type'] = 'hkorder.order_type IN (' .
$db->Quote('subsale') . ',' .
$db->Quote('sale') . ')';
		} else {
			$filters['order_vendor_id'] = '(hkorder.order_vendor_id =
0 OR hkorder.order_vendor_id = 1)';
			$filters['order_type'] = 'hkorder.order_type = ' .
$db->Quote('sale');
		}

		$extrafilters = array();
		$joins = array();
		JPluginHelper::importPlugin('hikashop');
		JPluginHelper::importPlugin('hikamarket');
		$app->triggerEvent('onBeforeOrderListing',
array($this->paramBase, &$extrafilters, &$pageInfo,
&$filters, &$joins, &$searchMap));
		$this->assignRef('extrafilters', $extrafilters);

		$this->processFilters($filters, $order, $searchMap, $orderingAccept);

		$query = 'FROM
'.hikamarket::table($cfg['table']).' AS hkorder
'.
			' LEFT JOIN '.hikamarket::table('shop.user').'
AS hkuser ON hkorder.order_user_id = hkuser.user_id '.
			implode(' ', $joins).' '.$filters.$order;
		$db->setQuery('SELECT hkorder.*, hkuser.* '.$query,
(int)$pageInfo->limit->start, (int)$pageInfo->limit->value);

		if(empty($pageInfo->search)) {
			$query = 'FROM
'.hikamarket::table($cfg['table']).' AS hkorder
'.$filters;
		}

		$orders = $db->loadObjectList('order_id');

		$db->setQuery('SELECT COUNT(*) '.$query);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($orders);

		$this->assignRef('orders', $orders);

		if(hikashop_level(2)) {
			$this->fieldClass->handleZoneListing($fields, $orders);
		}

		$this->display_shipping =
(bool)$shopConfig->get('force_shipping', 1);

		$addresses = null;
		$address_fields = null;
		$payments = array();
		if(!empty($orders)) {
			$query = 'SELECT DISTINCT a.* '.
				' FROM ' . hikamarket::table('shop.address') .
' AS a '.
				' INNER JOIN ' . hikamarket::table('shop.order') .
' AS o ON (a.address_id = o.order_billing_address_id OR a.address_id =
o.order_shipping_address_id) ' .
				' WHERE o.order_id IN (' . implode(',',
array_keys($orders)) . ')';
			$db->setQuery($query);
			$addresses = $db->loadObjectList('address_id');

			$this->shopAddressClass->loadZone($addresses);

			$shopPluginClass = hikamarket::get('shop.class.plugins');
			$paymentMethods = $shopPluginClass->getMethods('payment');
			foreach($paymentMethods as $payment) {
				$payments[$payment->payment_id] = $payment;
			}

			foreach($orders as &$order) {
				$order->shipping_name = null;
				if(empty($order->order_shipping_method) &&
empty($order->order_shipping_id))
					continue;

				$this->display_shipping = true;

				if(!empty($order->order_shipping_method)) {
					if(!is_numeric($order->order_shipping_id))
						$order->shipping_name =
$this->getShippingName($order->order_shipping_method,
$order->order_shipping_id);
					else
						$order->shipping_name = $this->getShippingName(null,
$order->order_shipping_id);
				} else {
					$order->shipping_name = array();
					$shipping_ids = explode(';', $order->order_shipping_id);
					foreach($shipping_ids as $shipping_id) {
						$order->shipping_name[] = $this->getShippingName(null,
$shipping_id);
					}
					if(count($order->shipping_name) == 1)
						$order->shipping_name = reset($order->shipping_name);
				}
			}
			unset($order);
		}
		$this->assignRef('addresses', $addresses);
		$this->assignRef('address_fields', $address_fields);
		$this->assignRef('payments', $payments);

		$this->order_stats = null;
		if($config->get('display_order_statistics', 0)) {
			if($vendor->vendor_id > 1) {
				$query = 'SELECT o.order_status, COUNT(o.order_id) as `total` FROM
'.hikamarket::table('shop.order').' AS o WHERE
o.order_type = \'subsale\' AND o.order_vendor_id =
'.(int)$vendor->vendor_id.' GROUP BY o.order_status';
			} else {
				$query = 'SELECT o.order_status, COUNT(o.order_id) as `total` FROM
'.hikamarket::table('shop.order').' AS o WHERE
o.order_type = \'sale\' GROUP BY o.order_status';
			}
			$db->setQuery($query);
			$this->order_stats =
$db->loadObjectList('order_status');
			ksort($this->order_stats);
		}

		$text_asc = JText::_('ASCENDING');
		$text_desc = JText::_('DESCENDING');
		$ordering_values = array(
			'hkorder.order_id' => JText::_('SORT_ID'),
			'hkorder.order_invoice_id' =>
JText::_('SORT_INVOICE'),
			'hkorder.order_user_id' =>
JText::_('SORT_USER'),
			'hkorder.order_created' =>
JText::_('SORT_CREATION'),
			'hkorder.order_modified' =>
JText::_('SORT_MODIFICATION'),
			'hkorder.order_full_price' =>
JText::_('SORT_PRICE'),
		);
		$this->ordering_values = array();
		foreach($ordering_values as $k => $v) {
			$this->ordering_values[$k.' asc'] = $v . ' '
.$text_asc;
			$this->ordering_values[$k.' desc'] = $v . ' '
.$text_desc;
		}
		$this->full_ordering =
$this->pageInfo->filter->order->value . ' ' .
strtolower($this->pageInfo->filter->order->dir);

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' => hikamarket::completeLink('vendor')
			),
			'report' => array(
				'icon' => 'report',
				'fa' => 'fa-bar-chart fa-chart-bar',
				'name' => JText::_('HIKA_EXPORT'),
				'url' =>
hikamarket::completeLink('order&task=export'),
				'pos' => 'right',
				'acl' => hikamarket::acl('order/export')
			),
			'new' => array(
				'icon' => 'new',
				'fa' => 'fa-plus-circle',
				'name' => JText::_('HIKA_NEW'),
				'url' =>
hikamarket::completeLink('order&task=create'),
				'pos' => 'right',
				'display' => ($vendor->vendor_id <= 1) ||
$config->get('vendor_edit_order', 0),
				'acl' => hikamarket::acl('order/add')
			),
			'request' => array(
				'icon' => 'pay',
				'fa' => 'fa-money fa-money-bill-alt',
				'name' => JText::_('HIKAM_PAYMENT_REQUEST'),
				'url' =>
hikamarket::completeLink('order&task=request'),
				'pos' => 'right',
				'display' => ($vendor->vendor_id > 1),
				'acl' => hikamarket::acl('order/request')
			),
			'payments' => array(
				'icon' => 'pay',
				'fa' => 'fa-list-alt',
				'name' => JText::_('HIKAM_PAYMENT_LISTING'),
				'url' =>
hikamarket::completeLink('order&task=payments'),
				'pos' => 'right',
				'display' => ($vendor->vendor_id > 1),
				'acl' => hikamarket::acl('order/payments')
			)
		);

		$this->getPagination();

		$this->getOrdering('hkorder.ordering', !$filterType);
	}

	public function show($tpl = null, $toolbar = true) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$order_id = hikamarket::getCID('order_id', true);

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$edit = hikaInput::get()->getCmd('task','') ==
'edit';
		$this->assignRef('edit', $edit);

		$address_mode = hikaInput::get()->getInt('address_mode',
0);
		$this->assignRef('address_mode', $address_mode);

		hikamarket::loadJslib('tooltip');

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid='&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$orderClass = hikamarket::get('shop.class.order');
		$order = $orderClass->loadFullOrder($order_id, true, false);
		if(!isset($order->hikamarket))
			$order->hikamarket = new stdClass();

		if(!empty($order) && $order->order_vendor_id !=
$vendor->vendor_id && ($vendor->vendor_id > 1 ||
($order->order_vendor_id > 1 &&
!hikamarket::acl('order/show/vendors')))) {
			$order = null;
			$app->enqueueMessage(JText::_('ORDER_ACCESS_FORBIDDEN'));
			$app->redirect(hikamarket::completeLink('order'));
			return false;
		}

		$editable_order = ($order->order_type === 'sale') &&
($vendor->vendor_id <= 1);
		if($order->order_type === 'sale' &&
$vendor->vendor_id > 1 && (int)$order->order_vendor_id ==
$vendor->vendor_id &&
(int)$config->get('vendor_edit_order', 0) == 1) {
			$editable_order = hikamarket::isEditableOrder($order_id,
$vendor->vendor_id);
		}
		$this->assignRef('editable_order', $editable_order);

		if(empty($order->customer)) {
			$userClass = hikamarket::get('shop.class.user');
			$order->customer = $userClass->get($order->order_user_id);
		}

		if($order->order_type == 'sale') {
			$filters = array(
				'type' => 'o.order_type IN (' .
$db->Quote('subsale') . ', ' .
$db->Quote('vendorrefund') . ')',
				'parent' => 'order_parent_id = ' .
(int)$order->order_id
			);
			$query = 'SELECT o.*, v.* FROM ' .
hikamarket::table('shop.order') . ' AS o ' .
				' LEFT JOIN ' . hikamarket::table('vendor') .
' AS v ON o.order_vendor_id = v.vendor_id '.
				' WHERE (' . implode(') AND (', $filters) . ')
' .
				' ORDER BY v.vendor_id ASC, o.order_id ASC';
			$db->setQuery($query);
			$order->hikamarket->children =
$db->loadObjectList('order_id');

			$refunds = false;
			foreach($order->hikamarket->children as $d) {
				if($d->order_type !== 'vendorrefund') {
					$refunds = true;
					break;
				}
			}
			if($refunds) {
				foreach($order->hikamarket->children as &$d) {
					if($d->order_type !== 'subsale')
						continue;
					$m = false;
					$total = (float)hikamarket::toFloat($d->order_vendor_price);
					foreach($order->hikamarket->children as $o) {
						if($o->order_type == 'vendorrefund' &&
$o->order_vendor_id == $d->order_vendor_id) {
							$total += (float)hikamarket::toFloat($o->order_vendor_price);
							$m = true;
						}
					}
					if($m)
						$d->order_vendor_price_with_refunds = $total;
				}
				unset($d);
			}
		}

		if($order->order_type == 'subsale' &&
(int)$vendor->vendor_id <= 1) {
			$vendorClass = hikamarket::get('class.vendor');
			$order->hikamarket->vendor = $vendorClass->get(
(int)$order->order_vendor_id );

			$query = 'SELECT order_number, order_invoice_number FROM ' .
hikamarket::table('shop.order') . ' WHERE order_id = '
. (int)$order->order_parent_id;
			$db->setQuery($query);
			$order->hikamarket->parent = $db->loadObject();
		}

		if(!empty($order->products)) {
			$product_ids = array();

			foreach($order->products as &$product) {
				$product_ids[(int)$product->product_id] =
(int)$product->product_id;

				$product->order_product_price =
(float)hikamarket::toFloat($product->order_product_price);
				$product->order_product_tax =
(float)hikamarket::toFloat($product->order_product_tax);

				$product->tax_rate = 0;
				if($product->order_product_tax > 0 &&
$product->order_product_price != 0)
					$product->tax_rate = $product->order_product_tax /
$product->order_product_price;
			}
			unset($product);

			if($order->order_type == 'sale') {
				$query = 'SELECT hkop.*, hko.order_vendor_id, hmv.vendor_name,
hmv.vendor_id '.
					' FROM ' . hikamarket::table('shop.order_product')
. ' as hkop '.
					' INNER JOIN ' . hikamarket::table('shop.order').
' AS hko ON hkop.order_id = hko.order_id '.
					' LEFT JOIN ' . hikamarket::table('vendor').
' AS hmv ON hmv.vendor_id = hko.order_vendor_id '.
					' WHERE hko.order_type = \'subsale\' AND
hko.order_parent_id = '. (int)$order->order_id .
					' ORDER BY hko.order_id DESC';
				$db->setQuery($query);
				$vendorProducts = $db->loadObjectList();

				foreach($order->products as &$product) {
					$product->vendor_data = array();
					foreach($vendorProducts as $vendorProduct) {
						if((int)$vendorProduct->order_product_parent_id ==
$product->order_product_id) {
							$product->vendor_data[] = $vendorProduct;
						}
					}
				}
				unset($product);

			} elseif($order->order_type == 'subsale') {
				$filters = array(
					'f.file_ref_id IN ('.implode(',',
$product_ids).')',
					'f.file_type = '.$db->quote('file')
				);
				$query = 'SELECT d.*, f.* '.
					' FROM '.hikamarket::table('shop.file').' AS
f '.
					' INNER JOIN
'.hikamarket::table('shop.download').' AS d ON
d.order_id = ' . (int)$order->order_parent_id . ' AND
f.file_id = d.file_id '.
					' WHERE (' . implode(') AND
(',$filters).')'.
					' ORDER BY f.file_ref_id ASC, f.file_ordering ASC, d.file_pos
ASC';
				$db->setQuery($query);
				$files = $db->loadObjectList();

				foreach($files as $file) {
					foreach($order->products as &$product) {
						if(empty($product->files))
							continue;

						foreach($product->files as &$f) {
							if((int)$f->file_id != (int)$file->file_id)
								continue;
							$f->download_number = $file->download_number;
							$file->done = true;
							break;
						}

						if($file->done)
							break;
					}
					unset($product);
				}
			}
		}

		$this->assignRef('order', $order);

		$rootCategory = 0;
		$vendorCategories = 0;
		$vendorClass = hikamarket::get('class.vendor');
		$rootCategory = $vendorClass->getRootCategory($vendor);
		$extra_categories = $vendorClass->getExtraCategories($vendor);
		if(!empty($extra_categories))
			$vendorCategories = array_merge(array($rootCategory),
$extra_categories);
		if(empty($rootCategory))
			$rootCategory = 1;
		if(empty($vendorCategories))
			$vendorCategories = $rootCategory;
		$this->assignRef('rootCategory', $rootCategory);
		$this->assignRef('vendorCategories', $vendorCategories);

		$this->loadRef(array(
			'toggleClass' => 'helper.toogle',
			'currencyHelper' => 'shop.class.currency',
			'payment' => 'shop.type.plugins',
			'shipping' => 'shop.type.plugins',
			'shippingClass' => 'shop.class.shipping',
			'paymentClass' => 'shop.class.payment',
			'fieldsClass' => 'shop.class.field',
			'addressClass' => 'class.address',
			'shopAddressClass' => 'shop.class.address',
			'popup' => 'shop.helper.popup',
			'order_status' => 'type.order_status',
			'imageHelper' => 'shop.helper.image',
			'dropdownHelper' => 'shop.helper.dropdown',
			'nameboxType' => 'type.namebox',
			'ratesType' => 'type.rates',
		));
		$this->payment->type = 'payment';
		$this->shipping->type = 'shipping';

		$fields = array();
		if(!empty($order_id)) {
			$order->order_discount_price =
(float)hikamarket::toFloat(@$order->order_discount_price);
			$order->order_discount_tax =
(float)hikamarket::toFloat(@$order->order_discount_tax);
			$order->order_discount_tax_rate = 0;
			if(empty($order->order_discount_tax_namekey))
				$order->order_discount_tax_namekey = '';

			$order->order_payment_price =
(float)hikamarket::toFloat(@$order->order_payment_price);
			$order->order_payment_tax =
(float)hikamarket::toFloat(@$order->order_payment_tax);
			$order->order_payment_tax_rate = 0;
			if(empty($order->order_payment_tax_namekey))
				$order->order_payment_tax_namekey = '';

			$order->order_shipping_price =
(float)hikamarket::toFloat(@$order->order_shipping_price);
			$order->order_shipping_tax =
(float)hikamarket::toFloat(@$order->order_shipping_tax);
			$order->order_shipping_tax_rate = 0;
			if(empty($order->order_shipping_tax_namekey))
				$order->order_shipping_tax_namekey = '';

			$order->currency = $this->currencyHelper->get(
(int)$order->order_currency_id );

			$order->fields =
$this->fieldsClass->getData('backend','address');
			if(hikashop_level(2)) {
				$fields['order'] =
$this->fieldsClass->getFields('display:vendor_order_show=1',
$order, 'order');
				$null = null;
				$fields['entry'] =
$this->fieldsClass->getFields('display:vendor_order_show=1',
$null, 'entry');
				$fields['item'] =
$this->fieldsClass->getFields('display:vendor_order_show=1',
$null, 'item');
			}

			$query = 'SELECT * FROM
'.hikamarket::table('shop.history').' WHERE
history_order_id = '.(int)$order_id.' ORDER BY history_created
DESC';
			$db->setQuery($query);
			$order->history = $db->loadObjectList();

			if(!empty($order->order_tax_info)) {
				foreach($order->order_tax_info as $k => $v) {
					if(isset($v->tax_amount_for_coupon) &&
empty($order->order_discount_tax_namekey)) {
						$order->order_discount_tax_namekey = $k;
					}
					if(isset($v->tax_amount_for_payment) &&
empty($order->order_payment_tax_namekey)) {
						$order->order_payment_tax_namekey = $k;
					}
					if(isset($v->tax_amount_for_shipping) &&
empty($order->order_shipping_tax_namekey)) {
						$order->order_shipping_tax_namekey = $k;
					}
				}
			}
			if(!empty($order->order_discount_tax) &&
($order->order_discount_price - $order->order_discount_tax) != 0)
				$order->order_discount_tax_rate = $order->order_discount_tax /
($order->order_discount_price - $order->order_discount_tax);
			if(!empty($order->order_payment_tax) &&
($order->order_payment_price - $order->order_payment_tax) != 0)
				$order->order_payment_tax_rate = $order->order_payment_tax /
($order->order_payment_price - $order->order_payment_tax);
			if(!empty($order->order_shipping_tax) &&
($order->order_shipping_price - $order->order_shipping_tax) != 0)
				$order->order_shipping_tax_rate = $order->order_shipping_tax /
($order->order_shipping_price - $order->order_shipping_tax);

			if(!empty($order->order_payment_id)) {
				if($order->order_type == 'subsale' &&
substr($order->order_payment_method, 0, 7) == 'market-')
					$order->order_payment_method =
substr($order->order_payment_method, 7);

				$order->payment_name = $order->order_payment_method . ' -
' . $order->order_payment_id;

				$paymentMethod = $this->paymentClass->get(
(int)$order->order_payment_id );
				if(!empty($paymentMethod->payment_name))
					$order->payment_name = $paymentMethod->payment_name;
			}

			$order->shipping_name = null;
			if(!empty($order->order_shipping_method)) {
				if($order->order_type == 'subsale' &&
substr($order->order_shipping_method, 0, 7) == 'market-')
					$order->order_shipping_method =
substr($order->order_shipping_method, 7);

				if(!is_numeric($order->order_shipping_id))
					$order->shipping_name =
$this->getShippingName($order->order_shipping_method,
$order->order_shipping_id);
				else
					$order->shipping_name = $this->getShippingName(null,
$order->order_shipping_id);
			} else if(!empty($order->order_shipping_id)) {
				$order->shipping_name = array();
				$shipping_ids = explode(';', $order->order_shipping_id);
				foreach($shipping_ids as $shipping_id) {
					$order->shipping_name[] = $this->getShippingName(null,
$shipping_id);
				}
				if(count($order->shipping_name) == 1)
					$order->shipping_name = reset($order->shipping_name);
			}

			if(!empty($order->order_vendor_params) &&
is_string($order->order_vendor_params))
				$order->order_vendor_params =
hikamarket::unserialize($order->order_vendor_params);

			if((int)$order->order_vendor_paid > 0) {
				$query = 'SELECT * '.
					' FROM ' . hikamarket::table('shop.order') .
					' WHERE order_parent_id = ' . $order->order_parent_id .
' AND order_type = ' . $db->Quote('vendorrefund');
				$db->setQuery($query);
				$order->refunds = $db->loadObjectList();

				foreach($order->refunds as $refund) {
					if($refund->order_vendor_paid == 0)
						$order->current_order_status = $refund->order_status;
				}
			}

			$query = 'SELECT DISTINCT a.* '.
				' FROM ' . hikamarket::table('shop.address') .
' AS a '.
				' INNER JOIN ' . hikamarket::table('shop.order') .
' AS o ON (a.address_id = o.order_billing_address_id OR a.address_id =
o.order_shipping_address_id) ' .
				' WHERE o.order_id = '.(int)$order->order_id;
			$db->setQuery($query);
			$addresses = $db->loadObjectList('address_id');
			$this->assignRef('addresses', $addresses);
			$address_fields = null;
			$this->assignRef('address_fields', $address_fields);

			$this->shopAddressClass->loadZone($addresses);

			$bundles = array();
			foreach($order->products as $p) {
				if(empty($p->bundle))
					continue;
				foreach($p->bundle as $b) {
					$bundles[(int)$b->product_id] = (int)$b->product_id;
				}
			}
			if(!empty($bundles)) {
				$filters = array(
					'a.file_ref_id IN ('.implode(',',
$bundles).')',
					'a.file_type = \'product\''
				);
				$query = 'SELECT a.* FROM
'.hikamarket::table('shop.file').' AS a WHERE
'.implode(' AND ',$filters).' ORDER BY file_ref_id ASC,
file_ordering ASC';
				$db->setQuery($query);
				$images = $db->loadObjectList();
				if(!empty($images)) {
					foreach($order->products as &$p) {
						if(empty($p->bundle))
							continue;
						foreach($p->bundle as &$b) {
							foreach($images as $image) {
								if($b->product_id != $image->file_ref_id)
									continue;
								if(empty($b->images))
									$b->images = array();
								$b->images[] = $image;
							}
						}
						unset($b);
					}
					unset($p);
				}
			}
		}
		$this->assignRef('fields',$fields);

		if(empty($order->order_shipping_method) &&
!empty($order->shippings)) {
			$this->loadRef(array(
				'warehouseClass' => 'class.warehouse'
			));

			$order->shipping_data = array();
			$shipping_ids = explode(';', $order->order_shipping_id);
			$order->warehouses = array();
			foreach($shipping_ids as $key) {
				$shipping_data = '';
				list($k, $w) = explode('@', $key);
				$shipping_id = $k;
				if(isset($order->shippings[$shipping_id])) {
					$shipping = $order->shippings[$shipping_id];
					$shipping_data = $shipping->shipping_name;
				}
				if(empty($shipping_data))
					$shipping_data = $this->getShippingName(null, $shipping_id,
false);

				if(empty($shipping_data)) {
					foreach($order->products as $order_product) {
						if($order_product->order_product_shipping_id != $key)
							continue;

						if(!is_numeric($order_product->order_product_shipping_id)) {
							$shipping_data =
$this->getShippingName($order_product->order_product_shipping_method,
$shipping_id);
						} else {
							$shipping_method_data =
$this->shippingClass->get($shipping_id);
							$shipping_data = $shipping_method_data->shipping_name;
						}
						break;
					}
				}
				if(empty($shipping_data))
					$shipping_data = '[ ' . $key . ' ]';
				if(isset($order->order_shipping_params->prices[$key])) {
					$price_params = $order->order_shipping_params->prices[$key];
					if($this->shopConfig->get('price_with_tax'))
						$shipping_data .= ' (' .
$this->currencyHelper->format($price_params->price_with_tax,
$order->order_currency_id) . ')';
					else
						$shipping_data .= ' (' .
$this->currencyHelper->format($price_params->price_with_tax -
@$price_params->tax, $order->order_currency_id) . ')';
				}
				$order->shipping_data[] = $shipping_data;

				$order->warehouses[$key] = $this->warehouseClass->get($key);
			}
		}

		JPluginHelper::importPlugin('hikashop');
		JPluginHelper::importPlugin('hikamarket');
		JPluginHelper::importPlugin('hikashoppayment');
		JPluginHelper::importPlugin('hikashopshipping');
		$app->triggerEvent('onMarketOrderEditionLoading',
array(&$order) );
		$app->triggerEvent('onHistoryDisplay',
array(&$order->history) );

		if(class_exists('JDispatcher'))
			$this->dispatcher = JDispatcher::getInstance();

		if($toolbar) {
			hikamarket::setPageTitle(JText::sprintf('HIKAM_ORDER',
$order->order_number));

			$this->toolbar = array(
				'back' => array(
					'icon' => 'back',
					'fa' => 'fa-arrow-circle-left',
					'name' => JText::_('HIKA_BACK'),
'url' => hikamarket::completeLink('order')
				),
				'order-status' => array(
					'icon' => 'order-status',
					'fa' => 'fa-tasks',
					'name' => JText::_('HIKAM_EDIT_ORDER_STATUS'),
					'url' =>
hikamarket::completeLink('order&task=status&cid='.(int)$order->order_id,
true),
					'popup' => array('id' =>
'hikamarket_order_status_popup', 'width' => 640,
'height' => 300),
					'linkattribs' => '
onclick="if(window.orderMgr.editOrderStatus) return
window.orderMgr.editOrderStatus(this); window.hikashop.openBox(this);
return false;"',
					'pos' => 'right',
					'acl' => hikamarket::acl('order/edit/general')
				),
				'email' => array(
					'icon' => 'email',
					'fa' => 'fa-envelope',
					'name' => JText::_('HIKA_EMAIL'),
					'url' =>
hikamarket::completeLink('order&task=mail&cid='.(int)$order->order_id,
true),
					'popup' => array('id' =>
'hikamarket_order_mail_popup', 'width' => 800,
'height' => 600),
					'pos' => 'right',
					'acl' => hikamarket::acl('order/edit/mail')
				),
				'invoice' => array(
					'icon' => 'invoice',
					'fa' => 'fa-book',
					'name' => JText::_('INVOICE'),
					'url' =>
hikamarket::completeLink('order&task=invoice&type=full&cid='.(int)$order->order_id,
true),
					'popup' => array('id' =>
'hikamarket_order_invoice_popup', 'width' => 640,
'height' => 480),
					'pos' => 'right',
					'acl' => hikamarket::acl('order/show/invoice')
				),
				'shipping-invoice' => array(
					'icon' => 'shipping-invoice',
					'fa' => 'fa-truck fa-shipping-fast',
					'name' => JText::_('SHIPPING_INVOICE'),
					'url' =>
hikamarket::completeLink('order&task=invoice&type=shipping&cid='.(int)$order->order_id,
true),
					'popup' => array('id' =>
'hikamarket_order_shippinginvoice_popup', 'width' =>
640, 'height' => 480),
					'pos' => 'right',
					'acl' =>
hikamarket::acl('order/show/shippinginvoice')
				)
			);
		}
	}

	public function show_vendor($tpl = null) {
		$this->show($tpl, true);
	}

	public function invoice() {
		$app = JFactory::getApplication();

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$order_id = hikamarket::getCID('order_id');

		$type = hikaInput::get()->getWord('type');
		$this->assignRef('invoice_type', $type);

		$nobutton = true;
		$this->assignRef('nobutton', $nobutton);

		$display_type = 'frontcomp';
		$this->assignRef('display_type', $display_type);

		$currencyClass = hikamarket::get('shop.class.currency');
		$this->assignRef('currencyHelper', $currencyClass);

		$orderClass = hikamarket::get('shop.class.order');
		$order = $orderClass->loadFullOrder($order_id, true, false);
		if(!empty($order) && $order->order_vendor_id !=
$vendor->vendor_id && ($vendor->vendor_id > 1 ||
($order->order_vendor_id > 1 &&
!hikamarket::acl('order/show/vendors')))) {
			$order = null;
			$app->enqueueMessage(JText::_('ORDER_ACCESS_FORBIDDEN'));
			$app->redirect(hikamarket::completeLink('order'));
			return false;
		}

		$fieldsClass = hikamarket::get('shop.class.field');
		$this->assignRef('fieldsClass', $fieldsClass);

		$fields = array();
		if(hikashop_level(2)) {
			$null = null;
			if($this->invoice_type == 'shipping') {
				$fields['item'] =
$fieldsClass->getFields('display:vendor_order_shipping_invoice=1',
$null, 'item');
				$fields['order'] =
$fieldsClass->getFields('display:vendor_order_shipping_invoice=1',
$null, 'order');
			} else {
				$fields['item'] =
$fieldsClass->getFields('display:vendor_order_invoice=1',
$null, 'item');
				$fields['order'] =
$fieldsClass->getFields('display:vendor_order_invoice=1',
$null, 'order');
			}
		}

		$vendorFields = $vendor;
		$extraFields = array(
			'vendor' =>
$fieldsClass->getFields('frontcomp', $vendorFields,
'plg.hikamarket.vendor')
		);
		$this->assignRef('extraFields', $extraFields);
		$this->assignRef('vendorFields', $vendorFields);

		$store = str_replace(
			array("\r\n","\n","\r"),
			array('<br/>','<br/>','<br/>'),
			$shopConfig->get('store_address','')
		);
		$this->assignRef('store_address', $store);
		$this->assignRef('element', $order);
		$this->assignRef('order', $order);
		$this->assignRef('fields', $fields);

		if(substr($order->order_shipping_method, 0, 7) ==
'market-')
			$order->order_shipping_method =
substr($order->order_shipping_method, 7);
		if(substr($order->order_payment_method, 0, 7) == 'market-')
			$order->order_payment_method =
substr($order->order_payment_method, 7);

		if(!empty($order->order_payment_id)) {
			$pluginsPayment = hikamarket::get('shop.type.plugins');
			$pluginsPayment->type = 'payment';
			$this->assignRef('payment', $pluginsPayment);
		}
		if(!empty($order->order_shipping_id)) {
			$pluginsShipping = hikamarket::get('shop.type.plugins');
			$pluginsShipping->type = 'shipping';
			$this->assignRef('shipping', $pluginsShipping);

			if(empty($order->order_shipping_method)) {
				$shippingClass = hikamarket::get('shop.class.shipping');
				$this->assignRef('shippingClass', $shippingClass);

				$shippings_data = array();
				$shipping_ids = explode(';', $order->order_shipping_id);
				foreach($shipping_ids as $key) {
					$shipping_data = '';
					list($k, $w) = explode('@', $key);
					$shipping_id = $k;
					if(isset($order->shippings[$shipping_id])) {
						$shipping = $order->shippings[$shipping_id];
						$shipping_data = $shipping->shipping_name;
					} else {
						foreach($order->products as $order_product) {
							if($order_product->order_product_shipping_id == $key) {
								if(!is_numeric($order_product->order_product_shipping_id)) {
									$shipping_name =
$this->getShippingName($order_product->order_product_shipping_method,
$shipping_id);
									$shipping_data = $shipping_name;
								} else {
									$shipping_method_data =
$this->shippingClass->get($shipping_id);
									$shipping_data = $shipping_method_data->shipping_name;
								}
								break;
							}
						}
						if(empty($shipping_data))
							$shipping_data = '[ ' . $key . ' ]';
					}
					$shippings_data[] = $shipping_data;
				}
				$order->order_shipping_method = $shippings_data;
			}
		}
	}

	public function status() {
		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$this->loadRef(array(
			'orderClass' => 'shop.class.order',
			'order_status' => 'type.order_status',
		));

		$order_id = hikamarket::getCID('order_id');
		$order = $this->orderClass->loadFullOrder($order_id, true, false);
		$this->assignRef('order', $order);

		$order_status_filters = array();
		if($order->order_type == 'subsale' &&
(int)$order->order_vendor_paid > 0 &&
$config->get('filter_orderstatus_paid_order', 1)) {
			$valid_order_statuses = explode(',',
$config->get('valid_order_statuses',
'confirmed,shipped'));
			if(in_array($order->order_status, $valid_order_statuses)) {
				$order_status_filters = $valid_order_statuses;
			} else {
				$order_status_filters = array($order->order_status);
			}
		}
		$this->assignRef('order_status_filters',
$order_status_filters);

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_CANCEL'),
				'url' => '#cancel',
				'linkattribs' => 'onclick="return
window.parent.hikamarket.closeBox();"',
			),
			'save' => array(
				'icon' => 'apply',
				'fa' => 'fa-check-circle',
				'url' => '#apply',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save\',\'adminForm\');"',
				'name' => JText::_('HIKA_OK'), 'pos'
=> 'right'
			)
		);
	}

	public function showblock($tpl = null) {
		$block = hikaInput::get()->getString('block', null);
		$blocks = array(
			'customer', 'edit_customer', 'details',
'general', 'history', 'products',
			'coupon', 'edit_coupon', 'payment',
'edit_payment', 'shipping', 'edit_shipping',
'fields', 'edit_fields',
			'product', 'edit_product',
'billingaddress', 'edit_billingaddress',
'shippingaddress', 'edit_shippingaddress',
			'vendors',
		);
		if(!in_array($block, $blocks))
			return false;

		$translate_edit = array('coupon' => 'edit_coupon',
'payment' => 'edit_payment', 'shipping'
=> 'edit_shipping');
		if(isset($translate_edit[$block]) &&
hikaInput::get()->getInt('blocksubmitted', 0) === 1)
			$block = $translate_edit[$block];

		$addresses_blocks = array(
			'show' => array('billingaddress' =>
'billing', 'shippingaddress' =>
'shipping'),
			'edit' => array('edit_billingaddress' =>
'billing', 'edit_shippingaddress' =>
'shipping'),
		);
		if(isset($addresses_blocks['show'][ $block ])) {
			$this->block_show_address = $addresses_blocks['show'][
$block ];
			$block = 'address';
		}
		if(isset($addresses_blocks['edit'][ $block ])) {
			$this->block_edit_address = $addresses_blocks['edit'][
$block ];
			$block = 'edit_address';

			$this->edit_address_mode =
hikaInput::get()->getCmd('address_mode', '');
		}

		$this->show($tpl, false);

		$this->ajax = true;

		if(in_array($block, array('edit_product',
'product'))) {
			$this->product = null;
			$this->pid = hikaInput::get()->getInt('pid', 0);
			if($this->pid == 0 &&
!hikamarket::acl('order/edit/products'))
				return false;

			foreach($this->order->products as $k => $v) {
				if((int)$v->order_product_id == $this->pid)
					$this->product = $v;
			}
			if($this->pid > 0 && empty($this->product))
				return false;
		}

		if($block == 'edit_address') {
			if($this->block_edit_address == 'billing') {
				if(!empty($this->order->order_billing_address_id))
					$this->order->billing_address =
$this->shopAddressClass->get($this->order->order_billing_address_id);
				$f = (isset($this->order->billing_fields) ?
$this->order->billing_fields : $this->order->fields);
				$this->fieldsClass->prepareFields($f,
$this->order->billing_address, 'address',
'checkout&task=state');
			}
			if($this->block_edit_address == 'shipping') {
				if(!empty($this->order->order_shipping_address_id))
					$this->order->shipping_address =
$this->shopAddressClass->get($this->order->order_shipping_address_id);
				$f = (isset($this->order->shipping_fields) ?
$this->order->shipping_fields : $this->order->fields);
				$this->fieldsClass->prepareFields($f,
$this->order->shipping_address, 'address',
'checkout&task=state');
			}
		}

		$this->setLayout('show_block_' . $block);
		echo $this->loadTemplate();

		$orderClass = hikamarket::get('class.order');
		$events = $orderClass->getEvents();
		if(!empty($events)) {
			echo "\r\n".'<script
type="text/javascript">'."\r\n";
			foreach($events as $k => $v) {
				echo 'window.Oby.fireAjax("'.$k.'",
'.json_encode($v).');' . "\r\n";
			}
			echo '</script>';
		}

		return false;
	}

	public function history() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();

		$order_id = hikaInput::get()->getInt('order_id', 0);
		$cid = hikamarket::getCID('cid');

		$query = 'SELECT * FROM ' .
hikamarket::table('shop.history') . ' WHERE history_id =
' . (int)$cid . ' AND history_order_id = ' .
(int)$order_id;
		$db->setQuery($query, 0, 1);
		$history = $db->loadObject();
		$this->assignRef('history', $history);

		if(empty($history))
			return;

		$histories = array( &$history );
		JPluginHelper::importPlugin('hikashop');
		JPluginHelper::importPlugin('hikamarket');
		JPluginHelper::importPlugin('hikashoppayment');
		JPluginHelper::importPlugin('hikashopshipping');
		$app->triggerEvent('onHistoryDisplay', array(
&$histories ));

		$history->user = null;

		if(!empty($history->history_user_id) &&
(int)$history->history_user_id > 0) {
			$userClass = hikamarket::get('shop.class.user');
			$history->user = $userClass->get(
(int)$history->history_user_id );
			unset($history->user->password);
		}

		if(!empty($history->history_data) &&
substr($history->history_data, 0, 1) == '{') {
			$d = json_decode($history->history_data, true);
			if(!empty($d))
				$history->history_data = $d;
		}
	}

	public function export_show() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.listing';

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid='&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$this->loadRef(array(
			'toggleClass' => 'helper.toggle',
			'currencyHelper' => 'shop.class.currency',
			'paymentType' => 'shop.type.payment',
			'orderStatusType' => 'type.order_status'
		));

		$pageInfo = new stdClass();
		$pageInfo->search =
HikaStringHelper::strtolower($app->getUserStateFromRequest($this->paramBase.'.search',
'search', '', 'string'));
		$pageInfo->filter = new stdClass();
		$pageInfo->filter->filter_status =
$app->getUserStateFromRequest($this->paramBase.'.filter_status',
'filter_status', '', 'string');
		$pageInfo->filter->filter_payment =
$app->getUserStateFromRequest($this->paramBase.'.filter_payment',
'filter_payment', '', 'string');
		$pageInfo->filter->filter_startdate =
$app->getUserStateFromRequest($this->paramBase.'.filter_startdate',
'filter_startdate', '', 'string');
		$pageInfo->filter->filter_enddate =
$app->getUserStateFromRequest($this->paramBase.'.filter_enddate',
'filter_enddate', '', 'string');
		$this->assignRef('pageInfo', $pageInfo);

		$this->toolbar = array(
			array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' => hikamarket::completeLink('order')
			),
			array(
				'url' => '#export',
				'fa' => 'fa-file-export',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'export\',\'hikamarket_order_export_form\');"',
				'icon' => 'report',
				'name' => JText::_('HIKA_EXPORT'),
'pos' => 'right'
			)
		);
	}

	public function export() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.listing';

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid='&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$this->loadRef(array(
			'export' => 'shop.helper.spreadsheet'
		));

		$pageInfo = new stdClass();
		$pageInfo->search =
HikaStringHelper::strtolower($app->getUserStateFromRequest($this->paramBase.'.search',
'search', '', 'string'));
		$pageInfo->filter = new stdClass();
		$pageInfo->filter->filter_status =
$app->getUserStateFromRequest($this->paramBase.'.filter_status',
'filter_status', '', 'string');
		$pageInfo->filter->filter_payment =
$app->getUserStateFromRequest($this->paramBase.'.filter_payment',
'filter_payment', '', 'string');
		$pageInfo->filter->filter_startdate =
$app->getUserStateFromRequest($this->paramBase.'.filter_startdate',
'filter_startdate', '', 'string');
		$pageInfo->filter->filter_enddate =
$app->getUserStateFromRequest($this->paramBase.'.filter_enddate',
'filter_enddate', '', 'string');
		$this->assignRef('pageInfo', $pageInfo);

		$formData = hikaInput::get()->get('data', array(),
'array');
		$export_format =
strtolower(@$formData['export']['format']);
		if(empty($export_format) || !in_array($export_format,
array('csv', 'xls'))) {
			$export_format = 'csv';
		}
		$this->assignRef('export_format', $export_format);

		$cfg = array(
			'table' => 'shop.order',
			'main_key' => 'order_id',
			'order_sql_value' => 'hkorder.order_id'
		);

		$filters = array();
		$searchMap = array(
			'hkorder.order_id',
			'hkorder.order_user_id',
			'hkorder.order_full_price',
			'hkorder.order_number',
			'hkuser.user_email',
			'juser.username',
			'juser.name'
		);
		$orderingAccept = array('hkorder.','hkuser.');
		$order = ' ORDER BY hkorder.order_id';

		if(!empty($pageInfo->filter->filter_status))
			$filters['order_status'] = 'hkorder.order_status = '
. $db->Quote($pageInfo->filter->filter_status);

		if(!empty($pageInfo->filter->filter_payment))
			$filters['order_payment_method'] =
'hkorder.order_payment_id = ' .
$db->Quote($pageInfo->filter->filter_payment);

		if($vendor->vendor_id > 1) {
			$filters['vendor_id'] = 'hkorder.order_vendor_id = '
. $vendor->vendor_id;
			$filters['order_type'] = 'hkorder.order_type = ' .
$db->Quote('subsale');
		} else {
			$filters['vendor_id'] = '(hkorder.order_vendor_id = 0 OR
hkorder.order_vendor_id = 1)';
			$filters['order_type'] = 'hkorder.order_type = ' .
$db->Quote('sale');
		}

		if(!empty($pageInfo->filter->filter_enddate)) {
			$filter_end = explode('-',
$pageInfo->filter->filter_enddate);
			$noHourDay = explode(' ', $filter_end[2]);
			$filter_end[2] = $noHourDay[0];
			$filter_end = mktime(23, 59, 59, $filter_end[1], $filter_end[2],
$filter_end[0]);
		}

		if(!empty($pageInfo->filter->filter_startdate)) {
			$filter_start =
explode('-',$pageInfo->filter->filter_startdate);
			$noHourDay = explode(' ',$filter_start[2]);
			$filter_start[2] = $noHourDay[0];
			$filter_start = mktime(0, 0, 0, $filter_start[1], $filter_start[2],
$filter_start[0]);

			if(!empty($pageInfo->filter->filter_enddate)) {
				$filters['order_created'] = 'hkorder.order_created >
'.$filter_start. ' AND hkorder.order_created <
'.$filter_end;
			} else {
				$filters['order_created'] = 'hkorder.order_created >
'.$filter_start;
			}
		} else if(!empty($pageInfo->filter->filter_enddate)) {
			$filters['order_created'] = 'hkorder.order_created <
'.$filter_end;
		}

		$select = '';
		$from = '';

		JPluginHelper::importPlugin('hikashop');
		JPluginHelper::importPlugin('hikamarket');
		$app->triggerEvent('onBeforeOrderExportQuery',
array(&$select, &$from, &$filters, &$order,
&$searchMap, &$orderingAccept) );

		$this->processFilters($filters, $order, $searchMap, $orderingAccept);

		$query = 'FROM
'.hikamarket::table($cfg['table']).' AS hkorder
'.
			'LEFT JOIN '.hikamarket::table('shop.user').'
AS hkuser ON hkorder.order_user_id = hkuser.user_id '.
			'LEFT JOIN
'.hikamarket::table('joomla.users').' AS juser ON
hkuser.user_cms_id = juser.id '.
			$from.' '.$filters.' '.$order;
		if(!empty($select) && substr($select, 0, 1) != ',')
			$select = ','.$select;
		$db->setQuery('SELECT hkorder.*, hkuser.*, juser.name,
juser.username '.$select.$query);

		$rows = $db->loadObjectList('order_id');
		if(empty($rows)) {
			$app->enqueueMessage(JText::_('HIKAM_NOTHING_TO_EXPORT'),
'error');
			$app->redirect(hikamarket::completeLink('order&task=export'.$url_itemid,
false, true));
			return false;
		}


		$addressIds = array();

		foreach($rows as &$row) {
			$row->products = array();
			$addressIds[$row->order_shipping_address_id] =
$row->order_shipping_address_id;
			$addressIds[$row->order_billing_address_id] =
$row->order_billing_address_id;
		}
		unset($row);

		if(!empty($addressIds)) {
			$db->setQuery('SELECT * FROM
'.hikamarket::table('shop.address').' WHERE address_id
IN ('.implode(',',$addressIds).')');
			$addresses = $db->loadObjectList('address_id');

			if(!empty($addresses)) {
				$zoneNamekeys = array();
				foreach($addresses as $address) {
					$zoneNamekeys[$address->address_country] =
$db->Quote($address->address_country);
					$zoneNamekeys[$address->address_state] =
$db->Quote($address->address_state);
				}

				if(!empty($zoneNamekeys)) {
					$db->setQuery('SELECT zone_namekey,zone_name FROM
'.hikamarket::table('shop.zone').' WHERE zone_namekey
IN ('.implode(',',$zoneNamekeys).')');
					$zones = $db->loadObjectList('zone_namekey');
					if(!empty($zones)) {
						foreach($addresses as &$address) {
							if(!empty($zones[$address->address_country]))
								$address->address_country =
$zones[$address->address_country]->zone_name;
							if(!empty($zones[$address->address_state]))
								$address->address_state =
$zones[$address->address_state]->zone_name;
						}
						unset($address);
					}
				}

				$fields = array_keys(get_object_vars(reset($addresses)));
				foreach($rows as $k => $row) {
					if(!empty($addresses[$row->order_shipping_address_id])) {
						foreach($addresses[$row->order_shipping_address_id] as $key =>
$val) {
							$key = 'shipping_'.$key;
							$rows[$k]->$key = $val;
						}
					} else {
						foreach($fields as $field){
							$key = 'shipping_'.$field;
							$rows[$k]->$key = '';
						}
					}

					if(!empty($addresses[$row->order_billing_address_id])) {
						foreach($addresses[$row->order_billing_address_id] as $key =>
$val) {
							$key = 'billing_'.$key;
							$rows[$k]->$key = $val;
						}
					} else {
						foreach($fields as $field) {
							$key = 'billing_'.$field;
							$rows[$k]->$key = '';
						}
					}
				}
			}
		}

		$orderIds = array_keys($rows);
		$db->setQuery('SELECT * FROM
'.hikamarket::table('shop.order_product').' WHERE
order_id IN ('.implode(',', $orderIds).')');
		$products = $db->loadObjectList();

		foreach($products as $product) {
			$order =& $rows[$product->order_id];
			$order->products[] = $product;
			if(!isset($order->order_full_tax)) {
				$order->order_full_tax = 0;
			}
			$order->order_full_tax += round($product->order_product_quantity *
$product->order_product_tax, 2);
		}
		foreach($rows as $k => $row) {
			$rows[$k]->order_full_tax += $row->order_shipping_tax -
$row->order_discount_tax;
		}

		$view =& $this;
		$app->triggerEvent('onBeforeOrderExport', array(&$rows,
&$view) );
		$this->assignRef('orders', $rows);
	}

	public function create() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.create';

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid = '&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$this->loadRef(array(
			'currencyHelper' => 'shop.class.currency',
			'nameboxType' => 'type.namebox',
			'currencyType' => 'shop.type.currency',
		));

		$this->main_currency =
$shopConfig->get('main_currency');

		hikamarket::setPageTitle(JText::_('HIKAM_ORDER_CREATION'));

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' => hikamarket::completeLink('order')
			),
			'create' => array(
				'icon' => 'new',
				'fa' => 'fa-plus-circle',
				'url' => '#create',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'add\',\'hikamarket_order_create_form\');"',
				'name' => JText::_('HIKAM_CREATE_ORDER'),
'pos' => 'right'
			)
		);
	}

	public function request() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.request';

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid = '&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$this->loadRef(array(
			'vendorClass' => 'class.vendor',
			'currencyHelper' => 'shop.class.currency'
		));

		$data = $this->vendorClass->getUnpaidOrders($vendor);
		$this->assignRef('data', $data);

		$total = new stdClass();
		$total->count = 0;
		$total->value = 0;
		$total->currency = (int)$vendor->vendor_currency_id;
		if(empty($total->currency))
			$total->currency = hikashop_getCurrency();

		foreach($data as $d) {
			$total->count += (int)$d->count;

			if($total->currency == $d->currency)
				$total->value += hikamarket::toFloat( (int)$d->value );
			else
				$total->value +=
$this->currencyClass->convertUniquePrice((float)hikamarket::toFloat($d->value),
(int)$d->currency, (int)$total->currency);
		}

		$this->assignRef('total', $total);

		$min_value =
hikamarket::toFloat($config->get('min_value_payment_request',
0.0));
		if($min_value > 0.0) {
			$main_currency = (int)$shopConfig->get('main_currency',
1);
			if($total->currency != $main_currency) {
				$min_value = $this->currencyClass->convertUniquePrice($min_value,
$main_currency, $total->currency);
			}
		}
		$this->assignRef('min_value', $min_value);

		hikamarket::setPageTitle(JText::_('HIKAM_PAYMENT_REQUEST'));

		$this->toolbar = array(
			array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' => hikamarket::completeLink('order')
			),
			array(
				'url' => '#request',
				'fa' => 'fa-money fa-money-bill-alt',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'request\',\'hikamarket_order_request_form\');"',
				'icon' => 'pay',
				'name' => JText::_('HIKAM_DO_PAYMENT_REQUEST'),
'pos' => 'right',
				'display' => ($this->total->value != 0) &&
($this->total->value > $min_value)
			)
		);
	}

	public function mail() {
		$order_id = hikashop_getCID('order_id');

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$orderClass = hikamarket::get('shop.class.order');
		$this->loadRef(array(
			'radioType' => 'shop.type.radio',
		));

		$formData = hikaInput::get()->get('data', array(),
'array');
		$params = array();
		if(!empty($formData['mail']['params'])) {
			foreach($formData['mail']['params'] as $k => $v)
{
				if(is_numeric($v))
					$v = (int)$v;
				if(is_string($v))
					$v = strip_tags($v);
				$params[$k] = $v;
			}
		}

		$order = $orderClass->get($order_id);
		$order->url_itemid = '';
		$orderClass->loadOrderNotification($order,
'market.user_order_notification', $params);
		$this->assignRef('element', $order);

		$order->mail->dst_email = $order->customer->user_email;
		$order->mail->dst_name = (!empty($order->customer->name)) ?
$order->customer->name : '';

		$this->toolbar = array(
			'send' => array(
				'icon' => 'email',
				'fa' => 'fa-envelope',
				'url' => '#send',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'sendmail\',\'hikamarket_mail_form\');"',
				'name' => JText::_('SEND_EMAIL'),
'pos' => 'right'
			)
		);
	}

	public function previewmail() {
		$this->mail();
	}


	public function payments($tpl = null) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.payments';

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid='&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$this->loadRef(array(
			'orderStatusType' => 'type.order_status',
			'addressClass' => 'class.address',
			'currencyHelper' => 'shop.class.currency',
			'shopAddressClass' => 'shop.class.address',
		));

		$filterType =
$app->getUserStateFromRequest($this->paramBase.'.filter_type',
'filter_type', 0, 'int');

		$cfg = array(
			'table' => 'shop.order',
			'main_key' => 'order_id',
			'order_sql_value' => 'hkorder.order_id'
		);

		$pageInfo = $this->getPageInfo($cfg['order_sql_value'],
'desc');
		$pageInfo->filter->filter_status =
$app->getUserStateFromRequest($this->paramBase.'.filter_status',
'filter_status', '', 'string');
		$pageInfo->filter->filter_payment =
$app->getUserStateFromRequest($this->paramBase.'.filter_payment',
'filter_payment', '', 'string');
		$pageInfo->filter->filter_user =
$app->getUserStateFromRequest($this->paramBase.'.filter_user',
'filter_user', '', 'string');

		$filters = array();
		$searchMap = array(
			'hkorder.order_id',
			'hkorder.order_number',
		);
		$orderingAccept = array('hkorder.');
		$order = '';

		$fields = array();
		if(hikashop_level(2)) {
		}
		$this->assignRef('fields', $fields);

		if(!empty($pageInfo->filter->filter_status))
			$filters['order_status'] = 'hkorder.order_status = '
. $db->Quote($pageInfo->filter->filter_status);

		if($vendor->vendor_id > 1) {
			$filters['order_vendor_id'] = 'hkorder.order_vendor_id =
' . $vendor->vendor_id;
			$filters['order_type'] = 'hkorder.order_type = ' .
$db->Quote('vendorpayment');
		} else {
			$filters['order_vendor_id'] = '(hkorder.order_vendor_id =
0 OR hkorder.order_vendor_id = 1)';
			$filters['order_type'] = 'hkorder.order_type = ' .
$db->Quote('vendorpayment');
		}

		$extrafilters = array();
		$joins = array();
		JPluginHelper::importPlugin('hikashop');
		JPluginHelper::importPlugin('hikamarket');
		$app->triggerEvent('onBeforeVendorPaymentListing',
array($this->paramBase, &$extrafilters, &$pageInfo,
&$filters, &$joins, &$searchMap));
		$this->assignRef('extrafilters', $extrafilters);

		$this->processFilters($filters, $order, $searchMap, $orderingAccept);

		$query = 'FROM
'.hikamarket::table($cfg['table']).' AS hkorder
'.
			implode(' ', $joins).' '.$filters.$order;
		$db->setQuery('SELECT hkorder.* '.$query,
(int)$pageInfo->limit->start, (int)$pageInfo->limit->value);

		if(empty($pageInfo->search)) {
			$query = 'FROM
'.hikamarket::table($cfg['table']).' AS hkorder
'.$filters;
		}

		$orders = $db->loadObjectList('order_id');

		$db->setQuery('SELECT COUNT(*) '.$query);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($orders);

		$order_ids = array_keys($orders);
		$transaction_stats = array();
		$transaction_old_stats = array();
		if(!empty($order_ids)) {
			$query = 'SELECT hkot.order_transaction_paid AS order_id,
COUNT(hkot.order_transaction_id) AS counter FROM
'.hikamarket::table('order_transaction').' AS hkot
'.
				'WHERE hkot.order_transaction_paid IN
('.implode(',', $order_ids).') GROUP BY
hkot.order_transaction_paid';
			$db->setQuery($query);
			$transaction_stats = $db->loadObjectList('order_id');

			$query = 'SELECT hko.order_vendor_paid AS order_id,
COUNT(hko.order_id) AS counter FROM
'.hikamarket::table('shop.order').' AS hko '.
				'WHERE hko.order_type =
'.$db->quote('subsale').' AND hko.order_vendor_paid
IN ('.implode(',', $order_ids).') GROUP BY
hko.order_vendor_paid';
			$db->setQuery($query);
			$transaction_old_stats = $db->loadObjectList('order_id');
		}

		foreach($orders as &$o) {
			$o->counter = 0;
			if(isset($transaction_stats[(int)$o->order_id]))
				$o->counter +=
(int)$transaction_stats[(int)$o->order_id]->counter;
			if(isset($transaction_old_stats[(int)$o->order_id]))
				$o->counter +=
(int)$transaction_old_stats[(int)$o->order_id]->counter;
		}
		unset($o);
		unset($transaction_stats);
		unset($transaction_old_stats);

		$this->assignRef('orders', $orders);

		$text_asc = JText::_('ASCENDING');
		$text_desc = JText::_('DESCENDING');
		$ordering_values = array(
			'hkorder.order_id' => JText::_('SORT_ID'),
			'hkorder.order_created' =>
JText::_('SORT_CREATION'),
			'hkorder.order_modified' =>
JText::_('SORT_MODIFICATION'),
			'hkorder.order_full_price' =>
JText::_('SORT_PRICE'),
		);
		$this->ordering_values = array();
		foreach($ordering_values as $k => $v) {
			$this->ordering_values[$k.' asc'] = $v . ' '
.$text_asc;
			$this->ordering_values[$k.' desc'] = $v . ' '
.$text_desc;
		}
		$this->full_ordering =
$this->pageInfo->filter->order->value . ' ' .
strtolower($this->pageInfo->filter->order->dir);

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' => hikamarket::completeLink('vendor')
			),
		);

		$this->getPagination();

		$this->getOrdering('hkorder.ordering', !$filterType);
	}

	protected function getShippingName($shipping_method, $shipping_id,
$default_return = true) {
		static $cache = array();

		if(strpos($shipping_id, '@') !== false)
			list($shipping_id, $warehouse) = explode('@', $shipping_id,
2);

		$key = md5($shipping_method . '##' . $shipping_id);
		if(isset($cache[$key]))
			return $cache[$key];

		$shipping_name = false;
		if($default_return)
			$shipping_name = $shipping_method . ' ' . $shipping_id;

		if(strpos($shipping_id, '-') !== false) {
			if(empty($this->shippingClass))
				$this->shippingClass =
hikamarket::get('shop.class.shipping');
			$shipping_ids = explode('-', $shipping_id, 2);
			$shipping = $this->shippingClass->get($shipping_ids[0]);
			if(!empty($shipping->shipping_params) &&
is_string($shipping->shipping_params))
				$shipping->shipping_params =
hikamarket::unserialize($shipping->shipping_params);

			if(empty($shipping_method) && !empty($shipping))
				$shipping_method = $shipping->shipping_type;

			$shippingMethod = hikamarket::import('hikashopshipping',
$shipping_method);
			$methods = array();
			if(!empty($shippingMethod))
				$methods = $shippingMethod->shippingMethods($shipping);
			if(isset($methods[$shipping_id]))
				$shipping_name = $shipping->shipping_name.' -
'.$methods[$shipping_id];

			$cache[$key] = $shipping_name;
		} else if($shipping_method === null && !empty($shipping_id)) {
			if(empty($this->shippingClass))
				$this->shippingClass =
hikamarket::get('shop.class.shipping');
			$shipping = $this->shippingClass->get($shipping_id);
			$shipping_name = $shipping->shipping_name;
			$cache[$key] = $shipping_name;
		}
		return $shipping_name;
	}


	public function show_general() {
		$this->show($tpl, false);
	}

	public function show_history() {
		$this->show($tpl, false);
	}

	public function edit_additional() {
		$vendor = hikamarket::loadVendor(true, false);
		if($vendor->vendor_id != 0 && $vendor->vendor_id != 1) {
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EDIT')));
		}

		$this->show($tpl, false);

		if(hikashop_level(2)) {
			$this->fields['order'] =
$this->fieldsClass->getFields('display:vendor_order_edit=1',
$order, 'order');
			$null = null;
			$this->fields['entry'] =
$this->fieldsClass->getFields('display:vendor_order_edit=1',
$null, 'entry');
			$this->fields['item'] =
$this->fieldsClass->getFields('display:vendor_order_edit=1',
$null, 'item');
		}

		$this->toolbar = array(
			array(
				'url' => '#save',
				'fa' => 'fa-save',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save\',\'hikamarket_order_additional_form\');"',
				'icon' => 'save',
				'name' => JText::_('HIKA_SAVE'), 'pos'
=> 'right'
			)
		);

		$ratesType = hikamarket::get('type.rates');
		$this->assignRef('ratesType',$ratesType);

		$pluginsPayment = hikamarket::get('shop.type.plugins');
		$pluginsPayment->type = 'payment';
		$this->assignRef('paymentPlugins', $pluginsPayment);

		$pluginsShipping = hikamarket::get('shop.type.plugins');
		$pluginsShipping->type = 'shipping';
		$this->assignRef('shippingPlugins', $pluginsShipping);
	}

	public function show_additional() {
		$task = hikaInput::get()->getCmd('task', '');
		if($task == 'save') {
			$html = '<html><body><script
type="text/javascript">'."\r\n".
				'window.parent.hikamarket.submitFct();'."\r\n".
				'</script></body></html>';
			die($html);
		}
		$this->show($tpl, false);
	}

	public function show_shipping_address() {
		$address_type = 'shipping';
		$this->assignRef('type', $address_type);
		$this->show($tpl, false);

		if($this->edit) {
			if(!empty($this->order->order_shipping_address_id)) {
				$addressClass = hikamarket::get('shop.class.address');
				$this->order->shipping_address =
$addressClass->get($this->order->order_shipping_address_id);
			}
			$f = (isset($this->order->shipping_fields) ?
$this->order->shipping_fields : $this->order->fields);
			$this->fieldsClass->prepareFields($f,
$this->order->shipping_address, 'address',
'checkout&task=state');
		}

		$this->setLayout('show_address');
	}

	public function show_billing_address() {
		$address_type = 'billing';
		$this->assignRef('type', $address_type);
		$this->show($tpl, false);

		if($this->edit) {
			if(!empty($this->order->order_billing_address_id)) {
				$addressClass = hikamarket::get('shop.class.address');
				$this->order->billing_address =
$addressClass->get($this->order->order_billing_address_id);
			}
			$f = (isset($this->order->billing_fields) ?
$this->order->billing_fields : $this->order->fields);
			$this->fieldsClass->prepareFields($f,
$this->order->billing_address, 'address',
'checkout&task=state');
		}

		$this->setLayout('show_address');
	}

	public function show_products() {
		$task = hikaInput::get()->getCmd('task', '');
		if($task == 'save') {
			$html = '<html><body><script
type="text/javascript">'."\r\n".
				'window.parent.hikamarket.submitFct();'."\r\n".
				'</script></body></html>';
			die($html);
		}
		$this->show($tpl, false);
	}

	public function edit_products() {
		$vendor = hikamarket::loadVendor(true, false);
		if($vendor->vendor_id != 0 && $vendor->vendor_id != 1) {
			return hikamarket::deny('order',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ACT_ORDER_EDIT')));
		}
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);
		$db = JFactory::getDBO();

		$productClass = hikamarket::get('shop.class.product');
		$fieldsClass = hikamarket::get('shop.class.field');
		$this->assignRef('fieldsClass', $fieldsClass);

		$order_id = hikaInput::get()->getInt('order_id');
		$order_product_id =
hikaInput::get()->getInt('order_product_id', 0);

		$this->toolbar = array(
			array(
				'url' => '#save',
				'fa' => 'fa-save',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save\',\'hikamarket_order_product_form\');"',
				'icon' => 'save',
				'name' => JText::_('HIKA_SAVE'), 'pos'
=> 'right'
			)
		);

		$orderClass = hikamarket::get('shop.class.order');
		$order = $orderClass->get($order_id);
		$originalProduct = new stdClass();

		if(!empty($order_product_id)) {
			$orderProductClass =
hikamarket::get('shop.class.order_product');
			$orderProduct = $orderProductClass->get($order_product_id);
			if(empty($orderProduct) || $orderProduct->order_id != $order_id) {
				$orderProduct = new stdClass();
				$orderProduct->order_id = $order_id;
			}
			if(!empty($orderProduct->product_id)) {
				$originalProduct =
$productClass->get($orderProduct->product_id);
			}
		} else {
			$orderProduct = new stdClass();
			$orderProduct->order_id = $order_id;

			$product_id = hikaInput::get()->get('cid', array(),
'array');
			if(!empty($product_id) &&
$productClass->getProducts($product_id)) {
				$products = $productClass->products;
				$product = $products[ (int)$product_id[0] ];
				$product->options = array();

				$originalProduct = $product;

				$orderProduct->product_id = $product->product_id;
				$orderProduct->order_product_name = $product->product_name;
				$orderProduct->order_product_code = $product->product_code;
				$orderProduct->order_product_quantity = 1;

				$currencyClass = hikamarket::get('shop.class.currency');
				$main_currency =
(int)$shopConfig->get('main_currency',1);
				$discount_before_tax =
(int)$shopConfig->get('discount_before_tax',0);
				$currency_id = $order->order_currency_id;

				if($shopConfig->get('tax_zone_type', 'shipping')
== 'billing')
					$zone_id = hikamarket::getZone('billing');
				else
					$zone_id = hikamarket::getZone('shipping');

				$rows = array($product);
				$currencyClass->getPrices($rows, $product_id, $currency_id,
$main_currency, $zone_id, $discount_before_tax);
				$currencyClass->pricesSelection($rows[0]->prices, 0);
				if(!empty($rows[0]->prices)) {
					foreach($rows[0]->prices as $price) {
						$orderProduct->order_product_price = $price->price_value;
						$orderProduct->order_product_tax =
(@$price->price_value_with_tax - @$price->price_value);
						$orderProduct->order_product_tax_info = @$price->taxes;
					}
				}
			}
		}
		if(!empty($orderProduct->order_product_id) &&
(int)$orderProduct->order_product_id > 0) {
			if(empty($orderProduct->order_product_parent_id)) {
				$query = 'SELECT hkop.*, hko.order_vendor_id, hmv.* FROM ' .
hikamarket::table('shop.order_product') . ' as hkop '.
					' INNER JOIN ' . hikamarket::table('shop.order').
' AS hko ON hkop.order_id = hko.order_id '.
					' LEFT JOIN ' . hikamarket::table('vendor').
' AS hmv ON hmv.vendor_id = hko.order_vendor_id '.
					' WHERE hko.order_type = \'subsale\' AND
order_product_parent_id = '. (int)$orderProduct->order_product_id
.
					' ORDER BY hko.order_id DESC';
				$db->setQuery($query);
				$orderProduct->vendor_data = $db->loadObject();
			}
		} else if(!empty($orderProduct->product_id)) {
			$query = 'SELECT p.product_vendor_id, pp.product_vendor_id AS
parent_vendor_id FROM
'.hikamarket::table('shop.product').' AS p '.
				' LEFT JOIN
'.hikamarket::table('shop.product').' AS pp ON
p.product_parent_id = pp.product_id '.
				' WHERE p.product_id = '. (int)$orderProduct->product_id;
			$db->setQuery($query);
			$productVendor = $db->loadObject();
			$orderProduct->vendor_data = $productVendor;

			$vendor_id = 0;
			if(!empty($productVendor->product_vendor_id))
				$vendor_id = (int)$productVendor->product_vendor_id;
			else if(!empty($productVendor->parent_vendor_id))
				$vendor_id = (int)$productVendor->parent_vendor_id;

			$vendorObj = null;
			if(!empty($vendor_id)) {
				$vendorClass = hikamarket::get('class.vendor');
				$vendorObj = $vendorClass->get($vendor_id);
			}
			$orderProduct->vendor = $vendorObj;
		}

		$this->assignRef('orderProduct', $orderProduct);
		$this->assignRef('originalProduct', $originalProduct);

		$ratesType = hikamarket::get('type.rates');
		$this->assignRef('ratesType',$ratesType);

		if(hikashop_level(2)) {
			$null = null;
			$this->fields['item'] =
$this->fieldsClass->getFields('display:vendor_order_edit=1',
$null, 'item','checkout&task=state');
		}
	}

	public function customer_set() {
		$users = hikaInput::get()->get('cid', array(),
'array');
		$closePopup = hikaInput::get()->getInt('finalstep', 0);

		if($closePopup) {
			$formData = hikaInput::get()->get('data', array(),
'array');
			$users = array(
(int)$formData['order']['order_user_id'] );
		}
		$rows = array();
		$data = '';
		$singleSelection = true;
//hikaInput::get()->getBool('single', false);
		$order_id = hikaInput::get()->getInt('order_id', 0);

		$elemStruct = array(
			'user_email',
			'user_cms_id',
			'name',
			'username',
			'email'
		);

		$set_address = hikaInput::get()->getInt('set_user_address',
0);

		if(!empty($users)) {
			hikamarket::toInteger($users);
			$db = JFactory::getDBO();
			$query = 'SELECT a.*, b.* FROM
'.hikamarket::table('user','shop').' AS a
INNER JOIN '.hikamarket::table('users', false).' AS b
ON a.user_cms_id = b.id WHERE a.user_id IN
('.implode(',',$users).')';
			$db->setQuery($query);
			$rows = $db->loadObjectList();

			if(!empty($rows)) {
				$data = array();
				foreach($rows as $v) {
					$d = '{id:'.$v->user_id;
					foreach($elemStruct as $s) {
						if($s == 'id')
							continue;
						$d .= ','.$s.':\''.
str_replace('"','\'',$v->$s).'\'';
					}
					if($set_address && $singleSelection)
						$d .=
',updates:[\'billing\',\'history\']';
					$data[] = $d.'}';
				}
				if(!$singleSelection)
					$data = '['.implode(',',$data).']';
				else {
					$data = $data[0];
					$rows = $rows[0];
				}
			}
		}
		$this->assignRef('rows', $rows);
		$this->assignRef('data', $data);
		$this->assignRef('confirm', $confirm);
		$this->assignRef('singleSelection', $singleSelection);
		$this->assignRef('order_id', $order_id);

		if($closePopup) {
			$js =
'window.hikashop.ready(function(){window.top.hikamarket.submitBox('.$data.');});';
			$doc = JFactory::getDocument();
			$doc->addScriptDeclaration($js);
		}
	}
}
views/pluginmarket/index.html000064400000000032151166607750012411
0ustar00<html><body></body></html>views/pluginmarket/tmpl/add.php000064400000006667151166607750012655
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('plugin&task=add&plugin_type='.$this->plugin_type);
?>" method="post" name="hikamarket_form"
id="hikamarket_form">
<div class="hk-row-fluid">
	<div class="hkc-md-7 hikam_search_zone">
<?php
	echo $this->loadHkLayout('search', array(
		'id' => 'hikamarket_plugins_listing_search',
	));
?>
	</div>
	<div class="hkc-md-5">
		<div class="expand-filters"
style="width:auto;float:right">
<?php
	if($this->plugin_type == 'payment') {
		$values = array(
			JHTML::_('select.option', 0, JText::_('HIKA_ALL'))
		);
		foreach($this->currencies as $currency) {
			$values[] = JHTML::_('select.option',
(int)$currency->currency_id, $currency->currency_symbol.'
'.$currency->currency_code);
		}
		echo JHTML::_('select.genericlist', $values,
'filter_currency',
'onchange="this.form.submit();"', 'value',
'text', @$this->pageInfo->filter->currency);
	}

	if($this->vendor->vendor_id <= 1) {
		$values = array(
			JHTML::_('select.option', -1,
JText::_('HIKA_ALL')),
			JHTML::_('select.option', 1,
JText::_('HIKA_PUBLISHED')),
			JHTML::_('select.option', 0,
JText::_('HIKA_UNPUBLISHED'))
		);
		if(!isset($this->pageInfo->filter->publish))
			$this->pageInfo->filter->publish = -1;
		echo JHTML::_('select.genericlist', $values,
'filter_publish',
'onchange="this.form.submit();"', 'value',
'text', $this->pageInfo->filter->publish);
	}
?>
		</div>
		<div style="clear:both"></div>
	</div>
</div>
</form>
<table class="adminlist table table-striped table-hover"
cellpadding="1">
	<thead>
		<tr>
			<th class="title titlenum"><?php
				echo JText::_('HIKA_NUM');
			?></th>
			<th class="title"><?php
				echo JText::_('HIKA_NAME');
			?></th>
<?php
	if(!empty($this->currencies)) {
		foreach($this->currencies as $currency) {
?>			<th class="title"><?php
				echo @$currency->currency_code;
			?></th>
<?php
		}
	}

	if($this->vendor->vendor_id <= 1) {
?>
			<th class="title titletoggle"><?php
				echo JText::_('HIKA_ENABLED');
			?></th>
<?php } ?>
		</tr>
	</thead>
	<tbody>
<?php
$k = 0;

foreach($this->plugins as $i => &$row) {

?>
		<tr class="row<?php echo $k; ?>">
			<td align="center"><?php
				echo $i+1
			?></td>
			<td>
				<a href="<?php echo
hikamarket::completeLink('plugin&task=edit&name='.$row->element.'&plugin_type='.$this->plugin_type.'&subtask=edit');?>"><?php
					$translation_key =
'PLG_HIKASHOP'.strtoupper($this->plugin_type).'_'.strtoupper($row->element);
					if($translation_key != JText::_($translation_key))
						echo JText::_($translation_key);
					else
						echo $row->name;
				?></a>
			</td>
<?php
	if(!empty($this->currencies)) {
		foreach($this->currencies as $currency) {
?>			<td align="center"><?php
				if(empty($row->accepted_currencies) ||
in_array($currency->currency_code, $row->accepted_currencies))
					echo $this->toggleClass->display(null, 1);
				else
					echo $this->toggleClass->display(null, 0);
			?></td>
<?php
		}
	}

	if($this->vendor->vendor_id <= 1) {
?>
			<td align="center"><?php
				echo $this->toggleClass->display('',
$row->published);
			?></td>
		</tr>
<?php
	}

	$k = 1-$k;
}
?>
	</tbody>
</table>
views/pluginmarket/tmpl/form.php000064400000013763151166607750013063
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><script type="text/javascript">
window.pluginMgr = {};
window.pluginMgr.cpt = {};
</script>
<form action="<?php echo
hikamarket::completeLink('plugin&plugin_type='.$this->type);?>"
method="post" name="hikamarket_form"
id="hikamarket_plugin_form">
	<h1><?php
		echo JText::_('HIKA_PLUGIN');
		$key =
'PLG_HIKASHOP'.strtoupper($this->type).'_'.strtoupper($this->name);
		if(JText::_($key) != $key)
			echo JText::_($key);
		else
			echo $this->name;
	?></h1>
	<h3><?php echo JText::_('MAIN_INFORMATION');
?></h3>
<?php
	if(!empty($this->main_form)) {
		echo $this->processConfig($this->main_form, $this->type,
'', @$this->element, '', true);
	}

	if(!empty($this->content) &&
hikamarket::acl($this->type.'plugin/edit/specific')) {
?>
	<h3><?php echo
JText::_('PLUGIN_SPECIFIC_CONFIGURATION'); ?></h3>
<?php if(!empty($this->pluginTemplateMode) &&
$this->pluginTemplateMode == 'html') { ?>
		<table class="hikam_listing table"><?php
			echo $this->content;
		?></table>
<?php } else
			echo $this->content;
	}

	if(!empty($this->extra_blocks)) {
		foreach($this->extra_blocks as $extra_block) {
			if(is_string($extra_block))
				echo $extra_block."\r\n";
			else
				echo $this->processConfig($extra_block, $this->type,
'', @$this->element, '', true);
		}
	}

	if(!empty($this->restriction_form)) {
		$values = array();
		foreach($this->restriction_form as $key => $r) {
			if(empty($r['category']))
				continue;
			$c = $r['category'];
			if(empty($values[$c]))
				$values[$c] = JHTML::_('select.option', $c,
JText::_('HIKA_RESTRICTION_'.strtoupper($c)));
			if($values[$c]->disable == false &&
(!isset($r['category_check']) ||
!empty($r['category_check']))) {
				$l = '';
				$data = $this->getParamsData(@$this->element, $key,
$this->type, '', $l);
				if(!empty($data) && (empty($r['empty_value']) ||
$r['empty_value'] != $data))
					$values[$c]->disable = true;
			}
		}
		foreach($this->restriction_form as &$r) {
			if(empty($r['category']))
				continue;
			$c = $r['category'];
			if(isset($values[$c]) && $values[$c]->disable == false)
				$r['hidden'] = true;
		}
		unset($r);
?>
	<h3><?php echo JText::_('HIKA_RESTRICTIONS');
?></h3>
<?php
		if(!empty($values)) {
?>
	<div id="plugin_add_restriction_zone"
style="display:none;"><?php
		echo JHTML::_('select.genericlist', $values, '',
'id="plugin_add_restriction_value"', 'value',
'text', '');
	?><button class="hikabtn hikabtn-danger"
onclick="return window.pluginMgr.cancelRestriction();"><i
class="far fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ?></button></div>
	<button class="hikabtn hikabtn-default" onclick="return
window.pluginMgr.addRestriction();"><i class="fas
fa-plus"></i> <?php echo
JText::_('HIKA_ADD_RESTRICTION'); ?></button>
<?php
		}

		echo $this->processConfig($this->restriction_form, $this->type,
'', @$this->element,
'hikamarket_'.$this->type.'_restrictions', true);
	}
?>
	<input type="hidden" name="cid"
value="<?php echo
@$this->element->{$this->type.'_id'}; ?>"/>
	<input type="hidden" name="name"
value="<?php echo $this->escape($this->plugin_name);
?>"/>
	<input type="hidden" name="plugin_type"
value="<?php echo $this->escape($this->type);
?>"/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
	<input type="hidden" name="task"
value="show"/>
	<input type="hidden" name="ctrl"
value="plugin"/>
	<?php echo JHTML::_('form.token'); ?>
</form>
<script type="text/javascript">
window.hikashop.ready(function(){
window.hikamarket.dlTitle('hikamarket_plugin_form'); });
window.pluginMgr.addRestriction = function() {
	var d = document, el =
d.getElementById('plugin_add_restriction_zone');
	if(!el) return false;
	if(el.style.display == 'none') {
		el.style.display = 'inline';
		return false;
	}

	var sel = d.getElementById('plugin_add_restriction_value');
	if(!sel) return false;
	var v = sel.value, i = sel.selectedIndex, key = 'hikamarket_<?php
echo $this->type; ?>_cat_' + v, e = null,
		container = d.getElementById('hikamarket_<?php echo
$this->type; ?>_restrictions');
	container.querySelectorAll('[data-hkm-key="'+key+'"]').forEach(function(el){
		el.style.display = '';
	});
	sel.options[i].disabled = 'disabled';
	if(typeof(jQuery) != 'undefined' &&
typeof(jQuery().chosen) == 'function')
		jQuery(sel).trigger('liszt:updated');
	el.style.display = 'none';
	return false;
};
window.pluginMgr.cancelRestriction = function() {
	var d = document, el =
d.getElementById('plugin_add_restriction_zone');
	if(el) el.style.display = 'none';
	return false;
};
window.pluginMgr.links = <?php if(!empty($this->displayTriggers)) {
echo json_encode($this->displayTriggers); } else { echo '{}';
} ?>;
window.Oby.registerAjax('field_changed', function(params) {
	if(!!window.pluginMgr.links || !window.pluginMgr.links[params.key])
		return;
	var d = document, value = null;
	if(params.obj && params.obj.value)
		value = params.obj.value;
	if(value === null)
		return;
	var tTitle = null, tValue = null,
		items = window.pluginMgr.links[params.key];
	for(var k in items) {
		if(!items.hasOwnProperty(k))
			continue;

		tTitle = d.getElementById(items[k][0].replace('{TYPE}',
'title'));
		tValue = d.getElementById(items[k][0].replace('{TYPE}',
'value'));
		if(items[k][1].indexOf(value) < 0) {
			tTitle.style.display = 'none';
			tValue.style.display = 'none';
		} else {
			tTitle.style.display = '';
			tValue.style.display = '';
		}
	}
});
<?php if(!empty($this->hiddenElements)) { ?>
window.hikashop.ready(function(){
	var d = document, el = null,
		hide = <?php echo json_encode($this->hiddenElements); ?>;
	for(var i = hide.length - 1; i >= 0; i--) {
		el = d.getElementById(hide[i]);
		if(el) el.style.display = 'none';
	}
});
<?php } ?>
</script>
views/pluginmarket/tmpl/index.html000064400000000032151166607750013365
0ustar00<html><body></body></html>views/pluginmarket/tmpl/listing.php000064400000023167151166607750013570
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikamarket_plugin_listing">
<form action="<?php echo
hikamarket::completeLink('plugin&plugin_type='.$this->type.'&task=listing');
?>" method="post" id="adminForm"
name="adminForm">

<div class="hk-row-fluid">
	<div class="hkc-md-12">
<?php
	echo $this->loadHkLayout('search', array(
		'id' => 'hikamarket_plugin_listing_search',
	));
?>
		<div class="hikam_sort_zone"><?php
			if(!empty($this->ordering_values))
				echo JHTML::_('select.genericlist',
$this->ordering_values, 'filter_fullorder',
'onchange="this.form.submit();"', 'value',
'text', $this->full_ordering);
		?></div>
	</div>
	<div class="hkc-md-12">
		<div class="expand-filters">
<?php
	$status_types = array(
		-1 => JText::_('HIKA_ALL_STATUSES'),
		1 => JText::_('HIKA_PUBLISHED'),
		0 => JText::_('HIKA_UNPUBLISHED'),
	);
	echo JHTML::_('select.genericlist', $status_types,
'filter_published', 'data-search-reset="-1"
onchange="this.form.submit();"', 'value',
'text', $this->pageInfo->filter->published);

?>
		</div>
		<div style="clear:both"></div>
	</div>
</div>
<div id="hikam_<?php echo $this->type;
?>_main_listing">
<?php
$p_id = $this->type.'_id';
$p_name = $this->type.'_name';
$p_order = $this->type.'_ordering';
$p_published = $this->type.'_published';
$p_type = $this->type.'_type';
$publish_type = 'plugin';
if(in_array($this->type, array('payment',
'shipping')))
	$publish_type = $this->type;

$publish_content = '<i class="fas fa-check"></i>
' . JText::_('HIKA_PUBLISHED');
$unpublish_content = '<i class="fas
fa-times"></i> ' .
JText::_('HIKA_UNPUBLISHED');

$icon = '<i class="fas
fa-puzzle-piece"></i>';
if($this->type == 'payment')
	$icon = '<i class="far
fa-credit-card"></i>';
if($this->type == 'shipping')
	$icon = '<i class="fas
fa-shipping-fast"></i>';

$restriction_icons = array(
	'min_volume' => '<i class="fas fa-box
hk-icon-green"></i>',
	'max_volume' => '<i class="fas fa-box
hk-icon-orange"></i>',
	'min_weight' => '<i class="fas fa-weight-hanging
hk-icon-green"></i>',
	'max_weight' => '<i class="fas fa-weight-hanging
hk-icon-orange"></i>',
	'min_price' => '<i class="far fa-money-bill-alt
hk-icon-green"></i>',
	'max_price' => '<i class="far fa-money-bill-alt
hk-icon-orange"></i>',
	'zone' => '<i class="fas fa-map-marker-alt
hk-icon-blue"></i>',
	'vendor' => '<i class="fas fa-user-tie
hk-icon-blue"></i>',
);

foreach($this->plugins as $plugin) {
	$id = 'market_plugin_' . $this->type.'_' .
$plugin->$p_id;
	$published_id = $this->type.'_published-' .
$plugin->$p_id;

	$url = ($this->manage) ?
hikamarket::completeLink('plugin&plugin_type='.$this->type.'&task=edit&name='.
$plugin->$p_type
.'&cid='.$plugin->$p_id.$this->url_itemid) :
'#';
	$extra_classes = '';
?>
	<div class="hk-card hk-card-default hk-card-plugin
hk-card-<?php echo $this->type; ?><?php echo $extra_classes;
?>" data-hkm-plugin="<?php echo (int)$plugin->$p_id;
?>">
		<div class="hk-card-header">
			<a class="hk-row-fluid" href="<?php echo $url;
?>">
				<div class="hkc-sm-6 hkm_plugin_name"><?php
	if(!empty($plugin->$p_name))
		echo $plugin->$p_name;
	else
		echo '<em>' . JText::_('HIKA_NONE') .
'</em>';
				?></div>
				<div class="hkc-sm-6 hkm_plugin_type"><?php
	if(!empty($currentPlugin))
		echo $currentPlugin->name;
	else
		echo $plugin->$p_type;
				?></div>
			</a>
		</div>
		<div class="hk-card-body">
			<div class="hk-row-fluid">
				<div class="hkc-sm-7 hkm_plugin_details">
<?php
		if(!empty($this->listing_columns)) {
			foreach($this->listing_columns as $key => $column) {
				if(!isset($column['col']) ||
empty($plugin->{$column['col']}))
					continue;

				$data = $plugin->{$column['col']};

				if($key == 'price') {
?>
				<div class="hkm_plugin_price">
					<i class="fa fa-credit-card hk-icon-blue"></i>
<?php
					if(!empty($data['fixed']))
						echo $data['fixed'];
					if(!empty($data['fixed']) &&
!empty($data['percent']))
						echo ' + ';
					if(!empty($data['percent']))
						echo $data['percent'] . '%';
				?></div>
<?php
					continue;
				}

				if($key == 'restriction') {
					foreach($data as $k => $v) {
?>
				<div class="hkm_plugin_restriction_<?php echo $k;
?>">
					<?php if(isset($restriction_icons[$k])) echo
$restriction_icons[$k]; ?>
					<strong><?php echo JText::_($v['name']);
?></strong> - <?php echo $v['value']; ?>
				</div>
<?php
					}
					continue;
				}

?>				<div class="hkm_plugin_detail_<?php echo $key;
?>">
					<?php if(isset($restriction_icons[$key])) echo
$restriction_icons[$key]; ?>
					<strong><?php echo JText::_($column['name']);
?></strong> <?php
					if(is_string($data))
						echo $data;
					else
						echo implode('<br/>', $data);
				?></div>
<?php
			}
		}
?>
				</div>
				<div class="hkc-sm-3 hkm_plugin_publish">
<?php
		if($this->plugin_action_publish) {
?>
					<a class="hikabtn hikabtn-<?php echo
($plugin->$p_published) ? 'success' : 'danger';
?> hkm_publish_button" data-toggle-state="<?php echo
$plugin->$p_published ? 1 : 0; ?>" data-toggle-id="<?php
echo $plugin->$p_id; ?>" onclick="return
window.localPage.togglePlugin(this);"><?php
						echo ($plugin->$p_published) ? $publish_content :
$unpublish_content;
					?></a>
<?php
		} else {
?>
					<span class="hkm_publish_state hk-label hk-label-<?php echo
($plugin->$p_published) ? 'green' : 'red';
?>"><?php echo ($plugin->$p_published) ? $publish_content
: $unpublish_content; ?></span>
<?php
		}
?>
				</div>
				<div class="hkc-sm-2 hkm_plugin_actions"><?php
	$data = array(
		'details' => array(
			'name' => '<i class="fas
fa-search"></i> ' . JText::_('HIKA_DETAILS',
true),
			'link' => $url
		)
	);
	if($this->plugin_action_delete) {
		$data['delete'] = array(
			'name' => '<i class="fas
fa-trash"></i> ' . JText::_('HIKA_DELETE',
true),
			'link' => '#delete',
			'click' => 'return
window.localPage.deletePlugin('.(int)$plugin->$p_id.',
\''.urlencode(strip_tags($plugin->$p_name)).'\');'
		);
	}
	if(!empty($data)) {
		echo $this->dropdownHelper->display(
			JText::_('HIKA_ACTIONS'),
			$data,
			array('type' => '', 'class' =>
'hikabtn-primary', 'right' => true, 'up'
=> false)
		);
	}
				?></div>
			</div>
		</div>
	</div>
<?php
}
?>
	<div class="hikamarket_plugins_footer">
		<div class="hikamarket_pagination">
			<?php echo $this->pagination->getListFooter(); ?>
			<?php echo $this->pagination->getResultsCounter(); ?>
		</div>
	</div>
</div>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="listing" />
	<input type="hidden" name="plugin_type"
value="<?php echo $this->escape($this->type); ?>"
/>
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<?php echo JHTML::_('form.token'); ?>
</form>
</div>
<?php if($this->plugin_action_publish) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.togglePlugin = function(el) {
	var w=window, d=document, o=w.Oby,
		state = el.getAttribute('data-toggle-state'),
		id = el.getAttribute('data-toggle-id');
	if(!id) return false;
	var url="<?php echo
hikamarket::completeLink('toggle','ajax',true);
?>",
		v = (state == 0) ? 1 : 0,
		data=o.encodeFormData({"task":"<?php echo
$publish_type;
?>_published-"+id,"value":v,"table":"<?php
echo $publish_type; ?>","<?php echo
hikamarket::getFormToken(); ?>":1});
	el.disabled = true;
	if(state == 1) el.innerHTML = "<i class=\"fas fa-spinner
fa-pulse\"></i> <?php echo
JText::_('HIKA_UNPUBLISHING', true); ?>";
	else el.innerHTML = "<i class=\"fas fa-spinner
fa-pulse\"></i> <?php echo
JText::_('HIKA_PUBLISHING', true); ?>";
	el.classList.remove("hikabtn-success",
"hikabtn-danger");
	o.xRequest(url,{mode:"POST",data:data},function(x,p){
		if(x.responseText && x.responseText == '1')
			state = v;
		el.disabled = false;
		el.setAttribute('data-toggle-state', v);
		if(state == 1) el.innerHTML = "<i class=\"fas
fa-check\"></i> <?php echo
JText::_('HIKA_PUBLISHED', true); ?>";
		else el.innerHTML = "<i class=\"fas
fa-times\"></i> <?php echo
JText::_('HIKA_UNPUBLISHED', true); ?>";
		el.classList.add( state ? "hikabtn-success" :
"hikabtn-danger" );
	});
};
</script>
<?php } ?>
<?php if($this->plugin_action_delete) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.deletePlugin = function(id, name) {
	var confirmMsg = "<?php echo
JText::_('CONFIRM_DELETE_PLUGIN_X'); ?>";
	if(!confirm(confirmMsg.replace('{PLUGIN}', decodeURI(name))))
		return false;
	var f = document.forms['hikamarket_delete_plugin_form'];
	if(!f) return false;
	f.plugin_id.value = id;
	f.submit();
	return false;
};
</script>
<form action="<?php echo
hikamarket::completeLink('plugin&task=delete'); ?>"
method="post" name="hikamarket_delete_plugin_form"
id="hikamarket_delete_plugin_form">
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="delete" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="plugin_type"
value="<?php echo $this->escape($this->type); ?>"
/>
	<input type="hidden" name="plugin_id"
value="0" />
	<?php echo JHTML::_('form.token'); ?>
</form>
<?php }
views/pluginmarket/tmpl/listing.xml000064400000002341151166607750013570
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendors Plugin listing</name>
		<params addpath="/components/com_hikamarket/params">
			<param name="plugin_type" type="radio"
default="payment" label="Select a plugin type"
description="Select here the plugin type you want to list for the
current link">
				<option value="payment">Payment</option>
				<option value="shipping">Shipping</option>
			</param>
			<param name="options" type="selectoptions"
default="module" label="options"
description="HikaMarket options" />
		</params>
	</state>
	<layout
title="COM_HIKAMARKET_VENDORMARKET_VIEW_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
		<fieldset name="basic" label="HikaMarket
Options">
			<field id="plugin_type" name="plugin_type"
type="radio" default="payment" label="Select a
plugin type" description="Select here the plugin type you want to
list for the current link">
				<option value="payment">Payment</option>
				<option value="shipping">Shipping</option>
			</field>
			<field id="options" name="options"
type="selectoptions" label="options"
description="HikaMarket options" />
		</fieldset>
	</fields>
</metadata>views/pluginmarket/view.html.php000064400000102417151166607750013054
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class pluginmarketViewpluginmarket extends hikamarketView {

	protected $ctrl = 'plugin';
	protected $icon = 'plugin';
	protected $triggerView = true;

	public function display($tpl = null, $params = array()) {
		$this->params =& $params;
		$fct = $this->getLayout();
		if(method_exists($this, $fct)) {
			if($this->$fct() === false)
				return;
		}
		parent::display($tpl);
	}

	public function listing($tpl = null) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';

		$type = hikaInput::get()->getCmd('plugin_type',
'payment');
		if(!in_array($type, array('payment', 'shipping',
'generic')))
			return false;

		$this->assignRef('type', $type);

		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.'.$type.'.listing';

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$this->loadRef(array(
			'toggleClass' => 'helper.toggle',
			'currencyClass' => 'shop.class.currency',
			'zoneClass' => 'shop.class.zone',
			'dropdownHelper' => 'shop.helper.dropdown',
		));

		$manage = hikamarket::acl($type.'plugin/edit');
		$this->assignRef('manage', $manage);

		$plugin_action_publish =
hikamarket::acl($type.'plugin/edit/published');
		$plugin_action_delete =
hikamarket::acl($type.'plugin/delete');
		$plugin_actions = $plugin_action_publish || $plugin_action_delete;
		$this->assignRef('plugin_action_publish',
$plugin_action_publish);
		$this->assignRef('plugin_action_delete',
$plugin_action_delete);
		$this->assignRef('plugin_actions', $plugin_actions);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid = '&Itemid='.$Itemid;
		$this->Itemid = $Itemid;
		$this->assignRef('url_itemid', $url_itemid);

		$plugin_configs = array(
			'payment' => array(
				'table' => 'shop.payment',
				'main_key' => 'payment_id',
				'order_sql_value' => 'plugin.payment_id'
			),
			'shipping' => array(
				'table' => 'shop.shipping',
				'main_key' => 'shipping_id',
				'order_sql_value' => 'plugin.shipping_id'
			),
			'generic' => array(
				'table' => 'shop.plugin',
				'main_key' => 'plugin_id',
				'order_sql_value' => 'plugin.plugin_id'
			),
		);
		$cfg = $plugin_configs[$type];

		$default_sort_dir = 'asc';

		$listing_filters = array(
			'vendors' => -1,
			'published' => -1,
		);

		$pageInfo = $this->getPageInfo($cfg['order_sql_value'],
$default_sort_dir, $listing_filters);

		$filters = array();
		$plugin_searchMaps = array(
			'payment' => array(
				'plugin.payment_type',
				'plugin.payment_name',
				'plugin.payment_id'
			),
			'shipping' => array(
				'plugin.shipping_type',
				'plugin.shipping_name',
				'plugin.shipping_id'
			),
			'generic' => array(
				'plugin.plugin_type',
				'plugin.plugin_name',
				'plugin.plugin_id'
			),
		);
		$searchMap = $plugin_searchMaps[$type];
		$order = '';

		$filter_type = ($type == 'generic') ? 'plugin' :
$type;
		if($vendor->vendor_id > 1) {
			$filters['vendor'] =
'plugin.'.$filter_type.'_vendor_id = ' .
(int)$vendor->vendor_id;
		} else {
			$vendorType = hikamarket::get('type.filter_vendor');
			$this->assignRef('vendorType', $vendorType);
			if($pageInfo->filter->vendors >= 0) {
				if($pageInfo->filter->vendors > 1)
					$filters['vendor'] =
'plugin.'.$filter_type.'_vendor_id =
'.(int)$pageInfo->filter->vendors;
				else
					$filters['vendor'] =
'plugin.'.$filter_type.'_vendor_id <= 1';
			}
		}
		if($pageInfo->filter->published >= 0) {
			$filters['published'] =
'plugin.'.$filter_type.'_published = ' .
($pageInfo->filter->published ? '1' : '0');
		}

		$this->processFilters($filters, $order, $searchMap);

		$extrafilters = null;

		JPluginHelper::importPlugin('hikashop');
		if(in_array($type, array('shipping', 'payment')))
			JPluginHelper::importPlugin('hikashop'.$type);
		$view =& $this;
		$app->triggerEvent('onBeforeHikaPluginConfigurationListing',
array($type, &$filters, &$order, &$searchMap,
&$extrafilters, &$view));

		$query = 'FROM
'.hikamarket::table($cfg['table']).' AS plugin
'.$filters.$order;
		$db->setQuery('SELECT * '.$query,
(int)$pageInfo->limit->start, (int)$pageInfo->limit->value);

		$rows = $db->loadObjectList();
		$this->assignRef('plugins', $rows);

		$db->setQuery('SELECT COUNT(*) '.$query);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($rows);

		if($pageInfo->elements->page) {

		}

		$listing_columns = array();
		$pluginInterfaceClass = hikamarket::get('shop.class.plugin');
		$pluginInterfaceClass->fillListingColumns($rows, $listing_columns,
$this, $type);

		$app->triggerEvent('onAfterHikaPluginConfigurationListing',
array($type, &$rows, &$listing_columns, &$view));

		$this->assignRef('listing_columns', $listing_columns);

		$this->toolbar = array(
			array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'), 'url'
=> hikamarket::completeLink('vendor')
			),
			array(
				'icon' => 'new',
				'fa' => 'fa-plus-circle',
				'name' => JText::_('HIKA_NEW'),
				'url' =>
hikamarket::completeLink('plugin&plugin_type='.$type.'&task=add'),
				'pos' => 'right',
				'display' =>
hikamarket::acl($type.'plugin/add')
			)
		);

		$this->getPagination();
	}


	public function form($tpl = null) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$task = hikaInput::get()->getCmd('task', 'edit');

		$type = hikaInput::get()->getCmd('plugin_type',
'payment');
		if(!in_array($type, array('payment', 'shipping',
'generic')))
			return false;

		$this->assignRef('type', $type);

		$this->content = '';
		$this->plugin_name = hikaInput::get()->getCmd('name',
'');

		if($type == 'plugin') {
			$plugin = hikamarket::import('hikashop',
$this->plugin_name);
			if(!is_subclass_of($plugin, 'hikashopPlugin'))
				return false;
		} else
			$plugin = hikamarket::import('hikashop' . $type,
$this->plugin_name);

		if(!$plugin)
			return false;

		$multiple_plugin = false;
		$multiple_interface = false;
		if(method_exists($plugin, 'isMultiple')) {
			$multiple_interface = true;
			$multiple_plugin = $plugin->isMultiple();
		}

		$subtask = hikaInput::get()->getCmd('subtask',
'edit');
		if($multiple_plugin && empty($subtask)) {
			$querySelect = array();
			$queryFrom = array();
			$queryWhere = array();
			$filters = array();

			JPluginHelper::importPlugin('hikashop');
			$app->triggerEvent('onHikaPluginListing', array($type,
&$querySelect, &$queryFrom, &$queryWhere, &$filters));

			if(!empty($querySelect)) $querySelect = ', ' .
implode(',', $querySelect);
			else $querySelect = '';

			if(!empty($queryFrom)) $queryFrom = ', ' .
implode(',', $queryFrom);
			else $queryFrom = '';

			if(!empty($queryWhere)) $queryWhere = ' AND (' .
implode(') AND (', $queryWhere) . ') ';
			else $queryWhere = '';

			$this->assignRef('filters', $filters);
		} else {
			$querySelect = '';
			$queryFrom = '';
			$queryWhere = '';
		}

		$query = 'SELECT plugin.* ' . $querySelect .
			' FROM ' . hikashop_table($type) . ' as plugin ' .
$queryFrom .
			' WHERE (plugin.' . $type . '_type = ' .
$db->Quote($this->plugin_name) . ') ' . $queryWhere .
			' ORDER BY plugin.' . $type . '_ordering ASC';
		$db->setQuery($query);
		$elements = $db->loadObjectList($type.'_id');

		if(!empty($elements)) {
			$params_name = $type.'_params';
			foreach($elements as $k => $el) {
				if(!empty($el->$params_name)) {
					$elements[$k]->$params_name =
hikamarket::unserialize($el->$params_name);
				}
			}
		}

		$function = 'pluginConfiguration';
		$ctrl =
'&plugin_type='.$type.'&task='.$task.'&name='.$this->plugin_name;
		if($multiple_plugin === true) {
			$ctrl .= '&subtask='.$subtask;
			if(empty($subtask)) {
				$function = 'pluginMultipleConfiguration';
			} else {
				$typeFunction = 'on' . ucfirst($type) .
'Configuration';
				if(method_exists($plugin, $typeFunction)) {
					$function = $typeFunction;
				}
			}
			$cid = hikashop_getCID($type.'_id');
			if(isset($elements[$cid])) {
				$this->assignRef('element', $elements[$cid]);
				$configParam =& $elements[$cid];
				$ctrl .= '&' . $type . '_id=' . $cid;
			} else {
				$configParam = new stdClass;
				$this->assignRef('element', $configParam);
			}
		} else {
			$configParam =& $elements;

			$element = null;
			if(!empty($elements)) {
				$element = reset($elements);
			}
			$this->assignRef('element', $element);
			$typeFunction = 'on' . ucfirst($type) .
'Configuration';
			if(method_exists($plugin, $typeFunction)) {
				$function = $typeFunction;
			}
		}
		$this->assignRef('elements', $elements);

		if($multiple_interface && !isset($subtask) || !empty($subtask))
{
			$extra_config = array();
			$extra_blocks = array();

			JPluginHelper::importPlugin('hikashop');
			$app->triggerEvent('onHikaPluginConfiguration',
array($type, &$plugin, &$this->element, &$extra_config,
&$extra_blocks));

			$this->assignRef('extra_config', $extra_config);
			$this->assignRef('extra_blocks', $extra_blocks);
		}

		if(method_exists($plugin, $function)) {
			if(empty($plugin->title))
				$plugin->title = JText::_('HIKA_PLUGIN').'
'.$this->plugin_name;
			ob_start();
			$plugin->$function($configParam);
			$this->content = ob_get_clean();
			$this->data = $plugin->getProperties();
			$setTitle = false;
		}

		$this->assignRef('name', $this->plugin_name);
		$this->assignRef('plugin', $plugin);
		$this->assignRef('multiple_plugin', $multiple_plugin);
		$this->assignRef('multiple_interface',
$multiple_interface);

		$this->main_form = array(
			$type.'_name' => array(
				'name' => 'HIKA_NAME',
				'type' => 'input'
			),
			$type.'_description' => array(
				'name' => 'HIKA_DESCRIPTION',
				'type' => 'wysiwyg'
			)
		);
		$this->restriction_form = array();

		if($multiple_plugin)
			$this->main_form[$type.'_published'] =
array('HIKA_PUBLISHED', 'boolean', '0');

		$pluginInterfaceClass = null;
		switch($type) {
			case 'payment':
				$pluginInterfaceClass = hikamarket::get('class.payment');
				break;
			case 'shipping':
				$pluginInterfaceClass = hikamarket::get('class.shipping');
				break;
			case 'generic':
			default:
				$pluginInterfaceClass = hikamarket::get('class.plugin');
				break;
		}

		$fields = array();
		if(!empty($pluginInterfaceClass) &&
method_exists($pluginInterfaceClass, 'loadConfigurationFields'))
			$fields = $pluginInterfaceClass->loadConfigurationFields();

		if(!empty($fields['main']))
			$this->main_form = array_merge($this->main_form,
$fields['main']);

		foreach($this->main_form as $k => $v) {
			$key = str_replace(array('params.'.$type.'_',
$type.'_', '_'), array('', '',
'-'), $k);
			if(!hikamarket::acl($type . 'plugin/edit/' . $key))
				unset($this->main_form[$k]);
		}

		if(!empty($fields['restriction']))
			$this->restriction_form = array_merge($this->restriction_form,
$fields['restriction']);

		foreach($this->restriction_form as $k => $v) {
			$key = str_replace(array('params.'.$type.'_',
$type.'_', '_'), array('', '',
'-'), $k);
			if(!hikamarket::acl($type . 'plugin/edit/restriction/' .
$key))
				unset($this->restriction_form[$k]);
		}

		if(empty($plugin->pluginView))
			$this->content .= $this->loadPluginTemplate(@$plugin->view,
$type);

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' =>
hikamarket::completeLink('plugin&plugin_type='.$type)
			),
			'apply' => array(
				'url' => '#apply',
				'fa' => 'fa-check-circle',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'apply\',\'hikamarket_plugin_form\');"',
				'icon' => 'apply',
				'name' => JText::_('HIKA_APPLY'),
'pos' => 'right',
				'display' =>
hikamarket::acl($type.'plugin/edit')
			),
			'save' => array(
				'url' => '#save',
				'fa' => 'fa-save',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save\',\'hikamarket_plugin_form\');"',
				'icon' => 'save',
				'name' => JText::_('HIKA_SAVE'), 'pos'
=> 'right',
				'display' =>
hikamarket::acl($type.'plugin/edit')
			)
		);
	}

	public function add($tpl = null) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$config = hikamarket::config();
		$shopConfig = hikamarket::config(false);
		$vendor = hikamarket::loadVendor(true);

		$this->assignRef('config', $config);
		$this->assignRef('vendor', $vendor);

		$this->loadRef(array(
			'toggleClass' => 'helper.toggle',
			'radioType' => 'shop.type.radio',
		));

		$type = hikaInput::get()->getCmd('plugin_type',
'payment');
		if(!in_array($type, array('payment', 'shipping',
'generic')))
			return false;

		if(!hikamarket::acl($type.'plugin/add') )
			return false;

		if($type == 'generic') {
			$plugin_group = 'hikashop';
			$plugin_table = 'plugin';
		} else {
			$plugin_group = 'hikashop' . $type;
			$plugin_table = $type;
		}

		$filters = array();
		if($vendor->vendor_id <= 1)
			$filters['publish'] = -1;
		if($type == 'payment')
			$filters['currency'] = 0;
		$this->paramBase = 'plugins_'.$type;
		$pageInfo = $this->getPageInfo('', 'asc',
$filters);

		if($vendor->vendor_id > 1)
			$pageInfo->filter->publish = 1;

		$query_select = array('extension_id as id', 'enabled as
published', 'name', 'element');
		$query_table = 'extensions';
		$query_filters = array(
			'`folder` = '.$db->Quote($plugin_group),
			'type = \'plugin\''
		);
		if((int)$pageInfo->filter->publish >= 0)
			$query_filters[] = 'enabled = ' .
(int)$pageInfo->filter->publish;

		if(!empty($pageInfo->search)) {
			$query_filters[] = 'name LIKE \'%' .
$db->escape(HikaStringHelper::strtolower($pageInfo->search)) .
'%\'';
		}
		$query_order = 'enabled DESC, name ASC, ordering ASC';

		$query = 'SELECT ' . implode(', ', $query_select) .
				' FROM ' . hikamarket::table($query_table, false) .
				' WHERE (' . implode(') AND (', $query_filters) .
')'.
				' ORDER BY ' . $query_order;

		$db->setQuery($query);
		$plugins = $db->loadObjectList();

		JPluginHelper::importPlugin($plugin_group);
		$view =& $this;
		$app->triggerEvent('onAfterHikaPluginConfigurationSelectionListing',
array($type, &$plugins, &$view));

		$query = 'SELECT * FROM
'.hikamarket::table('shop.'.$plugin_table);
		$db->setQuery($query);
		$obj = $db->loadObject();
		if(empty($obj))
			$app->enqueueMessage(JText::_('EDIT_PLUGINS_BEFORE_DISPLAY'));

		$currencies = null;
		if($type == 'payment') {
			$currencyClass = hikamarket::get('shop.class.currency');
			$mainCurrency = $shopConfig->get('main_currency',1);
			$currencyIds = $currencyClass->publishedCurrencies();
			if(!in_array($mainCurrency, $currencyIds))
				$currencyIds = array_merge(array($mainCurrency), $currencyIds);
			$null = null;
			$currencies = $currencyClass->getCurrencies($currencyIds, $null);

			$filter_currency = null;
			if(!empty($pageInfo->filter->currency) &&
!in_array((int)$pageInfo->filter->currency, $currencyIds))
				$pageInfo->filter->currency = 0;
			if(!empty($pageInfo->filter->currency))
				$filter_currency = $currencies[ (int)$pageInfo->filter->currency
]->currency_code;

			foreach($plugins as $key => &$plugin) {
				try{
					$p = hikamarket::import($plugin_group, $plugin->element);
				} catch(Exception $e) { $p = null; }
				if($vendor->vendor_id > 1 && (!method_exists($p,
'isMultiple') || !$p->isMultiple() ||
!empty($p->market_support))) {
					unset($plugins[$key]);
					unset($p);
					continue;
				}
				$plugin->accepted_currencies = array();
				if(isset($p->accepted_currencies)) {
					$plugin->accepted_currencies = $p->accepted_currencies;
					if(!empty($filter_currency) &&
!empty($p->accepted_currencies) && !in_array($filter_currency,
$p->accepted_currencies))
						unset($plugins[$key]);
				}
				unset($p);
			}
			unset($plugin);
		} else if($vendor->vendor_id > 1) {
			foreach($plugins as $key => &$plugin) {
				try{
					$p = hikamarket::import($plugin_group, $plugin->element);
				} catch(Exception $e) { $p = null; }
				if(!method_exists($p, 'isMultiple') || !$p->isMultiple()
|| !empty($p->market_support))
					unset($plugins[$key]);
				unset($p);
			}
			unset($plugin);
		}

		$this->assignRef('plugins', $plugins);
		$this->assignRef('plugin_type', $type);
		$this->assignRef('currencies', $currencies);

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' =>
hikamarket::completeLink('plugin&plugin_type='.$type)
			)
		);
	}

	protected function loadPluginTemplate($view = '', $type =
'') {
		static $previousType = '';
		if(empty($type))
			$type = $previousType;
		else
			$previousType = $type;

		$app = JFactory::getApplication();
		$this->subview = '';
		if(!empty($view))
			$this->subview = '_' . $view;

		if(!isset($this->data['pluginConfig'])) {
			if($type == 'plugin')
				$type = '';

			$name =
$this->name.'_configuration'.$this->subview.'.php';
			$path =
JPATH_THEMES.DS.$app->getTemplate().DS.'hikashop'.$type.DS.$name;

			if(!file_exists($path)) {
				$path =
JPATH_PLUGINS.DS.'hikashop'.$type.DS.$this->name.DS.$name;
				if(!file_exists($path))
					return '';
			}

			$this->pluginTemplateMode = 'html';

			ob_start();
			require($path);
			return ob_get_clean();
		}

		$paramsType = $type.'_params';

		$html = $this->processConfig($this->data['pluginConfig'],
$type, $paramsType, @$this->element->$paramsType);
		return $html;
	}

	protected function getParamsData($configData, &$key, $type,
$paramsType, &$localType) {
		$data = '';
		if(is_array($configData))
			$data = @$configData[$key];
		else if(!empty($configData))
			$data = @$configData->$key;

		if(empty($paramsType) && substr($key, 0, 7) ==
'params.') {
			$localType = $type . '_params';
			$key = substr($key, 7);

			if(is_array($configData))
				$params = @$configData[$localType];
			else if(!empty($configData))
				$params = @$configData->$localType;

			if(is_array($params))
				$data = @$params[$key];
			else if(!empty($params))
				$data = @$params->$key;
		}

		return $data;
	}

	protected function processConfig($configs, $type, $paramsType,
$configData, $id = '', $checkDisplay = false) {
		$html = '';
		if(empty($configs))
			return $html;

		$cache = array();

		if(!empty($id))
			$id = 'id="'.$id.'"';

		$html .= '<dl '.$id.' class="hikam_options
large">'."\r\n";
		foreach($configs as $key => $config) {

			if(!isset($config['name'])) {
				$tmp = array(
					'name' => $config[0],
					'type' => $config[1],
					'data' => @$config[2]
				);
				$config = $tmp;
			}

			if(is_array($config['name'])) {
				$a = array_shift($config['name']);
				$label = vsprintf(JText::_($a), $config['name']);
			} else
				$label = JText::_($config['name']);

			$paramsTypeKey = '';
			$paramsTypeForm = '';
			$params = null;
			$fullKey = '' . $key;

			$jsEvent =
"window.Oby.fireAjax('field_changed',{'key':'".$key."','obj':this});";

			$localType = $paramsType;
			$data = $this->getParamsData($configData, $key, $type, $paramsType,
$localType);

			if(!empty($localType)) {
				$paramsTypeKey = $localType.'_';
				$paramsTypeForm = '['.$localType.']';
			}

			$data_key = empty($config['category']) ? '' :
'hikamarket_'.$type.'_cat_'.$config['category'];
			$classname = $data_key.'
hikamarket_field_'.$paramsTypeKey.$key;
			$style = empty($config['hidden']) ? '' : '
style="display:none;"';

			if(!empty($config['display']))
				$style .= '
id="hikamarket_field_{TYPE}_'.$paramsTypeKey.$key.'"';

			$html .= '<dt data-hkm-key="'.$data_key.'"
class="'.$classname.'"'.str_replace('{TYPE}',
'title', $style).'><label
for="data_'.$type.'_'.$paramsTypeKey.$key.'">'.$label.'</label></dt>'."\r\n".
					'<dd data-hkm-key="'.$data_key.'"
class="'.$classname.'"'.str_replace('{TYPE}',
'value', $style).'>';

			switch($config['type']) {
				case 'input':
					$html .= '<input type="text"
onchange="'.$jsEvent.'"
id="data_'.$type.'_'.$paramsTypeKey.$key.'"
name="data['.$type.']'.$paramsTypeForm.'['.$key.']"
value="'.$this->escape($data).'"/>';
					break;

				case 'textarea':
					$html .= '<textarea
onchange="'.$jsEvent.'"
id="data_'.$type.'_'.$paramsTypeKey.$key.'"
name="data['.$type.']'.$paramsTypeForm.'['.$key.']"
rows="3">'.$this->escape($data).'</textarea>';
					break;
				case 'big-textarea':
					$html .= '<textarea
onchange="'.$jsEvent.'"
id="data_'.$type.'_'.$paramsTypeKey.$key.'"
name="data['.$type.']'.$paramsTypeForm.'['.$key.']"
rows="9" width="100%"
style="width:100%;">'.$this->escape($data).'</textarea>';
					break;

				case 'wysiwyg':
					if(empty($this->editorHelper)) {
						$this->editorHelper =
hikamarket::get('shop.helper.editor');
						$marketConfig = hikamarket::config();
						$this->editorHelper->setEditor($marketConfig->get('editor',
''));
						if($marketConfig->get('editor_disable_buttons', 0))
							$this->editorHelper->options = false;
					}
					$this->editorHelper->name = $paramsTypeKey.$key;
					$this->editorHelper->content = $data;
					$html .= $this->editorHelper->display() . '<div
style="clear:both"></div>';
					break;

				case 'boolean':
					if(empty($this->radioType))
						$this->radioType = hikamarket::get('shop.type.radio');
					if($data === null) {
						$default = null;
						if(isset($config['data'])) // retro-compat
							$default = $config['data'];
						if(isset($config['default']))
							$default = $config['default'];
						if($default === null)
							$default = 1;

						if($params === null) {
							if(!isset($configData->$key))
								$configData->$key = $default;
							$data = $configData->$key;
						} else {
							if(is_array($params)) {
								if(!isset($params[$key]))
									$params[$key] = $default;
								$data = @$params[$key];
							} else if(!empty($params)) {
								if(!isset($params->$key))
									$params->$key = $default;
								$data = @$params->$key;
							}
						}
					}
					$html .=
$this->radioType->booleanlist('data['.$type.']'.$paramsTypeForm.'['.$key.']'
, 'onchange="'.$jsEvent.'"', $data);
					break;

				case 'checkbox':
					$i = 0;
					foreach($config['data'] as $listKey => $listData) {
						$checked = '';
						if(!empty($data)) {
							if(in_array($listKey, $data))
								$checked = 'checked="checked"';
						}
						$html .= '<input onchange="'.$jsEvent.'"
id="data_'.$type.'_'.$paramsTypeKey.$key.'_'.$i.'"
name="data['.$type.']'.$paramsTypeForm.'['.$key.'][]"
type="checkbox" value="'.$listKey.'"
'.$checked.' /><label
for="data_'.$type.'_'.$paramsType.'_'.$key.'_'.$i.'">'.$listData.'</label><br/>';
						$i++;
					}
					break;

				case 'radio':
					$values = array();
					foreach($config['data'] as $listKey => $listData) {
						$values[] = JHTML::_('select.option', $listKey,
JText::_($listData));
					}
					$html .= $this->radioType->radiolist($values,
'data['.$type.']'.$paramsTypeForm.'['.$key.']'
, 'onchange="'.$jsEvent.'"
class="inputbox" size="1"', 'value',
'text', $data);
					break;

				case 'list':
					$values = array();
					foreach($config['data'] as $listKey => $listData) {
						$values[] = JHTML::_('select.option',
$listKey,JText::_($listData));
					}
					$html .= JHTML::_('select.genericlist', $values,
'data['.$type.']'.$paramsTypeForm.'['.$key.']'
, 'onchange="'.$jsEvent.'"
class="inputbox" size="1"', 'value',
'text', $data);
					break;

				case 'price':
					if(empty($this->currenciesType))
						$this->currenciesType =
hikamarket::get('shop.type.currency');

					if(!empty($config['data']))
						$key2 = $config['data'];
					else
						$key2 = str_replace('price', 'currency', $key);

					$link_params = false;
					if(!empty($config['link']))
						$link_params = (substr($config['link'], 0, 7) ==
'params.');

					$data2 = '';
					if(is_array($configData) && isset($configData[$key2])
&& !$link_params)
						$data2 = $configData[$key2];
					else if(is_object($configData) && isset($configData->$key2)
&& !$link_params)
						$data2 = $configData->$key2;
					else if(is_object($configData) &&
is_object($configData->{$type.'_params'}) &&
isset($configData->{$type.'_params'}->$key2))
						$data2 = @$configData->{$type.'_params'}->$key2;

					$html .= '<input type="text"
onchange="'.$jsEvent.'"
id="data_'.$type.'_'.$paramsTypeKey.$key.'"
name="data['.$type.']'.$paramsTypeForm.'['.$key.']"
value="'.$this->escape($data).'"/>';

					if($link_params && empty($paramsTypeForm))
						$paramsTypeForm = '['.$type . '_params]';
					$html .=
$this->currenciesType->display('data['.$type.']'.$paramsTypeForm.'['.$key2.']',
$data2);
					break;

				case 'tax':
					if(empty($this->categoryType))
						$this->categoryType =
hikamarket::get('type.shop_category');
					$html .=
$this->categoryType->display('data['.$type.']'.$paramsTypeForm.'['.$key.']',
$data, 'tax');
					break;

				case 'weight':
					if(empty($this->weightType))
						$this->weightType =
hikamarket::get('shop.type.weight');
					if(!empty($config['link'])) {
						$html .= '<input type="text"
id="data_'.$type.'_'.$paramsTypeKey.$key.'"
name="data['.$type.']'.$paramsTypeForm.'['.$key.']"
value="'.$this->escape($data).'"/>';

						$key = $config['link'];
						if(is_array($configData) && isset($configData[$key]))
							$data = $configData[$key];
						else if(is_object($configData) &&
isset($configData->$key))
							$data = $configData->$key;
						else if(is_object($configData) &&
is_object($configData->{$type.'_params'}) &&
isset($configData->{$type.'_params'}->$key))
							$data = $configData->{$type.'_params'}->$key;
					}
					if(empty($config['link']) ||
empty($cache[$type.'_'.$paramsTypeForm.'_'.$key]))
						$html .=
$this->weightType->display('data['.$type.']'.$paramsTypeForm.'['.$key.']',
$data);

					if(!empty($config['link']))
						$cache[$type.'_'.$paramsTypeForm.'_'.$key] =
true;
					break;

				case 'volume':
					if(empty($this->volumeType))
						$this->volumeType =
hikamarket::get('shop.type.volume');

					if(!empty($config['link'])) {
						$html .= '<input type="text"
id="data_'.$type.'_'.$paramsTypeKey.$key.'"
name="data['.$type.']'.$paramsTypeForm.'['.$key.']"
value="'.$this->escape($data).'"/>';

						$key = $config['link'];
						if(is_array($configData) && isset($configData[$key]))
							$data = $configData[$key];
						else if(is_object($configData) &&
isset($configData->$key))
							$data = $configData->$key;
						else if(is_object($configData) &&
is_object($configData->{$type.'_params'}) &&
isset($configData->{$type.'_params'}->$key))
							$data = $configData->{$type.'_params'}->$key;
					}
					if(empty($config['link']) ||
empty($cache[$type.'_'.$paramsTypeForm.'_'.$key]))
						$html .=
$this->volumeType->display('data['.$type.']'.$paramsTypeForm.'['.$key.']',
$data);

					if(!empty($config['link']))
						$cache[$type.'_'.$paramsTypeForm.'_'.$key] =
true;
					break;

				case 'orderstatus':
				case 'orderstatuses':
					if(empty($this->nameboxType))
						$this->nameboxType = hikamarket::get('type.namebox');

					$html .= $this->nameboxType->display(
						'data['.$type.']'.$paramsTypeForm.'['.$key.']',
						$data,
						($config['type'] == 'orderstatus') ?
hikamarketNameboxType::NAMEBOX_SINGLE :
hikamarketNameboxType::NAMEBOX_MULTIPLE,
						'order_status',
						array(
							'delete' => ($config['type'] ==
'orderstatus') ? false : true,
							'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
							'type' => $type
						)
					);
					break;

				case 'address':
					if(empty($this->addressType))
						$this->addressType =
hikamarket::get('shop.type.address');
					$html .=
$this->addressType->display('data['.$type.']'.$paramsTypeForm.'['.$key.']',
$data);
					break;

				case 'acl':
					if(empty($this->joomlaAclType))
						$this->joomlaAclType =
hikamarket::get('type.joomla_acl');
					if($data === null)
						$data = 'all';
					$html .=
$this->joomlaAclType->display('data['.$type.']'.$paramsTypeForm.'['.$key.']',
$data, true, true);
					break;

				case 'currency':
					if(empty($this->currenciesType))
						$this->currenciesType =
hikamarket::get('shop.type.currency');
					$html .=
$this->currenciesType->display('data['.$type.']'.$paramsTypeForm.'['.$key.']',
$data);
					break;

				case 'currencies':
					if(empty($this->currenciesType))
						$this->currenciesType =
hikamarket::get('shop.type.currency');
					if(is_string($data))
						$data = explode(',', trim($data, ','));
					$html .=
$this->currenciesType->display('data['.$type.']'.$paramsTypeForm.'['.$key.'][]',
$data, 'multiple="multiple" class="no-chzn"
size="3"');
					break;

				case 'zone':
					if(empty($this->nameboxType))
						$this->nameboxType = hikamarket::get('type.namebox');

					$html .= $this->nameboxType->display(
						'data['.$type.']'.$paramsTypeForm.'['.$key.']',
						$data,
						hikamarketNameboxType::NAMEBOX_SINGLE,
						'zone',
						array(
							'delete' => true,
							'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
							'type' => $type
						)
					);
					break;

				case 'warehouse':
					if(empty($this->nameboxType))
						$this->nameboxType = hikamarket::get('type.namebox');

					$html .= $this->nameboxType->display(
						'data['.$type.']'.$paramsTypeForm.'['.$key.']',
						$data,
						hikamarketNameboxType::NAMEBOX_SINGLE,
						'warehouse',
						array(
							'delete' => true,
							'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
							'type' => $type
						)
					);
					break;

				case 'plugin_images':
					if(empty($this->nameboxType))
						$this->nameboxType = hikamarket::get('type.namebox');

					$html .= $this->nameboxType->display(
						'data['.$type.']'.$paramsTypeForm.'['.$key.']',
						$data,
						hikamarketNameboxType::NAMEBOX_MULTIPLE,
						'plugin_images',
						array(
							'delete' => true,
							'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
							'type' => $type
						)
					);
					break;

				case 'shipping_method':
					if(empty($this->nameboxType))
						$this->nameboxType = hikamarket::get('type.namebox');

					if(is_string($data))
						$data = explode("\n", $data);

					$html .= $this->nameboxType->display(
						'data['.$type.']'.$paramsTypeForm.'['.$key.']',
						$data,
						hikamarketNameboxType::NAMEBOX_MULTIPLE,
						'shipping_methods',
						array(
							'delete' => true,
							'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
							'type' => $type
						)
					);
					break;

				case 'html':
					$html .= $config['data'];
					break;

				default:
					$ret = false;
					if(!empty($this->plugin) && method_exists($this->plugin,
'pluginConfigDisplay'))
						$ret =
$this->plugin->pluginConfigDisplay($config['type'],
$config['data'], $type, $paramsTypeKey, $key, $configData);

					if($ret === false || empty($ret) && !empty($this->plugin)
&& method_exists($this->plugin,
'displayConfigField'))
						$ret = $this->plugin->displayConfigField($config, $type,
$paramsTypeKey, $key, $data, $configData);
					if($ret === false || empty($ret)) {
						if(empty($this->dispatcher)) {
							JPluginHelper::importPlugin('hikamarket');
							JPluginHelper::importPlugin('hikashop');
							if(defined('HIKASHOP_J40') && HIKASHOP_J40)
								$this->dispatcher =
JFactory::getContainer()->get('dispatcher');
							else
								$this->dispatcher = JDispatcher::getInstance();
						}
						$ret = '';
						$this->dispatcher->trigger('onHikaDisplayConfigField',
array(&$ret, $config, $type, $paramsTypeKey, $key, $data,
$configData));
					}
					$html .= $ret;
					break;
			}

			if(!empty($config['append']))
				$html .= $config['append'];

			$html .= '</dd>'."\r\n";

			if($checkDisplay && !empty($config['display'])) {
				if(!isset($this->hiddenElements))
					$this->hiddenElements = array();

				foreach($config['display'] as $k => $values) {
					$displayKey = ''.$k;
					$localType = $paramsType;
					$otherData = $this->getParamsData($configData, $displayKey, $type,
$paramsType, $localType);

					$html_keys =
'hikamarket_field_{TYPE}_'.$paramsTypeKey.$key.''; //
title, value

					if(!is_array($values))
						$values = array($values);
					$hidden = true;
					foreach($values as &$v) {
						if($otherData === $v || ((''.$otherData) ===
(''.$v))) {
							$hidden = false;
							break;
						}
						$v = ''.$v;
					}
					unset($v);

					if($hidden) {
						$this->hiddenElements[] =
'hikamarket_field_title_'.$paramsTypeKey.$key;
						$this->hiddenElements[] =
'hikamarket_field_value_'.$paramsTypeKey.$key;
					}
					if(!isset($this->displayTriggers))
						$this->displayTriggers = array($k => array());
					if(!isset($this->displayTriggers[$k]))
						$this->displayTriggers[$k] = array();
					$this->displayTriggers[$k][$fullKey] = array($html_keys, $values);
				}
			}
		}
		$html .= '</dl>';
		return $html;
	}
}
views/productmarket/index.html000064400000000032151166607750012573
0ustar00<html><body></body></html>views/productmarket/tmpl/add.xml000064400000001245151166607750013033
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor product creation</name>
		<params addpath="/components/com_hikamarket/params">
			<param name="options" type="selectoptions"
default="module" label="options"
description="HikaMarket options" />
		</params>
	</state>
	<layout
title="COM_HIKAMARKET_PRODUCTMARKET_ADD_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
		<fieldset name="basic" label="HikaMarket
Options">
			<field id="options" name="options"
type="selectoptions" label="options"
description="HikaMarket options" />
		</fieldset>
	</fields>
</metadata>views/productmarket/tmpl/edit_translation.php000064400000015450151166607750015640
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('product'); ?>"
name="hikamarket_translation_form"
id="hikamarket_translation_form" method="post"
enctype="multipart/form-data">
<?php
if(!empty($this->product->translations)) {
	foreach($this->product->translations as $language_id =>
$translation) {
?>
	<table class="hikam_blocks">
		<tr>
			<td class="hikam_block_r">
				<dl class="hikam_options">
<?php if(hikamarket::acl('product/edit/name')) { ?>
					<dt
class="hikamarket_product_name"><label><?php echo
JText::_('HIKA_NAME'); ?></label></dt>
					<dd class="hikamarket_product_name"><input
type="text" name="translation[product_name][<?php echo
$language_id; ?>]" value="<?php echo
@$translation->product_name->value; ?>"/></dd>

<?php } else { ?>
					<dt
class="hikamarket_product_name"><label><?php echo
JText::_('HIKA_NAME'); ?></label></dt>
					<dd class="hikamarket_product_name"><?php echo
@$this->product->product_name; ?></dd>
<?php }

		if(hikamarket::acl('product/edit/pagetitle')) { ?>
					<dt
class="hikamarket_product_pagetitle"><label><?php
echo JText::_('PAGE_TITLE'); ?></label></dt>
					<dd class="hikamarket_product_pagetitle"><input
type="text" size="45"
name="translation[product_page_title][<?php echo $language_id;
?>]" value="<?php echo
$this->escape(@$translation->product_page_title->value);
?>" /></dd>
<?php
		}

		if(hikamarket::acl('product/edit/url')) { ?>
					<dt
class="hikamarket_product_url"><label><?php echo
JText::_('URL'); ?></label></dt>
					<dd class="hikamarket_product_url"><input
type="text" size="45"
name="translation[product_url][<?php echo $language_id;
?>]" value="<?php echo
$this->escape(@$translation->product_url->value); ?>"
/></dd>
<?php
		}

		if(hikamarket::acl('product/edit/alias')) { ?>
					<dt
class="hikamarket_product_alias"><label><?php echo
JText::_('HIKA_ALIAS'); ?></label></dt>
					<dd class="hikamarket_product_alias"><input
type="text" size="45"
name="translation[product_alias][<?php echo $language_id;
?>]" value="<?php echo
$this->escape(@$translation->product_alias->value); ?>"
/></dd>
<?php
		}

		if(hikamarket::acl('product/edit/canonical')) { ?>
					<dt
class="hikamarket_product_canonical"><label><?php
echo JText::_('PRODUCT_CANONICAL');
?></label></dt>
					<dd class="hikamarket_product_canonical"><input
type="text" size="45"
name="translation[product_canonical][<?php echo $language_id;
?>]" value="<?php echo
$this->escape(@$translation->product_canonical->value);
?>" /></dd>
<?php
		}

		if(hikamarket::acl('product/edit/metadescription')) { ?>
					<dt
class="hikamarket_product_metadescription"><label><?php
echo JText::_('PRODUCT_META_DESCRIPTION');
?></label></dt>
					<dd
class="hikamarket_product_metadescription"><textarea
id="product_meta_description" cols="35"
rows="2"
name="translation[product_meta_description][<?php echo
$language_id; ?>]"><?php echo
$this->escape(@$translation->product_meta_description->value);
?></textarea></dd>
<?php
		}

		if(hikamarket::acl('product/edit/keywords')) { ?>
					<dt
class="hikamarket_product_keywords"><label><?php echo
JText::_('PRODUCT_KEYWORDS'); ?></label></dt>
					<dd class="hikamarket_product_keywords"><textarea
id="product_keywords" cols="35" rows="2"
name="translation[product_keywords][<?php echo $language_id;
?>]"><?php echo
$this->escape(@$translation->product_keywords->value);
?></textarea></dd>
<?php
		}

		if(!empty($this->fields) &&
hikamarket::acl('product/edit/customfields')) {
			foreach($this->fields as $fieldName => $oneExtraField) {
				if($this->fields[$fieldName]->field_type == 'textarea'
&&
@$this->fields[$fieldName]->field_options['translatable']
== 1) { ?>
					<dt class="hikamarket_product_field_<?php echo $fieldName;
?>"><label><?php echo
$this->fieldsClass->getFieldName($oneExtraField);
?></label></dt>
					<dd class="hikamarket_product_field_<?php echo $fieldName;
?>"><textarea id="product_<?php echo $fieldName;
?>" cols="35" rows="2"
name="translation[<?php echo $fieldName; ?>][<?php echo
$language_id; ?>]"><?php echo
$this->escape(@$translation->$fieldName->value);
?></textarea></dd>
<?php
				}
				if($this->fields[$fieldName]->field_type == 'text'
&&
@$this->fields[$fieldName]->field_options['translatable']
== 1) { ?>
					<dt class="hikamarket_product_field_<?php echo $fieldName;
?>"><label><?php echo
$this->fieldsClass->getFieldName($oneExtraField);
?></label></dt>
					<dd class="hikamarket_product_field_<?php echo $fieldName;
?>"><input type="text" size="45"
name="translation[<?php echo $fieldName; ?>][<?php echo
$language_id; ?>]" value="<?php echo
$this->escape(@$translation->$fieldName->value); ?>"
/></dd>
<?php
				}
				if($this->fields[$fieldName]->field_type == 'wysiwyg'
&&
@$this->fields[$fieldName]->field_options['translatable']
== 1) { ?>
					<div class="hikamarket_product_field_wysiwyg_<?php echo
$fieldName; ?>_title"><?php echo
$this->fieldsClass->getFieldName($oneExtraField); ?></div>
					<div class="hikamarket_product_field_wysiwyg_<?php echo
$fieldName; ?>"><?php
						$this->editor->name = 'translation_' . $fieldName .
'_' . $language_id;
						$this->editor->content =
@$translation->$fieldName->value;
						echo $this->editor->display();
						?><div style="clear:both"></div>
					</div>
<?php
				}
			}
		}

		if(hikamarket::acl('product/edit/description') &&
$this->config->get('front_small_editor')) { ?>
					<dt
class="hikamarket_product_description"><label><?php
echo JText::_('PRODUCT_DESCRIPTION');
?></label></dt>
					<dd class="hikamarket_product_description"><div
class="hikam_options_nl"></div><?php
						$this->editor->name =
'translation_product_description_' . $language_id;
						$this->editor->content =
@$translation->product_description->value;
						echo $this->editor->display();
					?><div style="clear:both"></div></dd>
<?php } ?>
				</dl>
			</td>
		</tr>
<?php if(hikamarket::acl('product/edit/description')
&& !$this->config->get('front_small_editor')) {
?>
		<tr>
			<td><?php
				$this->editor->name =
'translation_product_description_' . $language_id;
				$this->editor->content =
@$translation->product_description->value;
				echo $this->editor->display();
			?><div style="clear:both"></div></td>
		</tr>
<?php } ?>
	</table>
<?php
	}
}
?>
	<input type="hidden" name="cid[]"
value="<?php echo @$this->product->product_id; ?>"
/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task" value=""
/>
	<input type="hidden" name="ctrl"
value="product" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
views/productmarket/tmpl/file.php000064400000013010151166607750013202
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><fieldset>
	<div class="toolbar" id="toolbar"
style="float: right;">
		<button class="hikabtn" type="button"
onclick="hikamarket.submitform('addfile','hikamarket_form');">
			<img style="vertical-align:middle" src="<?php echo
HIKASHOP_IMAGES; ?>save.png"/> <?php echo
JText::_('OK'); ?>
		</button>
	</div>
</fieldset>
<form action="<?php echo
hikamarket::completeLink('product&task=file'); ?>"
method="post" name="hikamarket_form"
id="hikamarket_form" enctype="multipart/form-data">

<dl class="hikam_options">
	<dt>
		<label for="data_file_file_name"><?php echo
JText::_('HIKA_NAME'); ?></label>
	</dt>
	<dd>
		<input type="text" name="data[file][file_name]"
id="data_file_file_name" value="<?php echo
$this->escape(@$this->element->file_name); ?>"/>
	</dd>
<?php
	if(empty($this->element->file_path)) {
		if(hikamarket::acl('product/edit/files/upload')) {
?>
	<dt>
		<label for="datafilemode"><?php echo
JText::_('HIKA_FILE_MODE'); ?></label>
	</dt>
	<dd><?php
		$values = array(
			JHTML::_('select.option', 'upload',
JText::_('HIKA_FILE_MODE_UPLOAD')),
			JHTML::_('select.option', 'path',
JText::_('HIKA_FILE_MODE_PATH'))
		);
		echo JHTML::_('hikaselect.genericlist', $values,
"data[filemode]", 'class="inputbox"
size="1"
onchange="hikamarket_filemode_switch(this);"',
'value', 'text', 'upload');
	?></dd>
<script type="text/javascript">
function hikamarket_filemode_switch(el) {
	var d = document, m = null,
		blocks =
d.querySelectorAll('[data-section="filemode"]');
	blocks.forEach(function(b){
		m = b.getAttribute('data-filemode');
		b.style.display = (m == el.value) ? '' : 'none';
	});
}
window.hikashop.ready(function(){
	var el = document.getElementById('datafilemode');
	if(el) hikamarket_filemode_switch(el);
});
</script>

	<dt data-section="filemode"
data-filemode="path">
		<label for="data_file_file_path"><?php echo
JText::_('HIKA_PATH'); ?></label>
	</dt>
	<dd data-section="filemode"
data-filemode="path">
		<input type="text" name="data[file][file_path]"
id="data_file_file_path" size="60"
style="width:100%" value=""/>
	</dd>

	<dt data-section="filemode"
data-filemode="upload">
		<label for=""><?php echo
JText::_('HIKA_FILE'); ?></label>
	</dt>
	<dd data-section="filemode"
data-filemode="upload">
		<input type="file" name="files[]"
size="30" /><br/>
		<?php echo
JText::sprintf('MAX_UPLOAD',(hikashop_bytes(ini_get('upload_max_filesize'))
> hikashop_bytes(ini_get('post_max_size'))) ?
ini_get('post_max_size') :
ini_get('upload_max_filesize')); ?>
	</dd>
<?php
		}
	} else {
?>
	<dt>
		<label for="data_file_file_path"><?php echo
JText::_('FILENAME'); ?></label>
	</dt>
	<dd>
<?php
		if(hikamarket::acl('product/edit/files/upload')) {
?>
		<input type="text" name="data[file][file_path]"
id="data_file_file_path" size="60"
style="width:100%" value="<?php echo
$this->escape($this->element->file_path); ?>"/>
<?php
		} else {
			echo '<span
class="hikam_raw_filename">'.$this->escape($this->element->file_path).'</span>';
		}
?>
	</dd>
<?php
	}
?>
<?php if(hikamarket::acl('product/edit/files/limit')) { ?>
	<dt>
		<label for="data_file_file_limit"><?php echo
JText::_('DOWNLOAD_NUMBER_LIMIT'); ?></label>
	</dt>
	<dd>
<?php
	$file_limit = (isset($this->element->file_limit) ?
($this->element->file_limit < 0 ? JText::_('UNLIMITED')
: (int)$this->element->file_limit) : '');
?>
		<input type="text" name="data[file][file_limit]"
id="data_file_file_limit" value="<?php echo $file_limit;
?>"/>
		<p>
			0: <?php echo JText::_('DEFAULT_PARAMS_FOR_PRODUCTS');?>
(<?php echo
$this->shopConfig->get('download_number_limit');?>)<br/>
			-1: <?php echo JText::_('UNLIMITED');?><br/>
		</p>
	</dd>
<?php } ?>
<?php if(hikamarket::acl('product/edit/files/free')) { ?>
	<dt>
		<label for="data_file_file_free_download"><?php echo
JText::_('FREE_DOWNLOAD'); ?></label>
	</dt>
	<dd><?php
		if(empty($this->element))
			$this->element = new stdClass();
		if(!isset($this->element->file_free_download))
			$this->element->file_free_download =
$this->config->get('upload_file_free_download', 0);
		echo
$this->radioType->booleanlist('data[file][file_free_download]',
'', $this->element->file_free_download);
	?></dd>
<?php } ?>
<?php if(hikamarket::acl('product/edit/files/description')) {
?>
	<dt>
		<label for="data_file_file_description"><?php echo
JText::_('HIKA_DESCRIPTION'); ?></label>
	</dt>
	<dd>
		<textarea name="data[file][file_description]"
id="data_file_file_description"><?php echo
$this->escape(@$this->element->file_description);
?></textarea>
	</dd>
<?php } ?>
	</table>
	<div class="clr"></div>
	<input type="hidden" name="data[file][file_type]"
value="file" />
	<input type="hidden" name="data[file][file_ref_id]"
value="<?php echo $this->product_id; ?>" />
	<input type="hidden" name="cid"
value="<?php echo @$this->cid; ?>" />
	<input type="hidden" name="pid"
value="<?php echo (int)$this->product_id; ?>" />
	<input type="hidden" name="id" value="<?php
echo hikaInput::get()->getInt('id');?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="task"
value="file" />
	<input type="hidden" name="ctrl"
value="product" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
views/productmarket/tmpl/form.php000064400000053137151166607750013244
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><script type="text/javascript">
window.productMgr = { cpt:{} };
window.hikashop.ready(function(){
	window.hikamarket.dlTitle('hikamarket_products_form');
	window.hikamarket.collapseTitles();
});
</script>
<form action="<?php echo
hikamarket::completeLink('product');?>"
method="post" name="hikamarket_form"
id="hikamarket_products_form"
enctype="multipart/form-data">
<?php if($this->aclEdit('variants')) { ?>
<div id="hikamarket_product_edition_header"
style="<?php if(empty($this->product->characteristics) ||
empty($this->product->product_id)) echo 'display:none;';
?>">
<?php
	if(!empty($this->product)) {
		$image =
$this->imageHelper->getThumbnail(@$this->product->images[0]->file_path,
array(50,50), array('default' => true));
		if($image->success)
			$image_url = $image->url;
		else
			$image_url = $image->path;
		unset($image);
?>
	<h3><img src="<?php echo $image_url; ?>"
alt=""
style="vertical-align:middle;margin-right:5px;"/><?php echo
$this->product->product_name; ?></h3>
	<ul class="hikam_tabs"
rel="tabs:hikamarket_product_edition_tab_">
		<li class="active"><a href="#product"
rel="tab:1" onclick="return
window.hikamarket.switchTab(this);"><?php echo
JText::_('PRODUCT'); ?></a></li>
		<li><a href="#variants" rel="tab:2"
onclick="return window.hikamarket.switchTab(this);"><?php
echo JText::_('VARIANTS'); ?><span
id="hikamarket_product_variant_label"></span></a></li>
	</ul>
	<div style="clear:both"></div>
<?php
	}
?>
</div>
<div id="hikamarket_product_edition_tab_1">
<?php } ?>

<div class="hk-row-fluid">
<?php if($this->aclEdit('images')) { ?>
	<div class="hkc-md-4"><?php
		echo $this->loadTemplate('image');
	?></div>
	<div class="hkc-md-8">
<?php } else { ?>
	<div class="hkc-md-12">
<?php } ?>
		<dl class="hikam_options">
<?php if($this->aclEdit('name')) { ?>
			<dt
class="hikamarket_product_name"><label><?php echo
JText::_('HIKA_NAME'); ?></label></dt>
			<dd class="hikamarket_product_name"><input
type="text" name="data[product][product_name]"
value="<?php echo
$this->escape(@$this->product->product_name);
?>"/></dd>
<?php } else { ?>
			<dt
class="hikamarket_product_name"><label><?php echo
JText::_('HIKA_NAME'); ?></label></dt>
			<dd class="hikamarket_product_name"><?php
				if(!empty($this->product->product_name))
					echo $this->product->product_name;
				else
					echo
'<em>'.JText::_('PRODUCT_NO_NAME').'</em>';
			?></dd>
<?php }

	if($this->aclEdit('code')) { ?>
			<dt
class="hikamarket_product_code"><label><?php echo
JText::_('PRODUCT_CODE'); ?></label></dt>
			<dd class="hikamarket_product_code"><input
type="text" name="data[product][product_code]"
value="<?php echo
$this->escape(@$this->product->product_code);
?>"/></dd>
<?php }

	if($this->aclEdit('quantity')) { ?>
			<dt
class="hikamarket_product_quantity"><label><?php echo
JText::_('PRODUCT_QUANTITY'); ?></label></dt>
			<dd class="hikamarket_product_quantity"><?php
				echo
$this->quantityType->display('data[product][product_quantity]',
@$this->product->product_quantity);
			?></dd>
<?php }

	if(@$this->product->product_type != 'variant' &&
$this->aclEdit('category')) { ?>
			<dt
class="hikamarket_product_category"><label><?php echo
JText::_('PRODUCT_CATEGORIES'); ?></label></dt>
			<dd class="hikamarket_product_category"><?php
		$categories = null;
		if(!empty($this->product->categories))
			$categories = array_keys($this->product->categories);
		echo $this->nameboxType->display(
			'data[product][categories]',
			$categories,
			hikamarketNameboxType::NAMEBOX_MULTIPLE,
			'category',
			array(
				'delete' => true,
				'sort' => true,
				'root' => $this->vendorCategories,
				'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
			)
		);
			?></dd>
<?php }

	if(@$this->product->product_type != 'variant' &&
$this->aclEdit('manufacturer')) {?>
			<dt
class="hikamarket_product_manufacturer"><label><?php
echo JText::_('MANUFACTURER'); ?></label></dt>
			<dd class="hikamarket_product_manufacturer"><?php
		echo $this->nameboxType->display(
			'data[product][product_manufacturer_id]',
			(int)@$this->product->product_manufacturer_id,
			hikamarketNameboxType::NAMEBOX_SINGLE,
			'brand',
			array(
				'delete' => true,
				'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
			)
		);
			?></dd>
<?php }

	if($this->aclEdit('published')) { ?>
			<dt
class="hikamarket_product_published"><label><?php
echo JText::_('HIKA_PUBLISHED'); ?></label></dt>
			<dd class="hikamarket_product_published"><?php
				echo
$this->radioType->booleanlist('data[product][product_published]',
'', @$this->product->product_published);
			?></dd>
<?php }

	if($this->aclEdit('translations')) {
		if(!empty($this->product->translations) &&
!empty($this->product->product_id)) { ?>
			<dt
class="hikamarket_product_translations"><label><?php
echo JText::_('HIKA_TRANSLATIONS');
?></label></dt>
			<dd class="hikamarket_product_translations"><?php
				foreach($this->product->translations as $language_id =>
$translation){
					$lngName = $this->translationHelper->getFlag($language_id);
					echo '<div
class="hikamarket_multilang_button">' .
						$this->popup->display(
							$lngName, strip_tags($lngName),
							hikamarket::completeLink('product&task=edit_translation&product_id='
.
@$this->product->product_id.'&language_id='.$language_id,
true),
							'hikamarket_product_translation_'.$language_id,
							760, 480, '', '', 'link'
						).
						'</div>';
				}
			?></dd>
<?php
		}
	}

	if(hikamarket::level(1) && $this->vendor->vendor_id == 1
&& hikamarket::acl('product/subvendor') &&
hikamarket::acl('product/edit/vendor')) {
?>
			<dt
class="hikamarket_product_vendor"><label><?php echo
JText::_('HIKA_VENDOR'); ?></label></dt>
			<dd class="hikamarket_product_vendor"><?php
		echo $this->nameboxType->display(
			'data[product][product_vendor_id]',
			(int)@$this->product->product_vendor_id,
			hikamarketNameboxType::NAMEBOX_SINGLE,
			'vendor',
			array(
				'delete' => true,
				'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>'
			)
		);
			?></dd>
<?php }
?>
		</dl>
	</div>
	<div class="hkc-md-12">
<?php
	if($this->aclEdit('description')) {
?>
	<div class="hikamarket_section_container
hikamarket_section_product_description">
		<h3 data-section-toggle="product_description"
class="hikamarket_section_toggle"><?php echo
JText::_('HIKA_DESCRIPTION'); ?></h3>
		<div id="hikamarket_section_product_description">
			<?php echo $this->editor->display(); ?>
			<div style="clear:both"></div>
		</div>
	</div>
<?php
	}

	if($this->aclEdit('price') ||
(@$this->product->product_type != 'variant' &&
($this->aclEdit('tax') ||
$this->aclEdit('msrp')))) {
?>
	<div class="hikamarket_section_container
hikamarket_section_product_prices">
		<h3 data-section-toggle="product_prices"
class="hikamarket_section_toggle"><?php echo
JText::_('PRICES_AND_TAXES'); ?></h3>
		<div id="hikamarket_section_product_prices">
<?php
		if($this->aclEdit('price')) {
			echo $this->loadTemplate('price');
		}

		if(@$this->product->product_type != 'variant' &&
($this->aclEdit('tax') ||
$this->aclEdit('msrp'))) {
?>
			<dl class="hikam_options">
<?php
			if(@$this->product->product_type != 'variant' &&
$this->aclEdit('tax')) { ?>
				<dt
class="hikamarket_product_tax"><label><?php echo
JText::_('TAXATION_CATEGORY'); ?></label></dt>
				<dd class="hikamarket_product_tax"><?php
					echo
$this->categoryType->display('data[product][product_tax_id]',
@$this->product->product_tax_id, 'tax');
				?></dd>
<?php
			}

			if(@$this->product->product_type != 'variant' &&
$this->aclEdit('msrp')) {
				$curr = '';
				$mainCurr =
$this->currencyClass->getCurrencies($this->main_currency_id,
$curr);
?>
				<dt
class="hikamarket_product_msrp"><label><?php echo
JText::_('PRODUCT_MSRP'); ?></label></dt>
				<dd class="hikamarket_product_msrp">
					<input type="text"
name="data[product][product_msrp]" value="<?php echo
$this->escape(@$this->product->product_msrp); ?>"/>
<?php echo
$mainCurr[$this->main_currency_id]->currency_symbol.'
'.$mainCurr[$this->main_currency_id]->currency_code;?>
				</dd>
<?php
			}
?>
			</dl>
<?php
		}
?>
		</div>
	</div>
<?php
	}

	if(!$this->is_variant_product &&
($this->aclEdit('characteristics') ||
$this->aclEdit('related') || (hikashop_level(1) &&
($this->aclEdit('options') ||
$this->aclEdit('bundles'))))) {
?>
	<div class="hikamarket_section_container
hikamarket_section_product_specifications">
		<h3 data-section-toggle="product_specifications"
class="hikamarket_section_toggle"><?php echo
JText::_('SPECIFICATIONS'); ?></h3>
		<div id="hikamarket_section_product_specifications">
			<dl class="hikam_options">
<?php
		if($this->aclEdit('characteristics')) { ?>
				<dt
class="hikamarket_product_characteristics"><label><?php
echo JText::_('CHARACTERISTICS'); ?></label></dt>
				<dd
class="hikamarket_product_characteristics"><?php
					echo $this->loadTemplate('characteristic');
				?></dd>
<?php
		}

		if($this->aclEdit('related')) { ?>
				<dt
class="hikamarket_product_related"><label><?php echo
JText::_('RELATED_PRODUCTS'); ?></label></dt>
				<dd class="hikamarket_product_related"><?php
			echo $this->nameboxType->display(
				'data[product][related]',
				@$this->product->related,
				hikamarketNameboxType::NAMEBOX_MULTIPLE,
				'product',
				array(
					'delete' => true,
					'sort' => true,
					'root' => $this->rootCategory,
					'allvendors' =>
(int)$this->config->get('related_all_vendors', 1),
					'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
				)
			);
				?></dd>
<?php
		}

		if(hikashop_level(1) && $this->aclEdit('options')) {
?>
				<dt
class="hikamarket_product_options"><label><?php echo
JText::_('OPTIONS'); ?></label></dt>
				<dd class="hikamarket_product_options"><?php
			echo $this->nameboxType->display(
				'data[product][options]',
				@$this->product->options,
				hikamarketNameboxType::NAMEBOX_MULTIPLE,
				'product',
				array(
					'delete' => true,
					'sort' => true,
					'root' => $this->rootCategory,
					'allvendors' =>
(int)$this->config->get('options_all_vendors', 0),
					'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
				)
			);
				?></dd>
<?php
		}

		if(hikashop_level(1) && $this->aclEdit('bundles')) {
?>
				<dt
class="hikamarket_product_bundles"><label><?php echo
JText::_('BUNDLED_PRODUCTS'); ?></label></dt>
				<dd class="hikamarket_product_bundles"><?php
					echo $this->loadTemplate('bundle');
				?></dd>
<?php
		}
?>
			</dl>
		</div>
	</div>
<?php
	}

	if(!$this->is_variant_product &&
($this->aclEdit('pagetitle') ||
$this->aclEdit('url') ||
$this->aclEdit('metadescription') ||
$this->aclEdit('keywords') ||
$this->aclEdit('alias') ||
$this->aclEdit('canonical') ||
$this->aclEdit('tags'))) {
?>
	<div class="hikamarket_section_container
hikamarket_section_product_seo">
		<h3 data-section-toggle="product_seo"
class="hikamarket_section_toggle"><?php echo
JText::_('SEO'); ?></h3>
		<div id="hikamarket_section_product_seo">
			<dl class="hikam_options">
<?php
		if($this->aclEdit('pagetitle')) { ?>
				<dt
class="hikamarket_product_pagetitle"><label><?php
echo JText::_('PAGE_TITLE'); ?></label></dt>
				<dd class="hikamarket_product_pagetitle"><input
type="text" class="fullrow" size="45"
name="data[product][product_page_title]" value="<?php
echo $this->escape(@$this->product->product_page_title);
?>" /></dd>
<?php
		}

		if($this->aclEdit('url')) { ?>
				<dt
class="hikamarket_product_url"><label><?php echo
JText::_('URL'); ?></label></dt>
				<dd class="hikamarket_product_url"><input
type="text" class="fullrow" size="45"
name="data[product][product_url]" value="<?php echo
$this->escape(@$this->product->product_url); ?>"
/></dd>
<?php
		}

		if($this->aclEdit('metadescription')) { ?>
				<dt
class="hikamarket_product_metadescription"><label><?php
echo JText::_('PRODUCT_META_DESCRIPTION');
?></label></dt>
				<dd
class="hikamarket_product_metadescription"><textarea
id="product_meta_description" class="fullrow"
cols="35" rows="2"
name="data[product][product_meta_description]"><?php echo
$this->escape(@$this->product->product_meta_description);
?></textarea></dd>
<?php
		}

		if($this->aclEdit('keywords')) { ?>
				<dt
class="hikamarket_product_keywords"><label><?php echo
JText::_('PRODUCT_KEYWORDS'); ?></label></dt>
				<dd class="hikamarket_product_keywords"><textarea
id="product_keywords" class="fullrow"
cols="35" rows="2"
name="data[product][product_keywords]"><?php echo
$this->escape(@$this->product->product_keywords);
?></textarea></dd>
<?php
		}

		if($this->aclEdit('alias')) { ?>
				<dt
class="hikamarket_product_alias"><label><?php echo
JText::_('HIKA_ALIAS'); ?></label></dt>
				<dd class="hikamarket_product_alias"><input
type="text" class="fullrow" size="45"
name="data[product][product_alias]" value="<?php echo
$this->escape(@$this->product->product_alias); ?>"
/></dd>
<?php
		}

		if($this->aclEdit('canonical')) { ?>
				<dt
class="hikamarket_product_canonical"><label><?php
echo JText::_('PRODUCT_CANONICAL');
?></label></dt>
				<dd class="hikamarket_product_canonical"><input
type="text" class="fullrow" size="45"
name="data[product][product_canonical]" value="<?php echo
$this->escape(@$this->product->product_canonical);
?>"/></dd>
<?php
		}

		if($this->aclEdit('tags')) {
			$tagsHelper = hikamarket::get('shop.helper.tags');
			if(!empty($tagsHelper) && $tagsHelper->isCompatible()) {
?>
				<dt
class="hikamarket_product_tags"><label><?php echo
JText::_('JTAG'); ?></label></dt>
				<dd class="hikamarket_product_tags"><?php
					$tags = $tagsHelper->loadTags('product',
$this->product);
					echo $tagsHelper->renderInput($tags, array('name' =>
'data[tags]', 'class' => 'inputbox'));
				?></dd>
<?php
			}
		}
?>
		</dl>
		</div>
	</div>
<?php
	}

	if($this->aclEdit('qtyperorder') ||
$this->aclEdit('saledates') ||
$this->aclEdit('warehouse') ||
$this->aclEdit('weight') ||
$this->aclEdit('volume') ||
($this->aclEdit('acl') && hikashop_level(2))) {
?>
	<div class="hikamarket_section_container
hikamarket_section_product_restrictions">
		<h3 data-section-toggle="product_restrictions"
class="hikamarket_section_toggle"><?php echo
JText::_('RESTRICTIONS_AND_DIMENSIONS'); ?></h3>
		<div id="hikamarket_section_product_restrictions">
			<dl class="hikam_options">
<?php
	if($this->aclEdit('qtyperorder')) {?>
				<dt
class="hikamarket_product_qtyperorder"><label><?php
echo JText::_('QUANTITY_PER_ORDER');
?></label></dt>
				<dd class="hikamarket_product_qtyperorder">
					<input type="text"
name="data[product][product_min_per_order]" value="<?php
echo (int)@$this->product->product_min_per_order; ?>"
/><?php
					echo ' ' . JText::_('HIKA_QTY_RANGE_TO'). '
';
					echo
$this->quantityType->display('data[product][product_max_per_order]',
@$this->product->product_max_per_order);
				?></dd>
<?php }

	if($this->aclEdit('saledates')) {?>
				<dt
class="hikamarket_product_salestart"><label><?php
echo JText::_('PRODUCT_SALE_DATES');
?></label></dt>
				<dd class="hikamarket_product_salestart"><?php
					echo JHTML::_('calendar',
hikamarket::getDate((@$this->product->product_sale_start?@$this->product->product_sale_start:''),'%Y-%m-%d
%H:%M'),
'data[product][product_sale_start]','product_sale_start','%Y-%m-%d
%H:%M',array('size' => '20'));
					echo ' <span class="calendar-separator">' .
JText::_('HIKA_RANGE_TO') . '</span> ';
					echo JHTML::_('calendar',
hikamarket::getDate((@$this->product->product_sale_end?@$this->product->product_sale_end:''),'%Y-%m-%d
%H:%M'),
'data[product][product_sale_end]','product_sale_end','%Y-%m-%d
%H:%M',array('size' => '20'));
				?></dd>
<?php }

	if($this->aclEdit('warehouse')) { ?>
				<dt
class="hikamarket_product_warehouse"><label><?php
echo JText::_('WAREHOUSE'); ?></label></dt>
				<dd class="hikamarket_product_warehouse"><?php
		echo $this->nameboxType->display(
			'data[product][product_warehouse_id]',
			(int)@$this->product->product_warehouse_id,
			hikamarketNameboxType::NAMEBOX_SINGLE,
			'warehouse',
			array(
				'delete' => true,
				'default_text' =>
'<em>'.JText::_('HIKA_NONE').'</em>',
			)
		);
				?></dd>
<?php }

	if($this->aclEdit('weight')) { ?>
				<dt
class="hikamarket_product_weight"><label><?php echo
JText::_('PRODUCT_WEIGHT'); ?></label></dt>
				<dd class="hikamarket_product_weight"><input
type="text" name="data[product][product_weight]"
value="<?php echo
$this->escape(@$this->product->product_weight);
?>"/><?php echo
$this->weight->display('data[product][product_weight_unit]',
@$this->product->product_weight_unit); ?></dd>
<?php }

	if($this->aclEdit('volume')) { ?>
				<dt
class="hikamarket_product_volume"><label><?php echo
JText::_('PRODUCT_VOLUME'); ?></label></dt>
				<dd class="hikamarket_product_volume">
					<div class="hkinput-group">
						<span class="hkinput-group-addon"><?php
							echo hikamarket::tooltip(JText::_('PRODUCT_LENGTH'),
'', '', '<i class="hk-icon-14
iconM-14-length"></i>', '', 0)
						?></span><input size="10"
class="hk-control" style="width:50px"
type="text" name="data[product][product_length]"
value="<?php echo
$this->escape(@$this->product->product_length); ?>"/>
					</div>
					<div class="hkinput-group">
						<span class="hkinput-group-addon"><?php
							echo hikamarket::tooltip(JText::_('PRODUCT_WIDTH'),
'', '', '<i class="hk-icon-14
iconM-14-width"></i>', '', 0);
						?></span><input size="10"
class="hk-control" style="width:50px"
type="text" name="data[product][product_width]"
value="<?php echo
$this->escape(@$this->product->product_width); ?>"/>
					</div>
					<div class="hkinput-group">
						<span class="hkinput-group-addon"><?php
							echo hikamarket::tooltip(JText::_('PRODUCT_HEIGHT'),
'', '', '<i class="hk-icon-14
iconM-14-height"></i>', '', 0);
						?></span><input size="10"
class="hk-control" style="width:50px"
type="text" name="data[product][product_height]"
value="<?php echo
$this->escape(@$this->product->product_height); ?>"/>
					</div>
					<?php echo
$this->volume->display('data[product][product_dimension_unit]',
@$this->product->product_dimension_unit);?>
				</dd>
<?php }

	if(hikashop_level(2) && $this->aclEdit('acl')) {
?>
			<dt class="hikamarket_product_acl"><label><?php
echo JText::_('ACCESS_LEVEL'); ?></label></dt>
			<dd class="hikamarket_product_acl"><?php
				$product_access = 'all';
				if(isset($this->product->product_access))
					$product_access = $this->product->product_access;
				echo
$this->joomlaAcl->display('data[product][product_access]',
$product_access, true, true);
			?></dd>
<?php }
?>
			</dl>
		</div>
	</div>
<?php } ?>
<?php
	if($this->aclEdit('files')) {
?>
	<div class="hikamarket_section_container
hikamarket_section_product_files">
		<h3 data-section-toggle="product_files"
class="hikamarket_section_toggle"><?php echo
JText::_('FILES'); ?></h3>
		<div id="hikamarket_section_product_files">
<?php
		echo $this->loadTemplate('file');
?>
		</div>
	</div>
<?php
	}
?>
<?php
	if($this->aclEdit('customfields')) {
		if(!empty($this->fields)) {
?>
	<div class="hikamarket_section_container
hikamarket_section_product_fields">
		<h3 data-section-toggle="product_fields"
class="hikamarket_section_toggle"><?php echo
JText::_('FIELDS'); ?></h3>
		<div id="hikamarket_section_product_fields">
<?php
			foreach($this->fields as $fieldName => $oneExtraField) {
?>
		<dl id="hikashop_product_<?php echo $fieldName; ?>"
class="hikam_options">
			<dt class="hikamarket_product_<?php echo $fieldName;
?>"><?php echo
$this->fieldsClass->getFieldName($oneExtraField); ?></dt>
			<dd class="hikamarket_product_<?php echo $fieldName;
?>"><?php
				$onWhat = 'onchange';
				if($oneExtraField->field_type == 'radio')
					$onWhat = 'onclick';
				echo $this->fieldsClass->display($oneExtraField,
@$this->product->$fieldName,
'data[product]['.$fieldName.']', false, '
'.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'product\',0);"');
			?></dd>
		</dl>
<?php
			}
?>
		</div>
	</div>
<?php
		}
	}

	if($this->aclEdit('plugin')) {
		$html = array();
		JPluginHelper::importPlugin('hikashop');
		JPluginHelper::importPlugin('hikamarket');
		JFactory::getApplication()->triggerEvent('onMarketProductBlocksDisplay',
array(&$this->product, &$html));

		foreach($html as $h) {
			echo $h;
		}
	}
?>
	</div>
</div>
<?php if($this->aclEdit('variants')) { ?>
</div>
<div id="hikamarket_product_edition_tab_2"
style="display:none;">
	<div id="hikamarket_product_variant_list"><?php
		echo $this->loadTemplate('variants');
	?></div>
	<div id="hikamarket_product_variant_edition">
	</div>
</div>
<?php } ?>
<?php if(!empty($this->product->product_type) &&
$this->product->product_type == 'variant' &&
!empty($this->product->product_parent_id)) { ?>
	<input type="hidden"
name="data[product][product_type]" value="<?php echo
$this->product->product_type; ?>"/>
	<input type="hidden"
name="data[product][product_parent_id]" value="<?php echo
(int)$this->product->product_parent_id; ?>"/>
<?php } ?>
	<input type="hidden" name="cancel_action"
value="<?php echo @$this->cancel_action; ?>"/>
	<input type="hidden" name="cancel_url"
value="<?php echo @$this->cancel_url; ?>"/>
	<input type="hidden" name="cid[]"
value="<?php echo @$this->product->product_id;
?>"/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
	<input type="hidden" name="task"
value=""/>
	<input type="hidden" name="ctrl"
value="product"/>
	<?php echo JHTML::_('form.token'); ?>
</form>
views/productmarket/tmpl/form_bundle.php000064400000010446151166607750014571
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><table id="hikamarket_product_characteristics_table"
class="adminlist table table-striped table-bordered
table-condensed" style="width:100%">
	<thead>
		<tr>
			<th class="title"><?php
				echo JText::_('HIKA_NAME');
			?></th>
			<th class="title"><?php
				echo JText::_('PRODUCT_QUANTITY');
			?></th>
			<th style="width:40px;text-align:center">
				<a class="hikabtn hikabtn-success hikabtn-mini"
href="#" onclick="return
window.productMgr.newBundle();"><i class="fas
fa-plus"></i></a>
			</th>
		</tr>
	</thead>
	<tfoot>
		<tr id="hikamarket_bundle_add_zone"
style="display:none;">
			<td colspan="3">
<dl>
	<dt><?php echo JText::_('PRODUCT_NAME');
?></dt>
	<dd><?php
		echo $this->nameboxType->display(
			null,
			null,
			hikamarketNameboxType::NAMEBOX_SINGLE,
			'product',
			array(
				'id' => 'hikamarket_bundle_nb_add',
				'root' => $this->rootCategory,
				'allvendors' => 0,
				'variants' => true,
				'default_text' => 'PLEASE_SELECT',
			)
		);
	?></dd>
	<dt><?php echo JText::_('PRODUCT_QUANTITY');
?></dt>
	<dd>
		<input type="text" size="5"
style="width:70px;" id="hikamarket_bundle_qty_add"
name="" value="1"/>
	</dd>
</dl>
<div style="float:right">
	<button onclick="return window.productMgr.addBundle();"
class="hikabtn hikabtn-success"><i class="fas
fa-check"></i> <?php echo JText::_('HIKA_SAVE');
;?></button>
</div>
<button onclick="return window.productMgr.cancelNewBundle();"
class="hikabtn hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
<div style="clear:both"></div>
			</td>
		</tr>
	</tfoot>
	<tbody>
<?php
	$k = 0;
	if(!empty($this->product->bundle)) {
		foreach($this->product->bundle as $bundle) {
			$pid = (int)$bundle->product_related_id;
?>
		<tr class="row<?php echo $k ?>">
			<td><?php
				$desc = JText::_('PRODUCT_ID') . ': ' . $pid;
				echo hikamarket::tooltip($desc, $bundle->product_name, '',
$bundle->product_name);
			?></td>
			<td>
				<input type="text" size="5"
style="width:70px;" name="data[product][bundle][<?php
echo $pid; ?>]" value="<?php echo
max((int)$bundle->product_related_quantity, 1); ?>"/>
			</td>
			<td style="text-align:center">
				<a href="#delete"
onclick="window.hikashop.deleteRow(this); return false;"><i
class="fas fa-trash-alt"></i></a>
			</td>
		</tr>
<?php
			$k = 1 - $k;
		}
	}
?>
		<tr id="hikamarket_bundle_row_template"
class="row<?php echo $k ?>"
style="display:none;">
			<td>{NAME}</td>
			<td>
				<input type="text" size="5"
style="width:70px;" name="{INPUT_NAME}"
value="{VALUE}"/>
			</td>
			<td style="text-align:center">
				<a href="#delete"
onclick="window.hikashop.deleteRow(this); return false;"><i
class="fas fa-trash-alt"></i></a>
			</td>
		</tr>
	</tbody>
</table>
<script type="text/javascript">
window.productMgr.newBundle = function() {
	var w = window, d = document, el = null;
	w.oNameboxes['hikamarket_bundle_nb_add'].clear();
	el = d.getElementById('hikamarket_bundle_qty_add');
	if(el) el.value = '1';
	el = d.getElementById('hikamarket_bundle_add_zone');
	if(el) el.style.display = '';
	return false;
};
window.productMgr.cancelNewBundle = function() {
	var w = window, d = document, o = w.Oby;
	var el = d.getElementById('hikamarket_bundle_add_zone');
	if(el) el.style.display = 'none';
	return false;
};
window.productMgr.addBundle = function() {
	var w = window, d = document, o = w.Oby, c = null, cv = null, ct = null,
		el = d.getElementById('hikamarket_bundle_nb_add_valuehidden');
	if(el) {
		c = parseInt(el.value);
		el = d.getElementById('hikamarket_bundle_nb_add_valuetext');
		if(el) ct = el.innerHTML;
	}
	el = d.getElementById('hikamarket_bundle_qty_add');
	if(el) cv = parseInt(el.value);

	if(c === null || isNaN(c) || c === 0 || isNaN(cv) || cv === 0)
		return false;

	var htmlblocks = { NAME: ct, ID: c, INPUT_NAME:
'data[product][bundle][' + c + ']', VALUE: cv };
	w.hikashop.dupRow('hikamarket_bundle_row_template',
htmlblocks);
	w.productMgr.cancelNewBundle();
	return false;
};
</script>
views/productmarket/tmpl/form_characteristic.php000064400000022772151166607750016315
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><table id="hikamarket_product_characteristics_table"
class="adminlist table table-striped table-bordered"
style="width:100%">
	<thead>
		<tr>
			<th style="width:1%"></th>
			<th class="title"><?php
				echo JText::_('HIKA_NAME');
			?></th>
			<th style="width:40px;text-align:center">
				<a class="hikabtn hikabtn-success hikabtn-mini"
href="#" onclick="return
window.productMgr.newCharacteristic();"><i class="fas
fa-plus"></i></a>
			</th>
		</tr>
	</thead>
	<tfoot>
		<tr id="hikamarket_characteristic_add_zone"
style="display:none;">
			<td colspan="3">
				<dl>
					<dt><?php echo JText::_('HIKAM_CHARACTERISTIC');
?></dt>
					<dd><?php
	echo $this->nameboxVariantType->display(
		null,
		null,
		hikamarketNameboxType::NAMEBOX_SINGLE,
		'characteristic',
		array(
			'id' => 'hikamarket_characteristic_nb_add',
			'add' => true,
			'displayFormat' => '{characteristic_value} -
{characteristic_alias}',
			'vendor' => @$this->vendor->vendor_id,
			'default_text' => 'PLEASE_SELECT'
		)
	);
					?></dd>
					<dt><?php echo
JText::_('HIKAM_CHARACTERISTIC_DEFAULT_VALUE'); ?></dt>
					<dd><?php
	echo $this->nameboxVariantType->display(
		null,
		null,
		hikamarketNameboxType::NAMEBOX_SINGLE,
		'characteristic_value',
		array(
			'id' => 'hikamarket_characteristic_nb_def',
			'add' => true,
			'vendor' => @$this->vendor->vendor_id,
			'url_params' => array('ID' => -1),
			'default_text' => 'PLEASE_SELECT'
		)
	);
					?></dd>
				</dl>
				<div style="float:right">
					<button onclick="return
window.productMgr.addCharacteristic();" class="hikabtn
hikabtn-success"><i class="fas fa-check"></i>
<?php echo JText::_('HIKA_SAVE'); ;?></button>
				</div>
				<button onclick="return
window.productMgr.cancelNewCharacteristic();" class="hikabtn
hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
				<div style="clear:both"></div>
			</td>
		</tr>
	</tfoot>
	<tbody>
<?php
$k = 0;
$current_characteristics = array();
if(empty($this->product->characteristics))
	$this->product->characteristics = array();
foreach($this->product->characteristics as $characteristic) {
	if((int)$characteristic->characteristic_parent_id > 0)
		continue;

	$current_characteristics[] = (int)$characteristic->characteristic_id;
?>
		<tr class="row<?php echo $k ?>">
			<td class="hikam_column_move"><i class="fas
fa-arrows-alt-v"></i></td>
			<td><?php
				echo $characteristic->characteristic_value;
				if(!empty($characteristic->characteristic_alias))
					echo ' - ' . $characteristic->characteristic_alias;
			?></td>
			<td style="text-align:center">
				<a href="#delete" onclick="return
window.productMgr.deleteCharacteristic(this, <?php echo
(int)$characteristic->characteristic_id; ?>); return
false;"><i class="fas
fa-trash-alt"></i></a>
				<input type="hidden"
name="data[characteristics][]" value="<?php echo
(int)$characteristic->characteristic_id; ?>"/>
<?php
	if(empty($this->product->product_id)) {
		foreach($this->product->characteristics as $c) {
			if((int)$c->characteristic_parent_id !=
(int)$characteristic->characteristic_id)
				continue;
?>				<input type="hidden"
name="data[characteristics][]" value="<?php echo
(int)$c->characteristic_id; ?>"/>
<?php
		}
	}
?>
			</td>
		</tr>
<?php
	$k = 1 - $k;
}
?>
		<tr id="hikamarket_characteristic_row_template"
class="row<?php echo $k ?>"
style="display:none;">
			<td class="hikam_column_move"><i class="fas
fa-arrows-alt-v"></i></td>
			<td>{NAME}</td>
			<td style="text-align:center">
				<a href="#delete" onclick="return
window.productMgr.deleteCharacteristic(this, {ID}); return
false;"><i class="fas
fa-trash-alt"></i></a>
				<input type="hidden" name="{INPUT_NAME}"
value="{ID}"/>
				<input type="hidden" name="{INPUT_NAME_2}"
value="{ID_2}"/>
			</td>
		</tr>
	</tbody>
</table>
<script type="text/javascript">
window.productMgr.current_characteristics = [<?php echo
implode(',', $current_characteristics); ?>];
window.productMgr.addCharacteristic = function() {
	var w = window, d = document, o = w.Oby, c = null, cv = null, ct = null,
		el =
d.getElementById('hikamarket_characteristic_nb_add_valuehidden');

	if(el) {
		c = parseInt(el.value);
		el =
d.getElementById('hikamarket_characteristic_nb_add_valuetext');
		if(el)
			ct = el.innerHTML;
	}
	if(isNaN(c) || c === 0) c = null;

	el =
d.getElementById('hikamarket_characteristic_nb_def_valuehidden')
	if(el) cv = parseInt(el.value);
	if(isNaN(cv) || cv === 0) cv = null;

	if(c <= 0  || c === null || cv <= 0 || cv === null)
		return false;

	var htmlblocks = {
		NAME: ct, ID: c, INPUT_NAME: 'data[characteristics][]',
		INPUT_NAME_2: 'data[characteristics][]', ID_2: cv
	};

<?php
	if((int)$this->product->product_id > 0) {
?>
	var url = '<?php echo
hikamarket::completeLink('product&task=characteristic&subtask=add&product_id='.(int)$this->product->product_id,true,false,true);
?>',
		formData = encodeURI('characteristic_id') + '=' +
encodeURIComponent(c) + '&' +
encodeURI('characteristic_value_id') + '=' +
encodeURIComponent(cv) + '&' + encodeURI('<?php echo
hikamarket::getFormToken(); ?>') + '=1';
	o.xRequest(url, {mode:'POST',data:formData}, function(x,p) {
		var ret = parseInt(x.responseText);
		if(ret === NaN || ret <= 0)
			return;
		htmlblocks.INPUT_NAME_2 = '';
		htmlblocks.ID_2 = '';
		w.hikamarket.dupRow('hikamarket_characteristic_row_template',
htmlblocks);
		var el =
d.getElementById('hikamarket_product_edition_header');
		if(el && el.style.display == 'none')
			el.style.display = '';
		if(window.productMgr.refreshVariantList)
			window.productMgr.refreshVariantList();
	});
<?php } else { ?>
	w.hikamarket.dupRow('hikamarket_characteristic_row_template',
htmlblocks);
<?php } ?>

	w.productMgr.cancelNewCharacteristic();
	w.productMgr.current_characteristics[w.productMgr.current_characteristics.length]
= c;
	return false;
};
window.productMgr.deleteCharacteristic = function(el, id) {
	var w = window, d = document, o = w.Oby;
	if(!confirm('<?php echo str_replace('\'',
'\\\'', JText::_('PLEASE_CONFIRM_DELETION'));
?>'))
		return false;

<?php
	if((int)$this->product->product_id > 0) {
?>
	var url = '<?php echo
hikamarket::completeLink('product&task=characteristic&subtask=remove&product_id='.(int)$this->product->product_id,true,false,true);
?>',
		formData = encodeURI('characteristic_id') + '=' +
encodeURIComponent(id) + '&' + encodeURI('<?php echo
hikamarket::getFormToken(); ?>') + '=1';
	o.xRequest(url, {mode:'POST',data:formData}, function(x,p) {
		if(x.responseText == '0') {
			var el =
d.getElementById('hikamarket_product_edition_header');
			if(el && el.style.display == '')
				el.style.display = 'none';
		}
		if(w.productMgr.refreshVariantList)
			w.productMgr.refreshVariantList();
	});
<?php } ?>

	if(w.oNameboxes['hikamarket_characteristic_nb_add'] &&
w.oNameboxes['hikamarket_characteristic_nb_add'].content)
		w.oNameboxes['hikamarket_characteristic_nb_add'].content.unblock(id);
	for(var i = w.productMgr.current_characteristics.length - 1; i >= 0;
i--) {
		if(w.productMgr.current_characteristics[i] &&
w.productMgr.current_characteristics[i] == id) {
			delete w.productMgr.current_characteristics[i];
			break;
		}
	}

	w.hikamarket.deleteRow(el);
	return false;
};
window.productMgr.newCharacteristic = function() {
	var w = window, d = document;
	w.oNameboxes['hikamarket_characteristic_nb_add'].clear();
	w.oNameboxes['hikamarket_characteristic_nb_add'].content.config.hideBlocked
= true;
	w.oNameboxes['hikamarket_characteristic_nb_add'].content.block(w.productMgr.current_characteristics);
	var el =
d.getElementById('hikamarket_characteristic_add_zone');
	if(el) el.style.display = '';
	return false;
};
window.productMgr.cancelNewCharacteristic = function() {
	var w = window, d = document, o = w.Oby;
	var el =
d.getElementById('hikamarket_characteristic_add_zone');
	if(el) el.style.display = 'none';
	el = d.getElementById('hikamarket_characteristic_add_list');
	if(el) setTimeout(function() { el.innerHTML = ''; }, 10);
	return false;
};
window.Oby.ready(function() {
	var w = window, ona = 'hikamarket_characteristic_nb_add', onv =
'hikamarket_characteristic_nb_def',
		u = '<?php echo
hikamarket::completeLink('characteristic&task=findList&characteristic_type=value&characteristic_parent_id={ID}&search=SEARCH',
true, false, true); ?>',
		a = '<?php echo
hikamarket::completeLink('characteristic&task=addCharacteristic&characteristic_type=value&characteristic_parent_id={ID}&tmpl=json&'.hikamarket::getFormToken().'=1',
false, false, true); ?>';
	if(!w.oNameboxes[ona] || !w.oNameboxes[onv])
		return;
	w.oNameboxes[ona].register('set', function(e) {
		if(e.value) {
			w.oNameboxes[onv].changeUrl(u.replace('{ID}', e.value), {add:
a.replace('{ID}', e.value)});
		} else {
			w.oNameboxes[onv].loadData(null);
			w.oNameboxes[onv].clear();
		}
	});

	hkjQuery("#hikamarket_product_characteristics_table
tbody").sortable({
		axis: "y", cursor: "move", opacity: 0.8,
		helper: function(e, ui) {
			ui.children().each(function() {
				hkjQuery(this).width(hkjQuery(this).width());
			});
			return ui;
		},
		stop: function(event, ui) {
			window.hikamarket.cleanTableRows('hikamarket_product_characteristics_table');
		}
	});
});
</script>
views/productmarket/tmpl/form_file.php000064400000011272151166607760014236
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$ajax = false;
if(!empty($this->upload_ajax))
	$ajax = true;
$product_type = ((!empty($this->params->product_type) &&
$this->params->product_type == 'variant') ||
!empty($this->editing_variant)) ? 'variant' :
'product';
$upload = $this->aclEdit('files/upload');
$options = array(
	'classes' => array(
		'mainDiv' => 'hikamarket_main_file_div',
		'contentClass' => 'hikamarket_product_files',
		'btn_add' => 'fas fa-plus',
		'btn_upload' => 'fas fa-upload'
	),
	'upload' => $upload,
	'upload_base_url' =>
'index.php?option=com_hikamarket&ctrl=upload',
	'toolbar' => array(
		$this->popup->display(
			'<span class="fas fa-plus"></span>',
			'MARKET_ADD_FILE',
			hikamarket::completeLink('product&task=file&pid='.$this->product->product_id,true),
			'hikamarket_file_add',
			750, 460, 'class="hikabtn hikabtn-primary"
onclick="return window.productMgr.addFile(this,
'.(int)$this->product->product_id.',\''.$product_type.'\');"',
'', 'link'
		)
	),
	'tooltip' => true,
	'text' => ($upload ?
JText::_('HIKAM_PRODUCT_FILES_EMPTY_UPLOAD') :
JText::_('HIKAM_PRODUCT_FILES_EMPTY')),
	'uploader' => array('product',
'product_file'),
	'vars' => array(
		'product_id' => $this->product->product_id,
		'product_type' => $product_type,
		'file_type' => 'file'
	),
	'ajax' => $ajax
);

$content = array();
if(!empty($this->product->files)) {
	foreach($this->product->files as $k => $file) {
		$file->product_id = $this->product->product_id;
		$file->product_type = $product_type;
		$this->params = $file;
		$content[] = $this->loadTemplate('file_entry');
	}
}

if(empty($this->editing_variant))
	echo
$this->uploaderType->displayFileMultiple('hikamarket_product_file',
$content, $options);
else
	echo
$this->uploaderType->displayFileMultiple('hikamarket_product_variant_file',
$content, $options);

if(empty($this->editing_variant))
	echo
$this->popup->display('','MARKET_FILE','','hikamarket_product_file_edit',750,
460,'', '', 'link');
else
	echo
$this->popup->display('','MARKET_FILE','','hikamarket_product_variant_file_edit',750,
460,'', '', 'link');

?>
<script type="text/javascript">
window.productMgr.addFile = function(el, pid, type) {
	var t = window.hikamarket;
	if(type === undefined || type == '') type =
'product';
	if(type == 'variant') type = 'product_variant';
	t.submitFct = function(data) {
		var o = window.Oby, d = document, c =
d.getElementById('hikamarket_'+type+'_file_content');
		if(data.cid) {
			var url = "<?php echo
hikamarket::completeLink('product&task=file_entry&pid=HIKAPID&cid=HIKACID',true);
?>";
			o.xRequest(
				url.replace('HIKAPID',pid).replace('HIKACID',data.cid),
				null,
				function(xhr,params){
					var myData = document.createElement('div');
					hkjQuery(myData).html(xhr.responseText);
					c.appendChild(myData);
					hkjQuery('#hikamarket_'+type+'_file_empty').hide();
				}
			);
		}
	};
	t.openBox(el);
	return false;
};
window.productMgr.editFile = function(el, id, pid, type) {
	var t = window.hikamarket, href = null, n = el;
	if(type === undefined || type == '') type =
'product';
	if(type == 'variant') type = 'product_variant';
	t.submitFct = function(data) {
		var o = window.Oby, c = el;
		while(c && !o.hasClass(c,
'hikamarket_'+type+'_file'))
			c = c.parentNode;
		if(c && data.cid) {
			var url = "<?php echo
hikamarket::completeLink('product&task=file_entry&pid=HIKAPID&cid=HIKACID',true);
?>";
			o.xRequest(
				url.replace('HIKAPID',
pid).replace('HIKACID',data.cid),
				null,
				function(xhr,params){
					var myData = document.createElement('div');
					hkjQuery(myData).html(xhr.responseText);
					c.parentNode.replaceChild(myData, c);
				}
			);
		}
	};
	if(el.getAttribute('rel') == null) {
		href = el.href;
		n = 'hikamarket_'+type+'_file_edit';
	}
	t.openBox(n,href,(el.getAttribute('rel') == null));
	return false;
};
window.productMgr.delFile = function(el, type) {
	if(!confirm('<?php echo
$this->escape(JText::_('PLEASE_CONFIRM_DELETION'));
?>')) return false;
	if(type === undefined || type == '') type =
'product';
	if(type == 'variant') type = 'product_variant';
	return
window.hkUploaderList['hikamarket_'+type+'_file'].delBlock(el);
};
window.hikashop.ready(function() {
	hkjQuery('#hikamarket_product<?php
if(!empty($this->editing_variant)) { echo '_variant'; }
?>_file_content').sortable({
		cursor: "move",
		placeholder: "ui-state-highlight",
		forcePlaceholderSize: true
	});
});
</script>
views/productmarket/tmpl/form_file_entry.php000064400000005064151166607760015461
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$type = (!empty($this->params->product_type) &&
$this->params->product_type == 'variant') ?
'variant' : 'product';
?><div class="hikamarket_product_file">
	<a href="#delete" class="deleteFile"
onclick="return window.productMgr.delFile(this, '<?php echo
$type; ?>');"><i class="fas
fa-trash-alt"></i></a>
<?php
	if(!empty($this->params->file_free_download)) {
		echo '';
	} else {
		echo '';
	}
?>
	<span class="file_name"
style="white-space:nowrap"><?php
		if(empty($this->params->file_id))
			$this->params->file_id = 0;
		if(empty($this->params->file_name))
			$this->params->file_name = '<em>' .
JText::_('HIKA_NONE') . '</em>';

		echo $this->popup->display(
			$this->params->file_name,
			'MARKET_FILE',
			hikamarket::completeLink('product&task=file&cid='.$this->params->file_id.'&pid='.$this->params->product_id,true),
			'',
			750, 460, 'onclick="return window.productMgr.editFile(this,
'.$this->params->file_id.',
'.$this->params->product_id.',
\''.$type.'\');"', '',
'link'
		);
	?></span><br/>
	<span class="file_path_text"><?php echo
JText::_('FILENAME');?>:&nbsp;</span><span
class="file_path"><?php
		if($this->vendor->vendor_id > 1) {
			$start = 'vendor' . $this->vendor->vendor_id;
			if(substr($this->params->file_path, 0, strlen($start)) == $start)
				$this->params->file_path = substr($this->params->file_path,
strlen($start)+1);
		}
		echo hikamarket::limitString($this->params->file_path, 24,
'...', true);
	?></span><br/>
	<span class="file_limit_text"><?php echo
JText::_('DOWNLOADS');?>: </span><span
class="file_limit"><?php
		if($this->vendor->vendor_id <= 1)
			echo (int)@$this->params->download_number . ' / ';

		if(!isset($this->params->file_limit) ||
(int)$this->params->file_limit == 0)
			echo
'<em>'.$this->shopConfig->get('download_number_limit').'</em>';
		else if((int)$this->params->file_limit > 0)
			echo $this->params->file_limit;
		else
			echo JText::_('UNLIMITED');
	?></span><br/>
	<span class="file_free_text"><?php echo
JText::_('FREE_DOWNLOAD');?>: </span><span
class="file_free"><?php
		echo ( !empty($this->params->file_free_download) ?
JText::_('JYES') : JText::_('JNO') );
	?></span>
	<input type="hidden" name="data[<?php echo $type;
?>][product_files][]" value="<?php echo
$this->params->file_id; ?>"/>
</div>
views/productmarket/tmpl/form_image.php000064400000006450151166607760014403
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$ajax = false;
if(!empty($this->upload_ajax))
	$ajax = true;
$product_type = (@$this->params->product_type == 'variant'
|| @$this->product->product_type == 'variant') ?
'variant' : 'product';
$uploader_id = empty($this->editing_variant) ?
'hikamarket_product_image' :
'hikamarket_product_variant_image';

$upload = $this->aclEdit('images/upload');
$options = array(
	'classes' => array(
		'mainDiv' => 'hikamarket_main_image_div',
		'contentClass' => 'hikamarket_product_images',
		'firstImg' =>
'hikamarket_product_main_image_thumb',
		'otherImg' => 'hikamarket_small_image_div',
		'btn_add' => 'fas fa-plus',
		'btn_upload' => 'fas fa-upload'
	),
	'upload' => $upload,
	'upload_base_url' =>
'index.php?option=com_hikamarket&ctrl=upload',
	'gallery' => $upload,
	'tooltip' => true,
	'text' => ($upload ?
JText::_('HIKAM_PRODUCT_IMAGES_EMPTY_UPLOAD') :
JText::_('HIKAM_PRODUCT_IMAGES_EMPTY')),
	'uploader' => array('product',
'product_image'),
	'vars' => array(
		'product_id' => $this->product->product_id,
		'product_type' => $product_type,
		'file_type' => 'product'
	),
	'buttons' => array(),
	'ajax' => $ajax
);

if($this->aclEdit('images/link')) {
	$options['buttons']['image_link' ] = array(
		'tooltip' => JText::_('HIKA_ENTER_IMAGE_PATH'),
		'class' => 'fas fa-link',
		'text' => 'HIKA_ENTER_IMAGE_PATH',
		'id' => $uploader_id.'_urlpopup',
		'url' =>
hikamarket::completeLink('product&task=image&image_link=1&pathonly=1&pid='.(int)$this->product->product_id,
true),
		'onclick' => 'return
window.hkUploaderList[\''.$uploader_id.'\'].genericButtonClick(this);',
	);
}

$content = array();
if(!empty($this->product->images)) {
	foreach($this->product->images as $k => $image) {
		$image->product_id = $this->product->product_id;
		$image->product_type = $product_type;
		$this->params = $image;
		$content[] = $this->loadTemplate('image_entry');
	}
}

echo $this->uploaderType->displayImageMultiple($uploader_id,
$content, $options);

echo
$this->popup->display('','MARKET_EDIT_IMAGE','','hikamarket_product_image_edit',750,
460,'', '', 'link');
?>
<script type="text/javascript">
window.productMgr.editImage = function(el, id, type) {
	var w = window, t = w.hikamarket, href = null, n = el;
	if(type === undefined || type == '') type =
'product';
	if(type == 'variant') type = 'product_variant';
	if(!w.hkUploaderList['hikamarket_'+type+'_image'])
return false;
	if(w.hkUploaderList['hikamarket_'+type+'_image'].imageClickBlocked)
return false; // Firefox trick
	t.submitFct = function(data) {};
	if(el.getAttribute('rel') == null) {
		href = el.href;
		n = 'hikamarket_product_image_edit';
	}
	t.openBox(n,href,(el.getAttribute('rel') == null));
	return false;
};
window.productMgr.delImage = function(el, type) {
	if(type === undefined || type == '') type =
'product';
	if(type == 'variant') type = 'product_variant';
	if(!window.hkUploaderList['hikamarket_'+type+'_image'])
return false;
	window.hkUploaderList['hikamarket_'+type+'_image'].delImage(el);
	return false;
};
</script>
views/productmarket/tmpl/form_image_entry.php000064400000003344151166607760015623
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$type = (!empty($this->params->product_type) &&
$this->params->product_type == 'variant') ?
'variant' : 'product';
?><a href="#delete" class="deleteImg"
onclick="return window.productMgr.delImage(this, '<?php echo
$type; ?>');"><i class="fas
fa-trash-alt"></i></a>
<div class="hikamarket_image">
<?php
	$size_x =
(int)$this->config->get('product_edition_image_x', 100);
	if($size_x <= 20) $size_x = 100;
	$size_y =
(int)$this->config->get('product_edition_image_y', 100);
	if($size_y <= 20) $size_y = 100;
	if(empty($this->params->file_id))
		$this->params->file_id = 0;
	$image =
$this->imageHelper->getThumbnail(@$this->params->file_path,
array($size_x, $size_y), array('default' => true));
	if(!empty($image) && $image->success) {
		$extra_data = '';
		if(!empty($image->external))
			$extra_data .= 'width="100"
height="100;"';

		$content = '<img src="'.$image->url.'"
alt="'.$image->filename.'"
'.$extra_data.'/>';
	} else {
		$content = '<img src=""
alt="'.@$this->params->file_name.'" />';
	}
	echo $this->popup->display(
		$content,
		'MARKET_IMAGE',
		hikamarket::completeLink('product&task=image&cid='.@$this->params->file_id.'&pid='.@$this->params->product_id,true),
		'',
		750, 460, 'onclick="return window.productMgr.editImage(this,
'.$this->params->file_id.',
\''.$type.'\');"', '',
'link'
	);
?>
</div><input type="hidden" name="data[<?php echo
$type; ?>][product_images][]" value="<?php echo
@$this->params->file_id;?>"/>
views/productmarket/tmpl/form_price.php000064400000022445151166607760014425
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$this->price_acls = array(
	'value' => $this->aclEdit('price/value'),
	'tax' => $this->aclEdit('price/tax') &&
!$this->shopConfig->get('floating_tax_prices', 0),
	'currency' => $this->aclEdit('price/currency')
&& (count($this->currencies) > 1),
	'quantity' => $this->aclEdit('price/quantity'),
	'acl' => hikashop_level(2) &&
$this->aclEdit('price/acl'),
	'user' => hikashop_level(2) &&
$this->aclEdit('price/user'),
	'date' => hikashop_level(2) &&
$this->aclEdit('price/date'),
);

if(!$this->price_acls['value'] &&
!$this->price_acls['tax'] &&
$this->aclEdit('price/tax') &&
$this->shopConfig->get('floating_tax_prices', 0))
	$this->price_acls['value'] = true;
if(!$this->price_acls['value'] &&
!$this->price_acls['tax'])
	return;

$show_minimal = (!$this->price_acls['currency'] &&
!$this->price_acls['quantity'] &&
!$this->price_acls['acl'] &&
!$this->price_acls['user']);
$form_key = empty($this->editing_variant) ? 'price' :
'variantprice';

if($show_minimal) {
	echo $this->loadTemplate('price_mini');
	return;
}

if(hikashop_level(2) && ($this->price_acls['acl'] ||
$this->price_acls['user'] ||
$this->price_acls['date'])) {
	echo $this->loadTemplate('price_advanced');
	return;
}

?>
<table class="table table-bordered table-condensed"
style="width:100%">
	<thead>
		<tr>
			<th class="title"><?php
				echo JText::_('PRICE');
			?></th>
<?php if($this->price_acls['tax'] &&
$this->price_acls['value']) { ?>
			<th class="title"><?php
				echo JText::_('PRICE_WITH_TAX');
			?></th>
<?php }
	if($this->price_acls['currency']) { ?>
			<th class="title"><?php
				echo JText::_('CURRENCY');
			?></th>
<?php }
	if($this->price_acls['quantity']) { ?>
			<th class="title"><?php
				echo hikamarket::tooltip(JText::_('MINIMUM_QUANTITY'),
'', '', JText::_('MIN_QTY'), '',
0);
			?></th>
<?php } ?>
			<th style="text-align:center">
				<a href="#" class="hikabtn hikabtn-success
hikabtn-mini" onclick="return
window.productMgr.newPrice('<?php echo $form_key;
?>');"><i class="fas
fa-plus"></i></a>
			</th>
		</tr>
	</thead>
	<tbody>
<?php
$k = 0;
if(!empty($this->product->prices)) {
	foreach($this->product->prices as $i => $price) {
		if(empty($price->price_min_quantity))
			$price->price_min_quantity = 1;

		$pre_price = '';
		$post_price = '';
		if(!$this->price_acls['currency']) {
			$currency = empty($price->price_currency_id) ?
$this->default_currency :
$this->currencies[$price->price_currency_id];
			if(is_string($currency->currency_locale))
				$currency->currency_locale =
hikamarket::unserialize($currency->currency_locale);
			if($currency->currency_locale['p_cs_precedes']) {
				$pre_price .= $currency->currency_symbol;
				if($currency->currency_locale['p_sep_by_space'])
					$pre_price .= ' ';
			} else {
				if($currency->currency_locale['p_sep_by_space'])
					$post_price .= ' ';
				$post_price .= $currency->currency_symbol;
			}
		}
		if(empty($price->price_currency_id))
			$price->price_currency_id = $this->default_currency;

?>		<tr class="row<?php echo $k;?>"
id="hikamarket_<?php echo $form_key; ?>_<?php echo
$i;?>">
			<td class="hikam_price">
				<input type="hidden" name="<?php echo $form_key;
?>[<?php echo $i;?>][price_id]" value="<?php echo
@$price->price_id;?>" />
<?php if($this->price_acls['value']) { ?>
				<?php echo $pre_price; ?><input size="10"
type="text" id="hikamarket_<?php echo $form_key;
?>_<?php echo $i;?>_price" name="<?php echo
$form_key; ?>[<?php echo $i;?>][price_value]"
value="<?php echo @$price->price_value; ?>"
onchange="window.productMgr.updatePriceValue(<?php echo $i; ?>,
false, '<?php echo $form_key; ?>')" /><?php echo
$post_price; ?>
<?php } else { ?>
				<input size="10" type="hidden"
id="hikamarket_<?php echo $form_key; ?>_<?php echo
$i;?>_price" name="<?php echo $form_key; ?>[<?php
echo $i;?>][price_value]" value="<?php echo
@$price->price_value; ?>"/>
				<?php echo $pre_price; ?><input size="10"
type="text" id="hikamarket_<?php echo $form_key;
?>_<?php echo $i;?>_with_tax" name="<?php echo
$form_key; ?>_with_tax_<?php echo $i;?>" value="<?php
echo @$price->price_value_with_tax; ?>"
onchange="window.productMgr.updatePriceValue(<?php echo $i; ?>,
true, '<?php echo $form_key; ?>')"/><?php echo
$post_price; ?>
<?php } ?>
			</td>
<?php if($this->price_acls['tax'] &&
$this->price_acls['value']) { ?>
			<td class="hikam_price">
				<?php echo $pre_price; ?><input size="10"
type="text" id="hikamarket_<?php echo $form_key;
?>_<?php echo $i;?>_with_tax" name="<?php echo
$form_key; ?>_with_tax_<?php echo $i;?>" value="<?php
echo @$price->price_value_with_tax; ?>"
onchange="window.productMgr.updatePriceValue(<?php echo $i; ?>,
true, '<?php echo $form_key; ?>')"/><?php echo
$post_price; ?>
			</td>
<?php }
	if($this->price_acls['currency']) { ?>
			<td class="hikam_currency"><?php
				echo
$this->currencyType->display($form_key.'['.$i.'][price_currency_id]',
@$price->price_currency_id,'class="no-chzn"');
			?></td>
<?php }
	if($this->price_acls['quantity']) { ?>
			<td class="hikam_qty">
				<input size="3" type="text" name="<?php
echo $form_key; ?>[<?php echo $i;?>][price_min_quantity]"
value="<?php echo @$price->price_min_quantity; ?>"
/>
			</td>
<?php } ?>
			<td style="text-align:center">
				<a href="#"
onclick="window.hikamarket.deleteRow(this); return
false;"><i class="fas
fa-trash-alt"></i></a>
			</td>
		</tr>
<?php
		$k = 1 - $k;
	}
}
?>		<tr class="row<?php echo $k;?>"
id="hikamarket_<?php echo $form_key; ?>_tpl"
style="display:none;">
			<td class="hikam_price">
				<input type="hidden" name="<?php echo $form_key;
?>[{id}][price_id]" value="" />
<?php if($this->price_acls['value']) { ?>
				<?php echo $pre_price; ?><input size="10"
type="text" id="hikamarket_<?php echo $form_key;
?>_{id}_price" name="<?php echo $form_key;
?>[{id}][price_value]" value=""
onchange="window.productMgr.updatePriceValue({id}, false,
'<?php echo $form_key; ?>')" /><?php echo
$post_price; ?>
<?php } else { ?>
				<input size="10" type="hidden"
id="hikamarket_<?php echo $form_key; ?>_{id}_price"
name="<?php echo $form_key; ?>[{id}][price_value]"
value=""/>
				<?php echo $pre_price; ?><input size="10"
type="text" id="hikamarket_<?php echo $form_key;
?>_{id}_with_tax" value=""
onchange="window.productMgr.updatePriceValue({id}, true,
'<?php echo $form_key; ?>')"/><?php echo
$post_price; ?>
<?php } ?>
			</td>
<?php if($this->price_acls['tax'] &&
$this->price_acls['value']) { ?>
			<td class="hikam_price">
				<?php echo $pre_price; ?><input size="10"
type="text" id="hikamarket_<?php echo $form_key;
?>_{id}_with_tax" value=""
onchange="window.productMgr.updatePriceValue({id}, true,
'<?php echo $form_key; ?>')"/><?php echo
$post_price; ?>
			</td>
<?php }
	if($this->price_acls['currency']) { ?>
			<td class="hikam_currency"><?php echo
$this->currencyType->display($form_key.'[{id}][price_currency_id]',
$this->main_currency_id, 'class="no-chzn"');
?></td>
<?php }
	if($this->price_acls['quantity']) { ?>
			<td class="hikam_qty"><input size="3"
type="text" name="<?php echo $form_key;
?>[{id}][price_min_quantity]" value="" /></td>
<?php } ?>
			<td style="text-align:center">
				<a href="#" onclick="hikamarket.deleteRow(this);
return false;"><i class="fas
fa-trash-alt"></i></a>
			</td>
		</tr>
	</tbody>
</table>
<script type="text/javascript">
if(!window.productMgr)
	window.productMgr = {};
if(!window.productMgr.updatePriceValue) {
window.productMgr.updatePriceValue = function(id, taxed, key) {
<?php if($this->price_acls['tax'] ||
!$this->price_acls['value']) { ?>
	var d = document, o = window.Oby, conversion = '', elName =
'hikamarket_'+key+'_'+id, destName = elName;
	if(taxed) {
		elName += '_with_tax'; destName += '_price';
conversion = 1;
	} else {
		elName += '_price'; destName += '_with_tax';
conversion = 0;
	}

	var price = d.getElementById(elName).value,
		dest = d.getElementById(destName),
		taxElem = d.getElementById('dataproductproduct_tax_id'),
		tax_id = -1;
	if(taxElem)
		tax_id = taxElem.value;
<?php if(!empty($this->product->product_tax_id)) { ?>
	else
		tax_id = <?php echo (int)$this->product->product_tax_id; ?>;
<?php } ?>
	var url = '<?php echo str_replace('\'',
'\\\'',
hikamarket::completeLink('product&task=getprice&price={PRICE}&product_id='.$this->product->product_id.'&tax_id={TAXID}&conversion={CONVERSION}',
true, false, true)); ?>';
	url = url.replace('{PRICE}', price).replace('{TAXID}',
tax_id).replace('{CONVERSION}', conversion);
	o.xRequest(url, null, function(xhr, params) {
		dest.value = xhr.responseText;
	});
<?php } ?>
};
}

if(!window.productMgr.newPrice) {
window.productMgr.newPrice = function(key) {
	var t = window.hikamarket,
		cpt = window.productMgr.cpt[key],
		htmlBlocks = {id: cpt};
	t.dupRow('hikamarket_'+key+'_tpl', htmlBlocks,
'hikamarket_'+key+'_'+cpt);
	window.productMgr.cpt[key]++;
	return false;
};
}
if(!window.productMgr.cpt)
	window.productMgr.cpt = {};
window.productMgr.cpt['<?php echo $form_key; ?>'] =
<?php echo count(@$this->product->prices); ?>;
window.hikashop.ready(function(){ hikamarket.noChzn(); });
</script>
views/productmarket/tmpl/form_price_advanced.php000064400000012555151166607760016253
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$form_key = empty($this->editing_variant) ? 'price' :
'variantprice';
?>
<div id="hikamarket_product_edit_<?php echo $form_key;
?>">
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
<table class="hikamarket_product_prices table table-bordered
table-striped" style="width:100%">
	<thead>
		<tr>
			<th class="title"><?php
				echo JText::_('PRICE');
			?></th>
<?php if($this->price_acls['quantity'] ||
$this->price_acls['acl'] ||
$this->price_acls['user']) { ?>
			<th class="title"><?php
				echo JText::_('RESTRICTIONS');
			?></th>
<?php } ?>
			<th style="text-align:center">
				<a class="hikabtn hikabtn-success hikabtn-mini"
href="#" onclick="return
window.productMgr.newPrice('<?php echo $form_key;
?>');"><i class="fas
fa-plus"></i></a>
			</th>
		</tr>
	</thead>
	<tbody id="hikamarket_<?php echo $form_key;
?>_list">
<?php
$k = 0;
if(!empty($this->product->prices)) {
	foreach($this->product->prices as $i => $price) {
		if(empty($price->price_min_quantity))
			$price->price_min_quantity = 1;
		if(empty($price->price_id))
			continue;

		$this->price_num = $i;
		$this->price = $price;
?>
		<tr class="row<?php echo $k;?>"
id="hikamarket_<?php echo $form_key; ?>_<?php echo $i;
?>" data-hkm-price="<?php echo (int)@$price->price_id;
?>"><?php
			echo $this->loadTemplate('price_entry');
		?></tr>
<?php
		$k = 1 - $k;
	}
}
?>
	</tbody>
</table>
</div>
<script type="text/javascript">
if(!window.productMgr)
	window.productMgr = {};
if(!window.productMgr.priceEdit)
	window.productMgr.priceEdit = {};
window.productMgr.priceEdit['<?php echo $form_key; ?>'] =
<?php echo count($this->product->prices); ?>

if(!window.productMgr.updatePriceValue) {
window.productMgr.updatePriceValue = function(id, taxed, key) {
<?php if($this->price_acls['tax']){ ?>
	var d = document, o = window.Oby, conversion = '', elName =
'hikamarket_'+key+'_'+id, destName = elName;
	if(taxed) {
		elName += '_with_tax_edit'; destName += '_edit';
conversion = 1;
	} else {
		elName += '_edit'; destName += '_with_tax_edit';
conversion = 0;
	}

	var price = d.getElementById(elName).value,
		dest = d.getElementById(destName),
		taxElem = d.getElementById('dataproductproduct_tax_id'),
		tax_id = -1;
	if(taxElem)
		tax_id = taxElem.value;
<?php if(!empty($this->product->product_tax_id)) { ?>
	else
		tax_id = <?php echo (int)$this->product->product_tax_id; ?>;
<?php } ?>
	var url = '<?php echo str_replace('\'',
'\\\'',
hikamarket::completeLink('product&task=getprice&price={PRICE}&product_id='.$this->product->product_id.'&tax_id={TAXID}&conversion={CONVERSION}',
true, false, true)); ?>';
	url = url.replace('{PRICE}', price).replace('{TAXID}',
tax_id).replace('{CONVERSION}', conversion);
	o.xRequest(url, null, function(xhr, params) {
		dest.value = xhr.responseText;
	});
<?php } ?>
};
}

if(!window.productMgr.newPrice) {
window.productMgr.newPrice = function(key) {
	var d = document, w = window, o = w.Oby,
		idx = (w.productMgr.priceEdit[key]++),
		el = d.getElementById('hikamarket_' + key + '_' +
idx);
	if(el)
		return window.productMgr.editPrice(null, key, idx, 0);

	var el = d.getElementById('hikamarket_' + key +
'_list');
		tr = d.createElement('tr');
	tr.className = 'row0';
	tr.id = 'hikamarket_'+key+'_'+idx;
	tr.setAttribute('data-hkm-price', 0);

	el.appendChild(tr);
	return window.productMgr.editPrice(null, key, idx, 0);
};
}
if(!window.productMgr.editPrice) {
window.productMgr.editPrice = function(el, key, num, id, state) {
	var d = document, w = window, o = w.Oby,
		container = d.getElementById('hikamarket_product_edit_'+key),
		priceLine = d.getElementById('hikamarket_' + key +
'_' + num);

	if(!priceLine) return false;
	if(container) o.addClass(container, 'hikamarket_ajax_loading');

	if(state === undefined || state === true) state = 1;
	if(state === false) state = 0;

	var url = '<?php echo
hikamarket::completeLink('product&task=editprice&product_id='.$this->product->product_id,
true, false, true); ?>',
		data = o.getFormData(priceLine) + '&' +
o.encodeFormData({price_id:id,price_num:num,edition_state:state,formkey:key});
	if(key == 'variantprice' && w.productMgr.variantEdition
&& w.productMgr.variantEdition.current)
		data += '&variant_product_id=' +
encodeURIComponent(w.productMgr.variantEdition.current);
	o.xRequest(url, {mode:'POST',data:data},function(xhr,params){
		var tr = document.createElement('tr'), cell = null;
		tr.innerHTML = xhr.responseText;
		priceLine.innerHTML = '';
		for(var i = tr.cells.length - 1; i >= 0; i--) {
			cell = tr.cells[0];
			tr.removeChild(cell);
			priceLine.appendChild(cell);
			cell = null;
		}
		window.Oby.updateElem(tr, xhr.responseText);
		tr = null;

		if(container) o.removeClass(container,
'hikamarket_ajax_loading');
	});
	return false;
};
}
if(!window.productMgr.updatePrice) {
window.productMgr.updatePrice = function(el, key, num, id) {
};
}
if(!window.productMgr.cpt)
	window.productMgr.cpt = {};
window.productMgr.cpt['<?php echo $form_key; ?>'] =
<?php echo count(@$this->product->prices); ?>;
</script>
views/productmarket/tmpl/form_price_entry.php000064400000026077151166607760015653
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$form_key = empty($this->editing_variant) ? 'price' :
'variantprice';

if(empty($this->price->edit)) {
?>
	<td style="white-space: nowrap; cursor:pointer;"
onclick="window.productMgr.editPrice(this, '<?php echo
$form_key; ?>', <?php echo (int)$this->price_num;
?>,<?php echo (int)@$this->price->price_id; ?>, true);
return false;"><?php
		if(!$this->shopConfig->get('floating_tax_prices', 0)) {
			echo $this->currencyClass->format($this->price->price_value,
$this->price->price_currency_id). ' / ';
		}
		echo
$this->currencyClass->format($this->price->price_value_with_tax,
$this->price->price_currency_id);
	?></td>
	<td style="cursor:pointer;"
onclick="window.productMgr.editPrice(this, '<?php echo
$form_key; ?>', <?php echo (int)$this->price_num;
?>,<?php echo (int)$this->price->price_id; ?>, true); return
false;">
<?php
	$restrictions = array();
	$qty = max((int)$this->price->price_min_quantity, 1);
	if($qty > 1 && $this->price_acls['quantity'])
		$restrictions[] =
'<strong>'.JText::_('MINIMUM_QUANTITY').'</strong>:
'.$qty;

	if($this->price_acls['user'] &&
!empty($this->price->price_users) && hikashop_level(2)) {
		$users = explode(',',trim($this->price->price_users,
','));
		$text = array();
		foreach($users as $user) {
			if(empty($user))
				continue;
			$data = $this->userClass->get($user);
			if($data)
				$text[] = $data->name;
		}
		$restrictions[] =
'<strong>'.JText::_('USERS').'</strong>:
'.implode(', ', $text);
	}

	if($this->price_acls['acl'] &&
isset($this->price->price_access) &&
$this->price->price_access != 'all' &&
hikashop_level(2)) {
		$groups = $this->joomlaAcl->getList();
		$access = explode(',', $this->price->price_access);
		$text = array();
		foreach($access as $a) {
			if(empty($a))
				continue;
			foreach($groups as $group) {
				if($group->id == $a) {
					$text[] = $group->text;
					break;
				}
			}
		}
		$restrictions[] =
'<strong>'.JText::_('ACCESS_LEVEL').'</strong>:
'.implode(', ', $text);
	}

	if($this->price_acls['date'] &&
(!empty($this->price->price_start_date) ||
!empty($this->price->price_end_date))) {
		if(!empty($this->price->price_start_date)) {
			$this->price->price_start_date =
hikamarket::getDate($this->price->price_start_date, '%d %B %Y
%H:%M');
			$restrictions[] =
'<strong>'.JText::_('START_DATE').'</strong>:
'. $this->price->price_start_date;
		}

		if(!empty($this->price->price_end_date)) {
			$this->price->price_start_date =
hikamarket::getDate($this->price->price_end_date, '%d %B %Y
%H:%M');
			$restrictions[] =
'<strong>'.JText::_('END_DATE').'</strong>:
'. $this->price->price_start_date;
		}
	}

	if(!empty($this->price->price_site_id))
		$restrictions[] =
'<strong>'.JText::_('SITE_ID').'</strong>:
'.$this->price->price_site_id;

	echo implode('<br/>', $restrictions);

	$price_value =
$this->shopConfig->get('floating_tax_prices', 0) ?
@$this->price->price_value_with_tax :
@$this->price->price_value;
?>
		<input type="hidden" name="<?php echo
$form_key.'['.$this->price_num.'][price_id]';
?>" value="<?php echo $this->price->price_id;
?>" />
		<input type="hidden" name="<?php echo
$form_key.'['.$this->price_num.'][price_value]';
?>" value="<?php echo $price_value; ?>" />
<?php if($this->price_acls['currency']) { ?>
		<input type="hidden" name="<?php echo
$form_key.'['.$this->price_num.'][price_currency_id]';
?>" value="<?php echo
$this->price->price_currency_id; ?>"/>
<?php } ?>
<?php if($this->price_acls['quantity']) { ?>
		<input type="hidden" name="<?php echo
$form_key.'['.$this->price_num.'][price_min_quantity]';
?>" value="<?php echo $qty; ?>"/>
<?php } ?>
<?php if(hikashop_level(2) &&
$this->price_acls['acl']) { ?>
		<input type="hidden" name="<?php echo
$form_key.'['.$this->price_num.'][price_access]';
?>" value="<?php echo $this->price->price_access;
?>"/>
<?php } ?>
<?php if(hikashop_level(2) &&
$this->price_acls['user']) { ?>
		<input type="hidden" name="<?php echo
$form_key.'['.$this->price_num.'][price_users]';
?>" value="<?php echo $this->price->price_users;
?>"/>
<?php } ?>
<?php if(hikashop_level(2) &&
$this->price_acls['date']) { ?>
		<input type="hidden" name="<?php echo
$form_key.'['.$this->price_num.'][price_start_date]';
?>" value="<?php echo
@$this->price->price_start_date; ?>"/>
		<input type="hidden" name="<?php echo
$form_key.'['.$this->price_num.'][price_end_date]';
?>" value="<?php echo @$this->price->price_end_date;
?>"/>
<?php } ?>
<?php if(!empty($this->jms_integration)) { ?>
		<input type="hidden" name="<?php echo
$form_key.'['.$this->price_num.'][price_site_id]';
?>" value="<?php echo $this->price->price_site_id;
?>"/>
<?php } ?>
	</td>
	<td style="text-align:center">
		<a href="#delete"
onclick="window.hikamarket.deleteRow(this); return
false;"><i class="fas
fa-trash-alt"></i></a>
	</td>
<?php
	return;
}

?>
<td colspan="3">
<dl class="hika_options" id="<?php echo
'hikamarket_price_edit_block_'.$form_key.'_'.$this->price_num;
?>">
	<dt><?php echo JText::_('PRICE'); ?></dt>
	<dd>
		<input type="hidden" name="<?php echo
$form_key.'['.$this->price_num.']';
?>[price_id]" value="<?php echo
@$this->price->price_id; ?>"/>
		<input type="text"
onchange="window.productMgr.updatePriceValue(<?php echo
$this->price_num; ?>, false, '<?php echo $form_key;
?>')" id="hikamarket_<?php echo $form_key;
?>_<?php echo $this->price_num; ?>_edit"
name="<?php echo
$form_key.'['.$this->price_num.']';
?>[price_value]" value="<?php
if($this->shopConfig->get('floating_tax_prices',0)){ echo
@$this->price->price_value_with_tax; }else{ echo
@$this->price->price_value; } ?>"/>
		<input type="hidden" name="<?php echo
$form_key.'_old['.$this->price_num.']';
?>[price_value]" value="<?php
if($this->shopConfig->get('floating_tax_prices',0)){ echo
@$this->price->price_value_with_tax; }else{ echo
@$this->price->price_value; } ?>"/>
	</dd>
<?php if(!$this->shopConfig->get('floating_tax_prices',
0)) { ?>
	<dt><?php echo JText::_('PRICE_WITH_TAX');
?></dt>
	<dd>
		<input type="text"
onchange="window.productMgr.updatePriceValue(<?php echo
$this->price_num; ?>, true, '<?php echo $form_key;
?>')" id="hikamarket_<?php echo $form_key;
?>_<?php echo $this->price_num; ?>_with_tax_edit"
name="" value="<?php echo
@$this->price->price_value_with_tax; ?>"/>
	</dd>
<?php } ?>
<?php if($this->price_acls['currency']) { ?>
	<dt><?php echo JText::_('CURRENCY'); ?></dt>
	<dd><?php
		if(empty($this->price->price_currency_id))
			$this->price->price_currency_id =
$this->default_currency->currency_id;
		echo
$this->currencyType->display($form_key.'['.$this->price_num.'][price_currency_id]',
@$this->price->price_currency_id,
'','hikamarket_' . $form_key .
'_currency_edit');
	?><input type="hidden" name="<?php echo
$form_key.'_old['.$this->price_num.']';
?>[price_currency_id]" value="<?php echo
@$this->price->price_currency_id; ?>"/></dd>
<?php } ?>
<?php if($this->price_acls['quantity']) { ?>
	<dt><?php echo JText::_('PRODUCT_QUANTITY');
?></dt>
	<dd>
		<input type="text" id="hikamarket_<?php echo
$form_key; ?>_qty_edit" name="<?php echo
$form_key.'['.$this->price_num.']';
?>[price_min_quantity]" value="<?php echo
$this->price->price_min_quantity; ?>"/>
		<input type="hidden" name="<?php echo
$form_key.'_old['.$this->price_num.']';
?>[price_min_quantity]" value="<?php echo
@$this->price->price_min_quantity; ?>"/>
	</dd>
<?php } ?>
<?php if(hikashop_level(2) &&
$this->price_acls['acl']) { ?>
	<dt><?php echo JText::_('ACCESS_LEVEL');
?></dt>
	<dd><?php
		echo
$this->joomlaAcl->display($form_key.'['.$this->price_num.'][price_access]',
@$this->price->price_access, true, true, 'hikamarket_' .
$form_key . '_acl_edit');
	?><input type="hidden" name="<?php echo
$form_key.'_old['.$this->price_num.']';
?>[price_access]" value="<?php echo
@$this->price->price_access; ?>"/></dd>
<?php } ?>
<?php if(hikashop_level(2) &&
$this->price_acls['user']) { ?>
	<dt><?php echo JText::_('USERS'); ?></dt>
	<dd><?php
echo $this->nameboxType->display(
	$form_key.'['.$this->price_num.'][price_users]',
	explode(',',trim(@$this->price->price_users,',')),
	hikamarketNameboxType::NAMEBOX_MULTIPLE,
	'user',
	array(
		'id' => 'hikamarket_' . $form_key . '_'
. $this->price_num . '_user_edit',
		'force_data' => true,
		'default_text' => 'PLEASE_SELECT'
	)
);
	?><input type="hidden" name="<?php echo
$form_key.'_old['.$this->price_num.']';
?>[price_users]" value="<?php echo
@$this->price->price_users; ?>"/></dd>
<?php } ?>
<?php if(hikashop_level(2) &&
$this->price_acls['date']) { ?>
	<dt><?php echo JText::_('START_DATE');
?></dt>
	<dd><?php
		echo JHTML::_('calendar',
hikamarket::getDate((@$this->price->price_start_date?@$this->price->price_start_date:''),'%Y-%m-%d
%H:%M'),
$form_key.'['.$this->price_num.'][price_start_date]',
'hikamarket_' . $form_key .'_'.$this->price_num .
'_start_date_edit', '%Y-%m-%d %H:%M',
array('size' => '20', 'showTime' =>
true));
	?><input type="hidden" name="<?php echo
$form_key.'_old['.$this->price_num.']';
?>[price_start_date]" value="<?php echo
@$this->price->price_start_date; ?>"/></dd>
	<dt><?php echo JText::_('END_DATE'); ?></dt>
	<dd><?php
		echo JHTML::_('calendar',
hikamarket::getDate((@$this->price->price_end_date?@$this->price->price_end_date:''),'%Y-%m-%d
%H:%M'),
$form_key.'['.$this->price_num.'][price_end_date]',
'hikamarket_' . $form_key .'_'.$this->price_num .
'_end_date_edit', '%Y-%m-%d %H:%M',
array('size' => '20', 'showTime' =>
true));
	?><input type="hidden" name="<?php echo
$form_key.'_old['.$this->price_num.']';
?>[price_end_date]" value="<?php echo
@$this->price->price_end_date; ?>"/></dd>
<script type="text/javascript">
window.hikashop.ready(function() {
	var d = document, els = document.querySelectorAll("#<?php echo
'hikamarket_price_edit_block_'.$form_key.'_'.$this->price_num;
?> .field-calendar");
	if(!els || typeof(JoomlaCalendar) == "undefined") return;
	for(i = els.length - 1; i >= 0; i--) {
		JoomlaCalendar.init(els[i]);
	}
});
</script>
<?php } ?>
<?php if(!empty($this->jms_integration)) { ?>
	<dt><?php echo JText::_('SITE_ID'); ?></dt>
	<dd><?php
		echo
str_replace('class="inputbox"','class="inputbox
no-chzn" style="width:90px;"',
MultisitesHelperUtils::getComboSiteIDs(@$this->price->price_site_id,
'hikamarket_' . $form_key . '_site_edit',
JText::_('SELECT_A_SITE')));
	?></dd>
<?php } ?>
</dl>
<div style="float:right">
	<button class="hikabtn hikabtn-success" onclick="return
window.productMgr.editPrice(this, '<?php echo $form_key;
?>', <?php echo (int)$this->price_num;?>,<?php echo
(int)$this->price->price_id; ?>, false);">
		<i class="fas fa-check"></i> <?php echo
JText::_('HIKA_OK'); ;?>
	</button>
</div>
<button class="hikabtn hikabtn-danger" onclick="return
window.productMgr.editPrice(this, '<?php echo $form_key;
?>', <?php echo (int)$this->price_num; ?>,<?php echo
(int)$this->price->price_id; ?>, -1);">
	<i class="far fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?>
</button>
</td>
views/productmarket/tmpl/form_price_mini.php000064400000010463151166607760015436
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><dl class="hikam_options">
	<dt class="hikamarket_product_price"><label><?php
echo JText::_('PRICES'); ?></label></dt>
	<dd class="hikamarket_product_price"><?php

	$price = reset($this->product->prices);

	$form_key = empty($this->editing_variant) ? 'price' :
'variantprice';

	$pre_price = ''; $post_price = '';
	$currency = empty($price->price_currency_id) ?
$this->default_currency :
$this->currencies[$price->price_currency_id];
	if(is_string($currency->currency_locale))
		$currency->currency_locale =
hikamarket::unserialize($currency->currency_locale);
	if($currency->currency_locale['p_cs_precedes']) {
		$pre_price .= $currency->currency_symbol;
		if($currency->currency_locale['p_sep_by_space'])
			$pre_price .= ' ';
	} else {
		if($currency->currency_locale['p_sep_by_space'])
			$post_price .= ' ';
		$post_price .= $currency->currency_symbol;
	}

	if($this->price_acls['tax'] &&
empty($this->product->product_tax_id)) {
		echo $pre_price;
		?><input size="10" type="text"
id="hikamarket_<?php echo $form_key; ?>_0_price"
name="<?php echo $form_key; ?>[0][price_value]"
value="<?php echo @$price->price_value;
?>"/><?php
		echo $post_price;
	} else {
		if($this->price_acls['value']) {
			echo $pre_price;
			?><input size="10" type="text"
id="hikamarket_<?php echo $form_key; ?>_0_price"
name="<?php echo $form_key; ?>[0][price_value]"
value="<?php echo @$price->price_value; ?>"
onchange="window.productMgr.updatePriceMini(false, '<?php echo
$form_key; ?>')" /><?php
			echo $post_price;
			echo '<br/>';
			if($this->price_acls['tax']) {
				echo $pre_price;
				?><input size="10" type="text"
id="hikamarket_<?php echo $form_key; ?>_0_with_tax"
name="<?php echo $form_key; ?>_with_tax_0"
value="<?php echo @$price->price_value_with_tax; ?>"
onchange="window.productMgr.updatePriceMini(true, '<?php echo
$form_key; ?>')" /><?php
				echo $post_price;
			} else {
				echo $pre_price;
				?><span id="hikamarket_<?php echo $form_key;
?>_0_with_tax_span"><?php echo
@$price->price_value_with_tax;?></span><?php
				echo $post_price;
			}
		} else {
			echo $pre_price;
?>
		<input size="10" type="text"
id="hikamarket_<?php echo $form_key; ?>_0_with_tax"
name="<?php echo $form_key; ?>_with_tax_0"
value="<?php echo @$price->price_value_with_tax; ?>"
onchange="window.productMgr.updatePriceMini(true, '<?php echo
$form_key; ?>')" />
		<input type="hidden" id="hikamarket_<?php echo
$form_key; ?>_0_price" name="<?php echo $form_key;
?>[0][price_value]" value="<?php echo
@$price->price_value; ?>" />
<?php
			echo $post_price;
		}
	}
	?></dd>
</dl>
	<input type="hidden" name="<?php echo $form_key;
?>[0][price_id]" value="<?php echo
@$price->price_id;?>" />
<script type="text/javascript">
if(!window.productMgr)
	window.productMgr = {};
if(!window.productMgr.updatePriceMini) {
window.productMgr.updatePriceMini = function(taxed, key) {
	var d = document, o = window.Oby, conversion = '', elName =
'hikamarket_'+key+'_0', destName = elName;
	if(taxed) {
		elName += '_with_tax'; destName += '_price';
conversion = 1;
	} else {
		elName += '_price'; destName += '_with_tax';
conversion = 0;
	}

	var price = d.getElementById(elName).value,
		dest = d.getElementById(destName),
		taxElem = d.getElementById('dataproductproduct_tax_id'),
		tax_id = -1, valueMode = true;
	if(!dest) {
		dest = d.getElementById(destName + '_span');
		valueMode = false;
	}
	if(taxElem)
		tax_id = taxElem.value;
<?php if(!empty($this->product->product_tax_id)) { ?>
	else
		tax_id = <?php echo (int)$this->product->product_tax_id; ?>;
<?php } ?>
	var url = '<?php echo str_replace('\'',
'\\\'',
hikamarket::completeLink('product&task=getprice&price={PRICE}&product_id='.$this->product->product_id.'&tax_id={TAXID}&conversion={CONVERSION}',
true, false, true)); ?>';
	url = url.replace('{PRICE}', price).replace('{TAXID}',
tax_id).replace('{CONVERSION}', conversion);
	o.xRequest(url, null, function(xhr, params) {
		if(valueMode)
			dest.value = xhr.responseText;
		else
			dest.innerHTML = xhr.responseText;
	});
};
}
</script>
views/productmarket/tmpl/form_variants.php000064400000033766151166607760015162
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!hikamarket::acl('product/edit/variants') ||
empty($this->product->product_id))
	return;
?>
<div>
	<div style="float:right">
		<button class="hikabtn hikabtn-success" onclick="return
window.productMgr.addVariants(this, <?php echo
(int)$this->product->product_id; ?>);"><i
class="fas fa-plus"></i> <?php echo
JText::_('HIKAM_ADD_VARIANTS'); ?></button>
	</div>
	<div id="hikamarket_variant_bundle_toolbar"
style="display:none;">
		<button class="hikabtn hikabtn-danger" onclick="return
window.productMgr.deleteVariants(this, <?php echo
(int)$this->product->product_id; ?>);"><i
class="far fa-times-circle"></i> <?php echo
JText::_('HIKA_DELETE'); ?></button>
		<button class="hikabtn hikabtn-info" onclick="return
window.productMgr.duplicateVariants(this, <?php echo
(int)$this->product->product_id; ?>);"><i
class="fas fa-copy"></i> <?php echo
JText::_('HIKAM_DUPLICATE'); ?></button>
	</div>
	<div style="clear:both"></div>
</div>
<div
id="hikamarket_product_variant_creation_container"></div>
<table class="<?php if(!HIKASHOP_RESPONSIVE) echo
'hikam_table '; ?>table table-striped table-hover"
style="width:100%">
	<thead>
		<tr>
			<th style="width:25px; text-align:center">
				<input onchange="window.hikamarket.checkAll(this,
'hikamarket_product_variant_checkbox_');"
type="checkbox"
id="hikamarket_product_variant_checkbox_general"
value=""/>
			</th>
			<th style="width:25px"></th>
<?php
	$default_variants = array();
	$characteristics = array();
	foreach($this->product->characteristics as $characteristic) {
		if((int)$characteristic->characteristic_parent_id > 0) {
			$default_variants[(int)$characteristic->characteristic_id] =
(int)$characteristic->characteristic_id;
			continue;
		}
		$characteristics[(int)$characteristic->characteristic_id] =
(int)$characteristic->characteristic_id;

?>			<th><?php echo $characteristic->characteristic_value;
?></th>
<?php
	}
?>
			<th><?php echo JText::_('PRICE'); ?></th>
			<th><?php echo JText::_('PRODUCT_QUANTITY');
?></th>
			<th style="width:1%"><?php echo
JText::_('HIKA_PUBLISHED'); ?></th>
			<th style="width:1%"><?php echo
JText::_('HIKA_DEFAULT'); ?></th>
		</tr>
	</thead>
	<tbody>
<?php
	$tab_notice_msg = '';
	$tab_variant_counter_color = (count($this->product->variants) >
1) ? 'green' : (count($this->product->variants) == 0 ?
'red' : 'orange');
	$default_found = false;
	$k = 0;
	foreach($this->product->variants as $variant) {
	?>	<tr class="row<?php echo $k; ?>"
id="hikamarket_product_variant_line_<?php echo
$variant->product_id; ?>">
<!--style="cursor:pointer" onclick="return
window.productMgr.editVariant(<?php echo $variant->product_id;
?>);">-->
			<td style="text-align:center">
				<input onchange="window.productMgr.checkVariant(this, <?php
echo $variant->product_id; ?>);" type="checkbox"
id="hikamarket_product_variant_checkbox_<?php echo
$variant->product_id; ?>" value="<?php echo
$variant->product_id; ?>"/>
			</td>
			<td style="text-align:center"><a
href="#edit:<?php echo $variant->product_id; ?>"
onclick="return window.productMgr.editVariant(<?php echo
$variant->product_id; ?>);"><i class="fas
fa-pencil-alt"></i></a></td>
<?php
		$cpt = 0;
		foreach($this->product->characteristics as $characteristic) {
			if((int)$characteristic->characteristic_parent_id > 0)
				continue;

			$o =
@$variant->characteristics[$characteristic->characteristic_id];
			if(!empty($o) && isset($default_variants[ (int)$o->id ]))
				$cpt++;
?>			<td style="cursor:pointer" onclick="return
window.productMgr.editVariant(<?php echo $variant->product_id;
?>);"><?php echo @$o->value; ?></td>
<?php
		}
		$variant_default = ($cpt == count($default_variants)) ?
'publish' : 'unpublish';
		if($variant_default == 'publish')
			$default_found = true;

?>			<td style="cursor:pointer" onclick="return
window.productMgr.editVariant(<?php echo $variant->product_id;
?>);"><?php echo
$this->currencyClass->displayPrices(@$variant->prices);?></td>
			<td style="cursor:pointer" onclick="return
window.productMgr.editVariant(<?php echo $variant->product_id;
?>);"><?php echo (($variant->product_quantity == -1) ?
JText::_('UNLIMITED') : $variant->product_quantity);
?></td>
			<td style="text-align:center"><?php echo
$this->toggleClass->display('product_published',
$variant->product_published); ?></td>
			<td style="text-align:center">
				<div class="toggle_loading"><a class="<?php
echo $variant_default; ?>" href="#" onclick="return
window.productMgr.setDefaultVariant(event, <?php echo
$variant->product_id; ?>);"></a></div>
			</td>
		</tr>
<?php
		$k = 1 - $k;
	}

	if(count($this->product->variants) > 0 &&
!$default_found) {
		$tab_variant_counter_color = 'red';
		$tab_notice_msg = ' - ' .
JText::_('HIKAM_NOT_DEFAULT_VARIANT');
	}
?>
	</tbody>
</table>
<?php if(hikaInput::get()->getCmd('tmpl', '') !=
'component') { ?>
<script type="text/javascript">
window.hikashop.ready(function(){
	var el =
document.getElementById('hikamarket_product_variant_label');
	if(el)
		el.innerHTML = '<span class="hk-label hk-label-<?php echo
$tab_variant_counter_color; ?>"><?php echo
count($this->product->variants) . $tab_notice_msg;
?></span>';
});
window.productMgr.variantEdition = {
	current: null,
	loading: false,
	checked: null
};
window.productMgr.refreshVariantList = function() {
	var w = window, o = w.Oby, t = this,
		url_list = '<?php echo
hikamarket::completeLink('product&task=variants&product_id='.$this->product->product_id.'&'.hikamarket::getFormToken().'=1',true,false,true);
?>';
	o.xRequest(url_list, {update:'hikamarket_product_variant_list'},
function(x,p) {
		if(!t.variantEdition.current)
			return;
		setTimeout(function(){
			var l =
document.getElementById('hikamarket_product_variant_line_' +
t.variantEdition.current);
			if(l) window.Oby.addClass(l, 'selectedVariant');
		},10);
	});
};
window.productMgr.editVariant = function(id) {
	var w = window, o = w.Oby, d = document, t = this, l = null,
		el = d.getElementById('hikamarket_product_variant_edition'),
		url = '<?php echo
hikamarket::completeLink('product&task=variant&product_id='.$this->product->product_id.'&cid={CID}',true,false,true);
?>';

	id = parseInt(id);
	if(isNaN(id) || id === 0)
		return false;
	if(w.productMgr.variantEdition.loading == true)
		return false;

	if(t.variantEdition.current) {
		l = d.getElementById('hikamarket_product_variant_line_' +
t.variantEdition.current);
		if(l) o.removeClass(l, 'selectedVariant');
	}

	if(t.variantEdition.current &&
window.productMgr.closeVariantEditor) {
		try { window.productMgr.closeVariantEditor(); } catch(err){}
	}

	l = d.getElementById('hikamarket_product_variant_line_' + id);
	if(l) o.addClass(l, 'selectedVariant');

	w.productMgr.variantEdition.current = id;
	var url = url.replace('{CID}',id);
	o.addClass(el, 'ajax_loading');
	o.xRequest(url,{update:el},function(x,p){
		o.removeClass(el, 'ajax_loading');
		w.productMgr.variantEdition.loading = false;
		setTimeout(function(){window.hikamarket.dlTitle(el);},50);
	});
	return false;
};
window.productMgr.closeVariant = function() {
	var t = this, d = document,
		el = d.getElementById('hikamarket_product_variant_edition');
	if(el) {
		setTimeout(function() {
			el.innerHTML = '';
		}, 10);
	}
	if(t.variantEdition.current) {
		l = d.getElementById('hikamarket_product_variant_line_' +
t.variantEdition.current);
		if(l) window.Oby.removeClass(l, 'selectedVariant');
	}
	t.variantEdition.current = null;
	t.variantEdition.loading = false;
	return false;
};
window.productMgr.cancelVariantEdition = function() {
	var t = this;
	if(t.variantEdition.current === null)
		return true;
	if(t.variantEdition.loading)
		return false;
	if(confirm('<?php echo str_replace('\'',
'\\\'',
JText::_('CONFIRM_CLOSiNG_VARIANT_IN_EDITION')); ?>')) {
		t.closeVariant();
		return true;
	}
	return false;
};
window.productMgr.saveVariant = function(id) {
	var w = window, o = w.Oby, d = document,
		el = d.getElementById('hikamarket_product_variant_edition'),
		form = d.getElementById('hikamarket_products_form');
		url = '<?php echo
hikamarket::completeLink('product&task=save&subtask=variant&product_id='.$this->product->product_id.'&variant_id={CID}&'.hikamarket::getFormToken().'=1',true,false,true);
?>';
	if(!el)
		return false;
	url = url.replace('{CID}', id);

	o.addClass(el, 'ajax_loading');
	w.productMgr.variantEdition.loading = true;

	if(window.productMgr.saveVariantEditor) {
		try { window.productMgr.saveVariantEditor(); } catch(err){}
	}
	o.fireAjax("syncWysiwygEditors", null);

	var formData = o.getFormData(el);
	o.xRequest(url, {update:el, mode: 'POST', data:formData},
function(x,p) {
		o.removeClass(el, 'ajax_loading');
		w.productMgr.variantEdition.loading = false;
		w.productMgr.refreshVariantList();
	});
	return false;
};
window.productMgr.setDefaultVariant = function(ev, id) {
	var event = ev || window.event;
	event.stopPropagation();
	event.preventDefault();

	var w = window, o = w.Oby, d = document,
		url = '<?php echo
hikamarket::completeLink('product&task=variants&subtask=setdefault&product_id='.$this->product->product_id.'&variant_id={CID}&'.hikamarket::getFormToken().'=1',true,false,true);
?>';
	url = url.replace('{CID}', id);
	o.xRequest(url, {update:'hikamarket_product_variant_list'});
	return false;
};
window.productMgr.checkVariant = function(el, id) {
	var ve = window.productMgr.variantEdition, d = document,
		tool = d.getElementById('hikamarket_variant_bundle_toolbar');
	if(!tool)
		return;
	if(el.checked) {
		if(ve.checked === null)
			ve.checked = [];
		if(ve.checked.indexOf(id) < 0)
			ve.checked.push(id);
	} else {
		if(ve.checked === null)
			ve.checked = [];
		var p = ve.checked.indexOf(id);
		if(p >= 0)
			ve.checked.splice(p, 1);
		if(ve.checked.length == 0) {
			ve.checked = null;
			var e =
d.getElementById('hikamarket_product_variant_checkbox_general');
			if(e)
				e.checked = false;
		}
	}
	tool.style.display = (ve.checked && ve.checked.length > 0) ?
'' : 'none';
};
window.productMgr.addVariants = function(el, id) {
	if(this.cancelVariantEdition && !this.cancelVariantEdition())
		return false;
	window.Oby.xRequest('<?php echo
hikamarket::completeLink('product&task=variants&subtask=add&product_id='.$this->product->product_id.'&'.hikamarket::getFormToken().'=1',true,false,true);
?>',
{update:'hikamarket_product_variant_creation_container'});
	return false;
};
window.productMgr.populateVariants = function(mode) {
	var d = document, w = window, o = w.Oby, data = null,
		ve = window.productMgr.variantEdition,
		el =
d.getElementById('hikamarket_product_variant_creation_container');
	if(!el)
		return false;

	data = o.getFormData(el);
	if(mode && mode == 'duplicate') {
		if(ve.length == 0) {
			alert('<?php echo str_replace("'",
"\\'", JText::_('PLEASE_SELECT_SOMETHING'));
?>');
			return false;
		}
		for(var i = ve.checked.length - 1; i >= 0; i--) {
			data += '&cid[]=' + ve.checked[i];
		}
	} else if(mode && mode == 'add') {
		var characteristics = [<?php echo implode(',',
$characteristics); ?>],
			rawData = data;
		if(rawData.indexOf('data[variant_add]') < 0)
			rawData = decodeURI(rawData);
		if(rawData.indexOf('data[variant_add]') >= 0) {
			for(var i = characteristics.length - 1; i >= 0; i--) {
				if(rawData.indexOf('data[variant_add][' + characteristics[i]
+ '][]') >= 0)
					continue;
				alert('<?php echo str_replace("'",
"\\'",
JText::_('PLEASE_SELECT_A_VALUE_FOR_EACH_CHARACTERISTIC'));
?>');
				return false;
			}
		}
	}

	o.xRequest('<?php echo
hikamarket::completeLink('product&task=variants&subtask=populate&product_id='.$this->product->product_id.'&'.hikamarket::getFormToken().'=1',true,false,true);
?>',
		{mode: 'POST', data: data},
		function(x,p) {
			o.updateElem(el, x.responseText);
			window.productMgr.refreshVariantList();
		}
	);
	return false;
};
window.productMgr.cancelPopulateVariants = function() {
	var d = document, el =
d.getElementById('hikamarket_product_variant_creation_container');
	if(el)
		setTimeout(function() { el.innerHTML = ''; }, 10);
	return false;
};
window.productMgr.duplicateVariants = function(el, id) {
	var ve = window.productMgr.variantEdition, d = document;
	if(ve.checked.length > 0) {
		window.Oby.xRequest('<?php echo
hikamarket::completeLink('product&task=variants&subtask=duplicate&product_id='.$this->product->product_id.'&'.hikamarket::getFormToken().'=1',true,false,true);
?>',
{update:'hikamarket_product_variant_creation_container'});
	} else {
		var el =
d.getElementById('hikamarket_product_variant_creation_container');
		if(el) el.innerHTML = '';
	}
	return false;
};
window.productMgr.deleteVariants = function(el, id) {
	var w = window, d = document, o = w.Oby, ve =
window.productMgr.variantEdition, data = '';
	if(ve.checked.length == 0)
		return false;
	var msg = '<?php echo str_replace('\'',
'\\\'',
JText::_('PLEASE_CONFIRM_DELETION_X_VARIANTS')); ?>';
	if(!confirm(msg.replace('{NUM}', ve.checked.length)))
		return false;
	for(var i = ve.checked.length - 1; i >= 0; i--) {
		if(data.length > 0) data += '&';
		data += 'cid[]=' + ve.checked[i];
	}
	o.xRequest('<?php echo
hikamarket::completeLink('product&task=variants&subtask=delete&product_id='.$this->product->product_id.'&'.hikamarket::getFormToken().'=1',true,false,true);
?>',
		{mode: 'POST', data: data},
		function(x,p) {
			window.productMgr.refreshVariantList();
		}
	);
	return false;
};
</script>
<?php } else { ?>
<script type="text/javascript">
if(window.productMgr.variantEdition)
	window.productMgr.variantEdition.checked = null;
var el =
document.getElementById('hikamarket_product_variant_label');
if(el)
	el.innerHTML = '<span class="hk-label hk-label-<?php echo
$tab_variant_counter_color; ?>"><?php echo
count($this->product->variants) . $tab_notice_msg;
?></span>';
</script>
<?php }
views/productmarket/tmpl/form_variants_add.php000064400000005617151166607760015764
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if($this->subtask != 'duplicate') {
	$populateMode = 'add';
?>
<dl>
<?php foreach($this->characteristics as $characteristic) { ?>
	<dt><?php echo $characteristic->characteristic_value;
?></dt>
	<dd><?php
		echo $this->nameboxVariantType->display(
			'data[variant_add][' . $characteristic->characteristic_id .
'][]',
			null,
			hikamarketNameboxType::NAMEBOX_MULTIPLE,
			'characteristic_value',
			array(
				'add' => true,
				'vendor' => $this->vendor->vendor_id,
				'url_params' => array('ID' =>
$characteristic->characteristic_id)
			)
		);
	?></dd>
<?php } ?>
</dl>
<?php
} else {
	$populateMode = 'duplicate';
?>
<div>
	<select style="width:30%"
name="data[variant_duplicate][characteristic]"
onchange="window.productMgr.duplicateChangeCharacteristic(this);">
<?php foreach($this->characteristics as $characteristic) { ?>
		<option value="<?php echo
$characteristic->characteristic_id; ?>"><?php echo
$characteristic->characteristic_value; ?></option>
<?php } ?>
	</select>
	<div style="display:inline-block;width:68%;">
<?php
	if(empty($this->productClass))
		$this->productClass = hikamarket::get('class.product');
	$c = reset($this->characteristics);
	echo $this->nameboxVariantType->display(
		'data[variant_duplicate][variants][]',
		null,
		hikamarketNameboxType::NAMEBOX_MULTIPLE,
		'characteristic_value',
		array(
			'add' => true,
			'vendor' => $this->vendor->vendor_id,
			'url_params' => array('ID' =>
$c->characteristic_id)
		)
	);
?>
	</div>
</div>
<script type="text/javascript">
window.productMgr.duplicateChangeCharacteristic = function(el) {
	var w = window, d = document,
		u = '<?php echo
hikamarket::completeLink('characteristic&task=findList&characteristic_type=value&characteristic_parent_id={ID}',
true, false, true); ?>',
		a = '<?php echo
hikamarket::completeLink('characteristic&task=add&characteristic_type=value&characteristic_parent_id={ID}&tmpl=json',
true, false, true); ?>';
	var n = w.oNameboxes['data_variant_duplicate_variants'];
	if(!n) return true;
	n.changeUrl(u.replace('{ID}', el.value), {add:
a.replace('{ID}', el.value)});
	return true;
};
</script>
<?php } ?>
<div style="clear:both"></div>
<div style="float:right">
	<button onclick="return
window.productMgr.populateVariants('<?php echo $populateMode;
?>');" class="hikabtn hikabtn-success"><i
class="fas fa-check"></i> <?php echo
JText::_('HIKA_SAVE'); ;?></button>
</div>
<button onclick="return
window.productMgr.cancelPopulateVariants();" class="hikabtn
hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
<div style="clear:both"></div>
views/productmarket/tmpl/galleryimage.php000064400000010216151166607760014733
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><fieldset>
	<div class="toolbar" id="toolbar"
style="float: right;">
		<button class="hikabtn" type="button"
onclick="window.hikamarket.submitform('galleryselect','adminForm');"><img
style="vertical-align: middle" src="<?php echo
HIKASHOP_IMAGES; ?>save.png"/><?php echo
JText::_('OK'); ?></button>
	</div>
</fieldset>
<form action="<?php echo
hikamarket::completeLink('product&task=galleryimage', true);
?>" method="post" name="adminForm"
id="adminForm" enctype="multipart/form-data">
	<table width="100%" height="100%"
class="adminlist" style="width:100%;height:100%;">
		<thead>
			<tr>
				<th></th>
				<th>
					<?php echo JText::_('FILTER');?>:
					<input type="text" name="search"
value="<?php echo
$this->escape($this->pageInfo->search);?>"
class="text_area"
onchange="document.adminForm.submit();" />
					<button class="hikabtn"
onclick="document.adminForm.limitstart.value=0;this.form.submit();"><i
class="fas fa-search"></i></button>
					<button class="hikabtn"
onclick="document.adminForm.limitstart.value=0;document.getElementById('search').value='';this.form.submit();"><i
class="fas fa-times"></i></button>
				</th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td></td>
				<td>
					<?php echo $this->pagination->getListFooter(); ?>
					<?php echo $this->pagination->getResultsCounter(); ?>
				</td>
			</tr>
		</tfoot>
		<tr>
			<td width="130px" height="100%"
style="width:130px;vertical-align:top;">
				<div style="width:130px;height:100%;overflow:auto;">
<?php
echo $this->treeContent;
?>
<script type="text/javascript">
hikashopGallery.callbackSelection = function(tree,id) {
	var d = document, node = tree.get(id);
	if( node.value && node.name ) {
		var url = "<?php echo
hikamarket::completeLink('product&task=galleryimage&id='.hikaInput::get()->getInt('id').'&cid='.@$this->cid.'&product_id='.hikaInput::get()->getInt('product_id').'&folder={FOLDER}',
true, true) ;?>";
		document.location = url.replace('{FOLDER}',
node.value.replace('/', '|'));
	}
}
</script>
				</div>
			</td>
			<td>
				<ul id="hikaGallery">
<?php
if(!empty($this->dirContent)) {
	foreach($this->dirContent as $k => $content) {
		$chk_uid = 'hikaGalleryChk_' . $k . '_' . uniqid();
?>
	<li class="hikaGalleryItem">
		<a class="hikaGalleryPhoto" href="#"
onclick="return window.hikagallery.select(this, '<?php echo
$chk_uid; ?>');">
			<img src="<?php echo $content->thumbnail->url;
?>" alt="<?php echo $content->filename;
?>"/>
			<span style="display:none;"
class="hikaGalleryChk"><input type="checkbox"
id="<?php echo $chk_uid ;?>" name="files[]"
value="<?php echo $content->path; ?>"/></span>
			<div class="hikaGalleryCommand">
				<span class="photo_name"><?php echo
$content->filename; ?></span>
				<span><?php echo $content->width . 'x' .
$content->height; ?></span>
				<span style="float:right"><?php echo
$content->size; ?></span>
			</div>
		</a>
	</li>
<?php
	}
}
?>
				</ul>
			</td>
		</tr>
	</table>
<script type="text/javascript">
window.hikagallery = {};
window.hikagallery.select = function(el, id) {
	var d = document, w = window, o = w.Oby, chk = d.getElementById(id);
	if(chk) {
		if(chk.checked) {
			o.removeClass(el.parentNode, 'selected');
		} else {
			o.addClass(el.parentNode, 'selected');
		}
		chk.checked = !chk.checked;
	}
	return false;
}
</script>
	<div class="clr"></div>
	<input type="hidden" name="product_id"
value="<?php echo
hikaInput::get()->getInt('product_id'); ?>" />
	<input type="hidden" name="pid"
value="<?php echo hikaInput::get()->getInt('pid');
?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="task"
value="galleryimage" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl',
'product'); ?>" />
	<?php echo JHTML::_('form.token'); ?>
</form>
views/productmarket/tmpl/image.php000064400000006110151166607760013351
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><fieldset>
	<div class="toolbar" id="toolbar"
style="float: right;">
		<button class="hikabtn" type="button"
onclick="hikamarket.submitform('addimage','hikamarket_form');">
			<img style="vertical-align:middle" src="<?php echo
HIKASHOP_IMAGES; ?>save.png" alt=""/> <?php echo
JText::_('OK'); ?>
		</button>
	</div>
</fieldset>
<form action="<?php echo
hikamarket::completeLink('product&task=image'); ?>"
method="post" name="hikamarket_form"
id="hikamarket_form" enctype="multipart/form-data">
<dl class="hikam_options">
	<dt>
		<label for="data_file_file_name"><?php echo
JText::_('HIKA_NAME'); ?></label>
	</dt>
	<dd>
		<input type="text" name="data[file][file_name]"
id="data_file_file_name" value="<?php echo
$this->escape(@$this->element->file_name); ?>"/>
	</dd>
<?php if(hikamarket::acl('product/edit/images/title')) {
?>
	<dt>
		<label for="data_file__file_description"><?php echo
JText::_('HIKA_TITLE'); ?></label>
	</dt>
	<dd>
		<input type="text"
name="data[file][file_description]"
id="data_file__file_description" value="<?php echo
$this->escape(@$this->element->file_description);
?>"/>
	</dd>
<?php } ?>
<?php
	if(empty($this->element->file_path)) {
		if(!empty($this->image_link) &&
hikamarket::acl('product/edit/images/link')) {
?>
	<dt>
		<label for="data_files"><?php echo
JText::_('HIKA_PATH'); ?></label>
	</dt>
	<dd>
		<input type="text" name="data[filepath]"
size="60" style="width:100%" value=""/>
	</dd>
<?php
		} else if(empty($this->image_link) &&
hikamarket::acl('product/edit/images/upload')) {
?>
	<dt>
		<label for="data_files"><?php echo
JText::_('HIKA_IMAGE'); ?></label>
	</dt>
	<dd>
		<input id="data_files" type="file"
name="files[]" size="30" /><br/>
		<?php echo JText::sprintf('MAX_UPLOAD',
(hikashop_bytes(ini_get('upload_max_filesize')) >
hikashop_bytes(ini_get('post_max_size'))) ?
ini_get('post_max_size') :
ini_get('upload_max_filesize')); ?>
	</dd>
<?php
		}
	} else {
?>
	<dt>
		<label for="files"><?php echo JText::_(
'HIKA_IMAGE' ); ?></label>
	</dt>
	<dd>
<?php $image =
$this->imageHelper->getThumbnail($this->element->file_path,
array(100, 100), array('default' => true)); ?>
		<img src="<?php echo $image->url; ?>"
alt="<?php echo $image->filename; ?>"/>
	</dd>
<?php
	}
?>
</dl>
	<div class="clr"></div>
	<input type="hidden" name="data[file][file_type]"
value="product" />
	<input type="hidden" name="data[file][file_ref_id]"
value="<?php echo $this->product_id; ?>" />
	<input type="hidden" name="cid[]"
value="<?php echo @$this->cid; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="task"
value="addimage" />
	<input type="hidden" name="ctrl"
value="product" />
	<?php echo JHTML::_('form.token'); ?>
</form>
views/productmarket/tmpl/import.php000064400000001400151166607760013576
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php

if(empty($this->import)) {
?>
<div id="hikamarket_import_zone">
<?php
	$options = array(
		'upload' => true,
		'upload_base_url' =>
'index.php?option=com_hikamarket&ctrl=upload',
		'toolbar' => null,
		'text' => JText::_('HIKAM_IMPORT_UPLOAD_ZONE'),
		'uploader' => array('product',
'import_file'),
		'vars' => array(

		),
		'ajax' => true
	);

	echo
$this->uploaderType->displayFileSingle('hikamarket_import_file',
'', $options);
?>
</div>
<?php
}
views/productmarket/tmpl/index.html000064400000000032151166607760013550
0ustar00<html><body></body></html>views/productmarket/tmpl/listing.php000064400000040775151166607760013757
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikamarket_product_listing">
<form action="<?php echo
hikamarket::completeLink('product&task=listing'); ?>"
method="post" name="adminForm"
id="adminForm">

<div class="hk-row-fluid">
	<div class="hkc-md-12 hikam_search_zone">
<?php
	echo $this->loadHkLayout('search', array(
		'id' => 'hikamarket_products_listing_search',
	));
?>
		<div class="hikam_sort_zone"><?php
			echo JHTML::_('select.genericlist', $this->ordering_values,
'filter_fullorder',
'onchange="this.form.submit();"', 'value',
'text', $this->full_ordering);
		?></div>
	</div>
	<div class="hkc-md-12">
		<div id="hikam_product_filters"
class="expand-filters">
<?php
	if(!empty($this->vendorType))
		echo $this->vendorType->display('filter_vendors',
@$this->pageInfo->filter->vendors);
	if($this->config->get('show_category_explorer', 1))
		echo $this->childdisplayType->display('filter_type',
$this->pageInfo->selectedType, false, false);
?>
		</div>
	</div>
</div>
<?php
if(!empty($this->breadcrumb)) {
?>
<div class="hikam_breadcrumb_explorer">
	<div class="hikam_breadcrumb"
onclick="window.Oby.toggleClass(this.parentNode,
'explorer_open');">
<?php
	foreach($this->breadcrumb as $i => $breadcrumb) {
		if($i > 0)
			echo '<span
class="breadcrumb_sep">/</span>';

		echo '<span class="breadcrumb_el">';
		if($breadcrumb->category_id != $this->cid) {
			echo '<a
href="'.hikamarket::completeLink('product&task=listing&cid='.$breadcrumb->category_id).'">'.JText::_($breadcrumb->category_name).'</a>';
		} else {
			echo JText::_($breadcrumb->category_name);
		}
		echo '</span>';
	}
?>
		<span class="breadcrumb_expand_icon"><i
class="fas fa-folder-open"></i></span>
	</div>
	<div class="hikam_category_explorer"><?php
		echo
$this->shopCategoryType->displayTree('hikam_categories',
$this->rootCategory, null, true, true, $this->cid,
hikamarket::completeLink('category&task=getTree', false,
true));
	?></div>
<script type="text/javascript">
window.hikashop.ready(function(){
var otreeCategories = window.oTrees['hikam_categories'];
otreeCategories.sel(otreeCategories.find(<?php echo $this->cid;
?>));
otreeCategories.callbackSelection = function(tree,id) {
	var d = document, node = tree.get(id);
	if(node.value && node.name) {
		var u = "<?php echo
hikamarket::completeLink('product&task=listing&cid=HIKACID',
false, false, true);?>";
		window.location = u.replace('HIKACID', node.value);
	}
};
});
</script>
</div>
<?php
}
	$acl_product_code = hikamarket::acl('product/edit/code');
	$acl_product_quantity =
hikamarket::acl('product/edit/quantity');

	$publish_content = '<i class="fas
fa-check"></i> ' .
JText::_('HIKA_PUBLISHED');
	$unpublish_content = '<i class="fas
fa-times"></i> ' .
JText::_('HIKA_UNPUBLISHED');
?>
<div id="hikam_product_main_listing">
<?php
if(!empty($this->products)) {
	foreach($this->products as $product) {
		$url = ($this->manage) ?
hikamarket::completeLink('product&task=edit&cid='.(int)$product->product_id)
:
hikamarket::completeLink('shop.product&task=show&cid='.(int)$product->product_id);

		if(empty($product->product_name) &&
!empty($product->parent_product_name))
			$product_name =
'<em>'.$this->escape($product->parent_product_name,
true).'</em>';
		else if(empty($product->product_name))
			$product_name =
'<em>'.JText::sprintf('HIKAM_PRODUCT_NO_NAME',
$product->product_code).'</em>';
		else
			$product_name = $this->escape($product->product_name, true);

		$stock_color = 'green';
		$extra_classes = '';
		if($product->product_type == 'waiting_approval')
			$extra_classes .= ' hkm_product_approval';
		if($product->product_quantity < 0) {
			$stock_color = 'blue';
		} else if($product->product_quantity == 0) {
			$stock_color = 'red';
			$extra_classes .= ' hkm_product_no_stock';
		} else if($product->product_quantity <
$this->config->get('stock_warning_level', 10)) {
			$stock_color = 'orange';
			$extra_classes .= ' hkm_product_low_stock';
		}
?>
	<div class="hk-card hk-card-default hk-card-product<?php echo
$extra_classes; ?>" data-hkm-product="<?php echo
(int)$product->product_id; ?>">
		<div class="hk-card-header">
			<a class="hk-row-fluid" href="<?php echo $url;
?>">
				<div class="hkc-sm-6 hkm_product_name"><?php
					echo $product_name;
				?></div>
				<div class="hkc-sm-6 hkm_product_price">
					<i class="fa fa-credit-card"></i> <?php
						if(empty($product->prices))
							echo JText::_('FREE_PRICE');
						else
							echo
$this->currencyHelper->displayPrices($product->prices);
					?>
				</div>
			</a>
		</div>
		<div class="hk-card-body">
			<div class="hk-row-fluid">
				<div class="hkc-sm-2 hkm_product_image">
					<a href="<?php echo $url; ?>"><?php
					$thumb =
$this->imageHelper->getThumbnail(@$product->file_path,
array(50,50), array('default' => 1, 'forcesize'
=> 1));
					if(!empty($thumb->path) && empty($thumb->external))
						echo '<img src="'.
$this->imageHelper->uploadFolder_url . str_replace('\\',
'/', $thumb->path).'" class=""
alt=""/>';
					else if(!empty($thumb->path) && !empty($thumb->url))
						echo '<img src="'. $thumb->url.'"
class="" alt="" width="50"
height="50"/>';
					?></a>
				</div>
				<div class="hkc-sm-5 hkm_product_details">
<?php if($acl_product_code) { ?>
					<div class="hkm_product_code">
						<i class="fas fa-tag"></i> <span><?php
echo $this->escape($product->product_code); ?></span>
					</div>
<?php } ?>
					<div class="hkm_product_stock">
						<i class="fas fa-cubes"></i> <span
class="hk-label hk-label-<?php echo $stock_color;
?>"><?php
							echo ($product->product_quantity == 0) ?
JText::_('HIKA_OUT_OF_STOCK') : (($product->product_quantity
>= 0) ? $product->product_quantity :
JText::_('UNLIMITED'));
						?></span>
<?php
	if($this->product_action_sort) {
		if($this->product_action_publish) {
?>
						<a class="hikabtn hikabtn-mini hikabtn-<?php echo
($product->product_published) ? 'success' :
'danger'; ?> hkm_publish_button"
data-toggle-state="<?php echo $product->product_published ? 1 :
0; ?>" data-toggle-id="<?php echo $product->product_id;
?>" onclick="return
window.localPage.toggleProduct(this);"><?php
							echo ($product->product_published) ? $publish_content :
$unpublish_content;
						?></a>
<?php
		} else {
?>
						<span class="hkm_publish_state hk-label hk-label-<?php
echo ($product->product_published) ? 'green' :
'red'; ?>"><?php echo
($product->product_published) ? $publish_content : $unpublish_content;
?></span>
<?php
		}
	}
?>
					</div>
<?php if(!empty($product->vendor_name)) { ?>
					<div class="hkm_product_vendor">
						<i class="fas fa-user-tie"></i> <?php echo
$product->vendor_name; ?>
					</div>
<?php } ?>
<?php if($product->product_type == 'waiting_approval') {
?>
					<div class="hkm_product_approval">
						<i class="far fa-thumbs-up"></i> <span
class="hk-label hk-label-orange"><?php echo
JText::_('HIKAM_PRODUCT_NOT_APPROVED') ?></span>
					</div>
<?php } else { ?>
					<div class="hkm_product_stats">
						<span class="hkm_product_hit"
data-toggle="hk-tooltip" data-title="<?php echo
JText::sprintf('HIKAM_X_VIEWS', (int)$product->product_hit);
?>"><i class="far fa-eye"></i>
<span><?php echo
$this->niceNumber((int)$product->product_hit);
?></span></span>
						/
						<span class="hkm_product_sales"
data-toggle="hk-tooltip" data-title="<?php echo
JText::sprintf('HIKAM_X_SALES', (int)$product->product_sales);
?>"><i class="fas fa-shopping-cart"></i>
<span><?php echo
$this->niceNumber((int)$product->product_sales);
?></span></span>
					</div>
<?php } ?>

<?php
		if(!empty($this->fields)) {
			$fields = array();
			foreach($this->fields as $fieldName => $oneExtraField) {
				$r = $this->fieldsClass->show($oneExtraField,
$product->$fieldName);
				if(empty($r))
					continue;
				$fields[] = '<dt
class="hkm_product_field_'.$fieldName.'">'.$this->fieldsClass->trans($oneExtraField->field_realname).'</dt><dd
class="hkm_product_field_'.$fieldName.'">'.$r.'</dd>';
			}
			if(!empty($fields)) {
?>
					<dl class="hikam_options hkm_product_fields"><?php
						echo implode("\r\n", $fields);
						unset($fields);
					?></dl>
<?php
			}
		}
?>

				</div>
<?php
		if($this->product_action_sort) {
?>
				<div class="hkc-sm-3 hkm_product_order">
					<div class="hk-input-group">
						<div class="hk-input-group-prepend">
							<a class="hikabtn" href="#up"
data-ordering="-1" data-ordering-id="<?php echo
(int)$product->product_id; ?>" onclick="return
window.localPage.orderingProduct(this);"><i class="fas
fa-arrow-up"></i></a>
						</div>
						<input type="text" class="hk-form-control
hkm_order_value" size="3" name="order[<?php echo
$product->product_id; ?>]" value="<?php echo
(int)@$product->ordering; ?>" />
						<div class="hk-input-group-append">
							<a class="hikabtn" href="#down"
data-ordering="1" data-ordering-id="<?php echo
(int)$product->product_id; ?>" onclick="return
window.localPage.orderingProduct(this);"><i class="fas
fa-arrow-down"></i></a>
						</div>
					</div>
				</div>
<?php
		} else {
?>
				<div class="hkc-sm-3 hkm_product_publish">
<?php
			if($this->product_action_publish) {
?>
					<a class="hikabtn hikabtn-<?php echo
($product->product_published) ? 'success' :
'danger'; ?> hkm_publish_button"
data-toggle-state="<?php echo $product->product_published ? 1 :
0; ?>" data-toggle-id="<?php echo $product->product_id;
?>" onclick="return
window.localPage.toggleProduct(this);"><?php
						echo ($product->product_published) ? $publish_content :
$unpublish_content;
					?></a>
<?php
			} else {
?>
					<span class="hkm_publish_state hk-label hk-label-<?php echo
($product->product_published) ? 'green' : 'red';
?>"><?php echo ($product->product_published) ?
$publish_content : $unpublish_content; ?></span>
<?php
			}
?>
				</div>
<?php
	}
?>
				<div class="hkc-sm-2 hkm_product_actions"><?php
		$data = array(
			'details' => array(
				'name' => '<i class="fas
fa-search"></i> ' . JText::_('HIKA_DETAILS',
true),
				'link' => $url
			)
		);
		if($this->product_action_copy)
			$data['copy'] = array(
				'name' => '<i class="fas
fa-copy"></i> ' . JText::_('HIKA_COPY',
true),
				'link' => '#copy',
				'click' => 'return
window.localPage.copyProduct('.(int)$product->product_id.',
\''.urlencode(strip_tags($product->product_name)).'\');'
			);
		if($this->product_action_delete)
			$data['delete'] = array(
				'name' => '<i class="fas
fa-trash"></i> ' . JText::_('HIKA_DELETE',
true),
				'link' => '#delete',
				'click' => 'return
window.localPage.deleteProduct('.(int)$product->product_id.',
\''.urlencode(strip_tags($product->product_name)).'\');'
			);
		if(!empty($data)) {
			echo $this->dropdownHelper->display(
				JText::_('HIKA_ACTIONS'),
				$data,
				array('type' => '', 'class' =>
'hikabtn-primary', 'right' => true, 'up'
=> false)
			);
		}
				?></div>
			</div>
		</div>
	</div>
<?php
	}
?>
	<div class="hikamarket_pagination">
		<?php echo $this->pagination->getListFooter(); ?>
		<?php echo $this->pagination->getResultsCounter(); ?>
	</div>
<?php
} else {
?>
	<div class="hk-well hikam_no_products">
		</p><?php echo
JText::_('HIKAM_EMPTY_PRODUCT_LISTING'); ?></p>
	</div>
<?php
}
?>
</div>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="listing" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="cid"
value="<?php echo $this->cid; ?>" />
	<?php echo JHTML::_('form.token'); ?>
</form>
<?php if($this->product_action_publish) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.toggleProduct = function(el) {
	var w=window, d=document, o=w.Oby,
		state = el.getAttribute('data-toggle-state'),
		id = el.getAttribute('data-toggle-id');
	if(!id) return false;
	var url="<?php echo
hikamarket::completeLink('toggle','ajax',true);?>",
		v = (state == 0) ? 1 : 0,
		data=o.encodeFormData({"task":"product_published-"+id,"value":v,"table":"product","<?php
echo hikamarket::getFormToken(); ?>":1});
	el.disabled = true;
	if(state == 1) el.innerHTML = "<i class=\"fas fa-spinner
fa-pulse\"></i> <?php echo
JText::_('HIKA_UNPUBLISHING', true); ?>";
	else el.innerHTML = "<i class=\"fas fa-spinner
fa-pulse\"></i> <?php echo
JText::_('HIKA_PUBLISHING', true); ?>";
	el.classList.remove("hikabtn-success",
"hikabtn-danger");
	o.xRequest(url,{mode:"POST",data:data},function(x,p){
		if(x.responseText && x.responseText == '1')
			state = v;
		el.disabled = false;
		el.setAttribute('data-toggle-state', v);
		if(state == 1) el.innerHTML = "<i class=\"fas
fa-check\"></i> <?php echo
JText::_('HIKA_PUBLISHED', true); ?>";
		else el.innerHTML = "<i class=\"fas
fa-times\"></i> <?php echo
JText::_('HIKA_UNPUBLISHED', true); ?>";
		el.classList.add( state ? "hikabtn-success" :
"hikabtn-danger" );
	});
};
</script>
<?php } ?>
<?php if($this->product_action_sort) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.orderingProduct = function(el) {
	var id = el.getAttribute('data-ordering-id'),
		direction = el.getAttribute('data-ordering') ==
'-1';
	if(!id) return false;
	var block =
document.querySelector('[data-hkm-product="'+id+'"]');
	if(!block) return false;
	var input =
block.querySelector('input[name="order['+id+']"]');
	if(!input) return false;
<?php if($this->pageInfo->filter->order->value ==
'product_category.ordering') { ?>
	var switchBlock = (direction) ? block.previousElementSibling :
block.nextElementSibling;
	if(!switchBlock) return false;
	var switchId = switchBlock.getAttribute('data-hkm-product'),
		switchInput =
switchBlock.querySelector('input[name="order['+switchId+']"]');
	if(direction)
		block.parentNode.insertBefore(block, switchBlock);
	else
		switchBlock.parentNode.insertBefore(switchBlock, block);
	var i = input.value;
	input.value = switchInput.value;
	switchInput.value = i;
<?php } else { ?>
	var value = parseInt(input.value);
	if(isNaN(value)) value = 1;
	value += (direction ? -1 : 1);
	if(value < 1) value = 1;
	input.value = value;
<?php } ?>
	return false;
};
</script>
<?php } ?>
<?php if($this->product_action_delete) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.deleteProduct = function(id, name) {
	var confirmMsg = "<?php echo
JText::_('CONFIRM_DELETE_PRODUCT_X'); ?>";
	if(!confirm(confirmMsg.replace('{PRODUCT}', decodeURI(name))))
		return false;
	var f = document.forms['hikamarket_delete_product_form'];
	if(!f) return false;
	f.product_id.value = id;
	f.submit();
	return false;
};
</script>
<form action="<?php echo
hikamarket::completeLink('product&task=delete'); ?>"
method="post" name="hikamarket_delete_product_form"
id="hikamarket_delete_product_form">
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="delete" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="product_id"
value="0" />
	<?php echo JHTML::_('form.token'); ?>
</form>
<?php } ?>
<?php if($this->product_action_copy) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.copyProduct = function(id, name) {
	var confirmMsg = "<?php echo
JText::_('CONFIRM_COPY_PRODUCT_X'); ?>";
	if(!confirm(confirmMsg.replace('{PRODUCT}', decodeURI(name))))
		return false;
	var f = document.forms['hikamarket_copy_product_form'];
	if(!f) return false;
	f.product_id.value = id;
	f.submit();
	return false;
};
</script>
<form action="<?php echo
hikamarket::completeLink('product&task=copy'); ?>"
method="post" name="hikamarket_copy_product_form"
id="hikamarket_copy_product_form">
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="copy" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="product_id"
value="0" />
	<?php echo JHTML::_('form.token'); ?>
</form>
<?php } ?>
</div>
views/productmarket/tmpl/listing.xml000064400000000472151166607760013756
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor product listing</name>
	</state>
	<layout
title="COM_HIKAMARKET_PRODUCTMARKET_LISTING_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
	</fields>
</metadata>views/productmarket/tmpl/variant.php000064400000026461151166607760013746
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div class="hikamarket_variant_toolbar">
	<div style="float:left;">
		<button onclick="if(window.productMgr.closeVariant) { return
window.productMgr.closeVariant(); } else return false;"
class="hikabtn hikabtn-danger"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_CANCEL'); ;?></button>
	</div>
	<div style="float:right;">
<?php
	if($this->config->get('product_cart_link', 0) &&
$this->product->product_id > 0) {
	}
?>
		<button onclick="if(window.productMgr.saveVariant) { return
window.productMgr.saveVariant(<?php echo
$this->product->product_id; ?>); } else return false;"
class="hikabtn hikabtn-success"><i class="far
fa-times-circle"></i> <?php echo
JText::_('HIKA_SAVE'); ;?></button>
	</div>
	<div style="clear:both"></div>
</div>
<div id="hikamarket_product_variant_edition_<?php echo
$this->product->product_id; ?>">
	<table class="hikam_blocks">
		<tr>
			<td class="hikam_block_l hikam_block_d30">
<?php
	if(hikamarket::acl('product/variant/images')) {
		$this->setLayout('form');
		$this->upload_ajax = true;
		echo $this->loadTemplate('image');
	}
?>
			</td>
			<td class="hikam_block_r">
				<dl class="hikam_options">
<?php if(hikamarket::acl('product/variant/name')) { ?>
					<dt
class="hikamarket_product_name"><label><?php echo
JText::_('HIKA_NAME'); ?></label></dt>
					<dd class="hikamarket_product_name"><input
type="text" name="data[variant][product_name]"
value="<?php echo @$this->product->product_name;
?>"/></dd>

<?php } else { ?>
					<dt
class="hikamarket_product_name"><label><?php echo
JText::_('HIKA_NAME'); ?></label></dt>
					<dd class="hikamarket_product_name"><?php echo
@$this->product->product_name; ?></dd>
<?php }

	if(hikamarket::acl('product/variant/code')) { ?>
					<dt
class="hikamarket_product_code"><label><?php echo
JText::_('PRODUCT_CODE'); ?></label></dt>
					<dd class="hikamarket_product_code"><input
type="text" name="data[variant][product_code]"
value="<?php echo @$this->product->product_code;
?>"/></dd>
<?php }

	$edit_variant =
hikamarket::acl('product/variant/characteristics');
	foreach($this->product->characteristics as $characteristic){ ?>
					<dt
class="hikamarket_product_characteristic"><label><?php
echo $characteristic->characteristic_value;
?></label></dt>
					<dd
class="hikamarket_product_characteristic"><?php
						if($edit_variant)
							echo
$this->characteristicType->display('data[variant][characteristic]['.$characteristic->characteristic_id.']',
(int)@$characteristic->default_id, @$characteristic->values);
						else
							echo $characteristic->values[$characteristic->default_id];
					?></dd>
<?php
	}

	if(hikamarket::acl('product/variant/quantity')) { ?>
					<dt
class="hikamarket_product_quantity"><label><?php echo
JText::_('PRODUCT_QUANTITY'); ?></label></dt>
					<dd class="hikamarket_product_quantity">
						<?php echo
$this->quantityType->display('data[variant][product_quantity]',
@$this->product->product_quantity);?>
					</dd>
<?php }

	if(hikamarket::acl('product/variant/published')) { ?>
					<dt
class="hikamarket_product_published"><label><?php
echo JText::_('HIKA_PUBLISHED'); ?></label></dt>
					<dd class="hikamarket_product_published"><?php
						echo
$this->radioType->booleanlist('data[variant][product_published]',
'', @$this->product->product_published);
					?></dd>
<?php } ?>
				</dl>
			</td>
		</tr>
<?php
	if(hikamarket::acl('product/variant/description')) {
		if(!$this->config->get('front_small_editor')) { ?>
		<tr class="hikamarket_product_description">
			<td colspan="2">
				<label
class="hikamarket_product_description_label"><?php echo
JText::_('HIKA_DESCRIPTION'); ?></label>
				<?php echo $this->editor->display();?>
				<div style="clear:both"></div>
<script type="text/javascript">
window.productMgr.saveVariantEditor = function() { <?php echo
$this->editor->jsCode(); ?> };
</script>
			</td>
		</tr>
<?php	} else { ?>
		<tr>
			<td colspan="2">
				<dl class="hikam_options">
					<dt
class="hikamarket_product_description"><label><?php
echo JText::_('HIKA_DESCRIPTION');
?></label></dt>
					<dd class="hikamarket_product_description"><?php
echo $this->editor->display();?><div
style="clear:both"></div></dd>
				</dl>
<script type="text/javascript">
window.productMgr.saveVariantEditor = function() { <?php echo
$this->editor->jsCode(); ?> };
</script>
			</td>
		</tr>
<?php	}
	}
?>
		<tr>
			<td colspan="2">
				<dl class="hikam_options">
<?php
	if(hikamarket::acl('product/variant/price')) { ?>
					<dt
class="hikamarket_product_price"><label><?php echo
JText::_('PRICES'); ?></label></dt>
					<dd class="hikamarket_product_price"><?php
						$this->setLayout('form');
						$this->price_form_key = 'variantprice';
						echo $this->loadTemplate('price');
					?></dd>
<?php }

	if(hikamarket::acl('product/variant/priceoverride')) {?>
					<dt
class="hikamarket_product_price_override"><label><?php
echo JText::_('MAIN_PRICE_OVERRIDE');
?></label></dt>
					<dd class="hikamarket_product_price_override">
						<input type="text"
name="data[variant][product_price_percentage]"
value="<?php echo
$this->escape(@$this->product->product_price_percentage);
?>" />%
					</dd>
<?php }

	if(hikamarket::acl('product/variant/qtyperorder')) {?>
					<dt
class="hikamarket_product_qtyperorder"><label><?php
echo JText::_('QUANTITY_PER_ORDER');
?></label></dt>
					<dd class="hikamarket_product_qtyperorder">
						<input type="text"
name="data[variant][product_min_per_order]" value="<?php
echo (int)@$this->product->product_min_per_order; ?>"
/><?php
						echo ' ' . JText::_('HIKA_RANGE_TO'). '
';
						echo
$this->quantityType->display('data[variant][product_max_per_order]',
@$this->product->product_max_per_order);
					?></dd>
<?php }

	if(hikamarket::acl('product/variant/saledates')) {?>
					<dt
class="hikamarket_product_salestart"><label><?php
echo JText::_('PRODUCT_SALE_DATES');
?></label></dt>
					<dd class="hikamarket_product_salestart"><?php
						echo JHTML::_('calendar',
hikamarket::getDate((@$this->product->product_sale_start?@$this->product->product_sale_start:''),'%Y-%m-%d
%H:%M'),
'data[variant][product_sale_start]','product_variant_sale_start','%Y-%m-%d
%H:%M',array('size' => '20'));
						echo ' <span class="calendar-separator">' .
JText::_('HIKA_RANGE_TO') . '</span> ';
						echo JHTML::_('calendar',
hikamarket::getDate((@$this->product->product_sale_end?@$this->product->product_sale_end:''),'%Y-%m-%d
%H:%M'),
'data[variant][product_sale_end]','product_variant_sale_end','%Y-%m-%d
%H:%M',array('size' => '20'));
					?></dd>
<?php }

	if(hikamarket::acl('product/variant/weight')) { ?>
					<dt
class="hikamarket_product_weight"><label><?php echo
JText::_('PRODUCT_WEIGHT'); ?></label></dt>
					<dd class="hikamarket_product_weight"><input
type="text" name="data[variant][product_weight]"
value="<?php echo @$this->product->product_weight;
?>"/><?php echo
$this->weight->display('data[variant][product_weight_unit]',
@$this->product->product_weight_unit); ?></dd>
<?php }

	if(hikamarket::acl('product/variant/volume')) { ?>
					<dt
class="hikamarket_product_volume"><label><?php echo
JText::_('PRODUCT_VOLUME'); ?></label></dt>
					<dd class="hikamarket_product_volume">
							<label><?php echo JText::_('PRODUCT_LENGTH');
?></label>
							<input size="10" type="text"
name="data[variant][product_length]" value="<?php echo
@$this->product->product_length; ?>"/><br/>
							<label><?php echo JText::_('PRODUCT_WIDTH');
?></label>
							<input size="10" type="text"
name="data[variant][product_width]" value="<?php echo
@$this->product->product_width;?>"/><?php echo
$this->volume->display('data[variant][product_dimension_unit]',
@$this->product->product_dimension_unit);?><br/>
							<label><?php echo JText::_('PRODUCT_HEIGHT');
?></label>
							<input size="10" type="text"
name="data[variant][product_height]" value="<?php echo
@$this->product->product_height; ?>"/>
					</dd>
<?php }

	if(hikamarket::acl('product/variant/customfields')) {
		if(!empty($this->fields)) {
?>
				</dl>
				<div style="clear:both"></div>
<?php
			foreach($this->fields as $fieldName => $oneExtraField) {
?>
				<dl id="<?php echo $this->fieldsClass->prefix .
'product_' . $fieldName; ?>"
class="hikam_options">
					<dt class="hikamarket_product_<?php echo $fieldName;
?>"><?php echo
$this->fieldsClass->getFieldName($oneExtraField); ?></dt>
					<dd class="hikamarket_product_<?php echo $fieldName;
?>"><?php
						$onWhat = 'onchange';
						if($oneExtraField->field_type == 'radio')
							$onWhat = 'onclick';
						echo $this->fieldsClass->display($oneExtraField,
$this->product->$fieldName,
'data[variant]['.$fieldName.']', false, '
'.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'product\',0,\''.$this->fieldsClass->prefix.'\');"');
					?></dd>
				</dl>
<?php
			}
?>
				<dl class="hikam_options">
<?php
		}
	}

	if(hikamarket::acl('product/variant/acl') &&
hikashop_level(2)) { ?>
					<dt
class="hikamarket_product_acl"><label><?php echo
JText::_('ACCESS_LEVEL'); ?></label></dt>
					<dd class="hikamarket_product_acl"><?php
						$product_access = 'all';
						if(isset($this->product->product_access))
							$product_access = $this->product->product_access;
						echo
$this->joomlaAcl->display('data[variant][product_access]',
$product_access, true, true);
					?></dd>
<?php }

	if(hikamarket::acl('product/variant/plugin')) {
		$html = array();
		JPluginHelper::importPlugin('hikashop');
		JPluginHelper::importPlugin('hikamarket');
		JFactory::getApplication()->triggerEvent('onMarketProductBlocksDisplay',
array(&$this->product, &$html));

		foreach($html as $h) {
			echo $h;
		}
	}
?>
				</dl>
				<div style="clear:both"></div>
<?php
	if(hikamarket::acl('product/variant/files')) {
		$this->setLayout('form');
		$this->upload_ajax = true;
		echo $this->loadTemplate('file');
	}
?>
			</td>
		</tr>
	</table>
</div>
<input type="hidden"
name="data[variant][product_id]" value="<?php echo
$this->product->product_id; ?>" />
<script type="text/javascript">
if(JoomlaCalendar && JoomlaCalendar.init){
	setTimeout(function(){
		var section =
document.getElementById('hikamarket_product_variant_edition_<?php
echo $this->product->product_id; ?>');
		if(!section) return;
		elements = section.querySelectorAll(".field-calendar");
		for(i = 0; i < elements.length; i++){
			JoomlaCalendar.init(elements[i]);
		}
	}, 500);
}
</script>
<?php
$doc = JFactory::getDocument();
foreach($doc->_custom as $custom) {
	$custom = preg_replace('#<script
.*(type="text/javascript")?
src=".*"></script>#iU', '', $custom);
	$custom = preg_replace('#<script
.*type=[\'"]text/javascript[\'"]>#iU',
'<script type="text/javascript">', $custom);
	if(strpos($custom,'<script
type="text/javascript">') !== false) {
		$custom = str_replace(
			array('<script type="text/javascript">',
'</script>'),
			array('<script
type="text/javascript">setTimeout(function(){',
'},20);</script>'),
			$custom);
	}
	echo $custom;
}
foreach($doc->_script as $script) {
	echo '<script
type="text/javascript">'."\r\n".$script."\r\n".'</script>';
}
views/productmarket/tmpl/waitingapproval.php000064400000021315151166607760015502
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikamarket_product_listing">
<form action="<?php echo
hikamarket::completeLink('product&task=waitingapproval');
?>" method="post" name="adminForm"
id="adminForm">

<div class="hk-row-fluid">
	<div class="hkc-md-12 hikam_search_zone">
<?php
	echo $this->loadHkLayout('search', array(
		'id' => 'hikamarket_products_listing_search',
	));
?>
		<div class="hikam_sort_zone"><?php
			echo JHTML::_('select.genericlist', $this->ordering_values,
'filter_fullorder',
'onchange="this.form.submit();"', 'value',
'text', $this->full_ordering);
		?></div>
	</div>
	<div class="hkc-md-12">
		<div id="hikam_product_filters"
class="expand-filters">
<?php
	if(!empty($this->vendorType))
		echo $this->vendorType->display('filter_vendors',
@$this->pageInfo->filter->vendors);
?>
		</div>
	</div>
</div>
<?php
	$show_product_image =
$this->config->get('front_show_product_image', 1);
	$acl_product_code = hikamarket::acl('product/edit/code');
?>
<div id="hikam_product_main_listing">
<?php
foreach($this->products as $product) {
	$url = ($this->manage) ?
hikamarket::completeLink('product&task=edit&cid='.(int)$product->product_id)
:
hikamarket::completeLink('shop.product&task=show&cid='.(int)$product->product_id);

	if(empty($product->product_name) &&
!empty($product->parent_product_name))
		$product_name =
'<em>'.$this->escape($product->parent_product_name,
true).'</em>';
	else if(empty($product->product_name))
		$product_name =
'<em>'.JText::sprintf('HIKAM_PRODUCT_NO_NAME',
$product->product_code).'</em>';
	else
		$product_name = $this->escape($product->product_name, true);

	$stock_color = 'green';
	$extra_classes = '';
	if($product->product_type == 'waiting_approval')
		$extra_classes .= ' hkm_product_approval';
	if($product->product_quantity < 0) {
		$stock_color = 'blue';
	} else if($product->product_quantity == 0) {
		$stock_color = 'red';
		$extra_classes .= ' hkm_product_no_stock';
	} else if($product->product_quantity <
$this->config->get('stock_warning_level', 10)) {
		$stock_color = 'orange';
		$extra_classes .= ' hkm_product_low_stock';
	}
?>
	<div class="hk-card hk-card-default hk-card-product<?php echo
$extra_classes; ?>" data-hkm-product="<?php echo
(int)$product->product_id; ?>">
		<div class="hk-card-header">
			<a class="hk-row-fluid" href="<?php echo $url;
?>">
				<div class="hkc-sm-6 hkm_product_name"><?php
					echo $product_name;
				?></div>
				<div class="hkc-sm-6 hkm_product_price">
					<i class="fa fa-credit-card"></i> <?php
						if(empty($product->prices))
							echo JText::_('FREE_PRICE');
						else
							echo
$this->currencyHelper->displayPrices($product->prices);
					?>
				</div>
			</a>
		</div>
		<div class="hk-card-body">
			<div class="hk-row-fluid">
				<div class="hkc-sm-2 hkm_product_image">
					<a href="<?php echo $url; ?>"><?php
					$thumb =
$this->imageHelper->getThumbnail(@$product->file_path,
array(50,50), array('default' => 1, 'forcesize'
=> 1));
					if(!empty($thumb->path) && empty($thumb->external))
						echo '<img src="'.
$this->imageHelper->uploadFolder_url . str_replace('\\',
'/', $thumb->path).'" class=""
alt=""/>';
					else if(!empty($thumb->path) && !empty($thumb->url))
						echo '<img src="'. $thumb->url.'"
class="" alt="" width="50"
height="50"/>';
					?></a>
				</div>
				<div class="hkc-sm-5 hkm_product_details">
<?php if($acl_product_code) { ?>
					<div class="hkm_product_code">
						<i class="fas fa-tag"></i> <span><?php
echo $this->escape($product->product_code); ?></span>
					</div>
<?php } ?>
					<div class="hkm_product_stock">
						<i class="fas fa-cubes"></i> <span
class="hk-label hk-label-<?php echo $stock_color;
?>"><?php
							echo ($product->product_quantity == 0) ?
JText::_('HIKA_OUT_OF_STOCK') : (($product->product_quantity
>= 0) ? $product->product_quantity :
JText::_('UNLIMITED'));
						?></span>
					</div>
<?php if(!empty($product->vendor_name)) { ?>
					<div class="hkm_product_vendor">
						<i class="fas fa-user-tie"></i> <?php echo
$product->vendor_name; ?>
					</div>
<?php } ?>
<?php if($product->product_type == 'waiting_approval') {
?>
					<div class="hkm_product_approval">
						<i class="far fa-thumbs-up"></i> <span
class="hk-label hk-label-orange"><?php echo
JText::_('HIKAM_PRODUCT_NOT_APPROVED') ?></span>
					</div>
<?php } else { ?>
					<div class="hkm_product_stats">
						<span class="hkm_product_hit"
data-toggle="hk-tooltip" data-title="<?php echo
JText::sprintf('HIKAM_X_VIEWS', (int)$product->product_hit);
?>"><i class="far fa-eye"></i>
<span><?php echo
$this->niceNumber((int)$product->product_hit);
?></span></span>
						/
						<span class="hkm_product_sales"
data-toggle="hk-tooltip" data-title="<?php echo
JText::sprintf('HIKAM_X_SALES', (int)$product->product_sales);
?>"><i class="fas fa-shopping-cart"></i>
<span><?php echo
$this->niceNumber((int)$product->product_sales);
?></span></span>
					</div>
<?php } ?>

<?php
	if(!empty($this->fields)) {
		$fields = array();
		foreach($this->fields as $fieldName => $oneExtraField) {
			$r = $this->fieldsClass->show($oneExtraField,
$product->$fieldName);
			if(empty($r))
				continue;
			$fields[] = '<dt
class="hkm_product_field_'.$fieldName.'">'.$this->fieldsClass->trans($oneExtraField->field_realname).'</dt><dd
class="hkm_product_field_'.$fieldName.'">'.$r.'</dd>';
		}
		if(!empty($fields)) {
?>
					<dl class="hikam_options hkm_product_fields"><?php
						echo implode("\r\n", $fields);
						unset($fields);
					?></dl>
<?php
		}
	}
?>

				</div>
				<div class="hkc-sm-3 hkm_product_publish">
<?php
	if($product->product_published) {
?>
						<span class="hk-label hk-label-green"><i
class="fas fa-check"></i> <?php echo
JText::_('HIKA_PUBLISHED'); ?></span>
<?php
	} else {
?>
						<span class="hk-label hk-label-red"><i
class="fas fa-times"></i> <?php echo
JText::_('HIKA_UNPUBLISHED'); ?></span>
<?php
	}
?>
				</div>
				<div class="hkc-sm-2 hkm_product_actions"><?php
	$data = array(
		'details' => array(
			'name' => '<i class="fas
fa-search"></i> ' . JText::_('HIKA_DETAILS',
true),
			'link' => $url
		)
	);
	if($this->product_action_delete)
		$data['delete'] = array(
			'name' => '<i class="fas
fa-trash"></i> ' . JText::_('HIKA_DELETE',
true),
			'link' => '#delete',
			'click' => 'return
window.localPage.deleteProduct('.(int)$product->product_id.',
\''.urlencode(strip_tags($product->product_name)).'\');'
		);
	if(!empty($data)) {
		echo $this->dropdownHelper->display(
			JText::_('HIKA_ACTIONS'),
			$data,
			array('type' => '', 'class' =>
'hikabtn-primary', 'right' => true, 'up'
=> false)
		);
	}
				?></div>
			</div>
		</div>
	</div>
<?php
}
?>
	<div class="hikamarket_pagination">
		<?php echo $this->pagination->getListFooter(); ?>
		<?php echo $this->pagination->getResultsCounter(); ?>
	</div>
</div>

	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="waitingapproval" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="filter_order"
value="<?php echo
$this->pageInfo->filter->order->value; ?>" />
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->pageInfo->filter->order->dir;
?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>
<?php if($this->product_action_delete) { ?>
<script type="text/javascript">
if(!window.localPage) window.localPage = {};
window.localPage.deleteProduct = function(id, name) {
	var confirmMsg = "<?php echo
JText::_('CONFIRM_DELETE_PRODUCT_X'); ?>";
	if(!confirm(confirmMsg.replace('{PRODUCT}', decodeURI(name))))
		return false;
	var f = document.forms['hikamarket_delete_product_form'];
	if(!f) return false;
	f.product_id.value = id;
	f.submit();
	return false;
};
</script>
<form action="<?php echo
hikamarket::completeLink('product&task=delete'); ?>"
method="post" name="hikamarket_delete_product_form"
id="hikamarket_delete_product_form">
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="delete" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="product_id"
value="0" />
	<?php echo JHTML::_('form.token'); ?>
</form>
<?php } ?>
views/productmarket/view.html.php000064400000221107151166607760013235
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class productmarketViewproductmarket extends hikamarketView {

	protected $ctrl = 'product';
	protected $icon = 'product';
	protected $triggerView = true;

	public function display($tpl = null, $params = array()) {
		$this->params =& $params;
		$fct = $this->getLayout();
		if(method_exists($this, $fct)) {
			if($this->$fct() === false)
				return;
		}
		parent::display($tpl);
	}

	public function listing($tpl = null) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.listing';

		hikamarket::loadJslib('tooltip');

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$this->loadRef(array(
			'toggleClass' => 'helper.toggle',
			'imageHelper' => 'shop.helper.image',
			'currencyHelper' => 'shop.class.currency',
			'childdisplayType' => 'shop.type.childdisplay',
			'shopCategoryType' => 'type.shop_category',
			'nameboxType' => 'type.namebox',
			'dropdownHelper' => 'shop.helper.dropdown',
		));

		$type = hikaInput::get()->getString('type',
'product,vendor,manufacturer');
		$getRoot = true;

		$cid = hikamarket::getCID();
		if(empty($cid))
			$cid = 1;
		$this->assignRef('cid', $cid);

		$manage = hikamarket::acl('product/edit');
		$this->assignRef('manage', $manage);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid = '&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$cfg = array(
			'table' => 'shop.product',
			'main_key' => 'product_id',
			'order_sql_value' => 'product.product_id'
		);

		$rootCategory = 0;
		$vendorCategories = 0;
		$vendorClass = hikamarket::get('class.vendor');
		$rootCategory = $vendorClass->getRootCategory($vendor);
		$extra_categories = $vendorClass->getExtraCategories($vendor);
		if(!empty($extra_categories))
			$vendorCategories = array_merge(array($rootCategory),
$extra_categories);

		if($vendor->vendor_id == 1) {
			$vendorType = hikamarket::get('type.filter_vendor');
			$this->assignRef('vendorType', $vendorType);
		}
		if(empty($rootCategory))
			$rootCategory = 1;
		if(empty($vendorCategories))
			$vendorCategories = $rootCategory;
		$this->assignRef('rootCategory', $rootCategory);
		$this->assignRef('vendorCategories', $vendorCategories);

		$category_id = $rootCategory;
		$this->assignRef('category_id', $category_id);

		$category_explorer = $config->get('show_category_explorer',
1);
		if(isset($this->category_explorer))
			$category_explorer = $this->category_explorer;

		if($category_explorer && (empty($cid) || $cid == 1)) {
			$cid =
(int)$app->getUserState(HIKAMARKET_COMPONENT.'.product.listing_cid');
			if(empty($cid))
				$cid = 1;
		}

		$default_sort_value =
trim($config->get('product_listing_default_sort_value',
$cfg['order_sql_value']));
		if(empty($default_sort_value))
			$default_sort_value = $cfg['order_sql_value'];
		$default_sort_dir =
trim($config->get('product_listing_default_sort_dir',
'asc'));
		if(empty($default_sort_dir) || !in_array($default_sort_dir,
array('asc', 'desc')))
			$default_sort_dir = 'asc';

		$pageInfo = $this->getPageInfo($default_sort_value,
$default_sort_dir);

		$pageInfo->selectedType =
$app->getUserStateFromRequest($this->paramBase.'.filter_type',
'filter_type',
(int)$config->get('default_filter_type_product_listing', 0),
'int');
		$pageInfo->filter->vendors =
$app->getUserStateFromRequest($this->paramBase.'.filter_vendors',
'filter_vendors', 0, 'int');
		$pageInfo->filter->filter_product_type = false;
		$filters = array(
			'main' => 'product.product_parent_id = 0',
			'product_type' => 'product.product_type IN
(\'main\',\'variant\'' .
($config->get('product_approval', 0) ?
',\'waiting_approval\'' : '') .
')'
		);
		$searchMap = array(
			'product.product_name',
			'product.product_description',
			'product.product_id',
			'product.product_code'
		);
		$select = array();
		$join = '';
		if($category_explorer) {
			$query = 'SELECT category_id, category_left, category_right,
category_depth, category_parent_id FROM
'.hikamarket::table('shop.category').' WHERE
category_id IN
('.(int)$cid.','.(int)$rootCategory.')';
			$db->setQuery($query);
			$categories = $db->loadObjectList('category_id');

			if(!isset($categories[$rootCategory]))
				return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY',
JText::_('HIKAM_ERR_ROOTCATEGORY_NOT_EXIST')));

			if(!isset($categories[$cid]) || $categories[$cid]->category_left <
$categories[$rootCategory]->category_left ||
$categories[$cid]->category_left >
$categories[$rootCategory]->category_right)
				$cid = $rootCategory;

			$app->setUserState(HIKAMARKET_COMPONENT.'.product.listing_cid',
$cid);

			$query = 'SELECT cats.category_id, cats.category_depth,
cats.category_name, cats.category_parent_id '.
				' FROM '.hikamarket::table('shop.category').'
AS cats INNER JOIN
'.hikamarket::table('shop.category').' AS basecat ON
cats.category_left <= basecat.category_left AND cats.category_right
>= basecat.category_right '.
				' WHERE basecat.category_id = '.(int)$cid.' AND
cats.category_depth >=
'.$categories[$rootCategory]->category_depth.' ORDER BY
category_depth';
			$db->setQuery($query);
			$breadcrumb = $db->loadObjectList();
			$this->assignRef('breadcrumb', $breadcrumb);
		}

		if($category_explorer)
			$join = ' INNER JOIN
'.hikamarket::table('shop.product_category').' AS
product_category ON (product.product_id = product_category.product_id OR
product.product_parent_id = product_category.product_id) ';
		if($category_explorer && !$pageInfo->selectedType)
			$select['product_ordering'] =
'product_category.ordering';

		if($pageInfo->filter->vendors > 0 || $vendor->vendor_id >
1) {
			$select['parent_product_name'] =
'parent_product.product_name as parent_product_name';
			$join = ' LEFT JOIN
'.hikamarket::table('shop.product').' AS parent_product
ON (product.product_parent_id = parent_product.product_id AND
parent_product.product_vendor_id != product.product_vendor_id AND
product.product_vendor_id > 0) ';
			if($category_explorer)
				$join .= ' INNER JOIN
'.hikamarket::table('shop.product_category').' AS
product_category ON (product.product_id = product_category.product_id OR
parent_product.product_id = product_category.product_id) ';
		}

		if((!hikamarket::level(2) || $vendor->vendor_id == 1) &&
!empty($pageInfo->filter->filter_product_type) &&
in_array($pageInfo->filter->filter_product_type,
array('all', 'variant'))) {
			$select['parent_product_name'] =
'parent_product.product_name as parent_product_name';
			$join = ' LEFT JOIN
'.hikamarket::table('shop.product').' AS parent_product
ON product.product_parent_id = parent_product.product_id ';
			if($category_explorer)
				$join .= ' INNER JOIN
'.hikamarket::table('shop.product_category').' AS
product_category ON (product.product_id = product_category.product_id OR
parent_product.product_id = product_category.product_id) ';
		}

		if($category_explorer) {
			if($pageInfo->selectedType) {
				$join .= ' INNER JOIN
'.hikamarket::table('shop.category').' AS category ON
(category.category_id = product_category.category_id) ';
				$filter = '(category.category_left >=
'.$categories[$cid]->category_left.' AND
category.category_right <= '.$categories[$cid]->category_right
.')';
			} else
				$filter = 'product_category.category_id = '.$cid;
			$filters[] = $filter;
		}

		$fieldsClass = hikamarket::get('shop.class.field');
		$cats = array();
		if($category_explorer) {
			$parent_cat_ids = array();
			foreach($breadcrumb as $catElem) {
				$parent_cat_ids[] = $catElem->category_id;
			}
			$cats = array('originals' => array($cid),
'parents' => $parent_cat_ids);
		}
		$fields =
$fieldsClass->getData('display:vendor_product_listing=1',
'product', false, $cats);
		$this->assignRef('fields', $fields);
		$this->assignRef('fieldsClass', $fieldsClass);

		foreach($fields as $fieldName => $oneExtraField) {
			$searchMap[] = 'product.' . $fieldName;
		}

		if(!empty($pageInfo->filter->filter_product_type) &&
in_array($pageInfo->filter->filter_product_type,
array('all', 'variant'))) {
			if($pageInfo->filter->filter_product_type == 'all')
				$filters['main'] = 'product.product_parent_id >=
0';
			if($pageInfo->filter->filter_product_type == 'variant')
				$filters['main'] = 'product.product_parent_id >
0';
		}
		if($pageInfo->filter->vendors == 1 || $vendor->vendor_id > 1)
{
			$filters['main'] .= ' OR parent_product.product_id != 0 )
AND (product.product_vendor_id = '.(int)$vendor->vendor_id;
			if($vendor->vendor_id == 1)
				$filters['main'] .= ' OR product.product_vendor_id =
0';
		} elseif( $pageInfo->filter->vendors > 1) {
			$filters['main'] .= ' OR parent_product.product_id != 0 )
AND (product.product_vendor_id =
'.(int)$pageInfo->filter->vendors;
		}

		$order = '';
		$accept_ordering = array('product.');
		if($category_explorer && !$pageInfo->selectedType)
			$accept_ordering[] = 'product_category.ordering';
		$this->processFilters($filters, $order, $searchMap,
$accept_ordering);

		$query = 'FROM
'.hikamarket::table($cfg['table']).' AS product
'.$join.$filters.$order;
		$db->setQuery('SELECT DISTINCT(product.product_id),
product.*' . (empty($select)?'':',') .
implode(',', $select) . ' ' . $query,
(int)$pageInfo->limit->start, (int)$pageInfo->limit->value);

		$rows = $db->loadObjectList('product_id');

		$vendors = array();
		$products = array();
		foreach($rows as &$product) {
			$product->prices = array();
			$product->vendor_name = '';
			$product->file_name = $product->product_name;
			if(!isset($products[$product->product_id])) {
				$products[$product->product_id] =& $product;
			} else if(!is_array($products[$product->product_id])) {
				$old =& $products[$product->product_id];
				unset($products[$product->product_id]);
				$products[$product->product_id] = array(&$old, &$product);
			} else {
				$products[$product->product_id][] =& $product;
			}
			if($vendor->vendor_id == 1)
				$vendors[(int)$product->product_vendor_id] =
(int)$product->product_vendor_id;
		}
		unset($product);
		$this->assignRef('products', $rows);

		$db->setQuery('SELECT COUNT(DISTINCT(product.product_id))
'.$query);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($rows);

		$this->loadPricesImages($products, $vendors);

		$fieldsClass->handleZoneListing($fields, $rows);

		$this->assignRef('vendor_id', $vendor_id);
		$this->assignRef('cancelUrl', $cancelUrl);

		$using_approval = ($config->get('product_approval', 0)
&& hikamarket::acl('product/approve'));

		$sorting_possible = false;
		if($app->getUserStateFromRequest($this->paramBase.'.filter_type',
'filter_type',
(int)$config->get('default_filter_type_product_listing', 0),
'int') == 0) {
			$sorting_possible = true;
		} else if($category_explorer && isset($categories[$cid])) {
			$sorting_possible = (((int)$categories[$cid]->category_right -
(int)$categories[$cid]->category_left) == 1);
		}

		$product_action_publish =
hikamarket::acl('product/edit/published');
		$product_action_delete = hikamarket::acl('product/delete');
		$product_action_copy = ($vendor->vendor_id == 0 ||
$vendor->vendor_id == 1) &&
hikamarket::acl('product/copy');
		$product_action_sort = ($vendor->vendor_id == 0 ||
$vendor->vendor_id == 1) &&
hikamarket::acl('product/sort') && $category_explorer
&& $sorting_possible;
		$product_actions = $product_action_publish || $product_action_delete ||
$product_action_copy || $product_action_sort;
		$this->assignRef('product_action_publish',
$product_action_publish);
		$this->assignRef('product_action_delete',
$product_action_delete);
		$this->assignRef('product_action_copy',
$product_action_copy);
		$this->assignRef('product_action_sort',
$product_action_sort);
		$this->assignRef('product_actions', $product_actions);

		$text_asc = JText::_('ASCENDING');
		$text_desc = JText::_('DESCENDING');
		$ordering_values = array(
			'product_category.ordering' =>
JText::_('SORT_ORDERING'),
			'product.product_id' => JText::_('SORT_ID'),
			'product.product_name' => JText::_('SORT_NAME'),
			'product.product_quantity' =>
JText::_('SORT_QUANTITY'),
		);
		$this->ordering_values = array();
		foreach($ordering_values as $k => $v) {
			if($k == 'product_category.ordering' &&
!$product_action_sort)
				continue;
			$this->ordering_values[$k.' asc'] = $v . ' '
.$text_asc;
			$this->ordering_values[$k.' desc'] = $v . ' '
.$text_desc;
		}
		$this->full_ordering =
$this->pageInfo->filter->order->value . ' ' .
strtolower($this->pageInfo->filter->order->dir);

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' => hikamarket::completeLink('vendor')
			),
			'ordering' => array(
				'icon' => 'ordering',
				'fa' => 'fa-sort-amount-down',
				'name' => JText::_('HIKA_SAVE_ORDER'),
				'url' => '#',
				'linkattribs' => 'onclick="return
hikamarket.submitform(\'saveorder\',\'adminForm\')"',
				'pos' => 'right',
				'display' => $product_action_sort
			),
			'approve' => array(
				'icon' => 'approve',
				'fa' => 'fa-thumbs-up',
				'name' => JText::_('WAITING_APPROVAL_LIST'),
				'url' =>
hikamarket::completeLink('product&task=waitingapproval'),
				'display' => $using_approval,
				'pos' => 'right'
			),
			'new' => array(
				'icon' => 'new',
				'fa' => 'fa-plus-circle',
				'name' => JText::_('HIKA_NEW'),
				'url' =>
hikamarket::completeLink('product&task=add'),
				'acl' => hikamarket::acl('product/add'),
				'pos' => 'right'
			)
		);

		$this->getPagination();

		$this->getOrdering('a.ordering',
!$pageInfo->selectedType);

		return true;
	}

	private function loadPricesImages(&$products, $vendors = null) {
		if(empty($products))
			return;

		$db = JFactory::getDBO();
		$db->setQuery('SELECT * FROM
'.hikamarket::table('shop.price').' WHERE
price_product_id IN ('.implode(',',
array_keys($products)).')');
		$prices = $db->loadObjectList();
		if(!empty($prices)) {
			foreach($prices as $price) {
				if(!isset($products[$price->price_product_id]) )
					continue;

				if(!is_array($products[$price->price_product_id])) {
					$products[$price->price_product_id]->prices[] = $price;
				} else {
					foreach($products[$price->price_product_id] as $p) {
						$p->prices[] = $price;
					}
				}
			}
		}
		unset($prices);

		$db->setQuery('SELECT * FROM
'.hikamarket::table('shop.file').' WHERE file_ref_id IN
('.implode(',', array_keys($products)).') AND
file_type=\'product\' ORDER BY file_ref_id ASC, file_ordering
ASC, file_id ASC');
		$images = $db->loadObjectList();
		if(!empty($images)) {
			foreach($images as $image) {
				if(!isset($products[(int)$image->file_ref_id]))
					continue;

				if(!is_array($products[(int)$image->file_ref_id])) {
					if(isset($products[(int)$image->file_ref_id]->file_ref_id))
						continue;

					foreach(get_object_vars($image) as $key => $name) {
						$products[(int)$image->file_ref_id]->$key = $name;
					}
				} else {
					$p = reset($products[(int)$image->file_ref_id]);
					if(isset($p->file_ref_id))
						continue;

					foreach($products[(int)$image->file_ref_id] as $p) {
						foreach(get_object_vars($image) as $key => $name) {
							$p->$key = $name;
						}
					}
				}
			}
		}

		if(empty($vendors))
			return;
		hikamarket::toInteger($vendors);
		$db->setQuery('SELECT vendor_id, vendor_name FROM
'.hikamarket::table('vendor').' WHERE vendor_id IN
('.implode(',', $vendors).')');
		$db_vendors = $db->loadObjectList('vendor_id');
		foreach($products as &$product) {
			if(!isset($db_vendors[(int)$product->product_vendor_id]))
				continue;
			$product->vendor_name =
$db_vendors[(int)$product->product_vendor_id]->vendor_name;
		}
		unset($product);
		unset($db_vendors);
	}

	public function form() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.edit';

		JHTML::_('behavior.tooltip');
		hikamarket::loadJslib('tooltip');

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$product_id = hikamarket::getCID('product_id');
		$productClass = hikamarket::get('class.product');
		$vendorClass = hikamarket::get('class.vendor');

		$main_currency = $shopConfig->get('main_currency',1);
		$this->assignRef('main_currency_id', $main_currency);

		$this->loadRef(array(
			'toggleClass' => 'helper.toggle',
			'currencyClass' => 'shop.class.currency',
			'userClass' => 'shop.class.user',
			'popup' => 'shop.helper.popup',
			'categoryType' => 'type.shop_category',
			'quantityType' => 'type.quantity',
			'productsType' => 'type.products',
			'nameboxType' => 'type.namebox',
			'nameboxVariantType' => 'type.namebox',
			'uploaderType' => 'shop.type.uploader',
			'imageHelper' => 'shop.helper.image',
			'currencyType' => 'shop.type.currency',
			'weight' => 'shop.type.weight',
			'volume' => 'shop.type.volume',
			'radioType' => 'shop.type.radio',
		));

		hikamarket::loadJslib('jquery');

		$product = new stdClass();
		$product->product_description = '';
		$product->product_id = $product_id;
		$template_id = 0;
		$variant_id = 0;

		if(empty($product_id) && !empty($vendor->vendor_template_id)
&& (int)$vendor->vendor_template_id > 0) {
			$template_id = (int)$vendor->vendor_template_id;
			$product_id = $template_id;
		}
		if(empty($product_id) &&
(int)$config->get('default_template_id', 0) > 0) {
			$template_id = (int)$config->get('default_template_id',
0);
			$product_id = $template_id;
		}

		if(!empty($template_id)) {
			$query = 'SELECT COUNT(*) FROM
'.hikamarket::table('shop.product').' AS p WHERE
p.product_id = ' . (int)$template_id . ' AND product_type =
' . $db->Quote('template');
			$db->setQuery($query);
			$isTemplate = (int)$db->loadResult();
			if($isTemplate == 0) {
				$template_id = 0;
				$product_id = 0;
			}
		}

		if(!empty($product_id))
			$product = $productClass->getRaw($product_id, true);

		$editing_variant = !empty($product->product_type) &&
($product->product_type == 'variant');
		$this->assignRef('editing_variant', $editing_variant);

		if(empty($template_id) && isset($product->product_vendor_id)
&& $vendor->vendor_id > 1 &&
(int)$product->product_vendor_id != $vendor->vendor_id) {
			$product_duplication =
hikaInput::get()->getVar('product_duplication', null);
			if(empty($product_duplication) ||
empty($product_duplication->product_id) ||
$product_duplication->product_id != $product_id ||
empty($product_duplication->characteristic_id))
				return hikamarket::deny('product',
JText::_('HIKAM_PAGE_DENY'));

			$mainProduct = clone($product);

			$product = new stdClass();
			$product->product_id = 0;
			$product->product_parent_id = $mainProduct->product_id;
			$product->product_name = $mainProduct->product_name;
			$product->product_description = '';
			$product->product_type = 'variant';
			$product_id = 0;
		}

		$fail_product = hikaInput::get()->getVar('fail', null);
		if(!empty($fail_product) && (isset($fail_product->product_id)
&& ($product->product_id == $fail_product->product_id) ||
(empty($fail_product->product_id) && (empty($product_id) ||
$product_id == $template_id)))) {
			foreach($fail_product as $k => $v) {
				$product->$k = $v;
			}
			$product_id = (int)@$fail_product->product_id;
			$template_id = 0;

			if(!empty($product->related)) {
				$tmp_ids = array();
				foreach($product->related as $v) {
					$tmp_ids[(int)$v->product_related_id] =
(int)$v->product_related_ordering;
				}
				$query = 'SELECT p.* FROM
'.hikashop_table('product').' AS p WHERE p.product_id
IN (' . implode(',', array_keys($tmp_ids)) . ')';
				$db->setQuery($query);
				$product->related = $db->loadObjectList();
				foreach($product->related as $k => $v) {
					$product->related[$k]->product_related_id = $v->product_id;
					$product->related[$k]->product_related_ordering =
$tmp_ids[$v->product_id];
				}
			}

			if(!empty($element->options)) {
				$tmp_ids = array();
				foreach($product->options as $v) {
					$rel_ids[(int)$v->product_related_id] =
(int)$v->product_related_ordering;
				}
				$query = 'SELECT p.* FROM
'.hikashop_table('product').' AS p WHERE p.product_id
IN (' . implode(',', array_keys($tmp_ids)) . ')';
				$db->setQuery($query);
				$product->options = $db->loadObjectList();
				foreach($product->options as $k => $v) {
					$product->options[$k]->product_related_id = $v->product_id;
					$product->options[$k]->product_related_ordering =
$tmp_ids[$v->product_id];
				}
			}

			if(!empty($element->bundle)) {
				$tmp_ids = array();
				foreach($product->bundle as $v) {
					$rel_ids[(int)$v->product_related_id] =
(int)$v->product_related_ordering;
				}
				$query = 'SELECT p.* FROM
'.hikashop_table('product').' AS p WHERE p.product_id
IN (' . implode(',', array_keys($tmp_ids)) . ')';
				$db->setQuery($query);
				$product->bundle = $db->loadObjectList();
				foreach($product->bundle as $k => $v) {
					$product->bundle[$k]->product_related_id = $v->product_id;
					$product->bundle[$k]->product_related_ordering =
$tmp_ids[$v->product_id];
				}
			}

			if(!empty($product->characteristics)) {
				$tmp_ids = array();
				foreach($product->characteristics as $k => $v) {
					$tmp_ids[ (int)$v->characteristic_id ] = $k;
				}
				$query = 'SELECT c.* FROM
'.hikashop_table('characteristic').' AS c WHERE
c.characteristic_id IN (' . implode(',',
array_keys($tmp_ids)) . ')';
				$db->setQuery($query);
				$characteristics = $db->loadObjectList();

				foreach($characteristics as $char) {
					$product->characteristics[ $tmp_ids[$char->characteristic_id]
]->characteristic_value = $char->characteristic_value;
					$product->characteristics[ $tmp_ids[$char->characteristic_id]
]->characteristic_parent_id = (int)$char->characteristic_parent_id;
				}
				unset($characteristics);
			}

			if(!empty($product->categories)) {
				hikamarket::toInteger($product->categories);
				$query = 'SELECT c.* FROM
'.hikashop_table('category').' AS c WHERE c.category_id
IN ('.implode(',', $product->categories).')';
				$db->setQuery($query);
				$product->categories =
$db->loadObjectList('category_id');
			}
		}

		if(empty($product_id) && !isset($product->product_tax_id)) {
			$mainTaxCategory = 'tax';
			$categoryClass = hikamarket::get('shop.class.category');
			$categoryClass->getMainElement($mainTaxCategory);
			$query = 'SELECT category_id FROM '.
hikamarket::table('shop.category'). ' WHERE category_type =
\'tax\' && category_parent_id =
'.(int)$mainTaxCategory.' ORDER BY category_ordering DESC';
			$db->setQuery($query);
			$product->product_tax_id = (int)$db->loadResult();
		}

		if(!empty($product_id)) {
			if((int)$product->product_parent_id > 0 &&
empty($template_id)) {
				$parentProduct =
$productClass->getRaw((int)$product->product_parent_id, true);
				if(!empty($parentProduct) && ($vendor->vendor_id == 0 ||
$vendor->vendor_id == 1 || $parentProduct->product_vendor_id ==
$vendor->vendor_id)) {
					$variant_id = $product_id;
					$product_id = (int)$product->product_parent_id;
					unset($product);
					$product = $parentProduct;
				} else {
					unset($parentProduct);
				}
			}

			$query = 'SELECT b.* FROM
'.hikamarket::table('shop.product_category').' AS a
LEFT JOIN '.hikamarket::table('shop.category').' AS b
ON a.category_id = b.category_id WHERE a.product_id =
'.(int)$product_id.' ORDER BY a.product_category_id';
			$db->setQuery($query);
			$product->categories =
$db->loadObjectList('category_id');

			$query = 'SELECT * FROM
'.hikamarket::table('shop.file').' WHERE file_ref_id =
'.(int)$product_id.' AND file_type=\'product\' ORDER BY
file_ordering, file_id';
			$db->setQuery($query);
			$product->images = $db->loadObjectList();

			$query = 'SELECT file.*, SUM(download.download_number) AS
download_number FROM '.hikamarket::table('shop.file').'
AS file '.
				' LEFT JOIN
'.hikamarket::table('shop.download').' AS download ON
file.file_id = download.file_id '.
				' WHERE file_ref_id = '.(int)$product_id.' AND
file.file_type='.$db->Quote('file').' '.
				' GROUP BY file.file_id '.
				' ORDER BY file.file_ordering, file.file_id';
			$db->setQuery($query);
			$product->files = $db->loadObjectList('file_id');

			$query = 'SELECT a.*,b.* FROM
'.hikamarket::table('shop.product_related').' AS a LEFT
JOIN '.hikamarket::table('shop.product').' AS b ON
a.product_related_id=b.product_id WHERE
a.product_related_type=\'related\' AND a.product_id =
'.(int)$product_id.' ORDER BY product_related_ordering';
			$db->setQuery($query);
			$product->related = $db->loadObjectList();

			$query = 'SELECT a.*,b.* FROM
'.hikamarket::table('shop.product_related').' AS a LEFT
JOIN '.hikamarket::table('shop.product').' AS b ON
a.product_related_id=b.product_id WHERE
a.product_related_type=\'options\' AND a.product_id =
'.(int)$product_id.' ORDER BY product_related_ordering';
			$db->setQuery($query);
			$product->options = $db->loadObjectList();

			if(hikashop_level(1)) {
				$query = 'SELECT a.*,b.* FROM
'.hikamarket::table('shop.product_related').' AS a LEFT
JOIN '.hikamarket::table('shop.product').' AS b ON
a.product_related_id=b.product_id WHERE
a.product_related_type=\'bundle\' AND a.product_id =
'.(int)$product_id.' ORDER BY product_related_ordering';
				$db->setQuery($query);
				$product->bundle = $db->loadObjectList();
			}

			$query = 'SELECT variant.*, characteristic.* FROM
'.hikamarket::table('shop.variant').' as variant LEFT
JOIN '.hikamarket::table('shop.characteristic').' as
characteristic ON variant.variant_characteristic_id =
characteristic.characteristic_id WHERE variant.variant_product_id =
'.$product_id . ' ORDER BY ordering ASC';
			$db->setQuery($query);
			$product->characteristics =
$db->loadObjectList('characteristic_id');
			$query = 'SELECT p.* FROM
'.hikamarket::table('shop.product').' as p WHERE
p.product_type = '.$db->Quote('variant').' AND
p.product_parent_id = '.(int)$product_id;
			$db->setQuery($query);
			$product->variants = $db->loadObjectList('product_id');

			if(!empty($product->variants)) {
				$variant_ids = array_keys($product->variants);
				$query = 'SELECT * FROM
'.hikamarket::table('shop.price').' WHERE
price_product_id IN (' . (int)$product_id . ',' .
implode(',', $variant_ids).')';
				$db->setQuery($query);
				$prices = $db->loadObjectList();

				$product->prices = array();
				foreach($prices as $price) {
					$ppid = (int)$price->price_product_id;
					if($ppid == $product_id) {
						$product->prices[] = $price;
					} elseif(isset($product->variants[$ppid])) {
						if(empty($product->variants[$ppid]->prices))
							$product->variants[$ppid]->prices = array();
						$product->variants[$ppid]->prices[] = $price;
					}
				}
				unset($prices);

				$query = 'SELECT v.*, c.* FROM
'.hikamarket::table('shop.variant').' AS v '.
					' INNER JOIN
'.hikamarket::table('shop.characteristic').' AS c ON
c.characteristic_id = v.variant_characteristic_id '.
					' WHERE v.variant_product_id IN
('.implode(',',$variant_ids).') '.
					' ORDER BY v.variant_product_id ASC, v.variant_characteristic_id
ASC, v.ordering ASC';
				$db->setQuery($query);
				$variant_data = $db->loadObjectList();

				foreach($variant_data as $d) {
					$ppid = (int)$d->variant_product_id;
					if(!isset($product->characteristics[$d->characteristic_parent_id]))
						continue;

					if(!isset($product->variants[$ppid]))
						continue;

					if(empty($product->variants[$ppid]->characteristics))
						$product->variants[$ppid]->characteristics = array();

					$pcid =
$product->characteristics[$d->characteristic_parent_id]->characteristic_id;
					$value = new stdClass();
					$value->id = $d->characteristic_id;
					$value->value = $d->characteristic_value;
					$product->variants[$ppid]->characteristics[$pcid] = $value;
				}
			} else {
				$query = 'SELECT * FROM
'.hikamarket::table('shop.price').' WHERE
price_product_id = ' . (int)$product_id;
				$db->setQuery($query);
				$product->prices = $db->loadObjectList();
			}

			if($vendor->vendor_id > 1) {
				foreach($product->files as &$file) {
					if(strpos($file->file_path, '/') !== false) {
						$file->file_path = substr($file->file_path,
strrpos($file->file_path, '/') + 1);
					}
				}
			}
		}

		if(empty($product_id) || !empty($template_id)) {
			$rootCategory = 0;
			$categoryClass = hikamarket::get('shop.class.category');
			$category_explorer = $config->get('show_category_explorer',
1);
			if($category_explorer)
				$rootCategory =
(int)$app->getUserState(HIKAMARKET_COMPONENT.'.product.listing_cid');
			if(empty($rootCategory) || $rootCategory == 1){
				$rootCategory =
$vendorClass->getRootCategory($vendor->vendor_id);
				if(empty($rootCategory)) {
					$rootCategory = 'product';
					$categoryClass->getMainElement($rootCategory);
				}
			}
			if(!empty($rootCategory)) {
				if(empty($product->categories))
					$product->categories = array( $rootCategory =>
$categoryClass->get($rootCategory) );
				else
					$product->categories[$rootCategory] =
$categoryClass->get($rootCategory);
			}
		}

		if(!empty($template_id)) {
			$product->product_id = 0;
			unset($product->product_type);
			unset($product->product_code);
		}

		if(!empty($product->product_tax_id)) {
			$main_tax_zone = explode(',',
$shopConfig->get('main_tax_zone', ''));
			if(count($main_tax_zone)) {
				$main_tax_zone = array_shift($main_tax_zone);
			}
		}
		if(!empty($product->prices)) {
			foreach($product->prices as $key => $price) {
				if(empty($price->price_value)){
					unset($product->prices[$key]);
				}
			}
			if(!empty($product->product_tax_id)) {
				foreach($product->prices as &$price) {
					$price->price_value_with_tax =
$this->currencyClass->getTaxedPrice($price->price_value,
$main_tax_zone, $product->product_tax_id);
				}
			}else{
				foreach($product->prices as $key => $price) {
					$price->price_value_with_tax = $price->price_value;
				}
			}
		}
		if(empty($product->prices)) {
			$obj = new stdClass();
			$obj->price_value = 0;
			$obj->price_value_with_tax = 0;
			$obj->price_currency_id = $main_currency;
			$product->prices = array($obj);
		}

		$default_description_type =
$config->get('default_description_type', null);
		if($default_description_type === null)
			$default_description_type =
$shopConfig->get('default_description_type', '');
		if(empty($product_id) && !empty($default_description_type))
			$product->product_description_type = $default_description_type;

		if($product->product_description_type == 'html')
			$product->product_description_type = null;
		if(!empty($product->product_description) &&
empty($product->product_description_raw))
			$product->product_description_type = null;

		if(!empty($product->product_description_type)) {
			$contentparserType =
hikamarket::get('shop.type.contentparser');
			$description_types = $contentparserType->load();
			if(!isset($description_types[ $product->product_description_type ]))
				$product->product_description_type = null;
		}

		$editor = hikamarket::get('shop.helper.editor');
		if(!empty($product->product_description_type)) {
			$editor->setEditor('none');
			$editor->name = 'product_description_raw';
			$editor->content = $product->product_description_raw;
		} else {
			$editor->setEditor($config->get('editor',
''));
			$editor->name = 'product_description';
			$editor->content = $product->product_description;
		}
		$editor->height = 200;
		if($config->get('editor_disable_buttons', 0))
			$editor->options = false;
		$this->assignRef('editor', $editor);

		if(!isset($product->product_quantity) || $product->product_quantity
< 0)
			$product->product_quantity = JText::_('UNLIMITED');
		if(!isset($product->product_max_per_order) ||
$product->product_max_per_order <= 0)
			$product->product_max_per_order = JText::_('UNLIMITED');

		$this->assignRef('product', $product);

		if(hikashop_level(2)) {
			hikamarket::loadJslib('otree');
			$joomlaAcl = hikamarket::get('type.joomla_acl');
			$this->assignRef('joomlaAcl', $joomlaAcl);
		}

		$translationHelper =
hikamarket::get('shop.helper.translation');
		if($translationHelper && $translationHelper->isMulti()) {
			$translationHelper->load('hikashop_product',
@$product->product_id, $product);
			$this->assignRef('translationHelper', $translationHelper);
		}

		$manufacturerType = hikamarket::get('shop.type.categorysub');
		$manufacturerType->type = 'manufacturer';
		$manufacturerType->field = 'category_id';
		$this->assignRef('manufacturerType', $manufacturerType);

		$rootCategory = $vendorClass->getRootCategory($vendor);
		$this->assignRef('rootCategory', $rootCategory);

		$vendorCategories = $rootCategory;
		$extra_categories = $vendorClass->getExtraCategories($vendor);
		if(!empty($extra_categories))
			$vendorCategories = array_merge(array($rootCategory),
$extra_categories);
		$this->assignRef('vendorCategories', $vendorCategories);

		$main_currency = (int)$shopConfig->get('main_currency');
		$this->currencyType->load($main_currency);
		$currencies = $this->currencyType->currencies;
		$this->assignRef('currencies', $currencies);
		$default_currency =
$this->currencyType->currencies[$main_currency];
		$this->assignRef('default_currency', $default_currency);

		$fieldsClass = hikamarket::get('shop.class.field');
		$fields =
$fieldsClass->getFields('display:vendor_product_edit=1',
$product, 'product', 'field&task=state');

		$null = array();
		$fieldsClass->addJS($null, $null, $null);
		$fieldsClass->jsToggle($fields, $product, 0);
		$this->assignRef('fieldsClass', $fieldsClass);
		$this->assignRef('fields', $fields);

		$using_approval = ($vendor->vendor_id <= 1 &&
$config->get('product_approval', 0) &&
!empty($product->product_type) && $product->product_type ==
'waiting_approval' &&
hikamarket::acl('product/approve'));

		$this->is_variant_product = (isset($this->product->product_type)
&& !in_array($this->product->product_type,
array('main', 'waiting_approval')));

		$this->toolbar = array(
			'cancel' => array(
				'url' => hikamarket::completeLink('product'),
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK')
			),
			'back' => array(
				'url' => hikamarket::completeLink('product'),
				'icon' => 'category',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKAM_PRODUCT_LISTING'),
				'display' => false
			),
			'cartlink' => array(
				'url' =>
hikamarket::completeLink('product&task=cartlink&pid=' .
$product->product_id, true),
				'icon' => 'cart',
				'fa' => 'fa-cart-arrow-down',
				'popup' => array('name' =>
JText::_('HIKAM_CART_LINK'), 'id' =>
'cartlink', 'width' => 450, 'height' =>
250),
				'name' => JText::_('HIKAM_CART_LINK'),
'pos' => 'right',
				'display' =>
($config->get('product_cart_link', 0) &&
$product->product_id > 0)
			),
			'sep01' => array(
				'sep' => true, 'pos' => 'right',
				'display' =>
($config->get('product_cart_link', 0) &&
$product->product_id > 0)
			),
			'approve' => array(
				'url' => '#approve',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'approve\',\'hikamarket_products_form\');"',
				'icon' => 'apply',
				'fa' => 'fa-thumbs-up',
				'name' => JText::_('HIKAM_APPROVE'),
'pos' => 'right',
				'display' => $using_approval,
			),
			'sep02' => array(
				'sep' => true, 'pos' => 'right',
				'display' => $using_approval,
			),
			'apply' => array(
				'url' => '#apply',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'apply\',\'hikamarket_products_form\');"',
				'icon' => 'apply',
				'fa' => 'fa-check-circle',
				'name' => JText::_('HIKA_APPLY'),
'pos' => 'right'
			),
			'save' => array(
				'url' => '#save',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save\',\'hikamarket_products_form\');"',
				'icon' => 'save',
				'fa' => 'fa-save',
				'name' => JText::_('HIKA_SAVE'), 'pos'
=> 'right'
			)
		);

		$cancel_action = hikaInput::get()->getCmd('cancel_action',
'');
		$this->assignRef('cancel_action', $cancel_action);
		$cancel_url =
urldecode(hikaInput::get()->getCmd('cancel_url',
''));
		$this->assignRef('cancel_url', $cancel_url);

		if(!empty($cancel_action)) {
			switch($cancel_action) {
				case 'product':
					if(!empty($product->product_id)) {
						$shopProductClass = hikamarket::get('shop.class.product');
						$shopProductClass->addAlias($product);
						$this->toolbar['cancel']['url'] =
hikashop_contentLink('product&task=show&cid=' .
(int)$product->product_id . '&name=' . $product->alias,
$product);
						$this->toolbar['back']['display'] = true;
					}
					break;
				case 'url':
					if(!empty($cancel_url)) {
						$cancel_url = base64_decode($cancel_url);
						if($cancel_url !== false && substr($cancel_url, 0, 4) ==
'http') {
							$this->toolbar['cancel']['url'] =
$cancel_url;
							$this->toolbar['back']['display'] = true;
						}
					}
					break;
			}
		}
	}

	protected function aclEdit($action) {
		static $useNewACL = null;
		$vendor_id = hikamarket::loadVendor(false);
		if($vendor_id <= 1)
			$useNewACL = false;
		if(!empty($this->editing_variant))
			return hikamarket::acl('product/variant/' . trim($action,
'/') );
		if($useNewACL !== null)
			return hikamarket::acl( (!empty($useNewACL) ? 'product/new/' :
'product/edit/') . trim($action, '/') );
		$isNew = empty($this->product->product_id) ||
$this->product->product_type == 'waiting_approval';
		$useNewACL = $isNew && hikamarket::acl('product/new');
		return hikamarket::acl( (!empty($useNewACL) ? 'product/new/' :
'product/edit/') . trim($action, '/') );
	}

	public function form_variants() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.edit';

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$product_id = hikamarket::getCID('product_id');
		$productClass = hikamarket::get('class.product');
		$vendorClass = hikamarket::get('class.vendor');

		$main_currency = $shopConfig->get('main_currency',1);
		$this->assignRef('main_currency_id', $main_currency);

		$this->loadRef(array(
			'toggleClass' => 'helper.toggle',
			'currencyClass' => 'shop.class.currency',
		));

		$product = new stdClass();
		$product->product_description = '';
		$product->product_id = $product_id;
		$template_id = 0;
		$variant_id = 0;

		if(empty($product_id) && !empty($vendor->vendor_template_id))
{
			$template_id = $vendor->vendor_template_id;
			$product_id = $template_id;
		}
		if(empty($product_id) &&
(int)$config->get('default_template_id', 0) > 0) {
			$template_id = (int)$config->get('default_template_id',
0);
			$product_id = $template_id;
		}

		if(!empty($product_id)) {
			$product = $productClass->getRaw($product_id, true);

			if((int)$product->product_parent_id > 0 &&
empty($template_id)) {
				$parentProduct =
$productClass->getRaw((int)$product->product_parent_id, true);
				if(!empty($parentProduct) && ($vendor->vendor_id == 0 ||
$vendor->vendor_id == 1 || $parentProduct->product_vendor_id ==
$vendor->vendor_id)) {
					$variant_id = $product_id;
					$product_id = (int)$product->product_parent_id;
					unset($product);
					$product = $parentProduct;
				} else {
					unset($parentProduct);
				}
			}

			$query = 'SELECT variant.*, characteristic.* FROM
'.hikamarket::table('shop.variant').' as variant LEFT
JOIN '.hikamarket::table('shop.characteristic').' as
characteristic ON variant.variant_characteristic_id =
characteristic.characteristic_id WHERE variant.variant_product_id =
'.$product_id . ' ORDER BY ordering ASC';
			$db->setQuery($query);
			$product->characteristics =
$db->loadObjectList('characteristic_id');

			$query = 'SELECT p.* FROM
'.hikamarket::table('shop.product').' as p WHERE
p.product_type = '.$db->Quote('variant').' AND
p.product_parent_id = '.(int)$product_id;
			$db->setQuery($query);
			$product->variants = $db->loadObjectList('product_id');

			if(!empty($product->variants)) {
				$variant_ids = array_keys($product->variants);
				$query = 'SELECT * FROM
'.hikamarket::table('shop.price').' WHERE
price_product_id IN (' . (int)$product_id . ',' .
implode(',', $variant_ids).')';
				$db->setQuery($query);
				$prices = $db->loadObjectList();

				foreach($prices as $price) {
					$ppid = (int)$price->price_product_id;
					if(isset($product->variants[$ppid])) {
						if(empty($product->variants[$ppid]->prices))
							$product->variants[$ppid]->prices = array();
						$product->variants[$ppid]->prices[] = $price;
					}
				}
				unset($prices);

				$query = 'SELECT v.*, c.* FROM
'.hikamarket::table('shop.variant').' AS v '.
					' INNER JOIN
'.hikamarket::table('shop.characteristic').' AS c ON
c.characteristic_id = v.variant_characteristic_id '.
					' WHERE v.variant_product_id IN
('.implode(',',$variant_ids).') '.
					' ORDER BY v.variant_product_id ASC, v.variant_characteristic_id
ASC, v.ordering ASC';
				$db->setQuery($query);
				$variant_data = $db->loadObjectList();

				foreach($variant_data as $d) {
					$ppid = (int)$d->variant_product_id;
					if(isset($product->variants[$ppid])) {
						if(empty($product->variants[$ppid]->characteristics))
							$product->variants[$ppid]->characteristics = array();

						$pcid =
(int)$product->characteristics[$d->characteristic_parent_id]->characteristic_id;
						$value = new stdClass();
						$value->id = $d->characteristic_id;
						$value->value = $d->characteristic_value;
						$product->variants[$ppid]->characteristics[$pcid] = $value;
					}
				}
			}
		}

		$this->assignRef('product', $product);
	}

	public function variant() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.edit';

		JHTML::_('behavior.tooltip');

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$product_id = hikamarket::getCID('variant_id');
		$product_parent_id =
hikaInput::get()->getInt('product_id');
		$productClass = hikamarket::get('class.product');
		$vendorClass = hikamarket::get('class.vendor');

		$editing_variant = true;
		$this->assignRef('editing_variant', $editing_variant);

		$main_currency = $shopConfig->get('main_currency',1);
		$this->assignRef('main_currency_id', $main_currency);

		$this->loadRef(array(
			'toggleClass' => 'helper.toggle',
			'currencyClass' => 'shop.class.currency',
			'popup' => 'shop.helper.popup',
			'quantityType' => 'type.quantity',
			'uploaderType' => 'shop.type.uploader',
			'imageHelper' => 'shop.helper.image',
			'currencyType' => 'shop.type.currency',
			'weight' => 'shop.type.weight',
			'volume' => 'shop.type.volume',
			'characteristicType' =>
'shop.type.characteristic',
			'radioType' => 'shop.type.radio',
		));

		$product = new stdClass();

		if(!empty($product_id)) {
			$product = $productClass->getRaw($product_id, true);

			if((int)$product->product_parent_id != (int)$product_parent_id)
				return false;

			$query = 'SELECT * FROM
'.hikamarket::table('shop.file').' WHERE file_ref_id =
'.(int)$product_id.' AND file_type=\'product\' ORDER BY
file_ordering, file_id';
			$db->setQuery($query);
			$product->images = $db->loadObjectList();

			$query = 'SELECT * FROM
'.hikamarket::table('shop.file').' WHERE file_ref_id =
'.(int)$product_id.' AND file_type=\'file\' ORDER BY
file_ordering, file_id';
			$db->setQuery($query);
			$product->files = $db->loadObjectList('file_id');

			$query = 'SELECT * FROM
'.hikamarket::table('shop.price').' WHERE
price_product_id = ' . (int)$product_id;
			$db->setQuery($query);
			$product->prices = $db->loadObjectList();

			$query = 'SELECT v.*, c.* FROM
'.hikamarket::table('shop.variant').' AS v '.
				' INNER JOIN
'.hikamarket::table('shop.characteristic').' as c ON
v.variant_characteristic_id = c.characteristic_id '.
				' WHERE characteristic_parent_id > 0 AND variant_product_id =
' . (int)$product_id;
			$db->setQuery($query);
			$characteristic_values =
$db->loadObjectList('characteristic_parent_id');

			$query = 'SELECT * FROM
'.hikamarket::table('shop.characteristic').
				' WHERE characteristic_id IN
('.implode(',',array_keys($characteristic_values)).')
OR characteristic_parent_id IN
('.implode(',',array_keys($characteristic_values)).')
'.
				' ORDER BY characteristic_parent_id ASC';
			$db->setQuery($query);
			$characteristics = $db->loadObjectList();

			$product->characteristics = array();
			foreach($characteristics as $c) {
				$charac_pid = ((int)$c->characteristic_parent_id == 0) ?
(int)$c->characteristic_id : (int)$c->characteristic_parent_id;
				if(!isset($product->characteristics[$charac_pid])) {
					$product->characteristics[$charac_pid] = new stdClass();
					$product->characteristics[$charac_pid]->values = array();
				}
				if(((int)$c->characteristic_parent_id == 0)) {
					foreach($c as $k => $v)
						$product->characteristics[$charac_pid]->$k = $v;
				} else {
					$product->characteristics[$charac_pid]->values[
(int)$c->characteristic_id ] = $c->characteristic_value;
				}
			}
			foreach($characteristic_values as $k => $v) {
				$product->characteristics[$k]->default_id =
(int)$v->characteristic_id;
			}

			if($vendor->vendor_id > 1) {
				foreach($product->files as &$file) {
					if(strpos($file->file_path, '/') !== false) {
						$file->file_path = substr($file->file_path,
strrpos($file->file_path, '/')+1);
					}
				}
			}
		}

		$product->parent = $productClass->getRaw((int)$product_parent_id,
true);
		if(!empty($product->parent)  &&
!empty($product->parent->product_tax_id))
			$product->product_tax_id =
(int)$product->parent->product_tax_id;

		if(!empty($product->product_tax_id)) {
			$main_tax_zone = explode(',',
$shopConfig->get('main_tax_zone', ''));
			if(count($main_tax_zone)) {
				$main_tax_zone = array_shift($main_tax_zone);
			}
		}
		if(!empty($product->prices)) {
			foreach($product->prices as $key => $price) {
				if(empty($price->price_value)){
					unset($product->prices[$key]);
				}
			}
			if(!empty($product->product_tax_id)) {
				foreach($product->prices as &$price) {
					$price->price_value_with_tax =
$this->currencyClass->getTaxedPrice($price->price_value,
$main_tax_zone, $product->product_tax_id);
				}
			} else {
				foreach($product->prices as $key => $price) {
					$price->price_value_with_tax = $price->price_value;
				}
			}
		}
		if(empty($product->prices)) {
			$obj = new stdClass();
			$obj->price_value = 0;
			$obj->price_value_with_tax = 0;
			$obj->price_currency_id = $main_currency;
			$product->prices = array($obj);
		}

		$default_description_type =
$shopConfig->get('default_description_type', '');
		if(empty($product_id) && !empty($default_description_type))
			$product->product_description_type = $default_description_type;

		if($product->product_description_type == 'html')
			$product->product_description_type = null;
		if(!empty($product->product_description) &&
empty($product->product_description_raw))
			$product->product_description_type = null;

		if(!empty($product->product_description_type)) {
			$contentparserType =
hikamarket::get('shop.type.contentparser');
			$description_types = $contentparserType->load();
			if(!isset($description_types[ $product->product_description_type ]))
				$product->product_description_type = null;
		}

		$editor = hikamarket::get('shop.helper.editor');
		$editorType = $shopConfig->get('editor', '');
		if(preg_match('/Edge/i',
$_SERVER['HTTP_USER_AGENT']))
			$editorType = 'none';
		if(!empty($product->product_description_type)) {
			$editorType = 'none';
			$editor->name = 'product_variant_description_raw';
			$editor->content = $product->product_description_raw;
		} else {
			$editor->name = 'product_variant_description';
			$editor->content = $product->product_description;
		}
		$editor->id = 'product_variant_editors_'.time();
		$editor->setEditor($editorType);
		$editor->id = 'product_variant_editors_'.time();
		$editor->height = 200;
		if($config->get('editor_disable_buttons', 0))
			$editor->options = false;
		$this->assignRef('editor', $editor);

		if(!isset($product->product_quantity) || $product->product_quantity
< 0)
			$product->product_quantity = JText::_('UNLIMITED');
		if(!isset($product->product_max_per_order) ||
$product->product_max_per_order <= 0)
			$product->product_max_per_order = JText::_('UNLIMITED');

		$this->assignRef('product', $product);

		if(hikashop_level(2)) {
			hikamarket::loadJslib('otree');
			$joomlaAcl = hikamarket::get('type.joomla_acl');
			$this->assignRef('joomlaAcl', $joomlaAcl);
		}

		$translationHelper =
hikamarket::get('shop.helper.translation');
		if($translationHelper && $translationHelper->isMulti()) {
			$translationHelper->load('hikashop_product',
@$product->product_id, $product);
			$this->assignRef('translationHelper', $translationHelper);
		}

		$main_currency = (int)$shopConfig->get('main_currency');
		$this->currencyType->load($main_currency);
		$currencies = $this->currencyType->currencies;
		$this->assignRef('currencies', $currencies);
		$default_currency =
$this->currencyType->currencies[$main_currency];
		$this->assignRef('default_currency', $default_currency);

		$fieldsClass = hikamarket::get('shop.class.field');
		$fieldsClass->prefix = 'variant_'.time().'_';
		$fields =
$fieldsClass->getFields('display:vendor_product_edit=1',
$product, 'product', 'field&task=state');
		$null = array();
		$fieldsClass->addJS($null, $null, $null);
		$fieldsClass->jsToggle($fields, $product, 0);
		$this->assignRef('fieldsClass', $fieldsClass);
		$this->assignRef('fields', $fields);

		return true;
	}

	public function form_variants_add() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.edit';

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$this->loadRef(array(
			'nameboxVariantType' => 'type.namebox',
		));

		$this->nameboxVariantType->setType('characteristic_value',
array());

		$product_id = hikamarket::getCID('product_id');
		$this->assignRef('product_id', $product_id);

		$subtask = hikaInput::get()->getCmd('subtask',
'');
		if($subtask == 'duplicate') {

		}
		$this->assignRef('subtask', $subtask);


		$characteristics = array();
		if(!empty($product_id)) {
			$query = 'SELECT v.*, c.* FROM
'.hikamarket::table('shop.variant').' AS v '.
				' INNER JOIN
'.hikamarket::table('shop.characteristic').' as c ON
v.variant_characteristic_id = c.characteristic_id '.
				' WHERE characteristic_parent_id = 0 AND variant_product_id =
' . (int)$product_id . ' ORDER BY ordering';
			$db->setQuery($query);
			$characteristics =
$db->loadObjectList('characteristic_id');
		}
		$this->assignRef('characteristics', $characteristics);
	}

	public function waitingapproval($tpl = null) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.waitingapproval';

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$this->loadRef(array(
			'toggleClass' => 'helper.toggle',
			'imageHelper' => 'shop.helper.image',
			'currencyHelper' => 'shop.class.currency',
			'childdisplayType' => 'shop.type.childdisplay',
			'shopCategoryType' => 'type.shop_category',
			'dropdownHelper' => 'shop.helper.dropdown',
		));

		$manage = hikamarket::acl('product/edit');
		$this->assignRef('manage', $manage);

		$product_action_delete = hikamarket::acl('product/delete');
		$this->assignRef('product_action_delete',
$product_action_delete);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid = '&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$cfg = array(
			'table' => 'shop.product',
			'main_key' => 'product_id',
			'order_sql_value' => 'product.product_id'
		);

		if($vendor->vendor_id == 1) {
			$vendorType = hikamarket::get('type.filter_vendor');
			$this->assignRef('vendorType', $vendorType);
		}

		$default_sort_value =
trim($config->get('product_listing_default_sort_value',
$cfg['order_sql_value']));
		if(empty($default_sort_value))
			$default_sort_value = $cfg['order_sql_value'];
		$default_sort_dir =
trim($config->get('product_listing_default_sort_dir',
'asc'));
		if(empty($default_sort_dir) || !in_array($default_sort_dir,
array('asc', 'desc')))
			$default_sort_dir = 'asc';

		$pageInfo = $this->getPageInfo($default_sort_value,
$default_sort_dir);

		$pageInfo->filter->vendors =
$app->getUserStateFromRequest($this->paramBase.'.filter_vendors',
'filter_vendors', -1, 'int');

		$filters = array(
			'main' => 'product.product_parent_id = 0',
			'product_type' => 'product.product_type =
\'waiting_approval\''
		);
		$searchMap = array(
			'product.product_name',
			'product.product_description',
			'product.product_id',
			'product.product_code'
		);
		$select = array();
		$join = '';

		if($pageInfo->filter->vendors >= 0 || $vendor->vendor_id >
1) {
			$select['parent_product_name'] =
'parent_product.product_name as parent_product_name';
			$join = ' LEFT JOIN
'.hikamarket::table('shop.product').' AS parent_product
ON product.product_parent_id = parent_product.product_id AND
parent_product.product_vendor_id != product.product_vendor_id AND
product.product_vendor_id > 0 ';
		}

		$fieldsClass = hikamarket::get('shop.class.field');
		$categories = array();
		$fields =
$fieldsClass->getData('display:vendor_product_listing=1',
'product', false, $categories);
		$this->assignRef('fields', $fields);
		$this->assignRef('fieldsClass', $fieldsClass);

		foreach($fields as $fieldName => $oneExtraField) {
			$searchMap[] = 'product.' . $fieldName;
		}

		if($pageInfo->filter->vendors == 0 || $vendor->vendor_id > 1)
{
			$filters['main'] .= ' OR parent_product.product_id != 0 )
AND (product.product_vendor_id = '.(int)$vendor->vendor_id;
			if($vendor->vendor_id == 1)
				$filters['main'] .= ' OR product.product_vendor_id =
0';
		} elseif( $pageInfo->filter->vendors > 1) {
			$filters['main'] .= ' OR parent_product.product_id != 0 )
AND (product.product_vendor_id =
'.(int)$pageInfo->filter->vendors;
		}

		$order = '';
		$this->processFilters($filters, $order, $searchMap,
array('product.'));

		$query = 'FROM
'.hikamarket::table($cfg['table']).' AS product
'.$join.$filters.$order;
		$db->setQuery('SELECT DISTINCT product.*' .
(empty($select)?'':',') . implode(',',
$select) . ' ' . $query, (int)$pageInfo->limit->start,
(int)$pageInfo->limit->value);

		$rows = $db->loadObjectList();

		$vendors = array();
		$products = array();
		foreach($rows as &$product) {
			$product->prices = array();
			$product->vendor_name = '';
			$product->file_name = $product->product_name;
			if(!isset($products[$product->product_id])) {
				$products[$product->product_id] =& $product;
			} else if(!is_array($products[$product->product_id])) {
				$old =& $products[$product->product_id];
				unset($products[$product->product_id]);
				$products[$product->product_id] = array(&$old, &$product);
			} else {
				$products[$product->product_id][] =& $product;
			}
			if($vendor->vendor_id == 1)
				$vendors[(int)$product->product_vendor_id] =
(int)$product->product_vendor_id;
		}
		unset($product);
		$this->assignRef('products', $rows);

		$this->loadPricesImages($products, $vendors);

		$db->setQuery('SELECT COUNT(DISTINCT(product.product_id))
'.$query);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($rows);

		$text_asc = JText::_('ASCENDING');
		$text_desc = JText::_('DESCENDING');
		$ordering_values = array(
			'product.product_id' => JText::_('SORT_ID'),
			'product.product_name' => JText::_('SORT_NAME'),
			'product.product_quantity' =>
JText::_('SORT_QUANTITY'),
		);
		$this->ordering_values = array();
		foreach($ordering_values as $k => $v) {
			$this->ordering_values[$k.' asc'] = $v . ' '
.$text_asc;
			$this->ordering_values[$k.' desc'] = $v . ' '
.$text_desc;
		}
		$this->full_ordering =
$this->pageInfo->filter->order->value . ' ' .
strtolower($this->pageInfo->filter->order->dir);

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' =>
hikamarket::completeLink('product&task=listing')
			),
		);

		$this->getPagination();

		$this->getOrdering('a.ordering', true);
		if(!empty($this->ordering->ordering)) {
			$this->toolbar['ordering']['display'] = true;
		}

		return true;
	}

	public function edit_translation() {
		$language_id = hikaInput::get()->getInt('language_id', 0);
		$this->assignRef('language_id', $language_id);

		$product_id = hikamarket::getCID('product_id');

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$productClass = hikamarket::get('class.product');
		$product = $productClass->getRaw($product_id);

		$translationHelper =
hikamarket::get('shop.helper.translation');
		if($translationHelper && $translationHelper->isMulti()) {
			$translationHelper->load('hikashop_product',
@$product->product_id, $product, $language_id);
			$this->assignRef('translationHelper', $translationHelper);
		}

		$editor = hikamarket::get('shop.helper.editor');
		$editor->setEditor($config->get('editor',
''));
		$editor->content = @$product->product_description;
		$editor->height = 300;
		if($config->get('editor_disable_buttons', 0))
			$editor->options = false;
		$this->assignRef('editor', $editor);

		$toggle = hikamarket::get('helper.toggle');
		$this->assignRef('toggle', $toggle);

		$fieldsClass = hikamarket::get('shop.class.field');
		$this->assignRef('fieldsClass', $fieldsClass);
		$fields =
$fieldsClass->getFields('display:vendor_product_edit=1',
$product, 'product', 'field&task=state');
		$this->assignRef('fields', $fields);

		$this->assignRef('product', $product);

		$this->toolbar = array(
			array(
				'url' => '#save',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save_translation\',\'hikamarket_translation_form\');"',
				'icon' => 'save',
				'fa' => 'fa-save',
				'name' => JText::_('HIKA_SAVE'), 'pos'
=> 'right'
			)
		);
	}

	public function image() {
		$file_id = (int)hikamarket::getCID();
		$this->assignRef('cid', $file_id);

		$config = hikamarket::config(false);
		$this->assignRef('config', $config);

		$element = null;
		if(!empty($file_id)){
			$fileClass = hikamarket::get('shop.class.file');
			$element = $fileClass->get($file_id);
		}
		$this->assignRef('element', $element);

		$product_id = hikaInput::get()->getInt('pid', 0);
		$this->assignRef('product_id', $product_id);

		$this->loadRef(array(
			'imageHelper' => 'shop.helper.image',
			'radioType' => 'shop.type.radio',
		));

		$this->image_link =
hikaInput::get()->getInt('image_link', 0);

		$editor = hikamarket::get('shop.helper.editor');
		$editor->setEditor($config->get('editor',
''));
		$editor->name = 'file_description';
		$editor->content = @$element->file_description;
		$editor->height = 200;
		if($config->get('editor_disable_buttons', 0))
			$editor->options = false;
		$this->assignRef('editor', $editor);
	}

	public function file() {
		$file_id = (int)hikamarket::getCID();
		$this->assignRef('cid', $file_id);

		$config = hikamarket::config(false);
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$vendor = hikamarket::loadVendor(true);
		$this->assignRef('vendor', $vendor);

		$this->loadRef(array(
			'radioType' => 'shop.type.radio',
		));

		$element = null;
		if(!empty($file_id)){
			$fileClass = hikamarket::get('shop.class.file');
			$element = $fileClass->get($file_id);
		}

		if(!empty($element)) {
			$firstChar = substr($element->file_path, 0, 1);
			$element->isVirtual = in_array($firstChar, array('#',
'@'));
			$element->isLink = (substr($element->file_path, 0, 7) ==
'http://' || substr($element->file_path, 0, 8) ==
'https://');
		}

		$this->assignRef('element', $element);

		$product_id = hikaInput::get()->getInt('pid', 0);
		$this->assignRef('product_id', $product_id);

		$editor = hikamarket::get('shop.helper.editor');
		$editor->setEditor($config->get('editor',
''));
		$editor->name = 'file_description';
		$editor->content = @$element->file_description;
		$editor->height = 200;
		if($config->get('editor_disable_buttons', 0))
			$editor->options = false;
		$this->assignRef('editor', $editor);
	}

	public function addimage() {
		$files_id = hikaInput::get()->get('cid', array(),
'array');
		$product_id = hikaInput::get()->getInt('product_id', 0);

		$output = '[]';
		if(!empty($files_id)) {
			hikamarket::toInteger($files_id);
			$query = 'SELECT * FROM
'.hikamarket::table('shop.file').' WHERE file_id IN
('.implode(',',$files_id).')';
			$db = JFactory::getDBO();
			$db->setQuery($query);
			$files = $db->loadObjectList();

			$helperImage = hikamarket::get('shop.helper.image');
			$ret = array();
			foreach($files as $file) {

				$params = new stdClass();
				$params->product_id = $product_id;
				$params->file_id = $file->file_id;
				$params->file_path = $file->file_path;
				$params->file_name = $file->file_name;

				$ret[] = hikamarket::getLayout('productmarket',
'form_image_entry', $params, $js);
			}
			if(!empty($ret)) {
				$output = json_encode($ret);
			}
		}
		$js =
'window.hikashop.ready(function(){window.top.hikamarket.submitBox({images:'.$output.'});});';
		$doc = JFactory::getDocument();
		$doc->addScriptDeclaration($js);

		return false;
	}

	public function galleryimage() {
		hikamarket::loadJslib('otree');

		$app = JFactory::getApplication();
		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.gallery';

		$vendor = hikamarket::loadVendor(true);
		$uploadFolder =
ltrim(JPath::clean(html_entity_decode($shopConfig->get('uploadfolder'))),DS);
		$uploadFolder = rtrim($uploadFolder,DS).DS;
		$basePath = JPATH_ROOT.DS.$uploadFolder.DS;
		if($vendor->vendor_id > 1) {
			$basePath .= 'vendor' . $vendor->vendor_id . DS;
		}

		$pageInfo = new stdClass();
		$pageInfo->limit = new stdClass();
		$pageInfo->limit->value = $app->getUserStateFromRequest(
$this->paramBase.'.list_limit', 'limit', 20,
'int' );
		$pageInfo->limit->start = $app->getUserStateFromRequest(
$this->paramBase.'.limitstart', 'limitstart', 0,
'int' );
		$pageInfo->search = $app->getUserStateFromRequest(
$this->paramBase.'.search', 'search', '',
'string');

		$this->assignRef('pageInfo', $pageInfo);

		jimport('joomla.filesystem.folder');
		if(!JFolder::exists($basePath))
			JFolder::create($basePath);

		$galleryHelper = hikamarket::get('shop.helper.gallery');
		$galleryHelper->setRoot($basePath);
		$this->assignRef('galleryHelper', $galleryHelper);

		$folder = str_replace('|', '/',
hikaInput::get()->getString('folder', ''));
		$destFolder = rtrim($folder, '/\\');
		if(!$galleryHelper->validatePath($destFolder))
			$destFolder = '';
		if(!empty($destFolder)) $destFolder .= '/';
		$this->assignRef('destFolder', $destFolder);

		$galleryOptions = array(
			'filter' => '.*' .
str_replace(array('.','?','*','$','^'),
array('\.','\?','\*','$','\^'),
$pageInfo->search) . '.*',
			'offset' => $pageInfo->limit->start,
			'length' => $pageInfo->limit->value
		);
		$this->assignRef('galleryOptions', $galleryOptions);

		$treeContent = $galleryHelper->getTreeList(null, $destFolder);
		$this->assignRef('treeContent', $treeContent);

		$dirContent = $galleryHelper->getDirContent($destFolder,
$galleryOptions);
		$this->assignRef('dirContent', $dirContent);

		jimport('joomla.html.pagination');
		$pagination = new JPagination( $galleryHelper->filecount,
$pageInfo->limit->start, $pageInfo->limit->value );
		$this->assignRef('pagination', $pagination);
	}

	public function addfile() {
		$file_id = (int)hikamarket::getCID();
		$js =
'window.hikashop.ready(function(){window.parent.hikamarket.submitBox({cid:'.$file_id.'});});';
		$doc = JFactory::getDocument();
		$doc->addScriptDeclaration($js);

		return false;
	}

	public function form_image_entry() {
		if(empty($this->popup)) {
			$popup = hikamarket::get('shop.helper.popup');
			$this->assignRef('popup', $popup);
		}
		$config = hikamarket::config(false);
		$this->assignRef('config', $config);
		$imageHelper = hikamarket::get('shop.helper.image');
		$this->assignRef('imageHelper', $imageHelper);
	}

	public function form_file_entry() {
		$file_id = (int)hikamarket::getCID();
		$this->assignRef('cid', $file_id);

		$product_id = hikaInput::get()->getInt('pid', 0);
		$this->assignRef('product_id', $product_id);

		$config = hikamarket::config(false);
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$vendor = hikamarket::loadVendor(true);
		$this->assignRef('vendor', $vendor);

		if(empty($this->popup)) {
			$popup = hikamarket::get('shop.helper.popup');
			$this->assignRef('popup', $popup);
		}

		if(empty($this->params) &&
empty($this->params->file_id)) {
			$element = new stdClass();
			if(!empty($file_id)){
				$fileClass = hikamarket::get('shop.class.file');
				$element = $fileClass->get($file_id);
			}
			$element->product_id = $product_id;

			if(!empty($element->product_id)) {
				$productClass = hikamarket::get('shop.class.product');
				$product = $productClass->get((int)$element->product_id);
				$element->product_type = $product->product_type;
			}

			$this->assignRef('params', $element);
		}

		if($vendor->vendor_id > 1) {
			if(!empty($this->params->file_path) &&
strpos($this->params->file_path, '/') !== false) {
				$this->params->file_path = substr($this->params->file_path,
strrpos($this->params->file_path, '/')+1);
			}
		}
	}

	public function form_price_entry() {
		$db = JFactory::getDBO();
		$config = hikamarket::config();
		$shopConfig = hikamarket::config(false);

		$this->assignRef('config', $config);
		$this->assignRef('shopConfig', $shopConfig);

		$main_currency = $shopConfig->get('main_currency', 1);

		$product_id = hikaInput::get()->getInt('product_id', 0);
		$price_id = hikaInput::get()->getInt('price_id', 0);
		$edition_state = hikaInput::get()->getInt('edition_state',
0);

		$formKeyParam = hikaInput::get()->getString('formkey',
'');
		$variant_product_id =
hikaInput::get()->getInt('variant_product_id', 0);
		if(!empty($variant_product_id) && !empty($formKeyParam)
&& $formKeyParam == 'variantprice') {
			$product_id = $variant_product_id;
		}

		$this->price_num = hikaInput::get()->getInt('price_num',
0);

		if(!empty($price_id)) {
			$query = 'SELECT * FROM
'.hikamarket::table('shop.price').
				' WHERE price_product_id = '.(int)$product_id.' AND
price_id = '.(int)$price_id;
			$db->setQuery($query);
			$this->price = $db->loadObject();
			if(empty($this->price))
				exit;
		} else {
			$this->price = new stdClass;
			$this->price->price_id = 0;
			$this->price->price_value = 0;
			$this->price->price_access = 'all';
			$this->price->price_min_quantity = 1;
			$this->price->price_currency_id = $main_currency;
		}
		if(!empty($this->price))
			$this->price->edit = ($edition_state == 1);

		$productClass = hikamarket::get('shop.class.product');
		$product = $productClass->get($product_id);
		$this->editing_variant = !empty($product->product_type) &&
($product->product_type == 'variant');

		if($this->editing_variant &&
!empty($product->product_parent_id)) {
			$parentProduct = $productClass->get($product->product_parent_id);
			$product->product_tax_id = (int)$parentProduct->product_tax_id;
			unset($parentParent);
		}

		$this->loadRef(array(
			'currencyClass' => 'shop.class.currency',
			'currencyType' => 'shop.type.currency',
			'nameboxType' => 'type.namebox',
			'currencyType' => 'shop.type.currency',
			'userClass' => 'shop.class.user',
		));
		if(hikashop_level(2)) {
			hikamarket::loadJslib('otree');
			$joomlaAcl = hikamarket::get('type.joomla_acl');
			$this->assignRef('joomlaAcl', $joomlaAcl);
		}

		$main_currency = $shopConfig->get('main_currency',1);
		$this->currencyType->load($main_currency);
		$default_currency =
$this->currencyType->currencies[$main_currency];
		$this->assignRef('default_currency', $default_currency);

		$currencies = $this->currencyType->currencies;

		$this->assignRef('product', $product);

		$this->price_acls = array(
			'value' => $this->aclEdit('price/value'),
			'tax' => $this->aclEdit('price/tax')
&& !$shopConfig->get('floating_tax_prices', 0),
			'currency' => $this->aclEdit('price/currency')
&& (count($currencies) > 1),
			'quantity' =>
$this->aclEdit('price/quantity'),
			'acl' => hikashop_level(2) &&
$this->aclEdit('price/acl'),
			'user' => hikashop_level(2) &&
$this->aclEdit('price/user'),
			'date' => hikashop_level(2) &&
$this->aclEdit('price/date')
		);

		$formKey = empty($this->editing_variant) ? 'price' :
'variantprice';
		if($edition_state == -1)
			$formKey .= '_old';

		$formData = hikaInput::get()->get($formKey, array(),
'array');
		$priceData = (isset($formData[$this->price_num])) ?
$formData[$this->price_num] : reset($formData);

		if($this->price_acls['value'] &&
isset($priceData['price_value']))
			$this->price->price_value =
hikamarket::toFloat($priceData['price_value']);
		if($this->price_acls['currency'] &&
isset($priceData['price_currency_id']))
			$this->price->price_currency_id =
(int)$priceData['price_currency_id'];
		if($this->price_acls['quantity'] &&
isset($priceData['price_min_quantity']))
			$this->price->price_min_quantity =
(int)$priceData['price_min_quantity'];
		if($this->price_acls['acl'] &&
isset($priceData['price_access']))
			$this->price->price_access =
(string)$priceData['price_access'];
		if($this->price_acls['user'] &&
isset($priceData['price_users']))
			$this->price->price_users =
is_array($priceData['price_users']) ? implode(',',
$priceData['price_users']) :
(string)$priceData['price_users'];
		if($this->price_acls['date'] &&
isset($priceData['price_start_date']))
			$this->price->price_start_date =
(string)$priceData['price_start_date'];
		if($this->price_acls['date'] &&
isset($priceData['price_end_date']))
			$this->price->price_end_date =
(string)$priceData['price_end_date'];

		$main_tax_zone = explode(',',
$shopConfig->get('main_tax_zone', ''));
		if(count($main_tax_zone) && !empty($product->product_tax_id)
&& !empty($this->price->price_value) &&
!empty($main_tax_zone)) {
			$this->price->price_value_with_tax =
$this->currencyClass->getTaxedPrice($this->price->price_value,
array_shift($main_tax_zone), $product->product_tax_id, 5);
		} else {
			$this->price->price_value_with_tax =
$this->price->price_value;
		}
	}

	protected function niceNumber($value) {
		if($value < 1000) return $value;
		if($value < 1000000) return floor($value/1000).'K';
		return floor($value/1000000).'M';
	}

	public function import() {
		$this->loadRef(array(
			'importHelper' => 'helper.import',
			'uploaderType' => 'shop.type.uploader', // TODO
use "type.upload" and a new display function
		));

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' => hikamarket::completeLink('product')
			),
		);
	}
}
views/toolbar/index.html000064400000000032151166607760011352
0ustar00<html><body></body></html>views/toolbar/tmpl/default.php000064400000004230151166607760012472
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php

$toolbar_classname =
$this->config->get('front_toolbar_btn_classname',
'hikabtn');
if(empty($toolbar_classname))
	$toolbar_classname = 'hikabtn';

$toolbar_mode =
$this->config->get('front_toolbar_icon_mode',
'fa');
if(!in_array($toolbar_mode, array('css', 'fa')))
	$toolbar_mode = 'css';

$data = $this->left;
if(!empty($this->right)) {
	$data[] = '#RIGHT#';
	$data = array_merge($data, $this->right);
}

?>
<div class="hikam_toolbar">
	<div class="hikam_toolbar_btn hikam_btn_32">
<?php

foreach($data as $key => $tool) {
	if($tool === '#RIGHT#') {
		echo '<div class="hikam_toolbar_right">';
		continue;
	}

	if(empty($tool['url']) &&
!empty($tool['sep'])) {
		echo '<div class="sep"></div>';
		continue;
	}

	$content = '';

	if(!empty($tool['fa']) && $toolbar_mode ==
'fa') {
		$content .= '<i class="fa
'.$tool['fa'].'"></i>';
		$tool['icon'] = null;
	}
	if(!empty($tool['icon'])) {
		$content .= '<span class="btnIcon
iconM-32-'.$tool['icon'].'"></span>';
	}

	if(!empty($tool['name'])) { $content .= '<span
class="btnName">' . $tool['name'] .
'</span>'; }

	if(!empty($tool['url'])) {
		if(empty($tool['popup'])) {
			if(empty($tool['linkattribs']))
				echo '<a class="'.$toolbar_classname.'"
href="'.$tool['url'].'">';
			else
				echo '<a class="'.$toolbar_classname.'"
href="'.$tool['url'].'"
'.$tool['linkattribs'].'>';
			echo $content . '</a>';
		} else {
			$attr = $this->popup->getAttr(@$tool['linkattribs'],
'hikabtn');
			echo $this->popup->display(
				$content,
				@$tool['name'],
				$tool['url'],
				$tool['popup']['id'],
				$tool['popup']['width'],
				$tool['popup']['height'],
				$attr, '', 'link'
			);
		}
	} else {
		echo '<div
class="'.$toolbar_classname.'">'.$content.'</div>';
	}
	unset($content);
}
if(!empty($this->right))
	echo '</div>';

?>
		<div style="clear:both"></div>
	</div>
</div>
views/toolbar/tmpl/index.html000064400000000032151166607760012326
0ustar00<html><body></body></html>views/toolbar/view.html.php000064400000002771151166607760012017
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class toolbarViewtoolbar extends hikamarketView {

	protected $ctrl = 'toolbar';
	protected $icon = '';
	protected $triggerView = false;

	public function display($tpl = null, $params = array()) {
		$this->params =& $params;
		$fct = $this->getLayout();
		if($fct == 'default')
			$fct = 'show';
		if(method_exists($this, $fct)) {
			if($this->$fct() === false)
				return;
		}
		if(isset($this->toolbar))
			unset($this->toolbar);
		parent::display($tpl);
	}

	public function show() {
		$toolbar = $this->params->get('toolbar', null);
		if(empty($toolbar))
			return false;

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$this->loadRef(array(
			'popup' => 'shop.helper.popup'
		));

		$toolbarLeft = array();
		$toolbarRight = array();
		foreach($toolbar as $tool) {
			if(isset($tool['acl']) && !$tool['acl'])
				continue;
			if(isset($tool['display']) &&
!$tool['display'])
				continue;

			if(!empty($tool['pos']) && $tool['pos'] ===
'right')
				$toolbarRight[] = $tool;
			else
				$toolbarLeft[] = $tool;
		}

		$this->assignRef('rawdata', $toolbar);
		$this->assignRef('left', $toolbarLeft);
		$this->assignRef('right', $toolbarRight);
	}
}
views/uploadmarket/index.html000064400000000032151166607760012400
0ustar00<html><body></body></html>views/uploadmarket/tmpl/galleryimage.php000064400000011335151166607760014542
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><fieldset>
	<div class="toolbar" id="toolbar"
style="float: right;">
		<button class="hikabtn" type="button"
onclick="window.hikamarket.submitform('galleryselect','adminForm');">
			<img style="vertical-align: middle" src="<?php echo
HIKASHOP_IMAGES; ?>save.png"/> <?php echo
JText::_('OK'); ?>
		</button>
	</div>
</fieldset>
<form action="<?php echo
hikamarket::completeLink('upload&task=galleryimage', true);
?>" method="post" name="adminForm"
id="adminForm">
	<table width="100%" height="100%"
class="adminlist" style="width:100%;height:100%;">
		<thead>
			<tr>
				<th></th>
				<th>
					<?php echo JText::_('FILTER');?>:
					<input type="text" name="search"
id="galleryimage_search" value="<?php echo
$this->escape($this->pageInfo->search);?>"
class="text_area"
onchange="document.adminForm.submit();" />
					<button class="hikabtn"
onclick="document.adminForm.limitstart.value=0;this.form.submit();"><i
class="fas fa-search"></i></button>
					<button class="hikabtn"
onclick="document.adminForm.limitstart.value=0;document.getElementById('galleryimage_search').value='';this.form.submit();"><i
class="fas fa-times"></i></button>
				</th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td></td>
				<td>
					<?php echo $this->pagination->getListFooter(); ?>
					<?php echo $this->pagination->getResultsCounter(); ?>
				</td>
			</tr>
		</tfoot>
		<tr>
			<td width="130px" height="100%"
style="width:130px;vertical-align:top;">
				<div style="width:130px;height:100%;overflow:auto;">
<?php
echo $this->treeContent;
?>
<script type="text/javascript">
hikashopGallery.callbackSelection = function(tree,id) {
	var d = document, node = tree.get(id);
	if( node.value && node.name ) {
		var url = "<?php
			$params = '';
			if(!empty($this->uploadConfig['extra'])) {
				foreach($this->uploadConfig['extra'] as $uploadField =>
$uploadFieldValue) {
					$params .= '&' . urlencode($uploadField) . '='
. urlencode($uploadFieldValue);
				}
			}
			echo
hikamarket::completeLink('upload&task=galleryimage&folder={FOLDER}&uploader='.$this->uploader.'&field='.$this->field.$params,
true, true) ;
		?>";
		document.location = url.replace('{FOLDER}',
node.value.replace('/', '|'));
	}
}
</script>
				</div>
			</td>
			<td>
				<ul id="hikaGallery">
<?php
if(!empty($this->dirContent)) {
	foreach($this->dirContent as $k => $content) {
		$chk_uid = 'hikaGalleryChk_' . $k . '_' . uniqid();

		if(!empty($this->vendorPath))
			$content->path = str_replace($this->vendorPath, '',
$content->path);
?>
	<li class="hikaGalleryItem">
		<a class="hikaGalleryPhoto" href="#"
onclick="return window.hikagallery.select(this, '<?php echo
$chk_uid; ?>');">
			<img src="<?php echo str_replace('//',
'/', $content->thumbnail->url); ?>"
alt="<?php echo $content->filename; ?>"/>
			<span style="display:none;"
class="hikaGalleryChk"><input type="checkbox"
id="<?php echo $chk_uid ;?>" name="files[]"
value="<?php echo $content->path; ?>"/></span>
			<div class="hikaGalleryCommand">
				<span class="photo_name"><?php echo
$content->filename; ?></span>
				<span><?php echo $content->width . 'x' .
$content->height; ?></span>
				<span style="float:right"><?php echo
$content->size; ?></span>
			</div>
		</a>
	</li>
<?php
	}
}
?>
				</ul>
			</td>
		</tr>
	</table>
<script type="text/javascript">
window.hikagallery = {};
window.hikagallery.select = function(el, id) {
	var d = document, w = window, o = w.Oby, chk = d.getElementById(id);
	if(chk) {
		if(chk.checked) {
			o.removeClass(el.parentNode, 'selected');
		} else {
			o.addClass(el.parentNode, 'selected');
		}
		chk.checked = !chk.checked;
	}
	return false;
}
</script>
	<div class="clr"></div>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="task"
value="galleryimage" />
	<input type="hidden" name="ctrl"
value="upload" />
	<input type="hidden" name="folder"
value="<?php echo $this->destFolder; ?>" />
	<input type="hidden" name="uploader"
value="<?php echo $this->uploader; ?>" />
	<input type="hidden" name="field"
value="<?php echo $this->field; ?>" />
<?php
	if(!empty($this->uploadConfig['extra'])) {
		foreach($this->uploadConfig['extra'] as $uploadField =>
$uploadFieldValue) {
?>
	<input type="hidden" name="<?php echo $uploadField;
?>" value="<?php echo $uploadFieldValue; ?>" />
<?php
		}
	}
?>
	<?php echo JHTML::_('form.token'); ?>
</form>
views/uploadmarket/tmpl/image_entry.php000064400000002235151166607760014402
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div>
<?php if(!empty($this->params->delete) &&
!empty($this->params->uploader_id)) { ?>
	<a href="#delete" class="deleteImg"
onclick="return window.hkUploaderList['<?php echo
$this->params->uploader_id;
?>'].delImage(this);"><i class="fas
fa-trash-alt"></i></a>
<?php } ?>
	<div class="hikamarket_image"><?php
		$img =
$this->imageHelper->getThumbnail(@$this->params->file_path,
array(100, 100), array('default' => true));
		if($img->success) {
			$extra_data = '';
			if(!empty($img->external))
				$extra_data .= 'width="100"
height="100;"';

			$content = '<img src="'.$img->url.'"
alt="'.$img->filename.'"
'.$extra_data.'/>';
			echo $this->popup->image($content, $img->origin_url);
		}

		if(!empty($this->params->field_name))
			echo '<input type="hidden"
name="'.$this->params->field_name.'"
value="'.$this->escape(@$this->params->file_path).'"/>';
	?></div>
</div>
views/uploadmarket/tmpl/index.html000064400000000032151166607760013354
0ustar00<html><body></body></html>views/uploadmarket/tmpl/sendfile.php000064400000004367151166607760013700
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><fieldset>
	<div class="toolbar" id="toolbar"
style="float: right;">
		<button class="hikabtn" type="button"
onclick="hikamarket.submitform('addimage','hikamarket_form');"<i
class="fas fa-check"></i> <?php echo
JText::_('OK'); ?></button>
	</div>
</fieldset>
<form action="<?php echo
hikamarket::completeLink('upload&task=image'); ?>"
method="post" name="hikamarket_form"
id="hikamarket_form" enctype="multipart/form-data">
	<table width="100%">
		<tr>
<?php
	if(empty($this->element->file_path)) {
?>
			<td class="key">
				<label for="files"><?php echo
JText::_('HIKA_IMAGE'); ?></label>
			</td>
			<td>
				<input type="file" name="files[]"
size="30" />
				<?php echo
JText::sprintf('MAX_UPLOAD',(hikashop_bytes(ini_get('upload_max_filesize'))
> hikashop_bytes(ini_get('post_max_size'))) ?
ini_get('post_max_size') :
ini_get('upload_max_filesize')); ?>
			</td>
<?php
	} else {
?>
			<td class="key">
				<label for="files"><?php echo JText::_(
'HIKA_IMAGE' ); ?></label>
			</td>
			<td><?php
				$image =
$this->imageHelper->getThumbnail($this->element->file_path,
array(100, 100), array('default' => true));
			?><img src="<?php echo $image->url ;?>"
alt="<?php echo $image->filename ;?>" /></td>
<?php
	}
?>
		</tr>
	</table>
	<div class="clr"></div>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="ctrl"
value="upload" />
	<input type="hidden" name="task"
value="addimage" />
	<input type="hidden" name="uploader"
value="<?php echo $this->uploader; ?>" />
	<input type="hidden" name="field"
value="<?php echo $this->field; ?>" />
<?php
	if(!empty($this->uploadConfig['extra'])) {
		foreach($this->uploadConfig['extra'] as $uploadField =>
$uploadFieldValue) {
?>
	<input type="hidden" name="<?php echo $uploadField;
?>" value="<?php echo $uploadFieldValue; ?>" />
<?php
		}
	}
?>
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
views/uploadmarket/view.html.php000064400000013001151166607760013031
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class uploadmarketViewuploadmarket extends hikamarketView {
	const ctrl = 'upload';
	const name = 'HIKA_UPLOAD';
	const icon = 'upload';

	public function display($tpl = null, $params = array()) {
		$this->params =& $params;
		$fct = $this->getLayout();
		if(method_exists($this, $fct)) {
			if($this->$fct() === false)
				return;
		}
		parent::display($tpl);
	}

	public function sendfile() {
		$uploadConfig = hikaInput::get()->getVar('uploadConfig',
null);
		if(empty($uploadConfig) || !is_array($uploadConfig))
			return false;

		$this->assignRef('uploadConfig', $uploadConfig);
		$uploader = hikaInput::get()->getCmd('uploader',
'');
		if(substr($uploader, 0, 11) == 'plg.market.')
			$uploader = substr($uploader, 11);
		$this->assignRef('uploader', $uploader);
		$field = hikaInput::get()->getCmd('field', '');
		$this->assignRef('field', $field);
	}

	public function galleryimage() {
		hikamarket::loadJslib('otree');

		$app = JFactory::getApplication();
		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.gallery';

		$uploadConfig = hikaInput::get()->getVar('uploadConfig',
null);
		if(empty($uploadConfig) || !is_array($uploadConfig))
			return false;

		$this->assignRef('uploadConfig', $uploadConfig);
		$uploader = hikaInput::get()->getCmd('uploader',
'');
		if(substr($uploader, 0, 11) == 'plg.market.')
			$uploader = substr($uploader, 11);
		$this->assignRef('uploader', $uploader);
		$field = hikaInput::get()->getCmd('field', '');
		$this->assignRef('field', $field);

		$uploadFolder =
ltrim(JPath::clean(html_entity_decode($shopConfig->get('uploadfolder'))),DS);
		$uploadFolder = rtrim($uploadFolder,DS).DS;
		$basePath = JPATH_ROOT.DS.$uploadFolder.DS;

		if(!empty($uploadConfig['options']['upload_dir']))
			$basePath =
rtrim(JPATH_ROOT,DS).DS.str_replace(array('\\','/'),
DS, $uploadConfig['options']['upload_dir']);

		$pageInfo = new stdClass();
		$pageInfo->limit = new stdClass();
		$pageInfo->limit->value = $app->getUserStateFromRequest(
$this->paramBase.'.list_limit', 'limit', 20,
'int' );
		$pageInfo->limit->start = $app->getUserStateFromRequest(
$this->paramBase.'.limitstart', 'limitstart', 0,
'int' );
		$pageInfo->search = $app->getUserStateFromRequest(
$this->paramBase.'.search', 'search', '',
'string');

		$this->assignRef('pageInfo', $pageInfo);

		jimport('joomla.filesystem.folder');
		if(!JFolder::exists($basePath))
			JFolder::create($basePath);

		$vendorBase = $basePath;
		if(!empty($uploadConfig['options']['sub_folder']))
			$vendorBase .= rtrim(str_replace(array('\\','/'),
DS, $uploadConfig['options']['sub_folder']), DS).DS;

		if(!JFolder::exists($vendorBase)) {
			JFolder::create($vendorBase);

			if(!JFolder::exists($vendorBase))
				return false;
		}

		$galleryHelper = hikamarket::get('shop.helper.gallery');
		$galleryHelper->setRoot($vendorBase);
		$this->assignRef('galleryHelper', $galleryHelper);

		$folder = str_replace(array('|', '\/'), array(DS,
DS), hikaInput::get()->getString('folder', ''));
		if(!empty($uploadConfig['options']['sub_folder'])
&& substr($folder, 0,
strlen($uploadConfig['options']['sub_folder'])) ==
$uploadConfig['options']['sub_folder']) {
			$folder = substr($folder,
strlen($uploadConfig['options']['sub_folder']));
			if($folder === false)
				$folder = '';
		}

		$destFolder = rtrim($folder, '/\\');
		if(!$galleryHelper->validatePath($destFolder))
			$destFolder = '';
		if(!empty($destFolder)) $destFolder .= '/';
		$treeContent = $galleryHelper->getTreeList(null, $destFolder);
		$this->assignRef('treeContent', $treeContent);

		$galleryHelper->setRoot($basePath);

		$destFolder = '';
		if(!empty($uploadConfig['options']['sub_folder']))
			$destFolder .=
rtrim(str_replace(array('\\','/'),DS,$uploadConfig['options']['sub_folder']),
DS).DS;
		$destFolder .= rtrim($folder, '/\\');
		if(!$galleryHelper->validatePath($destFolder))
			$destFolder = '';
		if(!empty($destFolder)) $destFolder .= '/';
		$this->assignRef('destFolder', $destFolder);

		$galleryOptions = array(
			'filter' => '.*' .
str_replace(array('.','?','*','$','^'),
array('\.','\?','\*','$','\^'),
$pageInfo->search) . '.*',
			'offset' => $pageInfo->limit->start,
			'length' => $pageInfo->limit->value
		);
		$this->assignRef('galleryOptions', $galleryOptions);

		$dirContent = $galleryHelper->getDirContent($destFolder,
$galleryOptions);
		$this->assignRef('dirContent', $dirContent);

		$vendorPath = '';
		if(!empty($uploadConfig['options']['sub_folder']))
			$vendorPath =
rtrim(str_replace(array('\\','/'),DS,$uploadConfig['options']['sub_folder']),
DS).DS;
		$this->assignRef('vendorPath', $vendorPath);

		jimport('joomla.html.pagination');
		$pagination = new JPagination( $galleryHelper->filecount,
$pageInfo->limit->start, $pageInfo->limit->value );
		$this->assignRef('pagination', $pagination);
	}

	public function image_entry() {
		$imageHelper = hikamarket::get('shop.helper.image');
		$this->assignRef('imageHelper', $imageHelper);
		$popup = hikamarket::get('shop.helper.popup');
		$this->assignRef('popup', $popup);
	}
}
views/usermarket/index.html000064400000000032151166607760012072
0ustar00<html><body></body></html>views/usermarket/tmpl/address.php000064400000013674151166607760013227
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!empty($this->ajax) && !empty($this->edit)) {
?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
<?php
}
$show_url =
'user&task=address&subtask=listing&user_id='.$this->user_id;
$save_url =
'user&task=address&subtask=save&cid='.$this->address->address_id.'&user_id='.$this->user_id;
$update_url =
'user&task=address&subtask=edit&cid='.$this->address->address_id.'&user_id='.$this->user_id;
$delete_url =
'user&task=address&subtask=delete&cid='.$this->address->address_id.'&user_id='.$this->user_id;

if(hikamarket::acl('user/edit/address') &&
($this->vendor->vendor_id == 0 || $this->vendor->vendor_id ==
1)) {
	if(!isset($this->edit) || $this->edit !== true ) {
?>		<div class="hikam_edit">
			<a class="hikabtn" href="<?php echo
hikamarket::completeLink($update_url, 'ajax');?>"
onclick="return
window.addressMgr.get(this,'hikamarket_user_addresses_show');"><i
class="fas fa-pencil-alt"></i> <span><?php echo
JText::_('HIKA_EDIT'); ?></span></a>
			<a class="hikabtn" href="<?php echo
hikamarket::completeLink($delete_url, 'ajax');?>"
onclick="return window.addressMgr.delete(this,<?php echo
$this->address->address_id; ?>);"><i class="far
fa-trash-alt"></i> <span><?php echo
JText::_('HIKA_DELETE'); ?></span></a>
		</div>
<?php
	} else {
		if(empty($this->address->address_id)) {
			$title = $this->type == 'billing' ?
'HIKASHOP_NEW_BILLING_ADDRESS':
'HIKASHOP_NEW_SHIPPING_ADDRESS';
		} else {
			$title = in_array($this->address->address_type,
array('billing', 'shipping')) ?
'HIKASHOP_EDIT_'.strtoupper($this->address->address_type).'_ADDRESS'
: 'HIKASHOP_EDIT_ADDRESS';
		}
?>
<div class="hikashop_address_edition">
	<h3><?php echo JText::_($title); ?></h3>
<?php
	}
}

if(isset($this->edit) && $this->edit === true) {
	$error_messages = hikaRegistry::get('address.error');
	if(!empty($error_messages)) {
		foreach($error_messages as $msg) {
			hikashop_display($msg[0], $msg[1]);
		}
	}

	foreach($this->fields['address'] as $fieldname => $field)
{
?>
	<dl id="hikamarket_user_address_<?php echo
$this->address->address_id; ?>_<?php echo
$fieldname;?>" class="hikam_options">
		<dt class="hikamarket_user_address_<?php echo
$fieldname;?>"><label><?php
			echo $this->fieldsClass->trans($field->field_realname);
			if($field->field_required && !empty($field->vendor_edit))
				echo ' <span
class="field_required">*</span>';
		?></label></dt>
		<dd class="hikamarket_user_address_<?php echo
$fieldname;?>"><?php
			if(!empty($field->vendor_edit)) {
				$onWhat = 'onchange';
				if($field->field_type == 'radio')
					$onWhat = 'onclick';

				$field->field_required = false;
				echo $this->fieldsClass->display(
						$field,
						@$this->address->$fieldname,
						'data[user_address]['.$fieldname.']',
						false,
						' ' . $onWhat .
'="hikashopToggleFields(this.value,\''.$fieldname.'\',\'user_address\',0);"',
						false,
						$this->fields['address'],
						$this->address
				);
			} else {
				echo $this->fieldsClass->show($field,
@$this->address->$fieldname);
			}
		?></dd>
	</dl>
<?php
	}
?>
	<div style="float:right">
		<a class="hikabtn hikabtn-success" href="<?php echo
hikamarket::completeLink($save_url, 'ajax');?>"
onclick="return
window.addressMgr.form(this,'hikamarket_user_addresses_show');"><i
class="fas fa-check"></i> <span><?php echo
JText::_('HIKA_SAVE'); ?></span></a>
	</div>
	<a class="hikabtn hikabtn-danger" href="<?php echo
hikamarket::completeLink($show_url, 'ajax');?>"
onclick="return
window.addressMgr.get(this,'hikamarket_user_addresses_show');"><i
class="fas fa-times-circle"></i> <span><?php
echo JText::_('HIKA_CANCEL'); ?></span></a>

	<input type="hidden"
name="data[user_address][address_id]" value="<?php echo
@$this->address->address_id; ?>"/>
	<input type="hidden"
name="data[user_address][address_user_id]" value="<?php
echo @$this->address->address_user_id; ?>"/>
	<?php echo JHTML::_( 'form.token' ); ?>
</div>
<?php
} else {
	if($this->config->get('address_show_details', 0)) {
		foreach($this->fields['address'] as $fieldname => $field)
{
?>
	<dl class="hikam_options">
		<dt class="hikamarket_user_address_<?php echo
$fieldname;?>"><label><?php echo
$this->fieldsClass->trans($field->field_realname);?></label></dt>
		<dd class="hikamarket_user_address_<?php echo
$fieldname;?>"><span><?php echo
$this->fieldsClass->show($field,
@$this->address->$fieldname);?></span></dd>
	</dl>
<?php
		}
	} else {
		echo $this->addressClass->maxiFormat($this->address,
$this->fields['address'], true);
	}

	if(!empty($this->display_badge)) {
?>
		<div class="" style="float:right"><?php
			if(in_array($this->address->address_type,
array('billing', '', 'both')))
				echo '<span class="hk-label
hk-label-blue">'.JText::_('HIKASHOP_BILLING_ADDRESS').'</span>';
			if(in_array($this->address->address_type,
array('shipping', '', 'both')))
				echo '<span class="hk-label
hk-label-orange">'.JText::_('HIKASHOP_SHIPPING_ADDRESS').'</span>';
		?></div>
<?php
	}
}

if(!empty($this->ajax)) {
	$miniFormat = $this->addressClass->miniFormat($this->address,
$this->fields['address']);
?>
<script type="text/javascript">
window.Oby.fireAjax('hikamarket_address_changed',{'edit':<?php
echo $this->edit?'1':'0';
?>,'cid':<?php echo $this->address->address_id;
?>,'miniFormat':'<?php echo
str_replace('\'','\\\'', $miniFormat);
?>'<?php
	$previous_id = hikaInput::get()->getVar('previous_cid',
null);
	if((!empty($previous_id) || $previous_id === 0) &&
is_int($previous_id))
		echo ',\'previous_cid\':' . $previous_id;
?>});
</script>
<?php
}

if(!empty($this->init_js)) {
?>
<script type="text/javascript">
<?php echo $this->init_js; ?>
</script>
<?php
}
views/usermarket/tmpl/index.html000064400000000032151166607760013046
0ustar00<html><body></body></html>views/usermarket/tmpl/listing.php000064400000010706151166607760013244
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div>
<form action="<?php echo
hikamarket::completeLink('user&task=listing'); ?>"
method="post" name="adminForm"
id="adminForm">
	<div class="hk-row-fluid">
		<div class="hkc-md-12"><?php
	echo $this->loadHkLayout('search', array(
		'id' => 'hikamarket_user_listing_search',
	));
		?></div>
	</div>
	<div class="hk-row-fluid">
		<div class="hkc-md-12">
			<div class="expand-filters"
style="width:auto;">
<?php
?>
			</div>
			<div style="clear:both"></div>
		</div>
	</div>
	<table class="hikam_listing hikam_table"
style="width:100%">
		<thead>
			<tr>
				<th class="hikamarket_user_name_title title"><?php
					echo JHTML::_('grid.sort',
JText::_('HIKA_USER_NAME'), 'juser.name',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value);
				?></th>
				<th class="hikamarket_user_login_title title"><?php
					echo JHTML::_('grid.sort',
JText::_('HIKA_USERNAME'), 'juser.username',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value);
				?></th>
				<th class="hikamarket_user_email_title title"><?php
					echo JHTML::_('grid.sort', JText::_('HIKA_EMAIL'),
'hkuser.user_email',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value);
				?></th>
<?php
if(!empty($this->fields)) {
	foreach($this->fields as $field) {
?>
				<th class="hikamarket_user_<?php echo
$field->field_namekey; ?>_title title"><?php
					echo JHTML::_('grid.sort',
$this->fieldsClass->trans($field->field_realname),
'hkuser.'.$field->field_namekey,
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value );
				?></th>
<?php
	}
}

	if($this->vendor->vendor_id == 1) {
?>
				<th class="hikamarket_user_id_title title">
					<?php echo JHTML::_('grid.sort', JText::_( 'ID'
), 'hkuser.user_id',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value ); ?>
				</th>
<?php
	}
?>
			</tr>
		</thead>
<?php if(!isset($this->embbed)) {
	$columns = 3 + count($this->fields);
	if($this->vendor->vendor_id == 1) $columns++;
?>
		<tfoot>
			<tr>
				<td colspan="<?php echo $columns; ?>">
					<?php echo $this->pagination->getListFooter(); ?>
					<?php echo $this->pagination->getResultsCounter(); ?>
				</td>
			</tr>
		</tfoot>
<?php } ?>
		<tbody>
<?php
$k = 0;
$i = 0;
foreach($this->rows as $user) {
	$rowId = 'market_user_'.$user->user_id;
	if($this->manage)
		$url =
hikamarket::completeLink('user&task=show&cid='.$user->user_id);
?>
			<tr class="row<?php echo $k; ?>" id="<?php
echo $rowId; ?>">
				<td class="hikamarket_user_name_value"><?php
					if(!empty($url))
						echo '<a href="'.$url.'"><i
class="fas fa-pencil-alt"
style="margin-right:6px;"></i>';
					if(!empty($user->name))
						echo $user->name;
					else
						echo
'<em>'.JText::_('HIKAM_GUEST_USER').'</em>';
					if(!empty($url))
						echo '</a>';
				?></td>
				<td class="hikamarket_user_login_value"><?php
					if(!empty($user->username))
						echo $user->username;
					else
						echo '-';
				?></td>
				<td class="hikamarket_user_email_value"><?php echo
@$user->user_email; ?></td>
<?php
	if(!empty($this->fields)) {
		foreach($this->fields as $field) {
			$namekey = $field->field_namekey;
?>
				<td class="hikamarket_user_<?php echo $namekey;
?>_value"><?php
					echo $this->fieldsClass->show($field, $user->$namekey);
				?></td>
<?php
		}
	}

	if($this->vendor->vendor_id == 1) {
?>
				<td class="hikamarket_user_id_value"><?php echo
$user->user_id; ?></td>
<?php
	}
?>
			</tr>
<?php
	$i++;
	$k = 1 - $k;
}
?>
		</tbody>
	</table>
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="listing" />
	<input type="hidden" name="ctrl"
value="<?php echo hikaInput::get()->getCmd('ctrl');
?>" />
	<input type="hidden" name="boxchecked"
value="0" />
	<input type="hidden" name="filter_order"
value="<?php echo
$this->pageInfo->filter->order->value; ?>" />
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->pageInfo->filter->order->dir;
?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>
views/usermarket/tmpl/listing.xml000064400000001242151166607760013250
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor User listing</name>
		<params addpath="/components/com_hikamarket/params">
			<param name="options" type="selectoptions"
default="module" label="options"
description="HikaMarket options" />
		</params>
	</state>
	<layout
title="COM_HIKAMARKET_USERMARKET_LISTING_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
		<fieldset name="basic" label="HikaMarket
Options">
			<field id="options" name="options"
type="selectoptions" label="options"
description="HikaMarket options" />
		</fieldset>
	</fields>
</metadata>views/usermarket/tmpl/show.php000064400000012074151166607760012553
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><form action="<?php echo
hikamarket::completeLink('user');?>"
method="post" name="hikamarket_form"
id="hikamarket_user_form">

<h2><?php echo JText::_('CUSTOMER'); ?></h2>
	<dl class="hikam_options">
		<dt class="hikamarket_user_name"><label><?php
echo JText::_('HIKA_USER_NAME');?></label></dt>
		<dd class="hikamarket_user_name"><span
id="hikamarket_user_name"><?php echo
@$this->user->name; ?></span></dd>
	</dl>
	<dl class="hikam_options">
		<dt
class="hikamarket_user_username"><label><?php echo
JText::_('HIKA_USERNAME');?></label></dt>
		<dd class="hikamarket_user_username"><span
id="hikamarket_user_username"><?php echo
@$this->user->username; ?></span></dd>
	</dl>
<?php if(hikamarket::acl('user/edit/email')) { ?>
	<dl class="hikam_options">
		<dt class="hikamarket_user_email"><label><?php
echo JText::_('HIKA_EMAIL');?></label></dt>
		<dd class="hikamarket_user_email"><span
id="hikamarket_user_email">
<?php if($this->vendor->vendor_id > 1) {
			echo $this->escape(@$this->user->user_email);
		} else { ?>
			<input type="text" name="data[user][user_email]"
value="<?php echo $this->escape(@$this->user->user_email);
?>" />
<?php } ?>
		</span></dd>
	</dl>
<?php } ?>
<?php
$edit_custom_fields = hikamarket::acl('user/edit/customfields');
foreach($this->fields['user'] as $fieldName =>
$oneExtraField) { ?>
	<dl class="hikam_options">
		<dt class="hikamarket_user_<?php echo $fieldName;
?>"><label><?php echo
$this->fieldsClass->getFieldName($oneExtraField);
?></label></dt>
		<dd class="hikamarket_user_<?php echo $fieldName;
?>"><?php
			if($edit_custom_fields && !empty($oneExtraField->vendor_edit)
&& $this->vendor->vendor_id <= 1)
				echo $this->fieldsClass->display($oneExtraField,
@$this->user->$fieldName,
'data[user]['.$fieldName.']');
			else
				echo $this->fieldsClass->show($oneExtraField,
@$this->user->$fieldName);
		?></dd>
	</dl>
<?php } ?>

<?php if(hikamarket::acl('user/show/address')) { ?>
<h2><?php echo JText::_('ADDRESSES'); ?></h2>
<?php
	$this->setLayout('show');
	echo $this->loadTemplate('address');
?>
<?php } ?>

<?php if(hikamarket::acl('order/listing')) { ?>
<h2><?php echo JText::_('ORDERS'); ?></h2>
	<table class="hikam_listing hikam_table hikam_bordered"
style="width:100%">
		<thead>
			<tr>
				<th class="hikamarket_order_num_title title
titlenum"><?php
					echo JText::_('HIKA_NUM');
				?></th>
				<th class="hikamarket_order_id_title title"><?php
					echo JText::_('ORDER_NUMBER');
				?></th>
				<th class="hikamarket_order_status_title
title"><?php
					echo JText::_('ORDER_STATUS');
				?></th>
				<th class="hikamarket_order_date_title title"><?php
					echo JText::_('DATE')
				?></th>
				<th class="hikamarket_order_total_title
title"><?php
					echo JText::_('HIKASHOP_TOTAL');
				?></th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<th colspan="5"><?php
					echo JText::sprintf('HIKAM_DISPLAY_X_ORDERS_OF_Y',
count($this->orders), (int)$this->order_count);
				?> <a href="<?php echo
hikamarket::completeLink('order&task=listing&filter_user='.$this->user->user_id);
?>"><?php echo JText::_('HIKAM_SEE_MORE');
?></a></th>
			</tr>
		</tfoot>
<?php
$k = 0;
$i = 1;
$order_show = hikamarket::acl('order/show');
if(!empty($this->orders)) {
	foreach($this->orders as $order) {
?>
			<tr class="row<?php echo $k; ?>">
				<td class="hikamarket_order_num_value"
style="text-align:center"><?php
					echo $i;
				?></td>
				<td class="hikamarket_order_id_value"
align="center">
<?php if($order_show) { ?>
					<a href="<?php echo
hikamarket::completeLink('order&task=show&cid='.$order->order_id);
?>"><?php
	}
	echo $order->order_number;
	if($order_show) {
					?></a>
<?php
	}
?>
				</td>
				<td class="hikamarket_order_status_value">
					<span class="order-label order-label-<?php echo
preg_replace('#[^a-z_0-9]#i', '_', str_replace('
','_',$order->order_status)); ?>"><?php
						echo hikamarket::orderStatus($order->order_status);
					?></span>
				</td>
				<td class="hikamarket_order_date_value"><?php echo
hikamarket::getDate($order->order_created,'%Y-%m-%d
%H:%M');?></td>
				<td class="hikamarket_order_total_value"><?php
					echo $this->currencyHelper->format($order->order_full_price,
$order->order_currency_id);
				?></td>
			</tr>
<?php
		$i++;
		$k = 1 - $k;
	}
} else {
?>
			<tr class="row<?php echo $k; ?>">
				<td class="hikamarket_no_order"
colspan="6"><?php
					echo JText::_('NO_ORDERS_FOUND');
				?></td>
			</tr>
<?php
}
?>
		</tbody>
	</table>
<?php } ?>
	<input type="hidden" name="cid"
value="<?php echo @$this->user->user_id; ?>"/>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
	<input type="hidden" name="task"
value="show"/>
	<input type="hidden" name="ctrl"
value="user"/>
	<?php echo JHTML::_('form.token'); ?>
</form>
views/usermarket/tmpl/show_address.php000064400000024006151166607760014256
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(hikamarket::acl('user/edit/address') &&
($this->vendor->vendor_id <= 1)) {

	if(empty($this->ajax)) {
?>
<div id="hikamarket_user_addresses_default">
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
	<dl class="hikam_options large">
		<dt><label
for="hikamarket_default_billing_address_selector"><?php
echo JText::_('HIKASHOP_SELECT_DEFAULT_BILLING_ADDRESS');
?></label></dt>
		<dd><?php
			$current = 0;
			$values = array();
			if(!empty($this->addresses)) {
				foreach($this->addresses as $k => $address) {
					if(!in_array($address->address_type, array('billing',
'both', '')))
						continue;

					$addr = $this->addressClass->miniFormat($address,
$this->fields['address']);
					$values[] = JHTML::_('select.option', $k, $addr);
					if(!empty($address->address_default))
						$current = $address->address_id;
				}
			}
			if(empty($values))
				$values = array(JHTML::_('select.option', '',
JText::_('HIKAM_NO_ADDRESS')));
			echo JHTML::_('select.genericlist', $values,
'data[user][default_billing]',
'class="hikamarket_default_address_dropdown"',
'value', 'text', $current,
'hikamarket_default_billing_address_selector');
		?></dd>
	</dl>
	<dl class="hikam_options large">
		<dt><label
for="hikamarket_default_shipping_address_selector"><?php
echo JText::_('HIKASHOP_SELECT_DEFAULT_SHIPPING_ADDRESS');
?></label></dt>
		<dd><?php
			$current = 0;
			$values = array();
			if(!empty($this->addresses)) {
				foreach($this->addresses as $k => $address) {
					if(!in_array($address->address_type, array('shipping',
'both', '')))
						continue;

					$addr = $this->addressClass->miniFormat($address,
$this->fields['address']);
					$values[] = JHTML::_('select.option', $k, $addr);
					if(!empty($address->address_default))
						$current = $address->address_id;
				}
			}
			if(empty($values))
				$values = array(JHTML::_('select.option', '',
JText::_('HIKAM_NO_ADDRESS')));
			echo JHTML::_('select.genericlist', $values,
'data[user][default_shipping]',
'class="hikamarket_default_address_dropdown"',
'value', 'text', $current,
'hikamarket_default_shipping_address_selector');
		?></dd>
	</dl>
</div>

<div id="hikamarket_user_addresses_show">
<?php
	}
?>
	<div class="hikamarket_ajax_loading_elem"></div>
	<div class="hikamarket_ajax_loading_spinner"></div>
<?php
	if(!empty($this->two_columns)) {
?>
<div class="hk-row-fluid">
	<div class="hkc-md-6">
		<h3><?php echo JText::_('HIKASHOP_BILLING_ADDRESSES');
?></h3>
<?php
	}

	foreach($this->addresses as $address) {
		if(!empty($this->two_columns) && $address->address_type !=
'billing')
			continue;
?>
	<div class="hikamarket_user_address address_selection"
id="hikamarket_user_address_<?php echo $address->address_id;
?>">
<?php
		$this->address_id = (int)$address->address_id;
		$this->address = $address;
		$this->setLayout('address');
		echo $this->loadTemplate();
?>
	</div>
<?php
	}

	if(!empty($this->two_columns)) {
?>
		<div class="" style="margin-top:6px;">
			<a class="hikabtn hikabtn-success"
href="#newAddress" onclick="return
window.addressMgr.new('billing');"><i class="fa
fa-plus"></i> <?php echo
JText::_('HIKASHOP_NEW_BILLING_ADDRESS'); ?></a>
		</div>
	</div>
	<div class="hkc-md-6">
		<h3><?php echo
JText::_('HIKASHOP_SHIPPING_ADDRESSES'); ?></h3>
<?php
		foreach($this->addresses as $address) {
			if($address->address_type != 'shipping')
				continue;
?>
	<div class="hikamarket_user_address address_selection"
id="hikamarket_user_address_<?php echo $address->address_id;
?>">
<?php
			$this->address_id = (int)$address->address_id;
			$this->address = $address;
			$this->setLayout('address');
			echo $this->loadTemplate();
?>
	</div>
<?php
		}
?>
		<div class="" style="margin-top:6px;">
			<a class="hikabtn hikabtn-success"
href="#newAddress" onclick="return
window.addressMgr.new('shipping');"><i class="fa
fa-plus"></i> <?php echo
JText::_('HIKASHOP_NEW_SHIPPING_ADDRESS'); ?></a>
		</div>
	</div>
</div>
<?php
	} else {
?>
	<div class="" style="margin-top:6px;">
		<a class="hikabtn hikabtn-success"
href="#newAddress" onclick="return
window.addressMgr.new('billing');"><i class="fa
fa-plus"></i> <?php echo
JText::_('HIKASHOP_NEW_BILLING_ADDRESS'); ?></a>
		<a class="hikabtn hikabtn-success"
href="#newAddress" onclick="return
window.addressMgr.new('shipping');"><i class="fa
fa-plus"></i> <?php echo
JText::_('HIKASHOP_NEW_SHIPPING_ADDRESS'); ?></a>
	</div>
<?php
	}

	$new_cid = hikaRegistry::get('new_cid');
	if(!empty($new_cid) && $this->ajax) {
		$data = array(
			'cid' => $new_cid,
			'type' => $this->addresses[$new_cid]->address_type,
			'miniFormat' =>
$this->addressClass->miniFormat($this->addresses[$new_cid]),
		);
		$previous_id = hikaRegistry::get('previous_cid');
		if($previous_id !== null)
			$data['previous_cid'] = $previous_id;
?>
<script type="text/javascript">
if(window.addressMgr.modifyAddr)
	window.addressMgr.modifyAddr(<?php echo json_encode($data); ?>);
</script>
<?php
	}

	$delete_cid = hikaRegistry::get('address_deleted_id');
	if(!empty($delete_cid) && $delete_cid > 0 &&
$this->ajax) {
?>
<script type="text/javascript">
if(window.addressMgr.deleteAddr)
	window.addressMgr.deleteAddr(<?php echo (int)$delete_cid; ?>);
</script>
<?php
	}

	if(empty($this->ajax)) {
?>
</div>

<script type="text/javascript">
if(!window.addressMgr) window.addressMgr = {};
window.addressMgr.loading = function(load, el) {
	var d = document, w = window, o = w.Oby;
	if(!el)
		el = 'hikamarket_user_addresses_show';
	el = d.getElementById(el);
	if(!el)
		return false;
	if(load || load === undefined)
		o.addClass(el, "hikamarket_ajax_loading");
	else
		o.removeClass(el, "hikamarket_ajax_loading");
};
window.addressMgr.get = function(elem, target) {
	var t = this;
	t.loading();
	window.Oby.xRequest(elem.getAttribute('href'), {update: target},
function(){
		t.loading(false);
	});
	return false;
};
window.addressMgr.form = function(elem, target) {
	var t = this;
	t.loading();
	var data = window.Oby.getFormData(target);
	window.Oby.xRequest(elem.getAttribute('href'), {update: target,
mode: 'POST', data: data}, function(){
		t.loading(false);
	});
	return false;
};
window.addressMgr.new = function(type) {
	var t = this, w = window, o = w.Oby;
	t.loading();
	var data = o.encodeFormData({'address_type': type});
	o.xRequest('<?php echo
hikamarket::completeLink('user&task=address&subtask=edit&cid=0&user_id='.$this->user_id,
'ajax', true); ?>', {update:
'hikamarket_user_addresses_show', mode: 'POST', data:
data}, function(){
		t.loading(false);
	});
	return false;
};
window.addressMgr.delete = function(el, cid) {
	if(!confirm('<?php echo
JText::_('HIKASHOP_CONFIRM_DELETE_ADDRESS', true); ?>'))
		return false;
	var t = this, w = window, o = w.Oby, d = document;
	t.loading();
	var data = o.encodeFormData({'<?php echo
hikamarket::getFormToken(); ?>': 1});
	o.xRequest(el.href, {update: 'hikamarket_user_addresses_show',
mode: 'POST', data: data}, function(xhr) {
		t.loading(false);
	});
	return false;
};
window.addressMgr.deleteAddr = function(cid) {
	var t = this, d = document;
	['billing','shipping'].forEach(function(atype){
		var el_sel = d.getElementById('hikamarket_default_' + atype +
'_address_selector');
		if(!el_sel) return;
		for(var k in el_sel.options) {
			if(!el_sel.options.hasOwnProperty(k))
				continue;
			if(el_sel.options[k].value != cid)
				continue;
			el_sel.remove(k);
		}
	});
};
window.addressMgr.modifyAddr = function(params) {
	var t = this, d = document, f = false;
	['billing','shipping'].forEach(function(atype){
		var el_sel = d.getElementById('hikamarket_default_' + atype +
'_address_selector');
		if(!el_sel) return;

		for(var k in el_sel.options) {
			if(!el_sel.options.hasOwnProperty(k))
				continue;
			if(params.previous_cid && el_sel.options[k].value ==
params.previous_cid && params.previous_cid != 0 &&
params.previous_cid != params.cid)
				el_sel.options[k].value = params.cid;
			if(el_sel.options[k].value == params.cid) {
				el_sel.options[k].text = params.miniFormat;
				f = true;
			}
		}
	});
	if(f) return;
	if(params.type && (params.type == 'billing' ||
params.type == 'shipping')) {
		window.addressMgr.addEntry(params.type, params.cid, params.miniFormat);
	} else if(!params.type || params.type == '' || params.type ==
'both') {
		window.addressMgr.addEntry('billing', params.cid,
params.miniFormat);
		window.addressMgr.addEntry('shipping', params.cid,
params.miniFormat);
	}
};
window.addressMgr.addEntry = function(type, cid, text) {
	var d = document,
		el_sel = d.getElementById('hikamarket_default_' + type +
'_address_selector');
	if(!el_sel) return;
	var o = d.createElement('option');
	o.text = text;
	o.value = cid;
	el_sel.add(o);
};
</script>
<div class="clear_both"></div>
<?php
	}
} else {
?>
	<div class="hk-row-fluid">
<?php
	foreach(array('billing','shipping') as $type) {
?>
	<div class="hkc-md-6" id="hikamarket_user_<?php echo
$type; ?>_addresses_show">
		<span class="hikamarket_address_title"><?php echo
JText::_('HIKASHOP_'.strtoupper($type).'_ADDRESS');
?></span>
<?php
		$show_only_current =
(int)$this->config->get('show_only_current_address', 1);

		foreach($this->addresses as $address) {
			if($show_only_current && empty($address->address_default))
				continue;

			$address_css = '';
			if(!empty($address->address_default))
				$address_css = ' address_default';
?>
	<div class="hikamarket_user_address address_selection<?php echo
$address_css; ?>" id="hikamarket_user_address_<?php echo
$address->address_id; ?>">
<?php
		$this->address = $address;
		$this->setLayout('address');
		echo $this->loadTemplate();
?>
	</div>
<?php
		}
?>
	</div>
<?php
	}
?>
	</div>
<?php
}
views/usermarket/view.html.php000064400000027715151166607760012544
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class usermarketViewusermarket extends HikamarketView {

	const ctrl = 'user';
	const name = 'HIKA_USERS';
	const icon = 'generic';

	public function display($tpl = null) {
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName();
		$function = $this->getLayout();
		if(method_exists($this,$function))
			$this->$function();
		parent::display($tpl);
	}

	public function show() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.edit';

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$user_id = hikamarket::getCID('user_id');
		$this->assignRef('user_id', $user_id);

		$this->loadRef(array(
			'userClass' => 'shop.class.user',
			'fieldsClass' => 'shop.class.field',
			'addressShopClass' => 'shop.class.address',
			'addressClass' => 'class.address',
			'currencyHelper' => 'shop.class.currency'
		));

		$user = $this->userClass->get($user_id);
		$this->assignRef('user', $user);

		$this->fieldsClass->addJS($null, $null, $null);

		$fields = array();
		$null = null;
		if($this->config->get('address_show_details', 0)) {
			$fields['address'] =
$this->fieldsClass->getFields('display:vendor_user_show=1',
$null, 'address');
		} else {
			$fields['address'] =
$this->fieldsClass->getFields('field_frontcomp', $null,
'address');
		}
		if(hikashop_level(1)) {
			$fields['user'] =
$this->fieldsClass->getFields('display:vendor_user_show=1',
$user, 'user');
			$this->fieldsClass->jsToggle($fields['user'], $user,
0);
			foreach($fields['user'] as &$field) {
				$field_display = explode(';', trim($field->field_display,
';'));
				$field->vendor_edit = in_array('vendor_user_edit=1',
$field_display);
			}
			unset($field);
		}
		$this->fieldsClass->jsToggle($fields['address'], $null,
0);
		$this->assignRef('fields', $fields);
		$all_addresses = $this->addressShopClass->getByUser($user_id);
		if(!empty($all_addresses))
			$this->addressShopClass->loadZone($all_addresses);
		$this->assignRef('addresses', $all_addresses);

		$this->two_columns = true;
		$this->display_badge = false;
		foreach($all_addresses as $addr) {
			if(in_array($addr->address_type, array('',
'both'))) {
				$this->two_columns = false;
				$this->display_badge = true;
				break;
			}
		}

		$order_list_limit =
$this->config->get('customer_order_list_limit', 15);
		$filters = array(
			'order_user_id = '.(int)$user_id
		);
		$order_type = 'sale';

		if($vendor->vendor_id > 1) {
			$order_type = 'subsale';
			$filters[] = 'order_vendor_id = ' .
(int)$vendor->vendor_id;
		}

		$query = 'SELECT * FROM ' .
hikamarket::table('shop.order') . ' WHERE order_type =
'.$db->Quote($order_type).' AND ('.implode(') AND
(', $filters).') ORDER BY order_id DESC';
		$db->setQuery($query, 0, $order_list_limit);
		$orders = $db->loadObjectList();
		$this->assignRef('orders', $orders);

		$query = 'SELECT COUNT(order_id) FROM ' .
hikamarket::table('shop.order') . ' WHERE
order_type='.$db->Quote($order_type).' AND
('.implode(' OR ', $filters).')';
		$db->setQuery($query);
		$order_count = $db->loadResult();
		$this->assignRef('order_count', $order_count);

		$this->toolbar = array(
			'back' => array(
				'icon' => 'back',
				'fa' => 'fa-arrow-circle-left',
				'name' => JText::_('HIKA_BACK'),
				'url' => hikamarket::completeLink('user')
			),
			'apply' => array(
				'url' => '#apply',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'apply\',\'hikamarket_user_form\');"',
				'icon' => 'apply',
				'fa' => 'fa-check-circle',
				'name' => JText::_('HIKA_APPLY'),
'pos' => 'right',
				'display' => hikamarket::acl('user/edit')
&& ($vendor->vendor_id <= 1)
			),
			'save' => array(
				'url' => '#save',
				'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save\',\'hikamarket_user_form\');"',
				'icon' => 'save',
				'fa' => 'fa-save',
				'name' => JText::_('HIKA_SAVE'), 'pos'
=> 'right',
				'display' => hikamarket::acl('user/edit')
&& ($vendor->vendor_id <= 1)
			)
		);
	}

	public function listing() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$fieldsClass = hikamarket::get('shop.class.field');

		$fields =
$fieldsClass->getData('display:vendor_user_listing=1',
'user', false);
		$this->assignRef('fields', $fields);
		$singleSelection = hikaInput::get()->getInt('single', 0);
		$confirm = hikaInput::get()->getInt('confirm', 1);

		$manage = hikamarket::acl('user/edit') ||
hikamarket::acl('user/show');
		$this->assignRef('manage', $manage);

		$elemStruct = array(
			'user_email',
			'user_cms_id',
			'name',
			'username',
			'email'
		);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid = '&Itemid='.$Itemid;
		$this->assignRef('Itemid', $Itemid);

		$cfg = array(
			'table' => 'shop.user',
			'main_key' => 'user_id',
			'order_sql_value' => 'hkuser.user_id'
		);

		$pageInfo = $this->getPageInfo($cfg['order_sql_value']);

		$filters = array();
		$oder = '';
		$searchMap = array(
			'hkuser.user_id',
			'hkuser.user_email',
			'juser.username',
			'juser.email',
			'juser.name'
		);
		foreach($fields as $field) {
			$searchMap[] = 'hkuser.'.$field->field_namekey;
		}

		$this->processFilters($filters, $order, $searchMap,
array('juser.', 'hkuser.'));

		$customerVendorJoin = '';
		if($vendor->vendor_id > 1)
			$customerVendorJoin = ' INNER JOIN
'.hikamarket::table('customer_vendor').' AS cv ON
hkuser.user_id = cv.customer_id AND cv.vendor_id =
'.$vendor->vendor_id . ' ';

		$query = ' FROM
'.hikamarket::table('user','shop').' AS
hkuser ' . $customerVendorJoin .
			' LEFT JOIN
'.hikamarket::table('users',false).' AS juser ON
hkuser.user_cms_id = juser.id '.$filters.$order;
		$db->setQuery('SELECT hkuser.*,juser.* '.$query,
(int)$pageInfo->limit->start, (int)$pageInfo->limit->value);
		$rows = $db->loadObjectList();

		$fieldsClass->handleZoneListing($fields, $rows);
		foreach($rows as $k => $row) {
			if(!empty($row->user_params)) {
				$rows[$k]->user_params =
hikamarket::unserialize($row->user_params);
			}
		}

		$db->setQuery('SELECT COUNT(*) '.$query);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($rows);

		$this->getPagination();

		$this->assignRef('rows', $rows);
		$this->assignRef('singleSelection', $singleSelection);
		$this->assignRef('confirm', $confirm);
		$this->assignRef('elemStruct', $elemStruct);
		$this->assignRef('pageInfo', $pageInfo);
		$this->assignRef('fieldsClass', $fieldsClass);
		$this->assignRef('fields', $fields);

		$this->toolbar = array(
			array('icon' => 'back', 'fa' =>
'fa-arrow-circle-left', 'name' =>
JText::_('HIKA_BACK'), 'url' =>
hikamarket::completeLink('vendor'))
		);
	}

	public function state() {
		$namekey =
hikaInput::get()->getCmd('namekey','');
		if(!headers_sent()){
			header('Content-Type:text/html; charset=utf-8');
		}
		if(!empty($namekey)){
			$field_namekey =
hikaInput::get()->getString('field_namekey', '');
			if(empty($field_namekey))
				$field_namekey = 'address_state';

			$field_id = hikaInput::get()->getString('field_id',
'');
			if(empty($field_id))
				$field_id = 'address_state';

			$field_type = hikaInput::get()->getString('field_type',
'');
			if(empty($field_type))
				$field_type = 'address';

			$class = hikamarket::get('shop.type.country');
			echo $class->displayStateDropDown($namekey, $field_id,
$field_namekey, $field_type);
		}
		exit;
	}

	public function show_address() {
		$this->ajax = true;
		$this->address();
	}

	public function address() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$ctrl = '';
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.edit';

		$vendor = hikamarket::loadVendor(true, false);
		$this->assignRef('vendor', $vendor);

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$tmpl = hikaInput::get()->getCmd('tmpl', '');
		$this->ajax = in_array($tmpl, array('component',
'ajax', 'raw'));

		$address_id = hikamarket::getCID('address_id');
		$this->loadRef(array(
			'fieldsClass' => 'shop.class.field',
			'addressShopClass' => 'shop.class.address',
			'addressClass' => 'class.address'
		));

		$user_id = hikaInput::get()->getInt('user_id');
		$this->assignRef('user_id', $user_id);

		$edit = false;
		if(hikaInput::get()->getVar('edition', false) === true
&& hikamarket::acl('user/edit/address'))
			$edit = true;
		$this->assignRef('edit', $edit);

		$address = $this->addressClass->get($address_id);
		$this->assignRef('address', $address);

		if(@$address->address_user_id != $user_id) {
			$address = new stdClass();
			$address->address_user_id = $user_id;
			$address->address_id = $address_id;
		}

		if(!empty($address) && !empty($address->address_type)) {
			$type = $address->address_type;
		} else if(!empty($this->params->type)) {
			$type = $this->params->type;
		} else {
			$type = hikaInput::get()->getCmd('address_type',
'');
			if(empty($type))
				$type = hikaInput::get()->getCmd('subtask',
'billing');
			if(substr($type, -8) == '_address')
				$type = substr($type, 0, -8);
		}
		if(!in_array($type, array('billing','shipping')))
			$type = 'billing';
		$this->assignRef('type', $type);

		$field_type = 'address';
		$shopVersion = $shopConfig->get('version',
'1.0.0');
		if(version_compare($shopVersion, '4.2.0', '>='))
			$field_type = $type.'_address';

		$null = null;
		if(!$edit) {
			$fieldMode = 'field_frontcomp';
			if($this->config->get('address_show_details', 0)) {
				$fieldMode = 'display:vendor_user_show=1';
			}
			$fields = array(
				'address' =>
$this->fieldsClass->getFields($fieldMode, $null, $field_type)
			);
		} else {
			$extra_fields_show =
$this->fieldsClass->getFields('display:vendor_user_show=1',
$null, $field_type);
			$extra_fields_edit =
$this->fieldsClass->getFields('display:vendor_user_edit=1',
$null, $field_type);
			$all_fields = array();
			foreach($extra_fields_show as $fieldname => $field) {
				$all_fields[$field->field_ordering] = $field;
				$all_fields[$field->field_ordering]->fieldname = $fieldname;
			}
			unset($extra_fields_show);
			foreach($extra_fields_edit as $fieldname => $field) {
				if(!isset($all_fields[$field->field_ordering])) {
					$all_fields[$field->field_ordering] = $field;
					$all_fields[$field->field_ordering]->fieldname = $fieldname;
				}
				$all_fields[$field->field_ordering]->vendor_edit = true;
			}
			unset($extra_fields_edit);
			ksort($all_fields);
			$fields = array('address' => array());
			foreach($all_fields as $field) {
				$fieldname = $field->fieldname;
				$fields['address'][$fieldname] = $field;
			}
			unset($all_fields);
		}
		$this->assignRef('fields', $fields);

		$this->fieldsClass->jsToggle($fields['address'], $null,
0);

		$all_addresses = $this->addressShopClass->getByUser($user_id);
		if(!empty($all_addresses))
			$this->addressShopClass->loadZone($all_addresses);
		$this->assignRef('addresses', $all_addresses);
		$this->two_columns = true;
		$this->display_badge = false;
		foreach($all_addresses as $addr) {
			if(in_array($addr->address_type, array('',
'both'))) {
				$this->two_columns = false;
				$this->display_badge = true;
				break;
			}
		}
	}
}
views/vendormarket/index.html000064400000000032151166607760012411
0ustar00<html><body></body></html>views/vendormarket/tmpl/after_register.php000064400000000440151166607760015111
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>views/vendormarket/tmpl/after_register.xml000064400000000132151166607760015120
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout hidden="true" />
</metadata>views/vendormarket/tmpl/cpanel.php000064400000010261151166607760013350
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div class="hikamarket_cpanel_main"
id="hikamarket_cpanel_main">
	<div class="hikamarket_cpanel_title header"
id="hikamarket_cpanel_title">
		<h1><?php echo
JText::_('VENDOR_ACCOUNT');?></h1>
	</div>
	<div class="hikamarketcpanel"
id="hikamarketcpanel">
<?php
if(!empty($this->multiple_vendor)) {
?>
		<div style="float:right">
<form id="hikamarket_vendor_switcher"
name="hikamarket_vendor_switcher" method="post"
action="<?php echo
hikamarket::completeLink('vendor&task=switchvendor'.$this->url_itemid);
?>" style="margin:0">
	<?php
		echo JHTML::_('select.genericlist', $this->multiple_vendor,
'vendor_id', ' style="margin:0"
onchange="this.form.submit();"', 'value',
'text', $this->vendor->vendor_id);
	?>
	<?php echo JHTML::_('form.token'); ?>
</form>
		</div>
<?php
}
?>
		<h2><?php echo $this->vendor->vendor_name;
?></h2>
		<div style="clear:right"></div>
<?php
$legacy = (int)$this->shopConfig->get('cpanel_legacy',
false);
if($legacy) {
?>
	<div class="hikamarket_cpanel">
<?php
		foreach($this->buttons as $btn) {
?>
	<div class="icon-wrapper">
		<div class="icon">
			<a href="<?php echo $btn['url'];?>">
				<span class="<?php echo $btn['icon'];?>"
style="background-repeat:no-repeat;background-position:center;height:48px;padding:10px
0;"></span>
				<span><?php echo $btn['name'];?></span>
			</a>
		</div>
	</div>
<?php
		}
?>
	</div>
	<div style="clear:both;"></div>
<?php
} else {
?>
	<div class="hk-row-fluid hikashop_dashboard"
id="hikashop_dashboard">
		<div class="hika_cpanel_side_bar hkc-md-3">
<?php if(!empty($this->extraData->topLeft)) { echo
implode("\r\n", $this->extraData->topLeft); } ?>
	<div class="hika_cpanel_icons">
<?php
	foreach($this->buttons as $btnName => $btn) {
		if(empty($btn))
			continue;

?>
		<a class="hika_cpanel_icon" href="<?php echo
$btn['url']; ?>">
<?php
		if (!empty($btn['fa'])) {
			if(substr($btn['icon'], 0, 9) == 'iconM-48-')
				$btn['icon'] = substr($btn['icon'], 9);

			if(is_string($btn['fa'])) {
?>
			<span class="hk-icon fa-stack fa-2x hk-icon-<?php echo
$btn['icon']; ?>">
				<i class="<?php echo $btn['fa'];?>
fa-stack-2x"></i>
			</span>
<?php
			} else {
?>
			<span class="hk-icon fa-stack fa-2x hk-icon-<?php echo
$btn['icon']; ?>"><?php
				echo implode('', $btn['fa']);
			?></span>
<?php
			}
		} else {
?>
			<span class="hkicon-48 <?php echo $btn['icon'];
?>"
style="background-repeat:no-repeat;background-position:center;height:48px;padding:0;"></span>
<?php
		}
?>
			<span class="hikashop_cpanel_button_text"><?php echo
$btn['name'];?></span>
		</a>
<?php
	}
?>
	</div>
<?php if(!empty($this->extraData->bottomLeft)) { echo
implode("\r\n", $this->extraData->bottomLeft); } ?>
		</div>
		<div class="hika_cpanel_main_data hkc-md-9">
<?php
}

if(!empty($this->statistics)) {
?>
<div class="hikamarket_cpanel_statistics_top
hk-row-fluid">
<?php
	$s = 0;
	foreach($this->statistics as $stat) {
		if(empty($stat['published']))
			continue;

		$key = $stat['key'];
		if(empty($stat['container']) ||
!in_array($stat['container'], array(3,4,6,8,9,12)))
			$stat['container'] = 12;

		if($s < 12 && ($s + (int)$stat['container']) >
12)
			echo '<div class="clearfix"></div>';
?>
		<div class="hkc-md-<?php echo $stat['container'];
?>">
			<div class="hikamarket_panel hikamarket_panel_stats">
				<div class="hikamarket_panel_heading"><?php echo
$stat['label']; ?></div>
				<div id="hikamarket_dashboard_stat_<?php echo $key;
?>" class="hikamarket_panel_body"><?php
					echo $this->statisticsClass->display($stat);
				?></div>
			</div>
		</div>
<?php
		if($stat['container'] == 12) {
			$s = 0;
			continue;
		}
		if(($s + (int)$stat['container']) == 12)
			echo '<div class="clearfix"></div>';
		$s += (int)$stat['container'];
		if($s >= 12) $s = 0;
	}

?>
</div>
<?php
}

if(!$legacy) {
?>
	</div>
</div>
<?php
}
?>
	</div>
</div>
<div class="clear_both"></div>
views/vendormarket/tmpl/cpanel.xml000064400000000430151166607760013356
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor control panel</name>
		<description>Vendor control panel</description>
	</state>
	<layout
title="COM_HIKAMARKET_VENDORMARKET_CPANEL_VIEW_DEFAULT_TITLE">
		<message></message>
	</layout>
</metadata>views/vendormarket/tmpl/form.php000064400000004231151166607760013051
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
	if(empty($this->form_type))
		$this->form_type = 'vendor';

	if($this->form_type == 'vendorregister') {
?>
<form id="hikamarket_registration_form"
name="hikamarket_registration_form" method="post"
action="<?php echo
hikamarket::completeLink('vendor&task=register'.$this->url_itemid);
?>" enctype="multipart/form-data"
onsubmit="if(window.localPage && window.localPage.checkForm){
return window.localPage.checkForm(this); }">
	<div class="hikamarket_vendor_registration_page">
		<h1><?php echo
JText::_('HIKA_VENDOR_REGISTRATION');?></h1>
<?php
	$this->setLayout('registration');
	echo $this->loadTemplate();
?>
<input type="hidden" name="task"
value="register"/>
<input type="hidden" name="ctrl"
value="vendor"/>
<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
	</div>
</form>
<?php
	} else {
?>
<form id="hikamarket_vendor_form"
name="hikamarket_vendor_form" method="post"
action="<?php echo
hikamarket::completeLink('vendor&task=form'.$this->url_itemid);
?>" enctype="multipart/form-data">
	<div class="hikamarket_vendor_edit_page">
		<h1><?php echo
JText::_('HIKAM_VENDOR_EDIT');?></h1>
<?php
	if(hikamarket::acl('vendor/edit')) {
		$this->setLayout('registration');
		echo $this->loadTemplate();
	}

	if(!empty($this->element->extraData->middle))
		echo implode("\r\n",
$this->element->extraData->middle);

	if(hikamarket::acl('vendor/edit/users')) {
		$this->setLayout('users');
		echo $this->loadTemplate();
	}

	if(!empty($this->element->extraData->bottom))
		echo implode("\r\n",
$this->element->extraData->bottom);
?>
<input type="hidden" name="vendor_id"
value="<?php echo $this->element->vendor_id;
?>"/>
<input type="hidden" name="task"
value="save"/>
<input type="hidden" name="ctrl"
value="vendor"/>
<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
	</div>
</form>
<?php
	}
?>
views/vendormarket/tmpl/form.xml000064400000000347151166607760013066
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor registration form</name>
	</state>
	<layout
title="COM_HIKAMARKET_VENDORMARKET_FORM_VIEW_DEFAULT_TITLE">
		<message></message>
	</layout>
</metadata>views/vendormarket/tmpl/index.html000064400000000032151166607760013365
0ustar00<html><body></body></html>views/vendormarket/tmpl/listing.php000064400000007340151166607760013563
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
ob_start();

$title = 'show_page_heading';
$titleType = 'h1';

if($this->module) {
	$title = 'showtitle';
	$titleType = 'h2';
}

if($this->params->get($title) &&
hikaInput::get()->getInt('hikamarket_front_end_main', 0)) {
	if($this->module) {
		$heading = $this->params->get('title');
	} else {
		$heading = $this->params->get('page_title');
		if($this->params->get('page_heading')) {
			$heading = $this->params->get('page_heading');
		}
	}
	echo '<' . $titleType . '>' . $heading .
'</' . $titleType . '>';
}

$layout_type = $this->params->get('layout_type');
if(empty($layout_type))
	$layout_type = 'div';

$this->setLayout('listingcontainer_' . $layout_type);
$html = $this->loadTemplate();
if(!empty($html))
	echo '<div
class="hikamarket_vendor_listing">'.$html.'</div>';

if(!$this->module) {
	if(!empty($this->modules)) {
		$html = '';
		jimport('joomla.application.module.helper');
		foreach($this->modules as $module) {
			$html .= JModuleHelper::renderModule($module);
		}
		if(!empty($html))
			echo '<div class="hikamarket_submodules"
style="clear:both">'.$html.'</div>';
	}
}
$html = ob_get_clean();
if(!empty($html)) {
?>
	<div id="<?php echo
$this->params->get('main_div_name');?>"
class="hikamarket_vendors_listing_main"><?php

	$pagination =
$this->config->get('pagination','bottom');
	if(in_array($pagination, array('top', 'both'))
&& $this->params->get('show_limit') &&
$this->pageInfo->elements->total) {
		$this->pagination->form = '_top';
?>
		<form action="<?php echo hikamarket::currentURL(); ?>"
method="post" name="adminForm_<?php echo
$this->params->get('main_div_name').$this->category_selected;?>_top">
			<div class="hikamarket_listing_pagination
hikamarket_listing_pagination_top hikamarket_vendors_pagination
hikamarket_vendors_pagination_top">
				<?php echo
$this->pagination->getListFooter($this->params->get('limit'));
?>
				<span class="hikamarket_results_counter"><?php echo
$this->pagination->getResultsCounter(); ?></span>
			</div>
			<input type="hidden" name="filter_order_<?php echo
$this->params->get('main_div_name'); ?>"
value="<?php echo
$this->pageInfo->filter->order->value; ?>" />
			<input type="hidden" name="filter_order_Dir_<?php
echo $this->params->get('main_div_name'); ?>"
value="<?php echo $this->pageInfo->filter->order->dir;
?>" />
			<?php echo JHTML::_('form.token'); ?>
		</form>
<?php
	}

	echo $html;

	if(in_array($pagination, array('bottom', 'both'))
&& $this->params->get('show_limit') &&
$this->pageInfo->elements->total) {
		$this->pagination->form = '_bottom';
?>
		<form action="<?php echo hikamarket::currentURL(); ?>"
method="post" name="adminForm_<?php echo
$this->params->get('main_div_name');
?>_bottom">
			<div class="hikamarket_listing_pagination
hikamarket_listing_pagination_botton hikamarket_vendors_pagination
hikamarket_vendors_pagination_bottom">
				<?php echo
$this->pagination->getListFooter($this->params->get('limit'));
?>
				<span class="hikamarket_results_counter"><?php echo
$this->pagination->getResultsCounter(); ?></span>
			</div>
			<input type="hidden" name="filter_order_<?php echo
$this->params->get('main_div_name'); ?>"
value="<?php echo
$this->pageInfo->filter->order->value; ?>" />
			<input type="hidden" name="filter_order_Dir_<?php
echo $this->params->get('main_div_name'); ?>"
value="<?php echo $this->pageInfo->filter->order->dir;
?>" />
			<?php echo JHTML::_('form.token'); ?>
		</form>
<?php
	}

	?></div>
<?php }
views/vendormarket/tmpl/listing.xml000064400000001236151166607760013572
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendors listing</name>
		<params addpath="/components/com_hikamarket/params">
			<param name="options" type="selectoptions"
default="module" label="options"
description="HikaMarket options" />
		</params>
	</state>
	<layout
title="COM_HIKAMARKET_VENDORMARKET_VIEW_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
		<fieldset name="hikamarket" label="Vendor
listing">
			<field id="hikamarketmenu" name="market"
multiple="true" type="hikamarketmenu"
label="HikaMarket options"/>
		</fieldset>
	</fields>
</metadata>views/vendormarket/tmpl/listingcontainer_div.php000064400000006667151166607760016343
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->rows))
	return;

$this->align = 'left';
if($this->params->get('text_center', 1))
	$this->align = 'center';

$borderClass = '';
if($this->params->get('border_visible', 1) == 1)
	$borderClass = 'hikamarket_subcontainer_border';
if($this->params->get('border_visible', 1) == 2)
	$borderClass = 'thumbnail';

?><div class="hikamarket_vendors"><?php

	if($this->params->get('enable_carousel', 0)) {
		$this->setLayout('carousel');
		echo $this->loadTemplate();
	} else {
		$columns = (int)$this->params->get('columns');
		if(empty($columns) || $columns < 1)
			$columns = 1;
		$width = (int)(100 / $columns) - 1;
		$current_column = 1;
		$current_row = 1;
		if($this->params->get('only_if_products','-1')
== '-1') {
			$defaultParams =
$this->shopConfig->get('default_params');
			$this->params->set('only_if_products',
@$defaultParams['only_if_products']);
		}
		$only_if_products =
$this->params->get('only_if_products', 0);

		if(HIKASHOP_RESPONSIVE) {
			switch($columns) {
				case 12:
				case 6:
				case 4:
				case 3:
				case 2:
				case 1:
					$row_fluid = 12;
					$span = $row_fluid / $columns;
					break;
				case 10:
				case 8:
				case 7:
					$row_fluid = $columns;
					$span = 1;
					break;
				case 5:
					$row_fluid = 10;
					$span = 2;
					break;
				case 9: // special case
					$row_fluid = 10;
					$span = 1;
					break;
			}
			if($row_fluid == 12)
				echo '<div class="row-fluid"><ul
class="thumbnails">';
			else
				echo '<div
class="row-fluid-'.$row_fluid.'"><ul
class="thumbnails">';
		} else {
			echo '<div class="hikamarket_listing">';
		}

		foreach($this->rows as $row) {


			if(!HIKASHOP_RESPONSIVE) {
?>
			<div class="hikamarket_vendor hikamarket_listing_elem
hikamarket_listing_column_<?php echo $current_column; ?>
hikamarket_listing_row_<?php echo $current_row; ?>
hikamarket_vendor_column_<?php echo $current_column; ?>
hikamarket_vendor_row_<?php echo $current_row; ?>"
style="width:<?php echo $width;?>%;">
				<div class="hikamarket_container">
					<div class="hikamarket_subcontainer <?php echo
$borderClass; ?>">
<?php
			} else {
?>
			<li class="span<?php echo $span; ?> hikamarket_vendor
hikamarket_listing_column_<?php echo $current_column; ?>
hikamarket_listing_row_<?php echo $current_row; ?>
hikamarket_vendor_column_<?php echo $current_column; ?>
hikamarket_vendor_row_<?php echo $current_row; ?>">
				<div class="hikamarket_container">
					<div class="hikamarket_subcontainer <?php echo
$borderClass; ?>">
<?php
			}

			$this->row =& $row;
			$this->setLayout('listingcontent_' .
$this->params->get('div_item_layout_type'));
			echo $this->loadTemplate();

			if(!HIKASHOP_RESPONSIVE) {
?>
					</div>
				</div>
			</div>
<?php
			} else {
?>
					</div>
				</div>
			</li>
<?php
			}

			if($current_column >= $columns) {
				$current_row++;

				if(!HIKASHOP_RESPONSIVE) {
?>
			<div style="clear:both"></div>
<?php
				}
				$current_column = 0;
			}
			$current_column++;
		}

		if(HIKASHOP_RESPONSIVE) {
			echo '</ul></div>';
		} else {
			echo '</div>';
		}
	}
?>
	<div style="clear:both"></div>
</div>
views/vendormarket/tmpl/listingcontainer_list.php000064400000002334151166607770016520
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->rows))
	return;

$only_if_products = $this->params->get('only_if_products',
0);

?><div class="hikamarket_vendors">
	<ul class="hikamarket_vendor_list<?php echo
$this->params->get('ul_class_name'); ?>">
<?php
		$width = (int)(100 / $this->params->get('columns'));
		if(empty($width))
			$width = '';
		else
			$width = 'style="width:' . $width .
'%;"';

		foreach($this->rows as $row) {
			if($only_if_products && $row->number_of_products < 1)
				continue;
			$link =
hikamarket::completeLink('vendor&task=show&cid=' .
$row->vendor_id . '&name=' . $row->vendor_name .
$this->menu_id);
			$class = '';
?>
		<li class="hikamarket_vendor_list_item<?php echo $class;
?>" <?php echo $width; ?>>
			<a href="<?php echo $link; ?>" ><?php echo
$row->vendor_name;
				if($this->params->get('number_of_products', 0))
					echo ' (' . $row->number_of_products . ')';
			?></a>
		</li>
<?php
		}
?>
	</ul>
</div>
views/vendormarket/tmpl/listingcontainer_table.php000064400000007155151166607770016642
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->rows))
	return;

?><div class="hikamarket_vendors">
	<table class="hikamarket_vendors_table adminlist table
table-striped table-hover">
		<thead>
			<tr>
<?php if($this->shopConfig->get('thumbnail')){ ?>
				<th class="hikamarket_vendor_image title"
align="center"><?php echo
JText::_('HIKA_IMAGE');?></th>
<?php } ?>
				<th class="hikamarket_vendor_name title"
align="center"><?php echo
JText::_('HIKA_VENDOR_NAME');?></th>
<?php if($this->params->get('show_vote')){ ?>
				<th class="hikamarket_vendor_vote title"
align="center"><?php echo JText::_('VOTE');
?></th>
<?php }
	if(!empty($this->displayFields['vendor'])) {
		foreach($this->displayFields['vendor'] as $fieldName =>
$oneExtraField) {
?>
				<th class="hikamarket_vendor_custom_<?php echo
$oneExtraField->field_namekey;?> title"
align="center"><?php
					echo $this->fieldsClass->getFieldName($oneExtraField);
				?></th>
<?php
		}
	}
?>
			</tr>
		</thead>
		<tbody>
<?php
	foreach($this->rows as $row) {
		$this->row =& $row;
		$link =
hikamarket::completeLink('vendor&task=show&cid=' .
$this->row->vendor_id . '&name=' .
$this->row->alias . $this->menu_id);
?>
			<tr>
<?php
		if($this->shopConfig->get('thumbnail')) {
			$image = null;
			if(!empty($this->row->vendor_image))
				$image =
$this->imageHelper->getThumbnail($this->row->vendor_image,
$this->image_size, $this->image_options);
			if(empty($image) || !$image->success)
				$image = $this->default_vendor_image;
?>
				<td class="hikamarket_vendor_image_row">
					<div style="height:<?php echo $image->height;
?>px;text-align:center;clear:both;"
class="hikamarket_vendor_image">
						<div
style="position:relative;text-align:center;clear:both;width:<?php
echo $image->width; ?>px;margin: auto;"
class="hikamarket_vendor_image_subdiv">
<?php
			if($this->params->get('link_to_vendor_page', 1)) {
?>
							<a href="<?php echo $link; ?>"
title="<?php echo $this->escape($this->row->vendor_name);
?>">
<?php
			}
?>
							<img src="<?php echo $image->url; ?>"
alt="<?php echo $this->escape($this->row->vendor_name);
?>" />
<?php
			if($this->params->get('link_to_vendor_page', 1)) {
?>
							</a>
<?php
			}
?>
						</div>
					</div>
				</td>
<?php
		}
?>
				<td class="hikamerket_vendor_name_row">
					<span class="hikamerket_vendor_name">
<?php
		if($this->params->get('link_to_vendor_page', 1)) {
?>
						<a href="<?php echo $link;?>"><?php
		}

		echo $this->row->vendor_name;

		if($this->params->get('link_to_vendor_page', 1)) {
						?></a>
<?php
		}
?>
					</span>
				</td>
<?php
		if($this->params->get('show_vote')) {
?>
				<td class="hikamarket_vendor_vote_row"><?php
					$voteParams = new HikaParameter();
					$voteParams->set('vote_type','vendor');
					$voteParams->set('vote_ref_id',$this->row->vendor_id);
					$js = '';
					echo hikamarket::getLayout('shop.vote', 'mini',
$voteParams, $js);
				?></td>
<?php
		}
		if(!empty($this->displayFields['vendor'])) {
			foreach($this->displayFields['vendor'] as $fieldName =>
$oneExtraField) {
?>
				<td class="hikamarket_vendor_custom_<?php echo
$oneExtraField->field_namekey;?>_row"><?php
					echo $this->fieldsClass->show($oneExtraField,
$this->row->$fieldName);
				?></td>
<?php
			}
		}
?>
			</tr>
<?php
		unset($this->row);
	}
?>
		</tbody>
	</table>
</div>
views/vendormarket/tmpl/listingcontent_img.php000064400000002163151166607770016011
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$link =
hikamarket::completeLink('vendor&task=show&cid='.$this->row->vendor_id.'&name='.$this->row->alias
. $this->menu_id);
$image = null;
if(!empty($this->row->vendor_image))
	$image =
$this->imageHelper->getThumbnail($this->row->vendor_image,
$this->image_size, $this->image_options);
if(empty($image) || !$image->success)
	$image = $this->default_vendor_image;
?>
<div style="height:<?php echo $image->height;
?>px;text-align:center;clear:both;"
class="hikamarket_vendor_image">
<?php if($this->params->get('link_to_vendor_page')) {
?>
	<a href="<?php echo $link;?>" title="<?php echo
$this->escape($this->row->vendor_name); ?>">
<?php } ?>
		<img src="<?php echo $image->url; ?>"
alt="<?php echo $this->escape($this->row->vendor_name);
?>"/>
<?php if($this->params->get('link_to_vendor_page')) {
?>
	</a>
<?php } ?>
</div>
views/vendormarket/tmpl/listingcontent_img_desc.php000064400000004075151166607770017013
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$link =
hikamarket::completeLink('vendor&task=show&cid='.$this->row->vendor_id.'&name='.$this->row->alias
. $this->menu_id);
if($this->shopConfig->get('thumbnail',1)) {
	$image = null;
	if(!empty($this->row->vendor_image))
		$image =
$this->imageHelper->getThumbnail($this->row->vendor_image,
$this->image_size, $this->image_options);
	if(empty($image) || !$image->success)
		$image = $this->default_vendor_image;
}
?>
<table>
	<tr>
<?php if($this->shopConfig->get('thumbnail',1)) { ?>
		<td>
			<div style="height:<?php echo $image->height;
?>px;width:<?php echo $image->width;
?>px;text-align:center;clear:both;"
class="hikamarket_vendor_image">
<?php
	if($this->params->get('link_to_vendor_page')) {
?>
				<a href="<?php echo $link;?>" title="<?php
echo $this->escape($this->row->vendor_name); ?>">
<?php
	}
?>
					<img src="<?php echo $image->url; ?>"
alt="<?php echo $this->escape($this->row->vendor_name);
?>"/>
<?php
	if($this->params->get('link_to_vendor_page')) {
?>
				</a>
<?php
	}
?>
			</div>
		</td>
<?php } ?>
		<td valign="top">
			<div>
				<h2>
					<span class="hikamarket_vendor_name">
<?php
	if($this->params->get('link_to_vendor_page')) {
?>
						<a href="<?php echo $link;?>" title="<?php
echo $this->escape($this->row->vendor_name); ?>">
<?php
	}

	echo $this->row->vendor_name;
	if($this->params->get('number_of_products', 0)) {
		echo ' ('.$this->row->number_of_products.')';
	}

	if($this->params->get('link_to_vendor_page')) {
?>
						</a>
<?php
	}
?>
					</span>
				</h2>

				<span class="hikamarket_vendor_desc"
style="text-align:<?php echo @$this->align;
?>;"><?php
					echo preg_replace('#<hr *id="system-readmore"
*/>.*#is','',$this->row->vendor_description);
				?></span>
			</div>
		</td>
	</tr>
</table>
views/vendormarket/tmpl/listingcontent_img_title.php000064400000003410151166607770017206
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$link =
hikamarket::completeLink('vendor&task=show&cid='.$this->row->vendor_id.'&name='.$this->row->alias
. $this->menu_id);
if($this->shopConfig->get('thumbnail',1)) {
	$image = null;
	if(!empty($this->row->vendor_image))
		$image =
$this->imageHelper->getThumbnail($this->row->vendor_image,
$this->image_size, $this->image_options);
	if(empty($image) || !$image->success)
		$image = $this->default_vendor_image;
?><div class="hikamarket_vendor">
	<div style="height:<?php echo $image->height;
?>px;text-align:center;clear:both;"
class="hikamarket_vendor_image">
<?php
	if($this->params->get('link_to_vendor_page')) {
?>
		<a href="<?php echo $link;?>" title="<?php
echo $this->escape($this->row->vendor_name); ?>">
<?php
	}
?>
			<img src="<?php echo $image->url; ?>"
alt="<?php echo $this->escape($this->row->vendor_name);
?>"/>
<?php
	if($this->params->get('link_to_vendor_page')) {
?>
		</a>
<?php
	}
?>
	</div>
<?php
}
?>
	<span class="hikamarket_vendor_name">
<?php
	if($this->params->get('link_to_vendor_page')) {
?>
		<a href="<?php echo $link;?>">
<?php
	}
	echo $this->row->vendor_name;
	if($this->params->get('number_of_products', 0) &&
isset($this->row->number_of_products)) {
		echo ' ('.$this->row->number_of_products.')';
	}

	if($this->params->get('link_to_vendor_page')) {
?>
		</a>
<?php
	}
?>
	</span>
<?php
if($this->params->get('show_vote', 0)) {
	$this->setLayout('listingmodule_vote');
	echo $this->loadTemplate();
}
?>
</div>
views/vendormarket/tmpl/listingcontent_title.php000064400000001371151166607770016356
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><span class="hikamarket_vendor_name">
<?php
	if($this->params->get('link_to_vendor_page')) {
?>
	<a href="<?php echo
hikamarket::completeLink('vendor&task=show&cid='.$this->row->vendor_id.'&name='.$this->row->alias
. $this->menu_id); ?>"><?php
	}
	echo $this->row->vendor_name;
	if($this->params->get('number_of_products', 0))
		echo ' (' . $this->row->number_of_products .
')';

	if($this->params->get('link_to_vendor_page')) {
	?></a>
<?php
	}
?>
</span>
views/vendormarket/tmpl/listingmodule_vote.php000064400000001122151166607770016017
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>	<div id="hikamarket_vendor_vote"
class="hikamarket_vendor_vote">
<?php
	$voteParams = new HikaParameter();
	$voteParams->set('vote_type', 'vendor');
	$voteParams->set('vote_ref_id',
$this->row->vendor_id);
	$js = '';
	echo hikamarket::getLayout('shop.vote', 'mini',
$voteParams, $js);
?>
	</div>
views/vendormarket/tmpl/registration.php000064400000037650151166607770014634
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><dl class="hikam_options">
<?php
if($this->form_type == 'register')
	$this->form_type == 'vendorregister';

if((empty($this->user) || empty($this->user->user_id)) &&
$this->form_type == 'vendorregister') {
	$user_name = $this->mainUser->get('name');
	$user_username = $this->mainUser->get('username');
	$user_email = $this->mainUser->get('email');
	if(!empty($this->user->name))
		$user_name = $this->user->name;
	if(!empty($this->user->username))
		$user_username = $this->user->username;
	if(!empty($this->user->email))
		$user_email = $this->user->email;
?>
	<dt class="hikamarket_registration_name_line">
		<label for="register_name"><?php echo
JText::_('HIKA_USER_NAME'); ?></label>
	</dt>
	<dd class="hikamarket_registration_name_line">
		<input type="text" id="register_name"
name="data[register][name]" value="<?php echo
$this->escape($user_name); ?>" class="inputbox
required" maxlength="50"/>
	</dd>
<?php
if($this->config->get('registration_email_is_username', 0)
== 0) { ?>
	<dt class="hikamarket_registration_username_line">
		<label for="register_username"><?php echo
JText::_('HIKA_USERNAME'); ?></label>
	</dt>
	<dd class="hikamarket_registration_username_line">
		<input type="text" id="register_username"
name="data[register][username]" value="<?php echo
$this->escape($user_username); ?>" class="inputbox required
validate-username" maxlength="25"/>
	</dd>
<?php } ?>
	<dt class="hikamarket_registration_email_line">
		<label for="register_email"><?php echo
JText::_('HIKA_EMAIL'); ?></label>
	</dt>
	<dd class="hikamarket_registration_email_line">
		<input type="text" id="register_email"
name="data[register][email]" value="<?php echo
$this->escape($user_email); ?>" class="inputbox required
validate-email" maxlength="100"/>
	</dd>

<?php if(!empty($this->extraData) &&
!empty($this->extraData->top)) { echo implode("\r\n",
$this->extraData->top); } ?>

<?php if($this->config->get('registration_ask_password',
1) == 1) { ?>
	<dt class="hikamarket_registration_password_line">
		<label for="register_password"><?php echo
JText::_('HIKA_PASSWORD'); ?></label>
	</dt>
	<dd class="hikamarket_registration_password_line">
		<input type="password" id="register_password"
name="data[register][password]" value=""
class="inputbox required validate-password"/>
	</dd>
	<dt class="hikamarket_registration_password2_line">
		<label for="register_password2"><?php echo
JText::_('HIKA_VERIFY_PASSWORD'); ?></label>
	</dt>
	<dd class="hikamarket_registration_password2_line">
		<input type="password" id="register_password2"
name="data[register][password2]" value=""
class="inputbox required validate-passverify"/>
	</dd>
<?php } ?>
<?php if(!empty($this->extraData) &&
!empty($this->extraData->middle)) { echo implode("\r\n",
$this->extraData->middle); } ?>
</dl>
<?php
	foreach($this->extraFields['user'] as $fieldName =>
$oneExtraField) {
?>
<dl id="hikamarket_<?php echo
'user_'.$oneExtraField->field_namekey; ?>"
class="hikam_options hikamarket_registration_user_<?php echo
$fieldName;?>_line">
	<dt><?php
		echo $this->fieldsClass->getFieldName($oneExtraField);
	?></dt>
	<dd><?php
		$onWhat='onchange';
		if($oneExtraField->field_type == 'radio')
			$onWhat='onclick';

		echo $this->fieldsClass->display(
			$oneExtraField,
			@$this->user->$fieldName,
			'data[user]['.$fieldName.']',
			false,
			'
'.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'user\',0,\'hikamarket_registration_\');"',
			false,
			$this->extraFields['user'],
			$this->user
		);
	?></dd>
</dl>
<?php
	}

	if(!empty($this->options['privacy'])) {
?>
<dl class="hikam_options">
	<dt class="hikamarket_registration_privacy_line">
		<label for="register_privacy"><?php echo
JText::_('PLG_SYSTEM_PRIVACYCONSENT_LABEL'); ?></label>
	</dt>
	<dd>
<?php
		if(!empty($this->options['privacy_text']))
			hikamarket::display($this->options['privacy_text'],
'info');

		if(!empty($this->options['privacy_id'])) {
			$popupHelper = hikamarket::get('shop.helper.popup');
			echo $popupHelper->display(
				JText::_('PLG_SYSTEM_PRIVACYCONSENT_FIELD_LABEL'),
				'PLG_SYSTEM_PRIVACYCONSENT_FIELD_LABEL',
				JRoute::_('index.php?option=com_hikashop&ctrl=checkout&task=privacyconsent&tmpl=component'),
				'shop_privacyconsent',
				800, 500, '', '', 'link'
			);
		}
		echo
$this->radioType->booleanlist('data[register][privacy]',
'', 0,
JText::_('PLG_SYSTEM_PRIVACYCONSENT_OPTION_AGREE'),
JText::_('JNO'));
?>
	</dd>
</dl>
<?php
	}

	if($this->shopConfig->get('address_on_registration', 1))
{
?>
	<h3
class="hikashop_registration_address_info_title"><?php
		echo JText::_('ADDRESS_INFORMATION');
	?></h3>
<?php
		foreach($this->extraFields['address'] as $fieldName =>
$oneExtraField) {
?>
<dl id="hikamarket_<?php echo
'address_'.$oneExtraField->field_namekey; ?>"
class="hikam_options hikamarket_registration_address_<?php echo
$fieldName;?>_line">
	<dt><?php
		echo $this->fieldsClass->getFieldName($oneExtraField);
	?></dt>
	<dd><?php
		$onWhat='onchange';
		if($oneExtraField->field_type == 'radio')
			$onWhat='onclick';

		echo $this->fieldsClass->display(
			$oneExtraField,
			@$this->address->$fieldName,
			'data[address]['.$fieldName.']',
			false,
			'
'.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'address\',0,\'hikamarket_registration_\');"',
			false,
			$this->extraFields['address'],
			$this->address
		);
	?></dd>
</dl>
<?php
		}
	}
?>
	<h3
class="hikashop_registration_vendor_info_title"><?php
		echo JText::_('VENDOR_INFORMATION');
	?></h3>
<dl class="hikam_options">
<?php
}
?>
	<dt class="hikamarket_<?php echo $this->form_type;
?>_vendorname_line">
		<label for="<?php echo $this->form_type;
?>_vendorname"><?php echo
JText::_('HIKA_VENDOR_NAME'); ?> *</label>
	</dt>
	<dd class="hikamarket_<?php echo $this->form_type;
?>_vendorname_line">
		<input type="text" id="<?php echo
$this->form_type; ?>_vendorname" name="data[<?php echo
$this->form_type; ?>][vendor_name]" value="<?php echo
$this->escape($this->element->vendor_name); ?>"
class="inputbox required" maxlength="50"/>
	</dd>
<?php if(!empty($this->user->user_id) || $this->form_type !=
'vendorregister') { ?>
	<dt class="hikamarket_<?php echo $this->form_type;
?>_email_line">
		<label for="<?php echo $this->form_type;
?>_vendoremail"><?php echo
JText::_('HIKA_CONTACT_EMAIL'); ?> *</label>
	</dt>
	<dd class="hikamarket_<?php echo $this->form_type;
?>_email_line">
		<input type="text" id="<?php echo
$this->form_type; ?>_vendoremail" name="data[<?php echo
$this->form_type; ?>][vendor_email]" value="<?php echo
$this->escape($this->element->vendor_email); ?>"
class="inputbox required validate-email"
maxlength="50"/>
	</dd>
<?php }

	if((!empty($this->element->vendor_id) &&
hikamarket::acl('vendor/edit/image')) ||
$this->config->get('register_ask_image', 0)) {
?>
	<dt class="hikamarket_<?php echo $this->form_type;
?>_vendorimage_line">
		<label><?php echo JText::_('HIKAM_VENDOR_IMAGE');
?></label>
	</dt>
	<dd class="hikamarket_<?php echo $this->form_type;
?>_vendorimage_line"><?php
		$options = array(
			'upload' => true,
			'gallery' => true,
			'text' =>
JText::_('HIKAM_VENDOR_IMAGE_EMPTY_UPLOAD'),
			'uploader' => array('plg.market.vendor',
'vendor_image'),
			'vars' => array('vendor_id' =>
@$this->vendor->vendor_id)
		);

		$content = '';
		if(!empty($this->vendor->vendor_image)) {
			$params = new stdClass();
			$params->file_path = @$this->vendor->vendor_image;
			$params->field_name = 'data[vendor][vendor_image]';
			$params->uploader_id = 'hikamarket_vendor_image';
			$params->delete = true;
			$js = '';
			$content = hikamarket::getLayout('uploadmarket',
'image_entry', $params, $js);
		}

		echo
$this->uploaderType->displayImageSingle('hikamarket_vendor_image',
$content, $options);
	?></dd>
<?php
	}

	if( (!isset($this->element->vendor_id) ||
$this->element->vendor_id > 1) &&
$this->options['ask_paypal'] ) {
		$r = ($this->config->get('register_paypal_required', 0)
!= 0);
?>
	<dt class="hikamarket_<?php echo $this->form_type;
?>_paypal_line">
		<label for="<?php echo $this->form_type;
?>_paypal_email"><?php echo
JText::_('PAYPAL_EMAIL'); ?></label>
	</dt>
	<dd class="hikamarket_<?php echo $this->form_type;
?>_paypal_line">
		<input type="text" id="<?php echo
$this->form_type; ?>_paypal_email" name="data[<?php echo
$this->form_type; ?>][vendor_params][paypal_email]"
value="<?php echo
$this->escape(@$this->element->vendor_params->paypal_email);
?>" class="inputbox <?php echo
$r?'required':'';?> validate-email"
maxlength="50"/><?php echo $r?'
*':'';?>
	</dd>
<?php
	}

	if( (!isset($this->element->vendor_id) ||
$this->element->vendor_id > 1) &&
$this->options['ask_currency']) {
?>
	<dt class="hikamarket_<?php echo $this->form_type;
?>_currency_line">
		<label for="data<?php echo $this->form_type;
?>vendor_currency_id"><?php echo
JText::_('CURRENCY'); ?></label>
	</dt>
	<dd class="hikamarket_<?php echo $this->form_type;
?>_currency_line"><?php
		echo
$this->currencyType->display('data['.$this->form_type.'][vendor_currency_id]',
$this->element->vendor_currency_id);
	?></dd>
<?php
	}

	if(!empty($this->extraFields['vendor'])) {
?>
</dl>
<?php
		foreach($this->extraFields['vendor'] as $fieldName =>
$oneExtraField) {
?>
<dl id="hikamarket_vendor_<?php echo
$oneExtraField->field_namekey; ?>" class="hikam_options
hikamarket_<?php echo $this->form_type; ?>_<?php echo
$fieldName;?>_line">
	<dt><?php
		echo $this->fieldsClass->getFieldName($oneExtraField, true);
	?></dt>
	<dd><?php
			$onWhat = 'onchange';
			if($oneExtraField->field_type == 'radio')
				$onWhat = 'onclick';
			$oneExtraField->table_name = 'vendor';
//$this->form_type; //'register';
			if(isset($this->element->$fieldName))
				$value = $this->element->$fieldName;
			else
				$value = $this->vendorFields->$fieldName;

			echo $this->fieldsClass->display(
				$oneExtraField,
				$value,
				'data['.$this->form_type.']['.$fieldName.']',
				false,
				' ' . $onWhat .
'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'vendor\',0,\'hikamarket_\');"',
				false,
				$this->extraFields['vendor'],
				@$this->element,
				false
			);
	?></dd>
</dl>
<?php
		}
?>
<dl class="hikam_options">
<?php
	}

	if( (!isset($this->element->vendor_id) ||
$this->element->vendor_id > 0) &&
$this->options['ask_description']) {
?>
	<dt class="hikamarket_<?php echo $this->form_type;
?>_description_line">
		<label><?php echo JText::_('HIKA_DESCRIPTION');
?></label>
	</dt>
	<dd class="hikamarket_<?php echo $this->form_type;
?>_description_line"><?php
		$this->editor->content = $this->element->vendor_description;
		echo $this->editor->display();
	?>
		<div style="clear:both"></div>
	</dd>
<?php
	}

	if( (!isset($this->element->vendor_id) ||
$this->element->vendor_id > 1) &&
$this->options['ask_terms']) {
		$r = ($this->config->get('register_terms_required', 0) !=
0);
?>
	<dt class="hikamarket_<?php echo $this->form_type;
?>_terms_line">
		<label><?php echo JText::_('HIKASHOP_CHECKOUT_TERMS');
?></label><?php echo $r?' *':'';?>
	</dt>
	<dd class="hikamarket_<?php echo $this->form_type;
?>_terms_line"><?php
		$this->editor->content = @$this->element->vendor_terms;
		$this->editor->name = 'vendor_terms';
		echo $this->editor->display();
	?>
		<div style="clear:both"></div>
	</dd>
<?php
	}

	if(isset($this->element->vendor_id) &&
hikamarket::acl('vendor/edit/location')) {
		hikamarket::loadJslib('leaflet');
?>
	<dt class="hikamarket_<?php echo $this->form_type;
?>_location_line">
		<label><?php echo JText::_('HIKAMARKET_LOCATION');
?></label>
	</dt>
	<dd class="hikamarket_<?php echo $this->form_type;
?>_location_line">
		<input type="hidden" id="vendor_location_lat"
name="data[vendor][vendor_location_lat]" value="<?php
echo hikamarket::toFloat($this->vendor->vendor_location_lat);
?>" />
		<input type="hidden" id="vendor_location_lon"
name="data[vendor][vendor_location_long]" value="<?php
echo hikamarket::toFloat($this->vendor->vendor_location_long);
?>" />
		<div id="vendor_map" class="map map-vendor"
style="height:200px;">
		</div>
		<div class="">
			<a href="#search" class="hikabtn hikabtn-primary"
onclick="return window.localPage.searchLocation(this);"><i
class="fas fa-map-marked-alt"></i> <?php echo
JText::_('HIKAM_MAP_SEARCH'); ?></a>
			<a href="#clear" class="hikabtn hikabtn-warning"
onclick="return window.localPage.clearLocation(this);"><i
class="fas fa-times-circle"></i> <?php echo
JText::_('HIKAM_MAP_CLEAR'); ?></a>
		</div>
<script type="text/javascript">
var osmUrl =
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
	osmAttrib = '&copy; <a
href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>
contributors',
	osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
var map = L.map('vendor_map').setView([<?php echo
hikamarket::toFloat($this->vendor->vendor_location_lat); ?>,
<?php echo
hikamarket::toFloat($this->vendor->vendor_location_long); ?>],
15).addLayer(osm);
var marker = null;
<?php if(!empty($this->vendor->vendor_location_lat) ||
!empty($this->vendor->vendor_location_long)) { ?>
marker = L.marker([<?php echo
hikamarket::toFloat($this->vendor->vendor_location_lat); ?>,
<?php echo
hikamarket::toFloat($this->vendor->vendor_location_long); ?>])
	.addTo(map);
<?php } else { ?>
map.setView([0, 0], 0);
<?php } ?>
map.on('click',function(e){
	window.localPage.setMapMarket(e.latlng);
});
if(!window.localPage) window.localPage = {};
window.localPage.searchLocation = function(btn) {
	var w = window, o = w.Oby, el = null, url =
'https://nominatim.openstreetmap.org/search?format=json&limit=1';
	el = document.getElementById('vendor_address_street');
	if(el && el.value) url += '&street=' +
encodeURIComponent(el.value);
	el = document.getElementById('vendor_address_city');
	if(el && el.value) url += '&city=' +
encodeURIComponent(el.value);
	o.xRequest(url,null,function(xhr){
		if(!xhr.responseText || xhr.status != 200) return;
		var ret = o.evalJSON(xhr.responseText);
		if(!ret || !ret[0]) return;
		window.localPage.setMapMarket(ret[0]);
	});
	btn.blur();
	return false;
};
window.localPage.clearLocation = function(btn) {
	var d = document, input =
d.getElementById('vendor_location_lat');
	if(input) input.value = '';
	input = d.getElementById('vendor_location_lon');
	if(input) input.value = '';
	if(marker) marker.remove();
	marker = null;
	map.setView([0, 0], 0);
	btn.blur();
	return false;
};
window.localPage.setMapMarket = function(obj) {
	var d = document, lon = obj.lon ? obj.lon: obj.lng;
	if(!marker)
		marker = L.marker([obj.lat, lon]).addTo(map);
	else
		marker.setLatLng([obj.lat, lon]);
	var zoom = map.getZoom();
	if(zoom <= 1) zoom = 15;
	map.setView([obj.lat, lon], zoom);
	var input = d.getElementById('vendor_location_lat');
	if(input) input.value = obj.lat;
	input = d.getElementById('vendor_location_lon');
	if(input) input.value = lon;
};
</script>
	</dd>
<?php
	}
?>
</dl>
<?php
echo JHTML::_('form.token');

if((empty($this->user) || empty($this->user->user_id)) &&
$this->form_type == 'vendorregister' &&
!empty($this->extraData) &&
!empty($this->extraData->bottom)) {
?>
<dl class="hikam_options">
<?php
	echo implode("\r\n", $this->extraData->bottom);
?>
</dl>
<?php
}
if(empty($this->user) && $this->form_type ==
'vendorregister') { ?>
<input type="hidden" name="data[register][id]"
value="<?php echo (int)$this->mainUser->get( 'id'
);?>" />
<input type="hidden" name="data[register][gid]"
value="<?php echo (int)$this->mainUser->get( 'gid'
);?>" />
<?php
}

if($this->form_type == 'vendorregister') {
?>
<div class="form-actions">
	<input class="button hikashop_cart_input_button hikabtn
hikabtn-primary" type="submit" value="<?php echo
JText::_('HIKA_REGISTER'); ?>"/>
</div>
<?php }
views/vendormarket/tmpl/registration.xml000064400000000132151166607770014626
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout hidden="true" />
</metadata>views/vendormarket/tmpl/selection.php000064400000013552151166607770014102
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php if( !$this->singleSelection ) { ?>
<fieldset>
	<div class="toolbar" id="toolbar"
style="float: right;">
		<button class="hikabtn" type="button"
onclick="if(document.adminForm.boxchecked.value==0){alert('<?php
echo JText::_('PLEASE_SELECT_SOMETHING', true);
?>');}else{submitbutton('useselection');}"><i
class="fas fa-check"></i> <?php echo
JText::_('OK'); ?></button>
	</div>
</fieldset>
<?php } ?>
<form action="<?php echo
hikamarket::completeLink('vendor'); ?>"
method="post" name="adminForm"
id="adminForm">
	<table class="hikam_filter" style="width:100%">
		<tr>
			<td width="100%">
				<?php echo JText::_('FILTER'); ?>:
				<input type="text" id="hikamarket_vendor_search"
name="search" value="<?php echo
$this->escape($this->pageInfo->search);?>"
class="text_area" onchange="this.form.submit();" />
				<button class="hikabtn"
onclick="this.form.submit();"><i class="fas
fa-search"></i></button>
				<button class="hikabtn"
onclick="document.getElementById('hikamarket_vendor_search').value='';this.form.submit();"><i
class="fas fa-times"></i></button>
			</td>
		</tr>
	</table>
	<table class="hikam_listing <?php echo
(HIKASHOP_RESPONSIVE)?'table table-striped
table-hover':'hikam_table'; ?>"
style="cell-spacing:1px">
		<thead>
			<tr>
				<th class="title titlenum"><?php
					echo JText::_('HIKA_NUM');
				?></th>
<?php if( !$this->singleSelection ) { ?>
				<th class="title titlebox"><input
type="checkbox" name="toggle" value=""
onclick="hikashop.checkAll(this);" /></th>
<?php } ?>
				<th class="title"><?php
					echo JHTML::_('grid.sort', JText::_('HIKA_NAME'),
'vendor.vendor_name',
$this->pageInfo->filter->order->dir,$this->pageInfo->filter->order->value
);
				?></th>
<?php if($this->mainVendor) { ?>
				<th class="title"><?php
					echo JHTML::_('grid.sort', JText::_('HIKA_EMAIL'),
'vendor.vendor_email',
$this->pageInfo->filter->order->dir,$this->pageInfo->filter->order->value
);
				?></th>
<?php }
	if(!empty($this->extraFields['vendor'])) {
		foreach($this->extraFields['vendor'] as $fieldName =>
$oneExtraField) {
?>
				<th class="hikamarket_vendor_custom_<?php echo
$oneExtraField->field_namekey;?> title"
align="center"><?php
					echo $this->fieldsClass->getFieldName($oneExtraField);
				?></th>
<?php
		}
	}
?>
				<th class="title"><?php
					echo JHTML::_('grid.sort', JText::_('ID'),
'vendor.vendor_id',
$this->pageInfo->filter->order->dir,
$this->pageInfo->filter->order->value);
				?></th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="10"><?php
					echo $this->pagination->getListFooter();
					echo $this->pagination->getResultsCounter();
				?></td>
			</tr>
		</tfoot>
		<tbody>
<?php
$k = 0;
$i = 0;
foreach($this->vendors as $vendor) {

	$lbl1 = ''; $lbl2 = '';
	$extraTr = '';
	if( $this->singleSelection ) {
		$data = '{id:'.$vendor->vendor_id;
		foreach($this->elemStruct as $s) {
			if($s == 'id')
				continue;
			$data .= ','.$s.':\''.
str_replace(array('\'','"'),array('\\\'','\\"'),$vendor->$s).'\'';
		}
		$data .= '}';
		$extraTr = ' style="cursor:pointer"
onclick="window.top.hikamarket.submitBox('.$data.');"';

		if(!empty($this->pageInfo->search)) {
			$row = hikamarket::search($this->pageInfo->search, $vendor,
'vendor_id');
		}
	} else {
		$lbl1 = '<label for="cb'.$i.'">';
		$lbl2 = '</label>';
		$extraTr = '
onclick="hikamarket.checkRow(\'cb'.$i.'\');"';
	}
?>
			<tr class="row<?php echo $k; ?>"<?php echo
$extraTr; ?>>
				<td align="center"><?php
					echo $this->pagination->getRowOffset($i);
				?></td>
<?php if( !$this->singleSelection ) { ?>
				<td align="center">
					<input type="checkbox" onclick="this.clicked=true;
this.checked=!this.checked" value="<?php echo
$vendor->vendor_id;?>" name="cid[]"
id="cb<?php echo $i;?>"/>
				</td>
<?php } ?>
				<td><?php
					echo $lbl1 . $vendor->vendor_name . $lbl2;
				?></td>
<?php if($this->mainVendor) { ?>
				<td><?php
					echo $lbl1 . $vendor->vendor_email . $lbl2;
				?></td>
<?php }
	if(!empty($this->extraFields['vendor'])) {
		foreach($this->extraFields['vendor'] as $fieldName =>
$oneExtraField) {
?>
				<td class="hikamarket_vendor_custom_<?php echo
$oneExtraField->field_namekey;?>_row"><?php
					echo $this->fieldsClass->show($oneExtraField,
$this->vendorFields->$fieldName);
				?></td>
<?php
		}
	}
?>
				<td width="1%" align="center"><?php
					echo $vendor->vendor_id;
				?></td>
			</tr>
<?php
		$k = 1-$k;
		$i++;
	}
?>
		</tbody>
	</table>
<?php if( $this->singleSelection ) { ?>
	<input type="hidden" name="pid" value="0"
/>
<?php } ?>
	<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>" />
	<input type="hidden" name="task"
value="selection" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="selection"
value="vendor" />
	<input type="hidden" name="confirm"
value="<?php echo $this->confirm ? '1' :
'0'; ?>" />
	<input type="hidden" name="single"
value="<?php echo $this->singleSelection ? '1' :
'0'; ?>" />
	<input type="hidden" name="ctrl"
value="vendor" />
	<input type="hidden" name="boxchecked"
value="0" />
	<input type="hidden" name="filter_order"
value="<?php echo
$this->pageInfo->filter->order->value; ?>" />
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->pageInfo->filter->order->dir;
?>" />
<?php
	if(!empty($this->afterParams)) {
		foreach($this->afterParams as $p) {
			if(empty($p[0]) || !isset($p[1]))
				continue;
			echo '<input type="hidden"
name="'.$this->escape($p[0]).'"
value="'.$this->escape($p[1]).'"/>' .
"\r\n";
		}
	}
?>
	<?php echo JHTML::_('form.token'); ?>
</form>
views/vendormarket/tmpl/show.php000064400000001336151166607770013072
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->vendor))
	return;

hikaInput::get()->set('hikashop_front_end_main', 1);

if(empty($this->vendor_layout) || (substr($this->vendor_layout, 0,
14) != 'showcontainer_' &&
substr($this->vendor_layout, 0, 7) != 'layout:'))
	$this->vendor_layout = 'showcontainer_default';

if(substr($this->vendor_layout, 0, 14) == 'showcontainer_') {
	$this->setLayout($this->vendor_layout);
	echo $this->loadTemplate();
	return;
}
views/vendormarket/tmpl/show.xml000064400000001356151166607770013105
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<state>
		<name>Vendor page</name>
		<params addpath="/components/com_hikamarket/params">
			<param name="vendor_id" type="text"
default="0" label="Select a vendor id"
description="Select here the vendor id to display for the current
link" />
		</params>
	</state>
	<layout
title="COM_HIKAMARKET_VENDORMARKET_SHOW_VIEW_DEFAULT_TITLE">
		<message></message>
	</layout>
	<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
		<fieldset name="basic" label="Select a
vendor">
			<field id="vendor_id" name="vendor_id"
type="text" label="Select a vendor id"
description="Select here the vendor id to display for the current
link" />
		</fieldset>
	</fields>
</metadata>views/vendormarket/tmpl/showcontainer_default.php000064400000011673151166607770016506
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikamarket_vendor_page"
class="hikamarket_vendor_page">
	<div id="hikamarket_vendor_top"
class="hikamarket_vendor_top">
		<h1><?php echo $this->vendor->vendor_name;
?></h1>

<div class="hk-row-fluid">
<?php
	if(!empty($this->vendor_image->url) ||
!empty($this->vendor->extraData->afterImage)) {
?>
	<div class="hkc-md-3">
		<div class="hikamarket_vendor_image">
<?php
		if(!empty($this->vendor_image->url)) {
?>
			<img src="<?php echo $this->vendor_image->url;
?>" alt=""/>
<?php
		}
?>
		</div>
<?php if(!empty($this->vendor->extraData->afterImage)) { echo
implode("\r\n",$this->vendor->extraData->afterImage); }
?>
	</div>
	<div class="hkc-md-9">
<?php
	} else {
?>
	<div class="hkc-md-12">
<?php
	}
?>
		<div class="hikamarket_vendor_contact">
<?php
	if($this->config->get('display_vendor_contact', 0)) {
		echo $this->popup->display(
			'<span>'.JText::_('CONTACT_VENDOR').'</span>',
			'CONTACT_VENDOR',
			hikamarket::completeLink('shop.product&task=contact&target=vendor&vendor_id='.$this->vendor->vendor_id,
true),
			'hikamarket_contactvendor_popup',
			array(
				'width' => 750, 'height' => 460,
'type' => 'link',
				'attr' => 'class="hikashop_cart_button hikabtn
hikabtn-primary"'
			)
		);
	}
?>
		</div>
		<div class="hikamarket_vendor_vote">
<?php
	if($this->config->get('display_vendor_vote',0)) {
		$js = '';
		echo hikamarket::getLayout('shop.vote', 'mini',
$this->voteParams, $js);
	}
?>
		</div>
<?php if(!empty($this->vendor->extraData->beforeFields)) { echo
implode("\r\n",$this->vendor->extraData->beforeFields);
} ?>
		<div class="hikamarket_vendor_fields">
<?php
	if(!empty($this->extraFields['vendor'])) {
?>
			<dl class="hikam_options">
<?php
		foreach($this->extraFields['vendor'] as $fieldName =>
$oneExtraField) {
?>
				<dt><span id="hikamarket_vendor_custom_name_<?php echo
$oneExtraField->field_id;?>"
class="hikamarket_vendor_custom_name"><?php
					echo
$this->fieldsClass->trans($oneExtraField->field_realname);
				?></span></dt>
				<dd><span id="hikamarket_vendor_custom_value_<?php
echo $oneExtraField->field_id;?>"
class="hikamarket_vendor_custom_value"><?php
					echo $this->fieldsClass->show($oneExtraField,
$this->vendor->$fieldName);
				?></span></dd>
<?php
		}
?>
			</dl>
<?php
	}
?>
		</div>
	</div>
	<div class="hkc-md-12">
<?php if(!empty($this->vendor->extraData->beforeDesc)) { echo
implode("\r\n",$this->vendor->extraData->beforeDesc); }
?>
		<div id="hikamarket_vendor_description"
class="hikamarket_vendor_description"><?php
			if($this->config->get('vendor_description_content_plugins',
0))
				echo $this->secure($this->vendor->vendor_description);
			else
				echo JHTML::_('content.prepare',
$this->vendor->vendor_description);
		?></div>
<?php if(!empty($this->vendor->extraData->afterDesc)) { echo
implode("\r\n",$this->vendor->extraData->afterDesc); }
?>
	</div>
	<div class="hkc-md-12">
<?php
	if(!empty($this->vendor->vendor_location_lat) &&
!empty($this->vendor->vendor_location_long)) {
		hikamarket::loadJslib('leaflet');
?>
		<div id="vendor_map" class="hikamarket_vendor_map"
style="height:200px;"></div>
<script type="text/javascript">
var osmUrl =
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmAttrib =
'&copy; <a
href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>
contributors', osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution:
osmAttrib});
var map = L.map('vendor_map').setView([<?php echo
hikamarket::toFloat($this->vendor->vendor_location_lat); ?>,
<?php echo
hikamarket::toFloat($this->vendor->vendor_location_long); ?>],
15).addLayer(osm);
var marker = L.marker([<?php echo
hikamarket::toFloat($this->vendor->vendor_location_lat); ?>,
<?php echo
hikamarket::toFloat($this->vendor->vendor_location_long);
?>]).addTo(map);
</script>
<?php
	}
?>
	</div>
</div>

<?php if($this->config->get('display_vendor_vote', 0)) {
?>
	<div id="hikashop_comment_form"
class="hikamarket_vendor_vote"><?php
		$js = '';
		echo hikamarket::getLayout('shop.vote', 'listing',
$this->voteParams, $js);
		echo hikamarket::getLayout('shop.vote', 'form',
$this->voteParams, $js);
	?></div>
<?php } ?>
<?php if(!empty($this->vendor->extraData->bottom)) { echo
implode("\r\n",$this->vendor->extraData->bottom); }
?>
	<div style="clear:both"></div>
	<div class="hikamarket_submodules"
id="hikamarket_submodules" style="clear:both">
<?php
if(!empty($this->modules)) {
	hikaInput::get()->set('force_using_filters', 1);
	foreach($this->modules as $module) {
		echo JModuleHelper::renderModule($module);
	}
}
?>
	</div>
<?php if(!empty($this->vendor->extraData->afterModules)) { echo
implode("\r\n",$this->vendor->extraData->afterModules);
} ?>
</div>
views/vendormarket/tmpl/terms.php000064400000001060151166607770013236
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!empty($this->vendor)) {
?>
<h1><?php echo $this->vendor->vendor_name; ?></h1>
<p><?php
	echo $this->vendor->vendor_terms;
?></p>
<?php
} else {
	echo empty($this->article) ? JText::_('TERMS_UNDEFINED') :
JHTML::_('content.prepare', $this->article);
}
views/vendormarket/tmpl/users.php000064400000007647151166607770013266
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><h1><?php echo JText::_('USERS'); ?></h1>
<div class="hikamarket_add_vendoruser">
	<div class="hk-input-group">
		<div class="hk-input-group-prepend">
			<span class="hk-input-group-text"><i class="fas
fa-info-circle" data-toggle="hk-tooltip"
data-title="<strong><?php echo
JText::_('HIKAM_INFO_ADD_USER_TITLE', true);
?></strong><br/></br§><?php echo
JText::_('HIKAM_INFO_ADD_USER', true);
?>"></i></span>
		</div>
		<input type="text" class="hk-form-control"
id="hikamarket_vendor_adduser" value=""/>
		<div class="hk-input-group-append">
			<a href="#add_vendor_user" class="hikabtn
hikabtn-primary" onclick="return
window.vendorMgr.addVendorUser(this);"><?php echo
JText::_('HIKAM_ADD_VENDOR_USER'); ?></a>
		</div>
	</div>
	<div id="hikamarket_vendor_adduser_loading"
class="toggle_onload"
style="display:none;"></div>
</div>
<table id="hikamarket_vendor_users" class="hikam_listing
hikam_table hikam_bordered" style="width:100%">
	<thead>
		<tr>
			<th class="hikamarket_user_name_title"><?php
				echo JText::_('HIKA_NAME');
			?></th>
			<th class="hikamarket_user_email_title"><?php
				echo JText::_('HIKA_EMAIL');
			?></th>
			<th class="hikamarket_user_acl_title titlenum"><?php
				echo JText::_('HIKAM_ACL');
			?></th>
			<th class="hikamarket_user_icon_title
titlenum"><?php
				echo JText::_('HIKA_DELETE');
			?></th>
		</tr>
	</thead>
<?php
$user_id = hikamarket::loadUser(false);
echo '<input type="hidden" name="data[users][]"
value="'.$user_id.'"/>';
$k = 0;
if(!empty($this->users)) {
	foreach($this->users as $user) {
		if($user->user_id == $user_id)
			continue;
?>
	<tr class="row<?php echo $k; ?>"
id="vendor_users_<?php echo $user->id; ?>">
		<td><?php echo $user->name;?></td>
		<td><?php echo $user->email;?></td>
		<td align="center"><?php echo
$this->marketaclType->displayButton('user['.$user->user_id.'][user_access]',
@$user->user_vendor_access); ?></td>
		<td align="center">
			<a href="#"
onclick="window.hikamarket.deleteRow(this); return
false;"><i class="fas
fa-times-circle"></i></a>
			<input type="hidden" name="data[users][]"
value="<?php echo $user->user_id;?>"/>
		</td>
	</tr>
<?php
		$k = 1 - $k;
	}
}
?>
	<!-- Template line -->
	<tr id="hikamarket_users_tpl" class="row<?php echo
$k; ?>" style="display:none;">
		<td>{name}</td>
		<td>{user_email}</td>
		<td align="center"><?php echo
$this->marketaclType->displayButton('user[{user_id}][user_access]',
'all'); ?></td>
		<td align="center">
			<a href="#"
onclick="window.hikamarket.deleteRow(this); return
false;"><img src="<?php echo
HIKASHOP_IMAGES;?>delete.png" alt="<?php echo
JText::_('DELETE'); ?>"/></a>
			<input type="hidden" name="{input_name}"
value="{user_id}"/>
		</td>
	</tr>
</table>
<script type="text/javascript">
<!--
window.vendorMgr = {};
window.vendorMgr.addVendorUser = function(el) {
	var d = document, w = window, o = window.Oby, loading =
d.getElementById('hikamarket_vendor_adduser_loading'), emailInput
= d.getElementById('hikamarket_vendor_adduser');
	if(emailInput) {
		if(loading)
			loading.style.display = '';
		var url = '<?php echo
hikamarket::completeLink('vendor&task=adduser&email={EMAIL}&'.hikamarket::getFormToken().'=1',
true, false, true); ?>', email = emailInput.value;
		emailInput.value = '';
		o.xRequest(url.replace('{EMAIL}', email), null, function(xhr){
			if(xhr.responseText.substring(0,1) == '{') {
				var data = o.evalJSON(xhr.responseText);
				data['input_name'] = "data[users][]";
				window.hikamarket.dupRow('hikamarket_users_tpl', data,
"vendor_users_" + data.user_id);
			}
			if(loading)
				loading.style.display = 'none';
		});
	}
	return false;
}
// -->
</script>
views/vendormarket/tmpl/useselection.php000064400000000440151166607770014607
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>views/vendormarket/view.html.php000064400000115135151166607770013056
0ustar00<?php
/**
 * @package    HikaMarket for Joomla!
 * @version    3.1.1
 * @author     Obsidev S.A.R.L.
 * @copyright  (C) 2011-2020 OBSIDEV. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class vendormarketViewvendormarket extends HikamarketView {

	protected $ctrl = 'vendor';
	protected $icon = 'vendor';
	protected $triggerView = true;

	public $extraFields = array();
	public $requiredFields = array();
	public $validMessages = array();

	public function display($tpl = null, $params = array()) {
		$this->params =& $params;
		$fct = $this->getLayout();
		if(method_exists($this, $fct))
			$this->$fct();
		parent::display($tpl);
	}

	public function show() {
		$app = JFactory::getApplication();
		$doc = JFactory::getDocument();
		$pathway = $app->getPathway();

		$config = hikamarket::config();
		$this->assignRef('config', $config);
		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid = '&Itemid=' . $Itemid;

		$imageHelper = hikamarket::get('shop.helper.image');
		$imageHelper->thumbnail = 1;
		$this->assignRef('imageHelper', $imageHelper);

		$this->loadRef(array(
			'fieldsClass' => 'shop.class.field',
			'popup' => 'shop.helper.popup',
		));

		$cid = hikamarket::getCID('vendor_id');
		if(empty($cid)) {
			$menus = $app->getMenu();
			$menu = $menus->getActive();
			if(empty($menu) && !empty($Itemid)) {
				$menus->setActive($Itemid);
				$menu = $menus->getItem($Itemid);
			}
			if(is_object($menu)) {
				$market_params = new HikaParameter($menu->params);
				$cid = $market_params->get('vendor_id');
				if(is_array($cid)) {
					$cid = (int)$cid[0];
				} else {
					$cid = (int)$cid;
				}
				hikaInput::get()->set('vendor_id', $cid);
			}
		}

		$vendorClass = hikamarket::get('class.vendor');
		$vendor = $vendorClass->get($cid);
		if(empty($vendor) || !$vendor->vendor_published) {
			$vendor = null;
			$app->enqueueMessage(JText::_('VENDOR_DOES_NOT_EXIST'));
			$this->assignRef('vendor', $vendor);
			return;
		}
		$this->assignRef('vendor', $vendor);

		$vendor->alias = (empty($vendor->vendor_alias)) ?
$vendor->vendor_name : $vendor->vendor_alias;

		$stringSafe = (method_exists($app, 'stringURLSafe'));
		if($stringSafe)
			$vendor->alias =
$app->stringURLSafe(strip_tags($vendor->alias));
		else
			$vendor->alias =
JFilterOutput::stringURLSafe(strip_tags($vendor->alias));

		$doc->setTitle( strip_tags($vendor->vendor_name) );

		$pathway->addItem($vendor->vendor_name,
hikamarket::completeLink('vendor&task=show&cid='.(int)$vendor->vendor_id.'&name='.$vendor->alias.$url_itemid));

		if(!empty($vendor->vendor_meta_keywords))
			$doc->setMetadata('keywords',
$vendor->vendor_meta_keywords);
		if(!empty($vendor->vendor_meta_description))
			$doc->setMetadata('description',
$vendor->vendor_meta_description);

		$vendor_layout = $config->get('default_vendor_layout',
'showcontainer_default');
		$vendor_layout_params = null;

		if(!empty($vendor->vendor_layout))
			$vendor_layout = $vendor->vendor_layout;
		if((int)$Itemid > 0) {
			$menu_params = $config->get('menu_'.(int)$Itemid, null);
			if(!empty($menu_params) &&
!empty($menu_params->vendor_page_layout))
				$vendor_layout = $menu_params->vendor_page_layout;
		}
		if(empty($vendor_layout) || (substr($vendor_layout, 0, 14) !=
'showcontainer_' && substr($vendor_layout, 0, 7) !=
'layout:'))
			$vendor_layout = 'showcontainer_default';

		if(substr($vendor_layout, 0, 7) == 'layout:') {
			if(empty($vendor_layout_params))
				$vendor_layout = 'showcontainer_default';
		}
		$this->assignRef('vendor_layout', $vendor_layout);
		$this->assignRef('vendor_layout_params',
$vendor_layout_params);

		$moduleHelper = hikamarket::get('shop.helper.module');
		$modules =
$moduleHelper->setModuleData($config->get('vendor_show_modules',
''));
		if(!empty($modules) && is_array($modules))
			jimport('joomla.application.module.helper');
		else
			$modules = null;
		$this->assignRef('modules', $modules);

		$image_size = array(
			'x' => (int)$config->get('vendor_image_x',
$shopConfig->get('product_image_x', 100)),
			'y' => (int)$config->get('vendor_image_y',
$shopConfig->get('product_image_y', 100)),
		);
		if(empty($image_size['x'])) $image_size['x'] =
(int)$shopConfig->get('product_image_x', 100);
		if(empty($image_size['x'])) $image_size['x'] = 100;
		if(empty($image_size['y'])) $image_size['y'] =
(int)$shopConfig->get('product_image_y', 100);
		if(empty($image_size['y'])) $image_size['y'] = 100;

		$this->assignRef('image_size', $image_size);

		$image_options = array();
		if($config->get('image_forcesize', '-1') !==
'-1')
			$image_options['forcesize'] =
(int)$config->get('image_forcesize');
		if($config->get('image_grayscale', '-1') !==
'-1')
			$image_options['grayscale'] =
(int)$config->get('image_grayscale');
		if($config->get('image_scale', '-1') !==
'-1') {
			switch((int)$config->get('image_scale')) {
				case 0:
					$image_options['scale'] = 'outside';
					break;
				case 1:
					$image_options['scale'] = 'inside';
					break;
			}
		}
		if($config->get('image_radius', '-1') !==
'-1')
			$image_options['radius'] =
(int)$config->get('image_radius');
		$this->assignRef('image_options', $image_options);

		$vendor_image = null;
		if(!empty($vendor->vendor_image)) {
			if(isset($image_options['default']))
				unset($image_options['default']);
			$vendor_image = $imageHelper->getThumbnail($vendor->vendor_image,
$image_size, $image_options);
		}
		if(empty($vendor_image) || !$vendor_image->success) {
			$image_options['default'] = true;
			$vendor_image =
$imageHelper->getThumbnail($config->get('default_vendor_image',
''), $image_size, $image_options, true);
		}
		$this->assignRef('vendor_image', $vendor_image);

		$voteParams = null;
		if($this->config->get('display_vendor_vote', 0)) {
			$voteParams = new HikaParameter();
			$voteParams->set('vote_type', 'vendor');
			$voteParams->set('vote_ref_id',
$this->vendor->vendor_id);
		}
		$this->assignRef('voteParams', $voteParams);

		$extraFields = array(
			'vendor' =>
$this->fieldsClass->getFields('display:vendor_page=1',
$vendor, 'plg.hikamarket.vendor')
		);

		foreach($extraFields['vendor'] as $fieldName => $extraField)
{
			if(empty($extraField->field_display) ||
strpos($extraField->field_display, ';vendor_page=1;') ===
false) {
				unset($extraFields['vendor'][$fieldName]);
			}
		}

		$this->assignRef('extraFields', $extraFields);
		$this->assignRef('vendorFields', $vendorFields);
	}

	public function listingAdmin($tpl = null, $mainVendor = false) {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.vendors';

		$shopConfig = hikamarket::config(false);
		$invoice_statuses = explode(',',
$shopConfig->get('invoice_order_statuses','confirmed,shipped'));
		if(empty($invoice_statuses))
			$invoice_statuses = array('confirmed','shipped');

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$toggleClass = hikamarket::get('helper.toggle');
		$this->assignRef('toggleClass', $toggleClass);
		$currencyClass = hikamarket::get('shop.class.currency');
		$this->assignRef('currencyClass', $currencyClass);

		$filterType =
$app->getUserStateFromRequest($this->paramBase.'.filter_type',
'filter_type', 0, 'int');

		$cfg = array(
			'table' => 'vendor',
			'main_key' => 'vendor_id',
			'order_sql_value' => 'vendor.vendor_id'
		);

		$manage = true;
		$this->assignRef('manage', $manage);

		$pageInfo = $this->getPageInfo($cfg['order_sql_value']);

		$filters = array();
		$searchMap = array(
			'vendor.vendor_id', 'vendor.vendor_name',
'vendor.vendor_email'
		);
		$orderingAccept = array('vendor.vendor_id',
'vendor.vendor_name', 'vendor.vendor_email',
'vendor.');
		$order = '';

		if(!$mainVendor)
			$filters[] = 'vendor.vendor_id > 1';
		$this->processFilters($filters, $order, $searchMap, $orderingAccept);

		$query = 'FROM
'.hikamarket::table($cfg['table']).' AS vendor
'.$filters.$order;
		$db->setQuery('SELECT * '.$query,
(int)$pageInfo->limit->start, (int)$pageInfo->limit->value);

		$vendors = $db->loadObjectList();
		$this->assignRef('vendors', $vendors);

		$db->setQuery('SELECT COUNT(*) '.$query);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($vendors);

		$this->toolbar = array(
			'back' => array('icon' => 'back',
'fa' => 'fa-arrow-circle-left', 'name'
=> JText::_('HIKA_BACK'), 'url' =>
hikamarket::completeLink('vendor')),
		);

		$this->getPagination();

		$this->getOrdering('a.ordering', !$filterType);
		if(!empty($this->ordering->ordering))
			$this->toolbar['ordering']['display'] = true;
	}

	public function selection($tpl = null){
		$singleSelection = hikaInput::get()->getInt('single', 0);
		$confirm = hikaInput::get()->getInt('confirm', 1);
		$this->assignRef('singleSelection', $singleSelection);
		$this->assignRef('confirm', $confirm);

		$vendor = hikamarket::loadVendor(false);
		$mainVendor = ($vendor == 1);
		$this->assignRef('mainVendor', $mainVendor);

		$elemStruct = array(
			'vendor_name'
		);

		if($mainVendor) {
			$elemStruct = array(
				'vendor_name',
				'vendor_email'
			);
		}
		$this->assignRef('elemStruct', $elemStruct);

		$ctrl = hikaInput::get()->getCmd('ctrl');
		$this->assignRef('ctrl', $ctrl);

		$task = 'useselection';
		$this->assignRef('task', $task);

		$afterParams = array();
		$after = hikaInput::get()->getString('after',
'');
		if(!empty($after)) {
			list($ctrl, $task) = explode('|', $after, 2);

			$afterParams = hikaInput::get()->getString('afterParams',
'');
			$afterParams = explode(',', $afterParams);
			foreach($afterParams as &$p) {
				$p = explode('|', $p, 2);
				unset($p);
			}
		}
		$this->assignRef('afterParams', $afterParams);

		$fieldsClass = hikamarket::get('shop.class.field');
		$this->assignRef('fieldsClass', $fieldsClass);

		$vendorFields = null;
		$extraFields = array(
			'vendor' =>
$fieldsClass->getFields('display:vendor_select=1',
$vendorFields, 'plg.hikamarket.vendor')
		);
		foreach($extraFields['vendor'] as $fieldName => $extraField)
{
			if(empty($extraField->field_display) ||
strpos($extraField->field_display, ';vendor_select=1;') ===
false) {
				unset($extraFields['vendor'][$fieldName]);
			}
		}

		$this->assignRef('extraFields', $extraFields);
		$this->assignRef('vendorFields', $vendorFields);

		$this->listingAdmin();
		$this->toolbar = array();
	}

	public function useselection() {
		$selection = hikaInput::get()->get('cid', array(),
'array');
		$rows = array();
		$data = '';

		$vendor = hikamarket::loadVendor(false);
		$mainVendor = ($vendor == 1);
		$this->assignRef('mainVendor', $mainVendor);

		$elemStruct = array(
			'vendor_name'
		);

		if($mainVendor) {
			$elemStruct = array(
				'vendor_name',
				'vendor_email'
			);
		}

		if(!empty($selection)) {
			hikamarket::toInteger($selection);
			$db = JFactory::getDBO();
			$query = 'SELECT a.* FROM
'.hikamarket::table('vendor').' AS a  WHERE a.vendor_id
IN ('.implode(',',$selection).')';
			$db->setQuery($query);
			$rows = $db->loadObjectList();

			if(!empty($rows)) {
				$data = array();
				foreach($rows as $v) {
					$d = array('id' => (int)$v->vendor_id);
					foreach($elemStruct as $s) {
						if($s == 'id')
							continue;
						$d[$s] = $v->$s;
					}
					$data[] = $d;
				}
				$data = json_encode($data);
			}
		}
		$this->assignRef('rows', $rows);
		$this->assignRef('data', $data);

		$confirm = hikaInput::get()->getBool('confirm', true);
		$this->assignRef('confirm', $confirm);
		if($confirm) {
			$js =
'hikashop.ready(function(){window.top.hikamarket.submitBox('.$data.');});';
			$doc = JFactory::getDocument();
			$doc->addScriptDeclaration($js);
		}
	}

	public function cpanel() {
		$app = JFactory::getApplication();
		$pathway = $app->getPathway();
		$config = hikamarket::config();
		$shopConfig = hikamarket::config(false);

		$this->assignRef('config', $config);
		$this->assignRef('shopConfig', $shopConfig);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid))
			$url_itemid='&Itemid='.$Itemid;
		$this->assignRef('url_itemid', $url_itemid);

		$vendor = hikamarket::loadVendor(true);
		$this->assignRef('vendor', $vendor);

		$this->multiple_vendor = array();
		if($config->get('user_multiple_vendor', 0)) {
			$vendorClass = hikamarket::get('class.vendor');
			$vendors = $vendorClass->getUserVendors();
			if(count($vendors) > 1) {
				foreach($vendors as $i => $v) {
					$this->multiple_vendor[$i] = $v->vendor_name;
				}
			}
			unset($vendors);
		}

		$plugin_edition = ($vendor->vendor_id == 0 || $vendor->vendor_id ==
1) || ($vendor->vendor_id > 1 &&
(int)$config->get('plugin_vendor_config', 0) > 0);

		$buttons = array(
			'account' => array(
				'url' =>
hikamarket::completeLink('vendor&task=form'.$url_itemid),
				'level' => 0,
				'icon' => 'iconM-48-account',
				'fa' => 'fas fa-user-tie',
				'name' => JText::_('VENDOR_ACCOUNT'),
				'description' => '',
				'display' => hikamarket::acl('vendor/edit')
			),
			'user' => array(
				'url' =>
hikamarket::completeLink('user'.$url_itemid),
				'level' => 0,
				'icon' => 'iconM-48-user',
				'fa' => 'fas fa-user-friends',
				'name' => JText::_('CUSTOMERS'),
				'description' => '',
				'display' => hikamarket::acl('user/listing')
			),
			'order' => array(
				'url' =>
hikamarket::completeLink('order'.$url_itemid),
				'level' => 0,
				'icon' => 'iconM-48-order',
				'fa' => 'fas fa-file-invoice-dollar',
				'name' => JText::_('ORDERS'),
				'description' => '',
				'display' => hikamarket::acl('order/listing')
			),
			'product' => array(
				'url' =>
hikamarket::completeLink('product'.$url_itemid),
				'level' => 0,
				'icon' => 'iconM-48-products',
				'fa' => 'fas fa-cubes',
				'name' => JText::_('PRODUCTS'),
				'description' => '',
				'display' => hikamarket::acl('product/listing')
			),
			'category' => array(
				'url' =>
hikamarket::completeLink('category'.$url_itemid),
				'level' => 0,
				'icon' => 'iconM-48-category',
				'fa' => 'fas fa-folder',
				'name' => JText::_('HIKA_CATEGORIES'),
				'description' => '',
				'display' =>
hikamarket::acl('category/listing')
			),
			'characteristic' => array(
				'url' =>
hikamarket::completeLink('characteristic'.$url_itemid),
				'level' => 0,
				'icon' => 'iconM-48-characteristic',
				'fa' => 'fas fa-adjust',
				'name' => JText::_('CHARACTERISTICS'),
				'description' => '',
				'display' =>
hikamarket::acl('characteristic/listing')
			),
			'discount' => array(
				'url' =>
hikamarket::completeLink('discount'.$url_itemid),
				'level' => 0,
				'icon' => 'iconM-48-discount',
				'fa' => array('<i class="fas fa-certificate
fa-stack-2x"></i>', '<i class="fas
fa-percent fa-inverse fa-stack-1x"></i>'),
				'name' => JText::_('DISCOUNTS'),
				'description' => '',
				'display' =>
hikamarket::acl('discount/listing')
			),
			'shipping' => array(
				'url' =>
hikamarket::completeLink('plugin&plugin_type=shipping'.$url_itemid),
				'level' => 0,
				'icon' => 'iconM-48-shipping',
				'fa' => 'fas fa-shipping-fast',
				'name' => JText::_('HIKAM_SHIPPINGS'),
				'description' => '',
				'display' => ($plugin_edition &&
hikamarket::acl('shippingplugin/listing'))
			),
			'payment' => array(
				'url' =>
hikamarket::completeLink('plugin&plugin_type=payment'.$url_itemid),
				'level' => 0,
				'icon' => 'iconM-48-payment',
				'fa' => 'far fa-credit-card',
				'name' => JText::_('HIKAM_PAYMENTS'),
				'description' => '',
				'display' => ($plugin_edition &&
hikamarket::acl('paymentplugin/listing'))
			),
		);

		$statistics = array();
		$statisticsClass = null;

		if(hikamarket::acl('vendor/statistics')) {
			$statisticsClass = hikamarket::get('class.statistics');
			$statistics = $statisticsClass->getVendor($vendor);
		}

		JPluginHelper::importPlugin('hikamarket');
		JPluginHelper::importPlugin('hikashop');
		JPluginHelper::importPlugin('hikashoppayment');
		JFactory::getApplication()->triggerEvent('onVendorPanelDisplay',
array(&$buttons, &$statistics));

		if(hikamarket::acl('vendor/statistics')) {
			$vendor_statistics = $config->get('vendor_statistics',
null);
			if(!empty($vendor_statistics)) {
				foreach($statistics as $key => &$stat) {
					$stat['published'] = false;
				}
				unset($stat);

				$vendor_statistics =
hikamarket::unserialize(base64_decode($vendor_statistics));
				foreach($vendor_statistics as $key => $stat_conf) {
					if(!isset($statistics[$key]))
						continue;

					if(isset($stat_conf['container']))
						$statistics[$key]['container'] =
(int)$stat_conf['container'];
					if(isset($stat_conf['slot']))
						$statistics[$key]['slot'] =
(int)$stat_conf['slot'];
					if(isset($stat_conf['order']))
						$statistics[$key]['order'] =
(int)$stat_conf['order'];
					else
						$statistics[$key]['order'] = 0;
					if(isset($stat_conf['published']))
						$statistics[$key]['published'] =
$stat_conf['published'];
					if(!empty($stat_conf['vars'])) {
						foreach($stat_conf['vars'] as $k => $v)
							$statistics[$key]['vars'][$k] = $v;
					}
				}
			}

			uasort($statistics, array($this, 'sortStats'));
		}

		$statistic_slots = array();
		if(!empty($statistics)) {
			foreach($statistics as $key => &$stat) {
				if(isset($stat['published']) &&
empty($stat['published']))
					continue;

				$stat['key'] = $key;
				if(empty($stat['slot']))
					$stat['slot'] = 0;
				if(!isset($statistic_slots[ (int)$stat['slot'] ]))
					$statistic_slots[ (int)$stat['slot'] ] = array();

				$order = @$stat['order'] * 100;
				if(isset($statistic_slots[ $stat['slot'] ][ $order ])) {
					for($i = 1; $i < 100; $i++) {
						if(!isset($statistic_slots[ (int)$stat['slot'] ][ $order +
$i ])) {
							$order += $i;
							break;
						}
					}
				}

				$statistic_slots[ (int)$stat['slot'] ][$order] =& $stat;
			}
			unset($stat);

			foreach($statistic_slots as $slot => &$stats) {
				ksort($stats);
			}
			unset($stats);
		}

		foreach($buttons as &$btn) {
			if(!hikamarket::level($btn['level']) ||
!$btn['display']) {
				$btn = null;
				unset($btn);
				continue;
			}
			if(!isset($btn['name']))
				$btn['name'] = '';
			if(!isset($btn['description']))
				$btn['description'] = '';
			if(empty($btn['icon']))
				$btn['icon'] = 'icon-48-hikamerket';
			unset($btn);
		}

		$this->assignRef('buttons', $buttons);
		$this->assignRef('statistics', $statistics);
		$this->assignRef('statisticsClass', $statisticsClass);
		$this->assignRef('statistic_slots', $statistic_slots);

		$items = $pathway->getPathway();
		if(!count($items))
			$pathway->addItem(JText::_('VENDOR_ACCOUNT'),
hikamarket::completeLink('vendor'));
	}

	protected function sortStats($a, $b) {
		if($a['order'] == $b['order'])
			return 0;
		return ($a['order'] < $b['order']) ? -1 : 1;
	}

	public function form() {
		$this->vendorEdition();

		$vendor = hikamarket::loadVendor(true);

		if(!empty($vendor)) {
			$this->toolbar = array(
				'back' => array('icon' => 'back',
'fa' => 'fa-arrow-circle-left', 'name'
=> JText::_('HIKA_BACK'), 'url' =>
hikamarket::completeLink('vendor')),
				'save' => array(
					'url' => '#save',
					'linkattribs' => 'onclick="return
window.hikamarket.submitform(\'save\',\'hikamarket_vendor_form\');"',
					'icon' => 'save',
					'fa' => 'fa-save',
					'name' => JText::_('HIKA_SAVE'),
'pos' => 'right'
				)
			);

			$app = JFactory::getApplication();
			$menu = $app->getMenu();
			$item = $menu->getActive();
			$menu_view = (!empty($item->query['view']) ?
$item->query['view'] :
(!empty($item->query['ctrl']) ?
$item->query['ctrl'] : null));
			$menu_layout = (!empty($item->query['layout']) ?
$item->query['layout'] :
(!empty($item->query['task']) ?
$item->query['task'] : null));
			if(in_array($menu_view,
array('vendor','vendormarket')) && $menu_layout
== 'form')
				unset($this->toolbar['back']);
		}

		$market_acl = hikamarket::get('type.market_acl');
		$this->assignRef('marketaclType', $market_acl);

		$users = array();
		if(hikamarket::acl('vendor/edit/users')) {
			$db = JFactory::getDBO();
			$query = 'SELECT a.*,b.* FROM
'.hikamarket::table('user','shop').' AS a
LEFT JOIN '.hikamarket::table('users',false).' AS b ON
a.user_cms_id = b.id '.
					'WHERE a.user_vendor_id = ' .
(int)$this->vendor->vendor_id . ' ORDER BY a.user_id';
			$db->setQuery($query);
			$users = $db->loadObjectList();

			$query = 'SELECT hku.*, vu.user_access as `user_vendor_access`,
ju.* '.
					' FROM
'.hikamarket::table('user','shop').' AS hku
'.
					' INNER JOIN
'.hikamarket::table('vendor_user').' AS vu ON
hku.user_id = vu.user_id ' .
					' LEFT JOIN
'.hikamarket::table('users',false).' AS ju ON
hku.user_cms_id = ju.id '.
					' WHERE vu.vendor_id = ' .
(int)$this->vendor->vendor_id . ' ORDER BY hku.user_id';
			$db->setQuery($query);
			$o_users = $db->loadObjectList('user_id');

			$users = array_merge($users, $o_users);
			unset($o_users);
		}
		$this->assignRef('users', $users);

		$app = JFactory::getApplication();
		$pathway = $app->getPathway();
		$items = $pathway->getPathway();
		if(!count($items)) {
			$pathway->addItem(JText::_('VENDOR_ACCOUNT'),
hikamarket::completeLink('vendor'));
			$itemName = JText::_('HIKAM_VENDOR_EDIT');
			if(empty($this->vendor))
				$itemName = JText::_('HIKA_VENDOR_REGISTRATION');
			$pathway->addItem($itemName,
hikamarket::completeLink('vendor&task=form'));
		}
	}

	public function registration() {
		$this->vendorEdition('register');
	}

	public function edit() {
		$this->vendorEdition('vendor');
	}

	public function vendorEdition($type = 'auto') {
		JHTML::_('behavior.formvalidation');

		$config = hikamarket::config();
		$this->assignRef('config', $config);

		$shopConfig = hikamarket::config(false);
		$this->assignRef('shopConfig', $shopConfig);

		$mainUser = JFactory::getUser();
		$this->assignRef('mainUser', $mainUser);

		$user = hikamarket::loadUser(true);
		$this->assignRef('user', $user);

		if(empty($user)) {
			$user = @$_SESSION['hikashop_user_data'];
			$address = @$_SESSION['hikashop_address_data'];

			if(empty($user))
				$user = new stdClass();

			$register = @$_SESSION['hikashop_register_data'];
			if(!empty($register)) {
				if(is_object($register))
					$register = get_object_vars($register);
				foreach($register as $k => $v) {
					if(!isset($user->$k))
						$user->$k = $v;
				}
			}
		}

		$simplified_reg = $config->get('simplified_registration',
1);
		$this->assignRef('simplified_registration',
$simplified_reg);

		$failVendor = hikaInput::get()->getVar('fail[vendor]',
null);
		$vendor = hikamarket::loadVendor(true);
		if(empty($vendor) && !empty($failVendor))
			$vendor = $failVendor;

		$this->assignRef('vendor', $vendor);

		if($type == 'auto')
			$type = ($vendor != null && !empty($vendor->vendor_id)) ?
'vendor' : 'vendorregister';
		$this->assignRef('form_type', $type);

		$this->loadRef(array(
			'uploaderType' => 'shop.type.uploader',
			'cartHelper' => 'shop.helper.cart',
			'currencyType' => 'shop.type.currency',
			'fieldsClass' => 'shop.class.field',
			'radioType' => 'shop.type.radio',
		));

		$editor = hikamarket::get('shop.helper.editor');
		$editor->setEditor($config->get('editor',
''));
		$editor->name = 'vendor_description';
		$editor->content = '';
		$editor->height = 250;
		if($config->get('editor_disable_buttons', 0))
			$editor->options = false;
		$this->assignRef('editor', $editor);

		global $Itemid;
		$url_itemid = '';
		if(!empty($Itemid)){ $url_itemid = '&Itemid='.$Itemid; }
		$this->assignRef('url_itemid',$url_itemid);

		$extraFields = array();
		$vendorFields = null;
		$fieldMode = 'frontcomp';
		if($type == 'vendorregister')
			$fieldMode = 'display:vendor_registration=1';

		if($type == 'vendorregister' ||
hikamarket::acl('vendor/edit/fields')) {
			$extraFields = array(
				'vendor' =>
$this->fieldsClass->getFields($fieldMode, $vendorFields,
'plg.hikamarket.vendor'),
				'user' =>
$this->fieldsClass->getFields('frontcomp', $user,
'user')
			);
		}
		$this->assignRef('extraFields', $extraFields);
		$this->assignRef('vendorFields', $vendorFields);

		$null = array();
		$this->fieldsClass->addJS($null, $null, $null);
		$this->fieldsClass->jsToggle($this->extraFields['vendor'],
$vendorFields, 0);
		$this->fieldsClass->jsToggle($this->extraFields['user'],
$user, 0);

		$values = array(
			'vendor' => $vendorFields,
			'user' => $user
		);

		if($shopConfig->get('address_on_registration', 1)) {
			$extraFields['address'] =
$this->fieldsClass->getFields('frontcomp', $address,
'address');
			$this->fieldsClass->jsToggle($this->extraFields['address'],
$address, 0);

			$values['address'] = $address;
			$this->assignRef('address', $address);
		}

		$this->fieldsClass->checkFieldsForJS($this->extraFields,
$this->requiredFields, $this->validMessages, $values);

		$options = array(
			'ask_description' => 1,
			'ask_currency' => 1,
			'ask_terms' => 1,
			'ask_paypal' => 1,
		);
		$element = new stdClass();
		if($type == 'vendor') {
			$element = $vendor;

			$options['ask_description'] =
hikamarket::acl('vendor/edit/description');
			$options['ask_currency'] =
hikamarket::acl('vendor/edit/currency');
			$options['ask_terms'] =
hikamarket::acl('vendor/edit/terms');
			$options['ask_paypal'] =
hikamarket::acl('vendor/edit/paypalemail');
		} else {
			$element->vendor_params = new stdClass();

			$element->vendor_name = '';
			$element->vendor_description = '';
			$element->vendor_email = @$user->user_email;
			$element->vendor_currency_id = hikamarket::getCurrency();
			$element->vendor_params->paypal_email = @$user->user_email;

			if(!empty($failVendor)) {
				foreach($failVendor as $k => $v) {
					if(is_string($v))
						$element->$k = $v;
				}
				$element->vendor_params->paypal_email =
@$failVendor->vendor_params->paypal_email;
				if(empty($element->vendor_params->paypal_email))
					$element->vendor_params->paypal_email =
$element->vendor_email;
			}

			$options['ask_description'] =
$config->get('register_ask_description', 1);
			$options['ask_currency'] =
$config->get('register_ask_currency', 1);
			$options['ask_terms'] =
$config->get('register_ask_terms', 1);
			$options['ask_paypal'] =
$config->get('register_ask_paypal', 1);

			$shopUserClass = hikamarket::get('shop.class.user');
			$privacy = $shopUserClass->getPrivacyConsentSettings();
			if(!empty($privacy)) {
				$options['privacy'] = true;
				$options['privacy_id'] = $privacy['id'];
				$options['privacy_text'] = $privacy['text'];
			}
		}
		$this->assignRef('element', $element);
		$this->assignRef('options', $options);

	}

	public function terms() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();

		$config = hikamarket::config();
		$shopConfig = hikamarket::config(false);

		$step = hikaInput::get()->getInt('step', -1);
		$pos = hikaInput::get()->getInt('pos', -1);

		$cid = hikamarket::getCID();
		if(empty($cid) && $step < 0)
			$cid = 1;

		if(!empty($cid)) {
			$query = 'SELECT * FROM
'.hikamarket::table('vendor').' WHERE vendor_id =
' . $cid;
			$db->setQuery($query);
			$vendor = $db->loadObject();
			$this->assignRef('vendor', $vendor);

			if($cid > 1 || !empty($vendor->vendor_terms))
				return;

		}
		$this->vendor = null;

		hikashop_get('helper.checkout');
		$checkoutHelper = hikashopCheckoutHelper::get();
		$this->workflow = $checkoutHelper->checkout_workflow;
		$block =
@$this->workflow['steps'][$step-1]['content'][$pos];
		if(!empty($block) && $block['task'] ==
'plg.market.terms' &&
!empty($block['params']['article_id']))
			$terms_article = $block['params']['article_id'];

		if(empty($terms_article))
			$terms_article = $config->get('checkout_terms', 0);

		if(empty($terms_article))
			return;

		$sql = 'SELECT * FROM #__content WHERE id = ' .
(int)$terms_article;
		$db->setQuery($sql);
		$data = $db->loadObject();

		$article = '';
		if (is_object($data))
			$article = $data->introtext . $data->fulltext;
		$this->assignRef('article', $article);
	}

	public function listing() {
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$doc = JFactory::getDocument();
		$config = hikamarket::config();
		$shopConfig = hikamarket::config(false);

		$this->assignRef('config', $config);
		$this->assignRef('shopConfig', $shopConfig);

		$this->module = false;
		$moduleHelper = hikamarket::get('helper.module');
		$moduleHelper->initialize($this);
		$this->paramBase =
HIKAMARKET_COMPONENT.'.'.$this->getName().'.vendors'
. '.' . $this->params->get('main_div_name');

		$stringSafe = (method_exists($app, 'stringURLSafe'));

		$filters = array();
		$sql_select = array();
		$sql_joins = array();

		$pageInfo = new stdClass();
		$pageInfo->filter = new stdClass();
		$pageInfo->filter->order = new stdClass();
		$pageInfo->limit = new stdClass();
		$this->assignRef('pageInfo', $pageInfo);

		$defaultParams = $shopConfig->get('default_params');
		$marketDefaultParams = $config->get('default_params');

		$marketDefaultParams['show_vote'] =
$config->get('display_vendor_vote', 0);

		$inheritShop = array(
			'limit' => '',
			'order_dir' => 'inherit',
			'margin' => '',
			'border_visible' => '-1',
			'div_item_layout_type' => 'inherit',
			'text_center' => '-1',
			'columns' => '',
			'background_color' => '',
			'layout_type' => 'inherit',
			'random' => '-1',

			'link_to_vendor_page' => '-1',
		);
		foreach($inheritShop as $k => $v) {
			if($this->params->get($k, $v) == $v)
				$this->params->set($k, @$defaultParams[$k]);
		}

		$inheritMarket = array(
			'image_forcesize' => '-1',
			'image_scale' => '-1',
			'image_grayscale' => '-1',
			'image_radius' => '',
			'show_vote' => '-1',
		);
		foreach($inheritMarket as $k => $v) {
			if($this->params->get($k, $v) == $v)
				$this->params->set($k, @$marketDefaultParams[$k]);
		}

		if((int)$this->params->get('limit', 0) == 0 )
			$this->params->set('limit', 1);

		if($this->params->get('vendor_order',
'inherit') == 'inherit' ||
$this->params->get('vendor_order', 'inherit') ==
'')
			$this->params->set('vendor_order',
'vendor_id');
		if($this->params->get('order_dir', 'inherit')
== 'inherit' ||
$this->params->get('order_dir','inherit') ==
'')
			$this->params->set('order_dir', 'ASC');

		$pageInfo->filter->order->value =
$app->getUserStateFromRequest($this->paramBase .
'.filter_order', 'filter_order_' .
$this->params->get('main_div_name'), 'vendor.' .
$this->params->get('vendor_order', 'vendor_id'),
'cmd');
		$pageInfo->filter->order->dir =
$app->getUserStateFromRequest($this->paramBase .
'.filter_order_Dir', 'filter_order_Dir_' .
$this->params->get('main_div_name'),
$this->params->get('vendor_order_dir','ASC'),
'word');

		$oldValue = $app->getUserState($this->paramBase .
'.list_limit');
		if($this->params->get('limit','') ==
'') {
			$this->params->set('limit',
@$defaultParams['limit']);
			if($this->params->get('limit', 0) <= 0)
				$this->params->set('limit', 20);
		}

		if(empty($oldValue))
			$oldValue = $this->params->get('limit');

		$pageInfo->limit->value =
$app->getUserStateFromRequest($this->paramBase .
'.list_limit', 'limit_' .
$this->params->get('main_div_name'),
$this->params->get('limit'), 'int');
		if($oldValue != $pageInfo->limit->value)
			hikaInput::get()->set('limitstart_' .
$this->params->get('main_div_name'), 0);

		$pageInfo->limit->start =
$app->getUserStateFromRequest($this->paramBase .
'.limitstart', 'limitstart_' .
$this->params->get('main_div_name'), 0, 'int');

		$pageInfo->search =
HikaStringHelper::strtolower($app->getUserStateFromRequest($this->paramBase.'.search',
'search', '', 'string'));
		$pageInfo->search = trim($pageInfo->search);

		if(empty($this->module) &&
$shopConfig->get('hikarss_format') != 'none') {
			$doc_title = $shopConfig->get('hikarss_name',
'');
			if($config->get('hikarss_format') != 'both') {
				$link = '&format=feed&limitstart=';
				$attribs = array('type' =>
'application/rss+xml', 'title' => $doc_title.'
RSS 2.0');
				$doc->addHeadLink(JRoute::_($link.'&type='.$shopConfig->get('hikarss_format')),
'alternate', 'rel', $attribs);
			} else {
				$link = '&format=feed&limitstart=';
				$attribs = array('type' =>
'application/rss+xml', 'title' => $doc_title.'
RSS 2.0');
				$doc->addHeadLink(JRoute::_($link.'&type=rss'),
'alternate', 'rel', $attribs);
				$attribs = array('type' =>
'application/atom+xml', 'title' => $doc_title.'
Atom 1.0');
				$doc->addHeadLink(JRoute::_($link.'&type=atom'),
'alternate', 'rel', $attribs);
			}
		}
		$mainVendor = $config->get('listing_show_main_vendor', 0);

		$filters = array(
			'published' => 'vendor_published = 1'
		);
		$searchMap = array(
			'vendor.vendor_name',
			'vendor.vendor_description',
			'vendor.vendor_id'
		);
		$orderingAccept = array(
			'vendor.vendor_id',
			'vendor.vendor_name',
			'vendor.vendor_email',
			'vendor.'
		);
		$order = '';

		if(!$mainVendor)
			$filters['no_main_vendor'] = 'vendor.vendor_id >
1';

		JPluginHelper::importPlugin('hikamarket');
		$trigger_params = array(
			'select' => &$sql_select,
			'join' => &$sql_joins,
			'filter' => &$filters,
			'order' => &$order,
			'search_map' => &$searchMap,
			'order_accept' => &$orderingAccept,
		);
		$view =& $this;
		JFactory::getApplication()->triggerEvent('onBeforeVendorListingDisplay',
array(&$view, &$trigger_params));
		unset($view);

		$this->processFilters($filters, $order, $searchMap, $orderingAccept);
		if($this->params->get('random'))
			$order = ' ORDER BY RAND()';

		if(!empty($sql_select)) {
			$sql_select = ',' . implode(',', $sql_select) .
' ';
		} else {
			$sql_select = '';
		}

		if(!empty($sql_joins)) {
			$sql_joins = implode(' ', $sql_joins) . ' ';
		} else {
			$sql_joins = '';
		}

		$query = 'FROM '.hikamarket::table('vendor').'
AS vendor ' . $sql_joins . $filters . $order;
		$db->setQuery('SELECT vendor.* ' . $sql_select . $query,
(int)$pageInfo->limit->start, (int)$pageInfo->limit->value);

		$rows = $db->loadObjectList();
		foreach($rows as &$row) {
			$row->alias = (empty($row->vendor_alias)) ? $row->vendor_name :
$row->vendor_alias;

			if($stringSafe)
				$row->alias = $app->stringURLSafe(strip_tags($row->alias));
			else
				$row->alias =
JFilterOutput::stringURLSafe(strip_tags($row->alias));

			unset($row);
		}
		$this->assignRef('rows', $rows);

		$db->setQuery('SELECT COUNT(vendor.vendor_id) FROM
'.hikamarket::table('vendor').' AS vendor ' .
$sql_joins . $filters);
		$pageInfo->elements = new stdClass();
		$pageInfo->elements->total = $db->loadResult();
		$pageInfo->elements->page = count($rows);

		if($pageInfo->elements->page) {

		}

		$this->assignRef('modules', $this->modules);

		$imageHelper = hikamarket::get('shop.helper.image');
		$imageHelper->thumbnail = 1;
		$this->assignRef('imageHelper', $imageHelper);

		if($this->params->get('image_height') == null &&
$this->params->get('image_width') == null) {
		 	$this->params->set('image_width',
$this->imageHelper->main_thumbnail_x);
			$this->params->set('image_height',
$this->imageHelper->main_thumbnail_y);
		}

		$image_size = array('x' =>
(int)$this->params->get('image_width'), 'y' =>
(int)$this->params->get('image_height'));
		$this->assignRef('image_size', $image_size);

		$image_options = array();
		if($this->params->get('image_forcesize', '-1')
!== '-1')
			$image_options['forcesize'] =
(int)$this->params->get('image_forcesize');
		if($this->params->get('image_grayscale', '-1')
!== '-1')
			$image_options['grayscale'] =
(int)$this->params->get('image_grayscale');
		if($this->params->get('image_scale', '-1') !==
'-1') {
			switch((int)$this->params->get('image_scale')) {
				case 0:
					$image_options['scale'] = 'outside';
					break;
				case 1:
					$image_options['scale'] = 'inside';
					break;
			}
		}
		if($this->params->get('image_radius', '-1') !==
'-1')
			$image_options['radius'] =
(int)$this->params->get('image_radius');

		$this->assignRef('image_options', $image_options);

		$opt = $image_options;
		$opt['default'] = true;
		$default_vendor_image =
$this->imageHelper->getThumbnail($config->get('default_vendor_image',
''), $this->image_size, $opt, true);
		$this->assignRef('default_vendor_image',
$default_vendor_image);

		$menu_id = '';
		if(empty($this->module)) {
			$title = $this->params->get('page_title');
			if(empty($title))
				$title = $this->params->get('title');

			$page_title = $title;
			if(empty($title)) {
				$page_title = $app->getCfg('sitename');
			} elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
				$page_title = JText::sprintf('JPAGETITLE',
$app->getCfg('sitename'), $page_title);
			} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
				$page_title = JText::sprintf('JPAGETITLE', $page_title,
$app->getCfg('sitename'));
			}
			$this->params->set('page_title', $title);
			$doc->setTitle(strip_tags($page_title));

			$pagination = hikamarket::get('shop.helper.pagination',
$pageInfo->elements->total, $pageInfo->limit->start,
$pageInfo->limit->value);
			$pagination->hikaSuffix =
'_'.$this->params->get('main_div_name');
			$this->assignRef('pagination',$pagination);
			$this->params->set('show_limit', 1);

			global $Itemid;
			if(!empty($Itemid))
				$menu_id = '&Itemid=' . $Itemid;
		} else {
			$menu_id = (int)$this->params->get('itemid', 0);
			$menu_id = (!empty($menu_id)) ? '&Itemid=' . $menu_id :
'';
		}

		if(empty($menu_id)) {
			$i = (int)$config->get('vendor_default_menu', 0);
			if(!empty($i))
				$menu_id = '&Itemid=' . $i;
		}

		$this->assignRef('menu_id', $menu_id);

		$fieldsClass = hikamarket::get('shop.class.field');
		$this->assignRef('fieldsClass', $fieldsClass);

		$vendorFields = null;
		$extraFields = array(
			'vendor' =>
$fieldsClass->getFields('display:vendor_listing=1',
$vendorFields, 'plg.hikamarket.vendor')
		);
		$displayFields = array(
			'vendor' => array()
		);
		foreach($extraFields['vendor'] as $fieldName => &$field)
{
			if(empty($field->field_display))
				continue;
			if(strpos($field->field_display, ';vendor_listing=1;') ===
false)
				continue;
			$displayFields['vendor'][$fieldName] =& $field;
		}
		unset($field);

		$fieldsClass->handleZoneListing($displayFields['vendor'],
$rows);

		$this->assignRef('extraFields', $extraFields);
		$this->assignRef('vendorFields', $vendorFields);
		$this->assignRef('displayFields', $displayFields);
	}
}