Exemple #1
0
 function set_user_subsriber()
 {
     $db = JFactory::getDBO();
     $user_id = JRequest::getVar('user_id', null);
     $value = JRequest::getVar('value', null);
     $query = $db->getQuery(true);
     $query->select('group_id')->from('#__user_usergroup_map')->where('user_id=' . $user_id);
     $db->setQuery($query);
     $groups = $db->loadColumn();
     if ($value == 1 && !in_array(KSUsers::getSubscribersGroupID(), $groups)) {
         $query = $db->getQuery(true);
         $values = array(KSUsers::getSubscribersGroupID(), $user_id);
         $query->insert('#__user_usergroup_map')->columns('group_id,user_id')->values(implode(',', $values));
         $db->setQuery($query);
         $db->Query();
     } elseif ($value == 0) {
         $query = $db->getQuery(true);
         $query->delete('#__user_usergroup_map')->where('user_id=' . $user_id)->where('group_id=' . KSUsers::getSubscribersGroupID());
         $db->setQuery($query);
         $db->query();
     }
     $response = array('erros' => 0, 'message' => array());
     $response = json_encode($response);
     JFactory::getDocument()->setMimeEncoding('application/json');
     echo $response;
     JFactory::getApplication()->close();
 }
Exemple #2
0
 /**
  * getData method
  * @param $params
  * @return array
  */
 static function getData($params)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('
         c.id,
         c.user_id AS user, 
         c.comment, 
         c.date_add,
         c.rate,  
         uf.filename AS logo, 
         u.name
     ');
     $query->from('#__ksenmart_comments AS c');
     $query->leftjoin('#__ksen_users AS kmu ON kmu.id=c.user_id');
     $query->leftjoin('#__users AS u ON kmu.id=u.id');
     $query->leftjoin('#__ksenmart_files AS uf ON uf.owner_id=u.id');
     $query->where("type='shop_review'");
     $query->where("published=1");
     $query->order('date_add DESC');
     $db->setQuery($query, 0, $params->get('count_review', 5));
     $reviews = $db->loadObjectList();
     $reviews = KSUsers::setAvatarLogoInObject($reviews);
     return $reviews;
 }
Exemple #3
0
 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;
 }
 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;
 }
