コード例 #1
0
ファイル: walletone.php プロジェクト: JexyRu/Ksenmart
 public function onAfterDisplayKSMCartDefault_congratulation($view, $tpl = null, &$html)
 {
     if (empty($view->order)) {
         return;
     }
     if (empty($view->order->payment_id)) {
         return;
     }
     $payment = KSMWalletone::getPayment($view->order->payment_id, $this->_name);
     if ($payment->id <= 0) {
         return;
     }
     if (empty($view->order->region_id)) {
         return;
     }
     if (!$this->checkRegion($payment->regions, $view->order->region_id)) {
         return;
     }
     $params = new JRegistry();
     $params->loadString($payment->params);
     $view->payment_params = $params;
     $view->payment_form_params = new stdClass();
     $view->payment_form_params->title = 'Оплата заказа №' . $view->order->id . ' на сайте ' . JFactory::getConfig()->get('sitename');
     $paymentTypes = $this->_preparePaymentTypes($view->payment_params->get('payment_types', array()));
     $view->user = KSUsers::getUser();
     KSMWalletone::_setFields(array_merge($paymentTypes, array('WMI_MERCHANT_ID' => $view->payment_params->get('merchant_id', null), 'WMI_PAYMENT_AMOUNT' => $view->order->costs['total_cost'], 'WMI_PAYMENT_NO' => $view->order->id, 'WMI_CURRENCY_ID' => 643, 'WMI_DESCRIPTION' => $view->payment_form_params->title, 'WMI_CUSTOMER_FIRSTNAME' => $view->order->customer_fields->first_name, 'WMI_CUSTOMER_LASTNAME' => $view->order->customer_fields->last_name, 'WMI_CUSTOMER_EMAIL' => $view->order->customer_fields->email, 'WMI_FAIL_URL' => JRoute::_(JURI::base() . 'index.php?option=com_ksenmart&view=cart&layout=pay_error'), 'WMI_SUCCESS_URL' => JRoute::_(JURI::base() . 'index.php?option=com_ksenmart&view=cart&layout=pay_success'))));
     $view->payment_form_params->sign = KSMWalletone::getHash($view->payment_params->get('secretKey', null));
     $html .= KSSystem::loadPluginTemplate($this->_name, $this->_type, $view, 'default_paymentform');
     return true;
 }
コード例 #2
0
ファイル: cart.php プロジェクト: JexyRu/Ksenmart
 public function __construct()
 {
     $this->_session = JFactory::getSession();
     $this->order_id = $this->_session->get('shop_order_id', 0);
     $this->_user = KSUsers::getUser();
     parent::__construct();
     $this->context = 'com_ksenmart';
     $this->getDefaultStates();
 }
コード例 #3
0
 public function getInput()
 {
     $db = JFactory::getDBO();
     $session = JFactory::getSession();
     $task = JRequest::getVar('task');
     $shipping_id = $this->form->getValue('shipping_id');
     $user_id = $this->form->getValue('user_id');
     $user = KSUsers::getUser($user_id);
     $html = '';
     $query = $db->getQuery(true);
     $query->select('*')->from('#__ksenmart_shipping_fields')->where('shipping_id=' . (int) $shipping_id)->where('position=' . $db->quote('customer'))->where('published=1')->order('ordering');
     $db->setQuery($query);
     $customer_fields = $db->loadObjectList();
     $html .= '<div class="positions">';
     if (count($customer_fields)) {
         foreach ($customer_fields as $customer_field) {
             $html .= '<div class="position">';
             if ($customer_field->system && isset($this->value[$customer_field->title])) {
                 $value = $this->value[$customer_field->title];
             } elseif (!$customer_field->system && isset($this->value[$customer_field->id])) {
                 $value = $this->value[$customer_field->id];
             } else {
                 $value = '';
             }
             if ($task == 'get_form_fields' && isset($user->{$customer_field->title})) {
                 $value = $user->{$customer_field->title};
             }
             $name = $customer_field->system ? $customer_field->title : $customer_field->id;
             $customer_field->title = $customer_field->system ? JText::_('ksm_orders_order_field_' . $customer_field->title) : $customer_field->title;
             $html .= '	<label class="inputname">' . $customer_field->title . '</label>';
             if ($customer_field->type == 'select') {
                 $query = $db->getQuery(true);
                 $query->select('*')->from('#__ksenmart_shipping_fields_values')->where('field_id=' . $customer_field->id);
                 $db->setQuery($query);
                 $customer_field->values = $db->loadObjectList();
                 $html .= '<select name="' . $this->name . '[' . $name . ']" class="sel">';
                 foreach ($customer_field->values as $value) {
                     $html .= '<option value="' . $value->id . '" ' . ($value->id == $value ? 'selected' : '') . '>' . $value->title . '</option>';
                 }
                 $html .= '</select>';
             } else {
                 $html .= '<input type="text" class="inputbox" ' . ($customer_field->system == 1 ? 'id="customer_' . $name . '"' : '') . ' name="' . $this->name . '[' . $name . ']" value="' . $value . '">';
             }
             $html .= '</div>';
         }
     } else {
         $html .= '	<div class="position empty-position">';
         $html .= '		<h3>' . JText::_('KSM_ORDERS_ORDER_NO_CUSTOMERFIELDS') . '</h3>';
         $html .= '	</div>';
     }
     $html .= '</div>';
     return $html;
 }
