Esempio n. 1
0
 function display($tpl = null)
 {
     $cart = unserialize(JFactory::getSession()->get('cart'));
     CartHelper::checkCart($cart);
     $setting = JModel::getInstance('setting', 'enmasseModel')->getSetting();
     $arData = array();
     $this->payGtyList = JModel::getInstance('payGty', 'enmasseModel')->listAll();
     $this->assignRef('termArticleId', $setting->article_id);
     $this->assignRef('theme', $setting->theme);
     $this->user = JModel::getInstance('user', 'enmasseModel')->getUser();
     $this->assignRef('cart', $cart);
     //get user data was save in the session
     $arData = JFactory::getApplication()->getUserState('com_enmasse.checkout.data');
     if (empty($arData)) {
         //contruct default value for the inputs
         $arData['name'] = $this->user->name;
         $arData['email'] = $this->user->email;
         $arData['receiver_name'] = "";
         $arData['receiver_email'] = "";
         $arData['receiver_msg'] = "";
         $arData['receiver_address'] = "";
         $arData['receiver_phone'] = "";
     }
     $this->arData = $arData;
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "shop_checkout";
     parent::display($tpl);
 }
Esempio n. 2
0
 function display($tpl = null)
 {
     //redirect user to dealtoday page if use already subscription
     if (JRequest::getVar('CS_SESSION_LOCATIONID', '', 'COOKIE')) {
         JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_enmasse&controller=deal&task=today'));
     }
     // get pagameters
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $parameters = new JObject();
     $parameters->module_id = $params->get('subscribe_module_id');
     $parameters->params = $params;
     //------------------------
     //gemerate integration class
     $integrateFileName = EnmasseHelper::getSubscriptionClassFromSetting() . '.class.php';
     $integrationClass = EnmasseHelper::getSubscriptionClassFromSetting();
     require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "subscription" . DS . $integrationClass . DS . $integrateFileName;
     $integrationObject = new $integrationClass();
     // assign data which get from integration class to view
     $data = $integrationObject->getViewData($parameters);
     $data->module->user = 0;
     $this->assignRef('data', $data);
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "subscription";
     parent::display($tpl);
 }
Esempio n. 3
0
 function display($tpl = null)
 {
     if (JFactory::getUser()->get('guest')) {
         $msg = JText::_("ORDER_PLEASE_LOGIN_BEFORE");
         $redirectUrl = base64_encode("index.php?option=com_enmasse&view=orderList");
         $version = new JVersion();
         $joomla = $version->getShortVersion();
         if (substr($joomla, 0, 3) >= '1.6') {
             $link = JRoute::_("index.php?option=com_users&view=login&return=" . $redirectUrl, false);
         } else {
             $link = JRoute::_("index.php?option=com_user&view=login&return=" . $redirectUrl, false);
         }
         JFactory::getApplication()->redirect($link, $msg);
     }
     $orderList = JModel::getInstance('order', 'enmasseModel')->listForBuyer(JFactory::getUser()->id);
     for ($count = 0; $count < count($orderList); $count++) {
         $orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByOrderId($orderList[$count]->id);
         $orderList[$count]->orderItem = $orderItemList[0];
         $orderList[$count]->display_id = EnmasseHelper::displayOrderDisplayId($orderList[$count]->id);
     }
     $this->assignRef('orderList', $orderList);
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "order_list";
     parent::display($tpl);
 }
Esempio n. 4
0
 function display($tpl = null)
 {
     $nLocId = JRequest::getInt(self::CS_SESSION_LOCATIONID, null, 'COOKIE');
     if ($nLocId) {
         $deal = JModel::getInstance('deal', 'enmasseModel')->getDealMaxSoldQtyFromLocation($nLocId);
         if (empty($deal->id)) {
             $msg = JText::_("NO_DEAL_ON_YOUR_LOCATION");
             JFactory::getApplication()->enqueueMessage($msg);
         }
     }
     if (!$nLocId || empty($deal->id)) {
         $deal = JModel::getInstance('deal', 'enmasseModel')->todayDeal();
     }
     //Referral ID
     $referralId = JRequest::getVar('referralid');
     $this->assignRef('referralId', $referralId);
     if (empty($deal)) {
         //redirect to upcomming deal page because there havent deal on today
         $link = JRoute::_("index.php?option=com_enmasse&controller=deal&task=upcoming", false);
         $msg = JText::_('NO_DEAL_TODAY');
         JFactory::getApplication()->redirect($link, $msg);
     }
     $deal->merchant = JModel::getInstance('merchant', 'enmasseModel')->getById($deal->merchant_id);
     $deal->merchant->branches = json_decode($deal->merchant->branches, true);
     $this->assignRef('deal', $deal);
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "deal_today";
     parent::display($tpl);
 }