Exemple #5
0
 /**
  * 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;
 }
Exemple #6
0
    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;
    }
Exemple #7
0
 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);
         }
     }
 }
Exemple #8
0
 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;
 }
Exemple #9
0
 public function getShopReview($uid)
 {
     $this->onExecuteBefore('getShopReview', array(&$uid));
     $query = $this->_db->getQuery(true);
     $query->select('
         c.id,
         c.user_id AS user, 
         c.name, 
         c.comment, 
         c.date_add, 
         c.rate
     ');
     $query->from('#__ksenmart_comments AS c');
     $query->where("c.type='shop_review'");
     $query->where("c.published=1");
     $query->where('c.user_id=' . $uid);
     $this->_db->setQuery($query);
     $review = $this->_db->loadObject();
     $review = KSUsers::setAvatarLogoInObject($review);
     $this->onExecuteAfter('getShopReview', array(&$review));
     return $review;
 }
Exemple #10
0
 public function getUser()
 {
     return KSUsers::getUser();
 }
Exemple #11
0
 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);
 }
Exemple #12
0
 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);
 }
Exemple #13
0
 public function setSubscribe()
 {
     KSUsers::setUserSubscribeGroup(KSUsers::getUser()->id);
 }
Exemple #14
0
 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;
 }
Exemple #15
0
 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, '.', '');
 }
Exemple #16
0
 * @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="">
Exemple #17
0
 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);
 }
Exemple #18
0
	</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">
Exemple #19
0
 public function getProductCommentsChild($comments)
 {
     $this->onExecuteBefore('getProductCommentsChild', array(&$comments));
     if (!empty($comments)) {
         $i = 0;
         $where = '';
         $comments_l = count($comments) - 1;
         $query = $this->_db->getQuery(true);
         $query->select('
                 c.id, 
                 c.user_id AS user, 
                 c.parent_id, 
                 c.product_id AS product, 
                 c.comment, 
                 c.name AS comment_name, 
                 c.good, 
                 c.bad, 
                 c.rate, 
                 c.date_add,
                 uf.filename AS logo, 
                 u.name
             ')->from('#__ksenmart_comments AS c')->leftjoin('#__ksen_users AS kmu ON kmu.id=c.user_id')->leftjoin('#__users AS u ON kmu.id=u.id')->leftjoin('#__ksenmart_files AS uf ON uf.owner_id=u.id')->where('c.published=1');
         foreach ($comments as $comment) {
             if (!empty($comment->id) && $comment->id > 0) {
                 $where .= 'c.parent_id=' . $this->_db->escape($comment->id);
                 if ($comments_l != $i) {
                     $where .= ' OR ';
                 }
             }
             $i++;
             continue;
         }
         $query->where($where);
         $query->order('c.date_add desc');
         $this->_db->setQuery($query);
         $children = $this->_db->loadObjectList();
         $this->_db->query();
         if ($this->_db->getNumRows() > 0) {
             $children = KSUsers::setAvatarLogoInObject($children);
             $children_l = count($children);
             for ($i = 0; $i < $children_l; $i++) {
                 for ($j = 0; $j <= $comments_l; $j++) {
                     if ($children[$i]->parent_id == $comments[$j]->id) {
                         $comments[$j]->children = $children[$i];
                     }
                     continue;
                 }
             }
         }
     }
     $this->onExecuteAfter('getProductCommentsChild', array(&$comments));
     return $comments;
 }
Exemple #20
0
 public function getAddresses()
 {
     return KSUsers::getAddresses();
 }
Exemple #21
0
 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;
 }
Exemple #22
0
				<a rel='{"x":"90%","y":"90%"}' href="<?php 
echo JRoute::_('index.php?option=com_ksen&view=users&layout=user&id=' . $this->item->id . '&tmpl=component');
?>
" class="edit km-modal"><?php 
echo JText::_('ks_edit');
?>
</a>
			</p>
		</div>
	</td>
	<td class="user_login"><?php 
echo $this->item->username;
?>
</td>
	<td class="user_email"><?php 
echo $this->item->email;
?>
</td>
	<td class="user_subsriber"><input type="checkbox" value="1" <?php 
echo in_array(KSUsers::getSubscribersGroupID(), $this->item->groups) ? 'checked' : '';
?>
></td>
	<td class="del"><a href="#"></a></td>
	<input type="hidden" class="id" name="items[<?php 
echo $this->item->id;
?>
][id]" value="<?php 
echo $this->item->id;
?>
">
</tr>
Exemple #23
0
 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;
 }
Exemple #24
0
<?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;
Exemple #25
0
			</a>
		</div>
		<div class="descr">
			<?php 
echo $this->item->name;
?>
		</div>
	</td>
	<td class="user_login"><?php 
echo $this->item->username;
?>
</td>
	<td class="user_email"><?php 
echo $this->item->email;
?>
</td>
	<td class="user_subsriber"><?php 
echo in_array(KSUsers::getSubscribersGroupID(), $this->item->groups) ? JText::_('jyes') : JText::_('jno');
?>
</td>
	<td class="add">
		<a href="#" class="add"></a>
	</td>
	<input type="hidden" class="id" name="items[<?php 
echo $this->item->id;
?>
][id]" value="<?php 
echo $this->item->id;
?>
">
</tr>
Exemple #26
0
							<?php 
        echo $comment->good;
        ?>
						</dd>
						<dt class="text-error"><?php 
        echo JText::_('KSM_COMMENTS_LABEL_MINUS');
        ?>
</dt>
						<dd class="text-error">
							<?php 
        echo $comment->bad;
        ?>
						</dd>
					</dl>
					<?php 
        if (empty($comment->children) && KSUsers::is_admin()) {
            ?>
						<div class="reply text-right">
							<a href="javascript:void(0);" title="<?php 
            echo JText::_('KSM_COMMENTS_LABEL_REPLY');
            ?>
" class="l-reply link_b_border"><?php 
            echo JText::_('KSM_COMMENTS_LABEL_REPLY');
            ?>
</a>
						</div>
						<?php 
        }
        ?>
				</div>
			</article>
Exemple #27
0
 public function setUserSubscribeGroup($uid)
 {
     if (!empty($uid) && $uid > 0) {
         $db = JFactory::getDBO();
         $groups = JFactory::getUser($uid)->groups;
         if (!in_array(KSUsers::getSubscribersGroupID(), $groups)) {
             $user_map = new stdClass();
             $user_map->group_id = KSUsers::getSubscribersGroupID();
             $user_map->user_id = $uid;
             try {
                 $db->insertObject('#__user_usergroup_map', $user_map);
             } catch (Exception $e) {
             }
         }
     }
     return false;
 }
Exemple #28
0
?>
	<?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 
Exemple #29
0
 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);
 }