コード例 #4
0
ファイル: order.php プロジェクト: JexyRu/Ksenmart
 public function getUser()
 {
     return KSUsers::getUser();
 }
コード例 #5
0
ファイル: reviews.php プロジェクト: JexyRu/Ksenmart
 * @copyright   Copyright (C) 2013. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
if (!$this->show_shop_review && KSUsers::getUser()->id > 0) {
    ?>
<div class="row-fluid">
    <p class="lead add_shop_review pull-right clearfix"><span>+</span> <a href="javascript:void(0);" class="link_b_border lrg"><?php 
    echo JText::_('KSM_SHOP_REVIEW_ADD');
    ?>
</a></p>
</div>
<div class="review add noTransition row-fluid" style="display: none;">
	<form method="post">
		<?php 
    if (empty(KSUsers::getUser()->name)) {
        ?>
		<div class="control-group">
			<div class="controls">
				<input type="text" name="name" placeholder="<?php 
        echo JText::_('KSM_SHOP_REVIEW_ADD_NAME');
        ?>
" required="true" />
			</div>
		</div>
		<?php 
    }
    ?>
		<div class="control-group">
			<div class="controls">
				<img data-rate="1" src="http://room9.ldmco.ru/components/com_ksenmart/images/star2-small.png" alt="">
コード例 #6
0
ファイル: users.php プロジェクト: JexyRu/Ksenmart
 /**
  * KSUsers::getAddresses()
  *
  * @return
  */
 public static function getAddresses()
 {
     $user = KSUsers::getUser();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select(KSDb::quoteName(array('id', 'city', 'zip', 'street', 'house', 'entrance', 'floor', 'flat', 'coords', 'default')));
     $query->from(KSDb::quoteName('#__ksen_user_addresses'));
     $query->where(KSDb::quoteName('user_id') . '=' . $db->escape($user->id));
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     return $rows;
 }
コード例 #7
0
ファイル: catalog.php プロジェクト: JexyRu/Ksenmart
 /**
  * KsenMartModelcatalog::setLayoutCatalog()
  * 
  * @param mixed $layout
  * @return
  */
 public function setLayoutCatalog($layout)
 {
     $this->onExecuteBefore('setLayoutCatalog', array(&$layout));
     if (!empty($layout)) {
         $user = KSUsers::getUser();
         $user_update = new stdClass();
         $user->settings->catalog_layout = $layout;
         $user_update->id = $user->id;
         $user_update->settings = json_encode($user->settings);
         try {
             $result = $this->_db->updateObject('#__ksen_users', $user_update, 'id');
             $this->onExecuteAfter('setLayoutCatalog', array(&$result));
             return true;
         } catch (exception $e) {
         }
     }
     return false;
 }
コード例 #8
0
ファイル: commentuser.php プロジェクト: JexyRu/Ksenmart
    public function getInput()
    {
        $db = JFactory::getDBO();
        $params = JComponentHelper::getParams('com_ksenmart');
        $html = '';
        $html .= '<div class="positions">';
        $html .= '	<div id="ksm-slidemodule-commentuser-container">';
        $user = KSUsers::getUser($this->value);
        $html .= '		<div class="position">';
        $html .= '			<div class="col1">';
        $html .= '				<div class="img"><img alt="" src="' . $user->small_img . '"></div>';
        $html .= '				<div class="name">' . $user->name . '<br>' . $user->email . '</div>';
        $html .= '			</div>';
        if ($user->id > 0) {
            $html .= '		<a href="#" class="del"></a>';
        }
        $html .= '			<input type="hidden" name="' . $this->name . '" value="' . $user->id . '">';
        $html .= '		</div>';
        $html .= '	</div>';
        if ($user->id == 0) {
            $html .= '<div class="row">';
            $html .= '	<a href="' . JRoute::_('index.php?option=com_ksen&view=users&layout=search&items_tpl=commentuser&items_to=ksm-slidemodule-commentuser-container&tmpl=component') . '" class="add">' . JText::_('ksm_add') . '</a>';
            $html .= '</div>';
        }
        $html .= '</div>';
        $script = '
		jQuery(document).ready(function(){
				
			jQuery("body").on("click", ".ksm-slidemodule-commentuser .add", function(){
				var url=jQuery(this).attr("href");
				jQuery(".ksm-slidemodule-commentuser input[type=\'hidden\']").each(function(){
					url+="&excluded[]="+jQuery(this).val();
				});
				url+="&excluded[]=";
				var width=jQuery(window).width();
				var height=jQuery(window).height();
				openPopupWindow(url,width,height);
				return false;
			});
			
			jQuery("body").on("click", ".ksm-slidemodule-commentuser .del", function(){
				jQuery(this).parents(".position:first").remove();
				jQuery("#ksm-slidemodule-commentuser-container").html("<input type=hidden id=jformuser_id name=' . $this->name . ' value=0>");
				onChangeUser();
				return false;
			});
			
		});
		
		function onChangeUser()
		{
			var data={};
			var vars={};
			var form=jQuery(".form");
			data["model"]="comments";
			data["form"]="comment";
			data["fields"]=["user_id"];
			vars["user_id"]=form.find("#jformuser_id").val();			
			data["vars"]=vars;
			data["id"]=form.find(".id").val();
			KMRenewFormFields(data);
		}	

		function afterAddingUsers()
		{
			jQuery(".ksm-slidemodule-commentuser .position:first").remove();
			onChangeUser();
		}		
		';
        $document = JFactory::getDocument();
        $document->addScriptDeclaration($script);
        return $html;
    }
コード例 #9
0
ファイル: default.php プロジェクト: JexyRu/Ksenmart
<?php

defined('_JEXEC') or die;
$user = KSUsers::getUser();
$profile_link = JRoute::_('index.php?option=com_ksenmart&view=profile&Itemid=' . KSSystem::getShopItemid());
?>
<div class="accordion catalog-menu" id="dropdownCat">
	<h3><?php 
echo $module->title;
?>
</h3>
	<div class="user-info">
		<div class="avatar">
			<img src="<?php 
echo $user->logo_thumb;
?>
" alt="<?php 
echo $user->name;
?>
" class="border_ksen" />
		</div>
		<div class="user_name"><?php 
echo $user->name;
?>
</div>
		<br clear="both">
	</div>
	<div class="left-menu">
		<ul class="nav nav-list">
			<li><a href="<?php 
echo $profile_link;
コード例 #10
0
ファイル: view.html.php プロジェクト: JexyRu/Ksenmart
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $path = $app->getPathway();
     $document = JFactory::getDocument();
     $this->params = JComponentHelper::getParams('com_ksenmart');
     $shop_name = $this->params->get('shop_name', 'магазине');
     $pref = $this->params->get('path_separator', '-');
     $doc_title = $shop_name . $pref . 'Отзывы';
     $id = $app->input->get('id', 0, 'int');
     $layout = $this->getLayout();
     $document->setTitle($doc_title);
     $document->addStyleSheet(JURI::base() . 'components/com_ksenmart/css/shop_reviews.css');
     switch ($layout) {
         case 'comments':
             if (!JFactory::getConfig()->get('config.caching', 0)) {
                 $path->addItem(JText::_('KSM_REVIEWS_LIST_PATH_TITLE'));
             }
             $comments = $this->get('comments');
             $pagination = $this->get('Pagination');
             $this->assignRef('pagination', $pagination);
             $this->assignRef('rows', $comments);
             break;
         case 'comment':
             if ($id > 0) {
                 if (!JFactory::getConfig()->get('config.caching', 0)) {
                     $path->addItem(JText::_('KSM_REVIEWS_LIST_PATH_TITLE'), 'index.php?option=com_ksenmart&view=comments&layout=comments&Itemid=' . KSSystem::getShopItemid());
                     $path->addItem(JText::_('KSM_REVIEW_ITEM_PATH_TITLE'));
                 }
                 $comment = $this->get('Comment');
                 if (!$comment) {
                     JError::raiseError(404, 'Page not found');
                     return false;
                 }
                 $this->assignRef('comment', $comment);
             } else {
                 JError::raiseError(404, 'Page not found');
                 return false;
             }
             break;
         case 'reviews':
             if (!JFactory::getConfig()->get('config.caching', 0)) {
                 $path->addItem(JText::_('KSM_SHOP_REVIEWS_PATH_TITLE'));
             }
             $reviews = $this->get('ShopReviewsList');
             $user = KSUsers::getUser();
             $isset_review = KSSystem::issetReview($user->id);
             $this->assignRef('reviews', $reviews);
             $this->assignRef('user', $user);
             $this->assignref('show_shop_review', $isset_review);
             break;
         case 'review':
             if ($id > 0) {
                 $user = KSUsers::getUser();
                 $this->params = JComponentHelper::getParams('com_ksenmart');
                 $model = $this->getModel();
                 $review = $model->getShopReviewById($id);
                 if (!$review) {
                     JError::raiseError(404, 'Page not found');
                     return false;
                 }
                 $isset_review = KSSystem::issetReview($user->id);
                 $this->assignRef('review', $review);
                 $this->assignRef('user', $user);
                 $this->assignref('show_shop_review', $isset_review);
                 $document->setTitle(JText::sprintf('KSM_SHOP_REVIEW_PATH_TITLE_TEXT', $review->user->name, $shop_name));
                 if (!JFactory::getConfig()->get('config.caching', 0)) {
                     $path->addItem(JText::_('KSM_SHOP_REVIEWS_PATH_TITLE'), 'index.php?option=com_ksenmart&view=comments&layout=reviews&Itemid=' . KSSystem::getShopItemid());
                     $path->addItem(JText::sprintf('KSM_SHOP_REVIEW_PATH_TITLE_TEXT', $review->user->name, $shop_name));
                 }
             } else {
                 JError::raiseError(404, 'Page not found');
                 return false;
             }
             break;
     }
     parent::display($tpl);
 }