Esempio n. 5
0
 function display($tpl = null)
 {
     $sortBy = JRequest::getVar('sortBy', null);
     $keyword = JRequest::getVar('keyword', null);
     $categoryId = JRequest::getInt('categoryId', null);
     $locationId = JRequest::getInt('locationId', null);
     $task = JRequest::getVar('task', null);
     //When searching for deal, we will have this variable
     if ($task != "display") {
         $locationId = JFactory::getSession()->get('CS_SESSION_LOCATIONID');
     } else {
         $locationId = JRequest::getInt('locationId', null);
     }
     $this->assignRef('sortBy', $sortBy);
     $this->assignRef('keyword', $keyword);
     $this->assignRef('categoryId', $categoryId);
     $this->assignRef('locationId', $locationId);
     $this->dealList = JModel::getInstance('deal', 'enmasseModel')->searchStartedPublishedDeal($keyword, $categoryId, $locationId, $sortBy);
     $arLoc = JModel::getInstance('location', 'enmasseModel')->listAllPublished();
     $arCat = JModel::getInstance('category', 'enmasseModel')->listAllPublished();
     $this->assignRef('locationList', $arLoc);
     $this->assignRef('categoryList', $arCat);
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "deal_listing";
     parent::display($tpl);
 }
Esempio n. 6
0
 function display($tpl = null)
 {
     $orderId = JRequest::getVar('orderid', null);
     $buyerId = JRequest::getVar('buyerid', null);
     //Get Id of current user
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $pointPaid = EnmasseHelper::getPointPaidByOrderId($orderId);
     $totalPrice = EnmasseHelper::getTotalPriceByOrderId($orderId);
     $orderStatus = EnmasseHelper::getOrderStatusByOrderId($orderId);
     //If current user is owner of the order and the order was paid with point
     if ($buyerId == $userId && $pointPaid > 0 && $orderStatus == 'Refunded') {
         $dealName = EnmasseHelper::getDealNameByOrderId($orderId);
         $this->assignRef('dealName', $dealName);
         $this->assignRef('orderId', $orderId);
         $this->assignRef('totalPrice', $totalPrice);
         $this->assignRef('pointPaid', $pointPaid);
         $this->assignRef('buyerId', $buyerId);
         $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
         $this->_layout = "point_refund";
         parent::display($tpl);
     } else {
         $link = JRoute::_("index.php?option=com_enmasse&view=deallisting", false);
         JFactory::getApplication()->redirect($link);
     }
 }
Esempio n. 7
0
 function display($tpl = null)
 {
     $id = JRequest::getVar('id', 0);
     $bFlag = JRequest::getVar('sideDealFlag', false);
     $upcoming = JRequest::getVar('upcoming');
     $deal = JModel::getInstance('deal', 'enmasseModel')->viewDeal($id);
     //we must check $deal->id because $deal was loaded from JTable so it alway not null.
     if (empty($deal->id)) {
         $link = JRoute::_("index.php?option=com_enmasse&controller=deal&task=listing", false);
         $msg = JText::_('DEAL_NOT_FOUND');
         JFactory::getApplication()->redirect($link, $msg, 'error');
     }
     $deal->merchant = JModel::getInstance('merchant', 'enmasseModel')->getById($deal->merchant_id);
     $deal->merchant->branches = json_decode($deal->merchant->branches, true);
     $this->assignRef('deal', $deal);
     $this->assignRef('sideDealFlag', $bFlag);
     //Referral ID
     $referralId = JRequest::getVar('referralid');
     $this->assignRef('referralId', $referralId);
     if ($upcoming) {
         $this->assignRef('upcoming', $upcoming);
     }
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "deal_detail";
     parent::display($tpl);
 }
Esempio n. 8
0
 function display($tpl = null)
 {
     $task = JRequest::getWord('task');
     switch ($task) {
         case 'dealCouponMgmt':
             $merchantId = JFactory::getSession()->get('merchantId');
             // To list deal by merchant
             $dealList = JModel::getInstance('deal', 'enmasseModel')->listConfirmedByMerchantId($merchantId);
             $this->assignRef('dealList', $dealList);
             $dealId = '';
             $orderItemList = null;
             $filter = JRequest::getVar('filter');
             $this->assignRef('filter', $filter);
             $dealId = $filter['deal_id'];
             if (!empty($dealId)) {
                 $deal = JModel::getInstance('deal', 'enmasseModel')->getById($dealId);
                 $this->assignRef('deal', $deal);
                 $orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByPdtIdAndStatus($dealId, "Delivered");
                 for ($count = 0; $count < count($orderItemList); $count++) {
                     $orderItemList[$count]->invtyList = JModel::getInstance('invty', 'enmasseModel')->listByOrderItemId($orderItemList[$count]->id);
                     $orderItemList[$count]->order = JModel::getInstance('order', 'enmasseModel')->getById($orderItemList[$count]->order_id);
                 }
             }
             $this->assignRef('orderItemList', $orderItemList);
             $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
             $this->_layout = "merchant_deal_coupon_mgmt";
             parent::display($tpl);
             break;
         default:
             $link = JRoute::_("index.php?option=com_enmasse&controller=merchant&task=dealCouponMgmt", false);
             JFactory::getApplication()->redirect($link, $null);
     }
 }
Esempio n. 9
0
 function display($tpl = null)
 {
     $dealList = JModel::getInstance('deal', 'enmasseModel')->upcomingDeal();
     $this->assignRef('dealList', $dealList);
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "deal_upcoming";
     parent::display($tpl);
 }
Esempio n. 10
0
 function display($tpl = null)
 {
     $success = JRequest::getVar('success', null);
     $dealid = JRequest::getVar('dealid', '0');
     $userid = JRequest::getVar('userid', '0');
     $itemid = JRequest::getVar('itemid', '0');
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "mail";
     $this->assignRef('success', $success);
     $this->assignRef('userid', $userid);
     $this->assignRef('dealid', $dealid);
     $this->assignRef('itemid', $itemid);
     parent::display($tpl);
 }
Esempio n. 11
0
 function display($tpl = null)
 {
     $nDealId = JRequest::getVar('id', 0);
     $oDeal = JModel::getInstance('deal', 'enmasseModel')->viewDeal($nDealId);
     //we must check $deal->id because $deal was loaded from JTable so it alway not null.
     if (empty($oDeal->id)) {
         $sLink = JRoute::_("index.php?option=com_enmasse&controller=deal&task=listing", false);
         $sMessage = JText::_('DEAL_NOT_FOUND');
         JFactory::getApplication()->redirect($sLink, $sMessage, 'error');
     }
     $this->assignRef('objDeal', $oDeal);
     $aComments = JModel::getInstance('comment', 'enmasseModel')->getCommentByDealId($nDealId);
     $this->assignRef('aComments', $aComments);
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "comment";
     parent::display($tpl);
 }
Esempio n. 12
0
 function display($tpl = null)
 {
     $sortBy = JRequest::getVar('sortBy', null);
     $keyword = JRequest::getVar('keyword', null);
     $categoryId = JRequest::getInt('categoryId', null);
     $locationId = JRequest::getInt('locationId', null);
     $this->assignRef('sortBy', $sortBy);
     $this->assignRef('keyword', $keyword);
     $this->assignRef('categoryId', $categoryId);
     $this->assignRef('locationId', $locationId);
     $this->dealList = JModel::getInstance('deal', 'enmasseModel')->searchExpiredPublishedDeal($keyword, $categoryId, $locationId, $sortBy);
     $this->locationList = JModel::getInstance('location', 'enmasseModel')->listAllPublished();
     $this->categoryList = JModel::getInstance('category', 'enmasseModel')->listAllPublished();
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "expired_deal_listing";
     parent::display($tpl);
 }