コード例 #11
0
ファイル: view.html.php プロジェクト: JexyRu/Ksenmart
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $this->params = JComponentHelper::getParams('com_ksenmart');
     $pref = $this->params->get('path_separator');
     $id = JRequest::getVar('id', 0);
     $names_komponent = $this->params->get('shop_name');
     $path = $app->getPathway();
     $doc_title = $names_komponent . $pref . 'Оформление заказа';
     if (!JFactory::getConfig()->get('config.caching', 0)) {
         $path->addItem('Оформление заказа');
     }
     $document->setTitle($doc_title);
     if ($id == 0) {
         $this->setLayout('choose_product');
     }
     switch ($this->getLayout()) {
         case 'congratulation':
             $order_id = JRequest::getVar('order_id', 0);
             $this->assignRef('order_id', $order_id);
             $this->setLayout('order_congratulation');
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/openorder_close.js', 'text/javascript', false);
             break;
         case 'close_congratulation':
             $order_id = JRequest::getVar('order_id', 0);
             $this->assignRef('order_id', $order_id);
             $this->setLayout('order_close_congratulation');
             break;
         case 'choose_product':
             $this->setLayout('choose_product');
             break;
         default:
             $close_order = JRequest::getVar('close_order', 0);
             if ($close_order == 1) {
                 $document->addScript(JURI::base() . 'components/com_ksenmart/js/openorder_close.js', 'text/javascript', false);
                 $document->addStyleSheet(JURI::base() . 'components/com_ksenmart/css/map.css');
                 $document->addScript('http://api-maps.yandex.ru/2.0/?load=package.full&lang=ru-RU', 'text/javascript', false);
                 $document->addScript(JURI::base() . 'administrator/components/com_ksenmart/js/map.js', 'text/javascript', false);
                 $document->addScript(JURI::base() . 'components/com_ksenmart/js/map_config.js', 'text/javascript', false);
                 $product = $this->get('Product');
                 $user = $this->get('User');
                 $fields = $this->get('Fields');
                 $regions = $this->get('Regions');
                 $shippings = $this->get('Shippings');
                 $payments = $this->get('Payments');
                 $this->assignRef('product', $product);
                 $this->assignRef('user', $user);
                 $this->assignRef('fields', $fields);
                 $this->assignRef('regions', $regions);
                 $this->assignRef('shippings', $shippings);
                 $this->assignRef('payments', $payments);
                 $this->setLayout('openorder_close');
             } else {
                 $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.inputmask.js', 'text/javascript', false);
                 $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.bind-first-0.1.min.js', 'text/javascript', false);
                 $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.inputmask-multi.js', 'text/javascript', false);
                 $document->addScript(JURI::base() . 'components/com_ksenmart/js/openorder.js', 'text/javascript', false);
                 $document->addStyleSheet(JURI::base() . 'components/com_ksenmart/css/openorder.css');
                 $product = $this->get('Product');
                 $user = KSUsers::getUser();
                 $customer_fields = $this->get('CustomerFields');
                 $this->assignRef('product', $product);
                 $this->assignRef('customer_fields', $customer_fields);
                 $this->assignRef('user', $user);
                 $this->setLayout('openorder');
             }
             break;
     }
     parent::display($tpl);
 }