Esempio n. 13
0
 function display($tpl = null)
 {
     $cart = unserialize(JFactory::getSession()->get('cart'));
     if ($cart == null) {
         $msg = JText::_("CART_IS_EMPTY");
         $link = JRoute::_("index.php?option=com_enmasse&controller=deal&task=listing", false);
         JFactory::getApplication()->redirect($link, $msg);
     } else {
         if ($cart->getTotalItem() == 0) {
             $msg = JText::_("CART_IS_EMPTY");
             $link = JRoute::_("index.php?option=com_enmasse&controller=deal&task=listing", false);
             JFactory::getApplication()->redirect($link, $msg);
         }
     }
     $this->assignRef('cart', $cart);
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "shop_cart";
     parent::display($tpl);
 }
Esempio n. 14
0
 function display($tpl = null)
 {
     $token = JRequest::getVar('token', null);
     $orderItemId = JRequest::getVar('orderItemId', null);
     $orderItem = JModel::getInstance('orderItem', 'enmasseModel')->getById($orderItemId);
     $ourToken = EnmasseHelper::generateOrderItemToken($orderItemId, $orderItem->created_at);
     if ($ourToken != $token) {
         $link = JRoute::_("/", false);
         $msg = JText::_("INVALID_COUPON_TOKEN");
         JFactory::getApplication()->redirect($link, $msg, "error");
     }
     $invtyList = JModel::getInstance('invty', 'enmasseModel')->listByOrderItemId($orderItem->id);
     $deal = JModel::getInstance('deal', 'enmasseModel')->getById($orderItem->pdt_id);
     $this->assignRef('invtyList', $invtyList);
     $this->assignRef('deal', $deal);
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
     $this->_layout = "coupon_listing";
     parent::display($tpl);
 }
Esempio n. 15
0
 function display($tpl = null)
 {
     $task = JRequest::getWord('task');
     $userId = JFactory::getUser()->id;
     switch ($task) {
         case 'show':
             $arOrderId = JModel::getInstance('deliverer', 'EnmasseModel')->getOrdersByUserId($userId);
             $orderList = JModel::getInstance('order', 'EnmasseModel')->getOrdersByIds(empty($arOrderId) ? array(0) : $arOrderId);
             for ($count = 0; $count < count($orderList); $count++) {
                 $orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByOrderId($orderList[$count]->id);
                 $oOrderDeliverer = JModel::getInstance('OrderDeliverer', 'enmasseModel')->getByOrderId($orderList[$count]->id);
                 $orderList[$count]->orderItem = $orderItemList[0];
                 $orderList[$count]->status = $oOrderDeliverer->status;
                 $orderList[$count]->display_id = EnmasseHelper::displayOrderDisplayId($orderList[$count]->id);
             }
             $this->assignRef('orderList', $orderList);
             $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
             $this->_layout = "deliverer_order_list";
             parent::display($tpl);
             break;
         case 'edit':
             $orderId = JRequest::getVar('id', 0, 'method', 'int');
             $oOrderDeliverer = JModel::getInstance('OrderDeliverer', 'enmasseModel')->getByOrderId($orderId);
             if (!$oOrderDeliverer) {
                 $link = JRoute::_("index.php?option=com_enmasse&controller=deliverer&task=show");
                 $msg = JText::_('INVALID_ORDER_ID_MSG');
                 JFactory::getApplication()->redirect($link, $msg, 'error');
             }
             $oOrder = JModel::getInstance('order', 'EnmasseModel')->getById($orderId);
             $oOrder->delivery_status = $oOrderDeliverer->status;
             $this->oOrder = $oOrder;
             $this->oOrderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByOrderId($oOrder->id);
             $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
             $this->_layout = "deliverer_order_edit";
             parent::display($tpl);
             break;
         default:
             $link = JRoute::_("index.php?option=com_enmasse&controller=deliverer&task=show");
             JFactory::getApplication()->redirect($link);
     }
 }
Esempio n. 16
0
 function display($tpl = null)
 {
     $task = JRequest::getWord('task');
     switch ($task) {
         case 'dealReport':
             $salesPersonId = JFactory::getSession()->get('salesPersonId');
             $filter = JRequest::getVar('filter', array('name' => "", 'code' => "", 'merchant_id' => "", 'fromdate' => "", 'todate' => ""));
             $this->assignRef('filter', $filter);
             $dealList = JModel::getInstance('deal', 'enmasseModel')->searchBySaleReports($salesPersonId, $filter['name'], $filter['merchant_id'], $filter['fromdate'], $filter['todate'], $filter['code']);
             $currency_prefix = JModel::getInstance('setting', 'enmasseModel')->getCurrencyPrefix();
             $this->dealList = $dealList;
             $this->assignRef('currency_prefix', $currency_prefix);
             $this->statusList = EnmasseHelper::$DEAL_STATUS_LIST;
             $this->merchantList = JModel::getInstance('merchant', 'enmasseModel')->listAllPublished();
             $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
             $this->_layout = "sales_person_deal_report";
             parent::display($tpl);
             break;
         default:
             $link = JRoute::_("index.php?option=com_enmasse&controller=salereports&task=dealReport", false);
             JFactory::getApplication()->redirect($link, $null);
     }
 }
Esempio n. 17
0
/* ------------------------------------------------------------------------
  # En Masse - Social Buying Extension 2010
  # ------------------------------------------------------------------------
  # By Matamko.com
  # Copyright (C) 2010 Matamko.com. All Rights Reserved.
  # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
  # Websites: http://www.matamko.com
  # Technical Support:  Visit our forum at www.matamko.com
  ------------------------------------------------------------------------- */
jimport('joomla.application.module.helper');
$oMenu = JFactory::getApplication()->getMenu();
$oItem = $oMenu->getItems('link', 'index.php?option=com_enmasse&view=dealtoday', true);
$sRedirectLink = JRoute::_('index.php?option=com_enmasse&controller=deal&task=today&Itemid=' . $oItem->id, false);
?>
<link href="components/com_enmasse/theme/<?php 
echo EnmasseHelper::getThemeFromSetting();
?>
/css/subscript.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
    function submit_multiform()
    {
        var numberForms = document.forms.length;
        //alert(numberForms);

        var formIndex;
        for (formIndex = 0; formIndex < numberForms; formIndex++)
        {      
            formName = document.forms[formIndex].name.toString(); 
        
            if(formName.substring(0,14) == 'formAcymailing')
            {
<?php

/*------------------------------------------------------------------------
# En Masse - Social Buying Extension 2010
# ------------------------------------------------------------------------
# By Matamko.com
# Copyright (C) 2010 Matamko.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.matamko.com
# Technical Support:  Visit our forum at www.matamko.com
-------------------------------------------------------------------------*/
require_once JPATH_ADMINISTRATOR . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "EnmasseHelper.class.php";
$theme = EnmasseHelper::getThemeFromSetting();
JFactory::getDocument()->addStyleSheet('components/com_enmasse/theme/' . $theme . '/css/screen.css');
$rows = $this->dealList;
$option = 'com_enmasse';
$filter = $this->filter;
$emptyJOpt = JHTML::_('select.option', '', JText::_(''));
// create list status for combobox
$statusJOptList = array();
array_push($statusJOptList, $emptyJOpt);
foreach ($this->statusList as $key => $name) {
    $var = JHTML::_('select.option', $key, JText::_('DEAL_' . str_replace(' ', '_', $name)));
    array_push($statusJOptList, $var);
}
$publishedJOptList = array();
array_push($publishedJOptList, $emptyJOpt);
array_push($publishedJOptList, JHTML::_('select.option', 1, JText::_('PUBLISHED')));
array_push($publishedJOptList, JHTML::_('select.option', 0, JText::_('NOT_PUBLISHED')));
// create list merchant for combobox
$merchantJOptList = array();
Esempio n. 19
0
 function display($tpl = null)
 {
     $task = JRequest::getWord('task');
     switch ($task) {
         case 'dealEdit':
             $cid = JRequest::getVar('cid', array(0), '', 'array');
             // define deal attributes
             $row = new JObject();
             $row->id = null;
             $row->name = null;
             $row->description = null;
             $row->short_desc = null;
             $row->origin_price = null;
             $row->price = null;
             $row->pic_dir = null;
             $row->start_at = null;
             $row->end_at = null;
             $row->min_needed_qty = null;
             $row->highlight = null;
             $row->terms = null;
             $row->created_at = null;
             $row->updated_at = null;
             $row->merchant_id = null;
             $row->prepay_percent = null;
             $row->commission_percent = null;
             if ($cid[0] != 0) {
                 $row = JModel::getInstance('deal', 'enmasseModel')->getById($cid[0]);
             }
             $this->assignRef('deal', $row);
             $this->currencyPrefix = JModel::getInstance('setting', 'enmasseModel')->getCurrencyPrefix();
             $this->currencyPostfix = JModel::getInstance('setting', 'enmasseModel')->getCurrencyPostfix();
             $this->statusList = EnmasseHelper::$DEAL_STATUS_LIST;
             $this->locationList = JModel::getInstance('location', 'enmasseModel')->listAllPublished();
             $this->categoryList = JModel::getInstance('category', 'enmasseModel')->listAllPublished();
             $this->merchantList = JModel::getInstance('merchant', 'enmasseModel')->listAllPublished();
             if ($cid[0] != null) {
                 $dealCategoryIdList = JModel::getInstance('dealcategory', 'enmasseModel')->getCategoryByDealId($cid[0]);
                 $this->dealCategoryList = JModel::getInstance('category', 'enmasseModel')->getCategoryListInArrId($dealCategoryIdList);
                 $dealLocationIdList = JModel::getInstance('deallocation', 'enmasseModel')->getLocationByDealId($cid[0]);
                 $this->dealLocationList = JModel::getInstance('location', 'enmasseModel')->getLocationListInArrId($dealLocationIdList);
             } else {
                 $dealCategoryList = array();
                 $this->assignRef('dealCategoryList', $dealCategoryList);
                 $dealLocationList = array();
                 $this->assignRef('dealLocationList', $dealLocationList);
             }
             $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
             $this->_layout = "sales_person_deal_edit";
             parent::display($tpl);
             break;
         case 'dealShow':
             $salesPersonId = JFactory::getSession()->get('salesPersonId');
             $filter = JRequest::getVar('filter', array('name' => "", 'code' => "", 'status' => "", 'published' => ""));
             $this->assignRef('filter', $filter);
             $dealList = JModel::getInstance('deal', 'enmasseModel')->searchBySalesPerson($salesPersonId, $filter['name'], $filter['published'], $filter['status'], $filter['code']);
             $this->assignRef('dealList', $dealList);
             $this->statusList = EnmasseHelper::$DEAL_STATUS_LIST;
             $this->locationList = JModel::getInstance('location', 'enmasseModel')->listAllPublished();
             $this->categoryList = JModel::getInstance('category', 'enmasseModel')->listAllPublished();
             $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
             $this->_layout = "sales_person_deal_show";
             parent::display($tpl);
             break;
         case 'merchantList':
             $oMerMdl = JModel::getInstance('merchant', 'EnmasseModel');
             $arMerchant = $oMerMdl->search();
             $oPgn = $oMerMdl->getPagination();
             $filter = JRequest::getVar('filter');
             $state = $oMerMdl->get('state');
             // get order values
             $order['order_dir'] = $state->get('filter_order_dir');
             $order['order'] = $state->get('filter_order');
             $this->filter = $filter;
             $this->merchantList = $arMerchant;
             $this->pagination = $oPgn;
             $this->order = $order;
             $this->_layout = "sales_person_merchant_show";
             $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
             parent::display($tpl);
             break;
         case 'merchantEdit':
             $cid = JRequest::getVar('cid', array(0), '', 'array');
             if ($cid[0] > 0) {
                 // implicit adding id filter condition for merchant search action(sale person id alway filter by default)
                 $filter = array();
                 $filter['id'] = $cid[0];
                 JRequest::setVar('filter', $filter);
                 $arContact = JModel::getInstance('merchant', 'EnmasseModel')->search();
                 if (!$arContact || count($arContact) == 0) {
                     $msg = JText::_("SALES_PERSON_NO_PERMISSION_ON_MERCHANT");
                     $link = JRoute::_("index.php?option=com_enmasse&controller=salesPerson&task=merchantList", false);
                     JFactory::getApplication()->redirect($link, $msg, 'error');
                 } else {
                     $oContact = array_shift($arContact);
                     //get the first merchant that was found
                 }
             } else {
                 JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . "components" . DS . "com_enmasse" . DS . "tables");
                 $oContact = JTable::getInstance('merchant', 'Table');
             }
             $this->oContact = $oContact;
             $this->_layout = "sales_person_merchant_edit";
             $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS);
             parent::display($tpl);
             break;
         default:
             $link = JRoute::_("index.php?option=com_enmasse&controller=salesPerson&task=dealShow", false);
             JFactory::getApplication()->redirect($link, $null);
     }
 }