コード例 #12
0
ファイル: profile.php プロジェクト: JexyRu/Ksenmart
 public function setSubscribe()
 {
     KSUsers::setUserSubscribeGroup(KSUsers::getUser()->id);
 }
コード例 #13
0
ファイル: comments.php プロジェクト: JexyRu/Ksenmart
 public function addCommentReply($id, $comment, $product_id)
 {
     $this->onExecuteBefore('addCommentReply', array(&$id, &$comment, &$product_id));
     if (!empty($id) && $id > 0) {
         $user = KSUsers::getUser();
         $reply = new stdClass();
         $reply->parent_id = $id;
         $reply->user_id = $user->id;
         $reply->name = $user->name;
         $reply->product_id = $product_id;
         $reply->comment = $comment;
         try {
             $result = $this->_db->insertObject('#__ksenmart_comments', $reply);
             $this->onExecuteAfter('addCommentReply', array(&$result));
             return true;
         } catch (Exception $e) {
         }
     }
     return false;
 }
コード例 #14
0
ファイル: comments.php プロジェクト: JexyRu/Ksenmart
	</div>
	<?php 
if (count($this->product->comments) > 0) {
    ?>
	<div class="items">
		<?php 
    $i = 0;
    ?>
		<?php 
    foreach ($this->product->comments as $comment) {
        ?>
		<?php 
        $i++;
        ?>
		<?php 
        $user = KSUsers::getUser($comment->user);
        ?>
		<?php 
        if ($i == 3) {
            ?>
		<div class="all-comments">
		<?php 
        }
        ?>
		<div class="item">
			<div class="w100">
				<div class="ava"><a href="javascript:void(0)"><img src="<?php 
        echo $comment->logo_thumb;
        ?>
" alt="" /></a></div>
				<div class="info">
コード例 #15
0
ファイル: price.php プロジェクト: JexyRu/Ksenmart
 public static function getPriceWithDiscount($price, $subscribe = 0)
 {
     $user = KSUsers::getUser();
     $db = JFactory::getDBO();
     $percent = 0;
     $rur = 0;
     /*$where = " and (0";
             foreach ($user->groups as $group)
                 if ($group != 2 || ($group == 2 && $subscribe == 2)) $where .=
                         " or user_group like '%|$group|%'";
             if ($subscribe == 1) $where .= " or user_group like '%|2|%'";
             $where .= ")";
             if (array_key_exists($where, self::$_discounts)) {
                 $discounts = self::$_discounts[$where];
             } else {
                 $query = "select * from #__ksenmart_discounts where enabled='1' $where";
                 $db->setQuery($query);
                 $discounts = $db->loadObjectList();
                 self::$_discounts[$where] = $discounts;
             }
       */
     $price = ($price - $rur) * (100 - $percent) / 100;
     return number_format($price, 2, '.', '');
 }
コード例 #16
0
ファイル: profile.php プロジェクト: JexyRu/Ksenmart
 public function moveTmpImg($resize = false)
 {
     $this->onExecuteBefore('moveTmpImg', array(&$resize));
     $uid = KSUsers::getUser()->id;
     $jinput = JFactory::getApplication()->input;
     $x1 = $jinput->get('x1', 0, 'int');
     $y1 = $jinput->get('y1', 0, 'int');
     $w = $jinput->get('w', 0, 'int');
     $h = $jinput->get('h', 0, 'int');
     $boundx = $jinput->get('boundx', 0, 'int');
     $boundy = $jinput->get('boundy', 0, 'int');
     $uploaddir = JPATH_ROOT . DS . 'media' . DS . 'com_ksen' . DS . 'images' . DS . 'users';
     if ($resize) {
         foreach ($_FILES as $key => $value) {
             $size = getimagesize($value['tmp_name']);
             if ($value["size"] > 1024 * 8 * 1024) {
                 return false;
             }
             if (empty($uid)) {
                 $value['name'] = $this->generateRandomString(15);
             } else {
                 $value['name'] = $uid . '_' . $value['name'];
             }
             $uploadfile_original = $uploaddir . DS . 'original' . DS . basename($value['name']);
             $uploadfile_thumb = $uploaddir . DS . 'thumb' . DS . basename($value['name']);
             if (!file_exists($uploaddir . DS . 'original' . DS)) {
                 mkdir($uploaddir . DS . 'original' . DS);
             }
             if (!file_exists($uploaddir . DS . 'thumb' . DS)) {
                 mkdir($uploaddir . DS . 'thumb' . DS);
             }
             if (!is_uploaded_file($value['tmp_name'])) {
                 return false;
             }
             $this->resizeImage($value['tmp_name'], 0, 0, $w, $h, $boundx, $boundy, true);
             copy($value['tmp_name'], $uploadfile_original);
             $this->resizeImage($value['tmp_name'], $x1, $y1, $w, $h, $boundx, $boundy);
             move_uploaded_file($value['tmp_name'], $uploadfile_thumb);
             $this->setUserAvatar($uid, $value['name']);
             $this->onExecuteAfter('moveTmpImg');
             return true;
         }
     } else {
         $avatar_full = JPATH_ROOT . DS . JRequest::getVar('avatar_full', null);
         if (!empty($avatar_full)) {
             if (file_exists($avatar_full)) {
                 $pathinfo = pathinfo($avatar_full);
                 $thumb_patch = $uploaddir . DS . 'thumb' . DS;
                 if (copy($pathinfo['dirname'] . '/' . $pathinfo['basename'], $thumb_patch . $pathinfo['basename'])) {
                     if ($this->resizeImage($thumb_patch . $pathinfo['basename'], $x1, $y1, $w, $h, $boundx, $boundy)) {
                         $this->onExecuteAfter('moveTmpImg');
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }
コード例 #17
0
ファイル: view.html.php プロジェクト: JexyRu/Ksenmart
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $path = $app->getPathway();
     $this->params = JComponentHelper::getParams('com_ksenmart');
     $session = JFactory::getSession();
     $user = KSUsers::getUser();
     $this->state = $this->get('State');
     $layout_view = $session->get('layout', $user->settings->catalog_layout);
     $layout = $this->getLayout();
     switch ($layout) {
         case 'items':
             $rows = $this->get('Items');
             $this->assignRef('rows', $rows);
             $this->setLayout('catalog_ajax_items');
             break;
         case 'manufacturers':
             $model = $this->getModel();
             $brands = $this->get('Manufacturers');
             $brands = $model->groupBrandsByLet($brands);
             $letters = $model->getLetters($brands);
             $document->setTitle(JText::_('KSM_MANUFACTURERS_PATHWAY_ITEM'));
             $path->addItem(JText::_('KSM_MANUFACTURERS_PATHWAY_ITEM'), JRoute::_('index.php?option=com_ksenmart&view=catalog&layout=manufacturers'));
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/manufactures.js', 'text/javascript', true);
             $this->assignRef('brands', $brands);
             $this->assignRef('letters', $letters);
             break;
         case 'countries':
             $model = $this->getModel();
             $brands = $this->get('ManufacturersListGroupByCountry');
             $document->setTitle(JText::_('KSM_MANUFACTURERS_PATHWAY_ITEM'));
             $path->addItem(JText::_('KSM_MANUFACTURERS_PATHWAY_ITEM'), JRoute::_('index.php?option=com_ksenmart&view=catalog&layout=manufacturers'));
             $this->assignRef('brands', $brands);
             break;
         default:
             $model = $this->getModel();
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/catalog.js', 'text/javascript', true);
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/highslide/highslide-with-gallery.js', 'text/javascript', true);
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/highslide.js', 'text/javascript', true);
             $document->addStyleSheet(JURI::base() . 'components/com_ksenmart/js/highslide/highslide.css');
             if (count($this->state->get('com_ksenmart.categories', array())) == 1) {
                 $category = $this->get('Category');
                 $title = $this->get('CategoryTitle');
                 if (!$category) {
                     JError::raiseError(404, 'Категории не существует');
                 }
                 $document->setTitle($title);
                 $model->setCategoryMetaData();
                 $this->assignRef('category', $category);
                 $this->setLayout('category');
             } elseif (count($this->state->get('com_ksenmart.manufacturers', array())) == 1) {
                 $manufacturer = $this->get('Manufacturer');
                 $title = $this->get('ManufacturerTitle');
                 if (!$manufacturer) {
                     JError::raiseError(404, 'Производитель не существует');
                 }
                 $document->setTitle($title);
                 $path->addItem(JText::_('KSM_MANUFACTURERS_PATHWAY_ITEM'), JRoute::_('index.php?option=com_ksenmart&view=catalog&layout=manufacturers'));
                 $model->setManufacturerMetaData();
                 $this->assignRef('manufacturer', $manufacturer);
                 $this->setLayout('manufacturer');
             } elseif (count($this->state->get('com_ksenmart.countries', array())) == 1) {
                 $country = $this->get('Country');
                 $title = $this->get('CountryTitle');
                 if (!$country) {
                     JError::raiseError(404, 'Страна не существует');
                 }
                 $document->setTitle($title);
                 $model->setCountryMetaData();
                 $this->assignRef('country', $country);
                 $this->setLayout('country');
             } elseif (count($this->state->get('com_ksenmart.users', array())) == 1) {
                 $manufacturer = $this->get('Manufacturer');
                 $title = $this->get('ManufacturerTitle');
                 $document->setTitle($title);
                 $model->setManufacturerMetaData();
                 $this->assignRef('manufacturer', $manufacturer);
                 $this->setLayout('manufacturer');
             } else {
                 $title = $this->get('CatalogTitle');
                 $document->setTitle($title);
                 if ($layout == 'default') {
                     $this->setLayout('catalog');
                 }
             }
             if (!JFactory::getConfig()->get('config.caching', 0)) {
                 $catalog_path = $this->get('CatalogPath');
                 $k = 0;
                 foreach ($catalog_path as $c_path) {
                     $k++;
                     if ($k == count($catalog_path)) {
                         $path->addItem($c_path['title']);
                     } else {
                         $path->addItem($c_path['title'], $c_path['link']);
                     }
                 }
             }
             $pagination = $this->get('Pagination');
             $rows = $this->get('Items');
             $sort_links = $this->get('SortLinks');
             $this->assignRef('sort_links', $sort_links);
             $this->assignRef('rows', $rows);
             $this->assignRef('pagination', $pagination);
             $this->assignRef('sort_links', $sort_links);
             break;
     }
     $this->assignRef('layout_view', $layout_view);
     parent::display($tpl);
 }
コード例 #18
0
ファイル: shopajax.php プロジェクト: JexyRu/Ksenmart
 function subscribe()
 {
     $user = KSUsers::getUser();
     if ($user->id != 0 && !in_array(2, $user->groups)) {
         if ($user->email == '') {
             echo 'email';
             exit;
         }
         $user->groups[] = 2;
         $db = JFactory::getDBO();
         $query = "update #__ksen_users set groups='|" . implode('||', $user->groups) . "|' where id='{$user->id}'";
         $db->setQuery($query);
         $db->query();
     }
     exit;
 }
コード例 #19
0
ファイル: orders.php プロジェクト: JexyRu/Ksenmart
 function getListItems()
 {
     $this->onExecuteBefore('getListItems');
     $statuses = $this->getState('statuses');
     $searchword = $this->getState('searchword');
     $order_dir = $this->getState('order_dir');
     $order_type = $this->getState('order_type');
     $from_date = $this->getState('from_date');
     $to_date = $this->getState('to_date');
     $query = $this->_db->getQuery(true);
     $query->select('SQL_CALC_FOUND_ROWS *')->from('#__ksenmart_orders')->order($order_type . ' ' . $order_dir);
     if (count($statuses) > 0) {
         $query->where('status_id in (' . implode(',', $statuses) . ')');
     }
     if (!empty($searchword)) {
         $query->where('customer_fields like ' . $this->_db->quote('%' . $searchword . '%') . ' or address_fields like ' . $this->_db->quote('%' . $searchword . '%') . ' or date_add like ' . $this->_db->quote('%' . $searchword . '%'));
     }
     if (!empty($from_date)) {
         $from_date = date('Y-m-d', strtotime($from_date)) . ' 00:00:00';
         $query->where('date_add>' . $this->_db->quote($from_date));
     }
     if (!empty($to_date)) {
         $to_date = date('Y-m-d', strtotime($to_date)) . ' 23:59:59';
         $query->where('date_add<' . $this->_db->quote($to_date));
     }
     $this->_db->setQuery($query, $this->getState('list.start'), $this->getState('list.limit'));
     $orders = $this->_db->loadObjectList();
     $query = $this->_db->getQuery(true);
     $query->select('FOUND_ROWS()');
     $this->_db->setQuery($query);
     $this->total = $this->_db->loadResult();
     foreach ($orders as &$order) {
         $order->user = KSUsers::getUser($order->user_id);
         $order->cost_val = KSMPrice::showPriceWithTransform($order->cost);
         $order->date = date('d.m.Y', strtotime($order->date_add));
         $order->status_name = '';
         $order->customer_info = '';
         $query = $this->_db->getQuery(true);
         $query->select('*')->from('#__ksenmart_order_statuses')->where('id=' . $order->status_id);
         $this->_db->setQuery($query);
         $status = $this->_db->loadObject();
         if (!empty($status)) {
             $order->status_name = $status->system ? JText::_('ksm_orders_' . $status->title) : $status->title;
         }
         $order->customer_fields = json_decode($order->customer_fields, true);
         if (isset($order->customer_fields['name']) && !empty($order->customer_fields['name'])) {
             $order->customer_info .= $order->customer_fields['name'];
         }
         if (isset($order->customer_fields['last_name']) && !empty($order->customer_fields['last_name'])) {
             $order->customer_info .= $order->customer_fields['last_name'] . ' ';
         }
         if (isset($order->customer_fields['first_name']) && !empty($order->customer_fields['first_name'])) {
             $order->customer_info .= $order->customer_fields['first_name'] . ' ';
         }
         if (isset($order->customer_fields['middle_name']) && !empty($order->customer_fields['middle_name'])) {
             $order->customer_info .= $order->customer_fields['middle_name'];
         }
         if (isset($order->customer_fields['email']) && !empty($order->customer_fields['email'])) {
             $order->customer_info .= '<br>' . $order->customer_fields['email'];
         }
         if (isset($order->customer_fields['phone']) && !empty($order->customer_fields['phone'])) {
             $order->customer_info .= '<br>' . $order->customer_fields['phone'];
         }
         if (empty($order->customer_info)) {
             $order->customer_info = JText::_('ksm_orders_default_customer_info');
         }
     }
     $this->onExecuteAfter('getListItems', array(&$orders));
     return $orders;
 }
コード例 #20
0
ファイル: kmdiscountplugin.php プロジェクト: JexyRu/Ksenmart
 function onSendDiscountEmail($discount_id = null)
 {
     if (empty($discount_id)) {
         return false;
     }
     $db = JFactory::getDBO();
     $session = JFactory::getSession();
     $emailed = $session->get('com_ksenmart.emailed_discount_' . $discount_id, null);
     if (empty($emailed)) {
         $query = $db->getQuery(true);
         $query->select('content,info_methods')->from('#__ksenmart_discounts')->where('type=' . $db->quote($this->_name))->where('id=' . $discount_id)->where('enabled=1');
         $db->setQuery($query);
         $discount = $db->loadObject();
         if (empty($discount)) {
             return;
         }
         $info_methods = json_decode($discount->info_methods, true);
         if (KSUsers::getUser()->id == 0 || KSUsers::getUser()->email == '' || !in_array('email', $info_methods)) {
             return;
         }
         $mailer = JFactory::getMailer();
         $params = JComponentHelper::getParams('com_ksenmart');
         $sender = array($params->get('shop_email', ''), $params->get('shop_name', ''));
         $mailer->setSender($sender);
         $mailer->addRecipient(KSUsers::getUser()->email);
         $mailer->setSubject(JText::_('ksm_discount_email_subject'));
         $mailer->isHTML(true);
         $content = $this->onGetDiscountContent($discount_id);
         $mailer->setBody($content);
         $send = $mailer->Send();
         if ($send) {
             $session->set('com_ksenmart.emailed_discount_' . $discount_id, 1);
         }
     }
 }
コード例 #21
0
ファイル: reports.php プロジェクト: JexyRu/Ksenmart
 function getOrders()
 {
     $this->onExecuteBefore('getOrders');
     $order_dir = $this->getState('order_dir');
     $order_type = $this->getState('order_type');
     $from_date = $this->getState('from_date');
     $to_date = $this->getState('to_date');
     $from_date = date('Y-m-d', strtotime($from_date)) . ' 00:00:00';
     $to_date = date('Y-m-d', strtotime($to_date)) . ' 23:59:59';
     $query = $this->_db->getQuery(true);
     $query->select('*')->from('#__ksenmart_orders')->where('date_add>' . $this->_db->quote($from_date))->where('date_add<' . $this->_db->quote($to_date));
     $this->_db->setQuery($query);
     $total_orders = $this->_db->loadObjectList();
     $this->total = count($total_orders);
     $total_cost = 0;
     for ($i = 0; $i < count($total_orders); $i++) {
         $total_cost += $total_orders[$i]->cost;
     }
     $query = $this->_db->getQuery(true);
     $query->select('o.*,(select title from #__ksenmart_order_statuses where id=o.status_id) as status_name')->from('#__ksenmart_orders as o')->where('o.date_add>' . $this->_db->quote($from_date))->where('o.date_add<' . $this->_db->quote($to_date))->order('o.' . $order_type . ' ' . $order_dir);
     $this->_db->setQuery($query, $this->getState('list.start'), $this->getState('list.limit'));
     $orders = $this->_db->loadObjectList();
     foreach ($orders as &$order) {
         $order->user = KSUsers::getUser($order->user_id);
         $order->cost_val = KSMPrice::showPriceWithTransform($order->cost);
         $order->date = date('d.m.Y', strtotime($order->date_add));
         $order->status_name = '';
         $order->customer_info = '';
         $query = $this->_db->getQuery(true);
         $query->select('*')->from('#__ksenmart_order_statuses')->where('id=' . $order->status_id);
         $this->_db->setQuery($query);
         $status = $this->_db->loadObject();
         if (!empty($status)) {
             $order->status_name = $status->system ? JText::_('ksm_orders_' . $status->title) : $status->title;
         }
         $order->customer_fields = json_decode($order->customer_fields, true);
         if (isset($order->customer_fields['lastname']) && !empty($order->customer_fields['lastname'])) {
             $order->customer_info .= $order->customer_fields['lastname'] . ' ';
         }
         if (isset($order->customer_fields['name']) && !empty($order->customer_fields['name'])) {
             $order->customer_info .= $order->customer_fields['name'] . ' ';
         }
         if (isset($order->customer_fields['surname']) && !empty($order->customer_fields['surname'])) {
             $order->customer_info .= $order->customer_fields['surname'];
         }
         if (isset($order->customer_fields['email']) && !empty($order->customer_fields['email'])) {
             $order->customer_info .= '<br>' . $order->customer_fields['email'];
         }
         if (isset($order->customer_fields['phone']) && !empty($order->customer_fields['phone'])) {
             $order->customer_info .= '<br>' . $order->customer_fields['phone'];
         }
         if (empty($order->customer_info)) {
             $order->customer_info = JText::_('ksm_orders_default_customer_info');
         }
     }
     $this->total_cost = $total_cost;
     $this->onExecuteAfter('getOrders', array(&$orders));
     return $orders;
 }
コード例 #22
0
ファイル: default_shipping.php プロジェクト: JexyRu/Ksenmart
?>
	<?php 
if ($this->address_fields) {
    ?>
	<div class="step row-fluid address_fields_b">
        <div class="span6">
            <legend><?php 
    echo JText::_('KSM_CART_ADDRESS_FIELDS_TITLE');
    ?>
</legend>
            <?php 
    echo $this->loadTemplate('address_fields');
    ?>
        </div>
        <?php 
    if (KSUsers::getUser()->id && $this->addresses) {
        ?>
        <div class="span6">
            <legend><?php 
        echo JText::_('KSM_CART_ADDRESS_CHANGE_TITLE');
        ?>
</legend>
            <?php 
        echo $this->loadTemplate('change_addresses');
        ?>
        </div>
        <?php 
    }
    ?>
	</div>	
	<?php 
コード例 #23
0
ファイル: view.html.php プロジェクト: JexyRu/Ksenmart
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $layout = $this->getLayout();
     if ($user->id == 0 && $layout != 'registration' && $layout != 'module_shipping') {
         header('Location:/');
     }
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $this->params = JComponentHelper::getParams('com_ksenmart');
     $path = $app->getPathway();
     $names_komponent = $this->params->get('shop_name', '');
     $pref = $this->params->get('path_separator', '');
     $doc_title = $names_komponent . $pref . JText::_('KSM_PROFILE_PATHWAY_ITEM');
     if (!JFactory::getConfig()->get('config.caching', 0) && $layout != 'registration') {
         $path->addItem(JText::_('KSM_PROFILE_PATHWAY_ITEM'), '');
     }
     $document->setTitle($doc_title);
     $this->assign('params', $this->params);
     switch ($layout) {
         case 'registration':
             $doc_title = $names_komponent . $pref . JText::_('KSM_PROFILE__REGISTRATION_PATHWAY_ITEM');
             $document->setTitle($doc_title);
             if (!JFactory::getConfig()->get('config.caching', 0)) {
                 $path->addItem(JText::_('KSM_PROFILE__REGISTRATION_PATHWAY_ITEM'), '');
             }
             $this->fields = KSUsers::getFields();
             $this->setLayout('profile_registration');
             break;
         case 'profile_order':
             $id = JRequest::getVar('id', 0);
             if (!JFactory::getConfig()->get('config.caching', 0)) {
                 $path->addItem(JText::_('profile_orders'), 'index.php?option=com_ksenmart&view=profile&layout=profile_orders');
                 $path->addItem('Заказ №' . $id);
             }
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/profile_order.js', 'text/javascript', false);
             $order = $this->get('Order');
             $fields = KSUsers::getFields();
             $regions = $this->get('Regions');
             $this->assign('order', $order);
             $this->assign('fields', $fields);
             $this->assign('regions', $regions);
             $this->setLayout('profile_order');
             break;
         case 'module_shipping':
             break;
         default:
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.inputmask.js', 'text/javascript', false);
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.bind-first-0.1.min.js', 'text/javascript', false);
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.inputmask-multi.js', 'text/javascript', false);
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.Jcrop.min.js', 'text/javascript', true);
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/profile.js', 'text/javascript', false);
             $document->addStyleSheet(JURI::base() . 'components/com_ksenmart/css/map.css');
             $document->addStyleSheet(JURI::base() . 'components/com_ksenmart/css/jquery.Jcrop.min.css');
             $model = $this->getModel('profile');
             $user = KSUsers::getUser();
             $fields = KSUsers::getFields();
             $regions = $this->get('Regions');
             $favorities = $this->get('Favorities');
             $watched = $this->get('Watched');
             $orders = $this->get('Orders');
             $addresses = $this->get('Addresses');
             $reviews = $this->get('Comments');
             $pagination = $this->get('Pagination');
             $user_review = $model->getShopReview($user->id);
             $this->assign('user', $user);
             $this->assign('fields', $fields);
             $this->assign('regions', $regions);
             $this->assign('favorities', $favorities);
             $this->assign('watched', $watched);
             $this->assign('orders', $orders);
             $this->assign('addresses', $addresses);
             $this->assign('reviews', $reviews);
             $this->assign('user_review', $user_review);
             $this->assign('pagination', $pagination);
             $this->assign('model_profile', $model);
             $this->assign('show_shop_review', KSSystem::issetReview($user->id));
             $this->setLayout('profile');
             break;
     }
     parent::display($tpl);
 }