Esempio n. 1
0
 function dealSetLocationCookie()
 {
     $locationId = JRequest::getInt('locationId', null);
     $email = JRequest::getVar('email');
     $oMenu = JFactory::getApplication()->getMenu();
     $oItem = $oMenu->getItems('link', 'index.php?option=com_enmasse&view=dealtoday', true);
     ////////// Integration with ACY Mailing //////////
     $integrationClass = EnmasseHelper::getSubscriptionClassFromSetting();
     $acy_path = JPATH_SITE . DS . 'components' . DS . 'com_acymailing';
     if (file_exists($acy_path)) {
         if ($integrationClass == 'acystarter' || $integrationClass == 'acyenterprise') {
             require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "subscription" . DS . $integrationClass . DS . $integrationClass . ".class.php";
             if ($integrationClass == 'acystarter') {
                 $acy = new acystarter();
             } elseif ($integrationClass == 'acyenterprise') {
                 $acy = new acyenterprise();
             }
             $acy->updateSubscriptionList($locationId, $email);
         }
     }
     /////////////////////////////////////////////////
     if (!empty($locationId)) {
         //set cookie locationId with lifetime is 365 days
         $dtLifeTime = time() + 365 * 24 * 60 * 60;
         setcookie(self::CS_SESSION_LOCATIONID, $locationId, $dtLifeTime, '/');
         $oDeal = JModel::getInstance('deal', 'enmasseModel')->getDealMaxSoldQtyFromLocation($locationId);
         if ($oDeal->id) {
             JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_enmasse&controller=deal&task=view&id=' . $oDeal->id . '&Itemid=' . $oItem->id, false));
         }
     }
     $link = JRoute::_('index.php?option=com_enmasse&controller=deal&task=today&Itemid=' . $oItem->id, false);
     JFactory::getApplication()->redirect($link);
 }
Esempio n. 2
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. 3
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. 4
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. 5
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. 6
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. 7
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. 8
0
 function display($tpl = null)
 {
     // -------------------to re define server link
     $server = JURI::base();
     //-----------------------------------
     $cart = unserialize(JFactory::getSession()->get('cart'));
     $payGty = unserialize(JFactory::getSession()->get('payGty'));
     if (empty($payGty)) {
         $link = JRoute::_("index.php?option=com_enmasse&controller=deal", false);
         JFactory::getApplication()->redirect($link);
     }
     $orderId = JRequest::getVar('orderId');
     $returnUrl = $server . "/index.php?option=com_enmasse&controller=payment&task=returnUrl&orderId={$orderId}";
     $notifyUrl = $server . "/index.php?option=com_enmasse&controller=payment&task=notifyUrl&orderId={$orderId}";
     $cancelUrl = $server . "/index.php?option=com_enmasse&controller=payment&task=cancelUrl";
     $returnUrl .= "&payClass=" . $payGty->class_name;
     $notifyUrl .= "&payClass=" . $payGty->class_name;
     $setting = new JObject();
     $setting->currency = JModel::getInstance('setting', 'enmasseModel')->getCurrency();
     $setting->country = JModel::getInstance('setting', 'enmasseModel')->getCountry();
     $this->returnUrl = $returnUrl;
     $this->notifyUrl = $notifyUrl;
     $this->cancelUrl = $cancelUrl;
     $this->cart = $cart;
     $this->user = JModel::getInstance('user', 'enmasseModel')->getUser();
     $this->systemName = JModel::getInstance('setting', 'enmasseModel')->getCompanyName();
     $this->attributeConfig = json_decode($payGty->attribute_config);
     $this->orderDisplayId = EnmasseHelper::displayOrderDisplayId($orderId);
     $this->setting = $setting;
     $this->orderId = $orderId;
     $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "payGty" . DS . $payGty->class_name . DS);
     $this->_layout = "pay_gty";
     parent::display($tpl);
 }
Esempio n. 9
0
 function getViewData($params)
 {
     $data = new JObject();
     $data->module = EnmasseHelper::getModuleById($params->module_id);
     $data->locationList = JModel::getInstance('location', 'enmasseModel')->listAllPublished();
     return $data;
 }
Esempio n. 10
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. 11
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. 12
0
 public function display($tpl = null)
 {
     $task = JRequest::getWord('task');
     TOOLBAR_enmasse::_SMENU();
     TOOLBAR_enmasse::_PARTIAL_ORDER();
     $filter = JRequest::getVar('filter', array());
     // Weird that only this will caused warning...
     if (!isset($filter['deal_name'])) {
         $filter['deal_name'] = "";
     }
     if (!isset($filter['deal_code'])) {
         $filter['deal_code'] = "";
     }
     if (!isset($filter['status'])) {
         $filter['status'] = "";
     }
     if (!isset($filter['year'])) {
         $filter['year'] = "";
     }
     if (!isset($filter['month'])) {
         $filter['month'] = "";
     }
     //filter partial order
     $filter['partial'] = true;
     JRequest::setVar('filter', $filter);
     $oOrderModel = JModel::getInstance('order', 'enmasseModel');
     $orderList = $oOrderModel->search($filter['status'], $filter['deal_code'], $filter['deal_name'], "created_at", "DESC", true);
     $pagination = $oOrderModel->getPagination();
     $this->statusList = EnmasseHelper::$ORDER_STATUS_LIST;
     $this->filter = $filter;
     $this->orderList = $orderList;
     $this->pagination = $pagination;
     $this->deliveryPersons = EnmasseHelper::getDeliveryPersons();
     parent::display($tpl);
 }
Esempio n. 13
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. 14
0
 private function checkAccess()
 {
     $userGroup = JFactory::getUser()->groups;
     $delivererGroup = EnmasseHelper::getSetting()->delivery_group;
     if (!in_array($delivererGroup, $userGroup)) {
         $msg = JText::_('NO_PRIVILEDGE_FOR_ACCESSING');
         JFactory::getApplication()->redirect(JURI::base(), $msg, 'error');
     } else {
         return true;
     }
 }
Esempio n. 15
0
 function display($tpl = null)
 {
     $token = JRequest::getVar('token', null);
     $invtyName = JRequest::getVar('invtyName', null);
     $elementList = JModel::getInstance('couponElement', 'enmasseModel')->listAll();
     $bgImageUrl = JModel::getInstance('setting', 'enmasseModel')->getCouponBg();
     if ($invtyName != "") {
         $invty = JModel::getInstance('invty', 'enmasseModel')->getByName($invtyName);
         $orderItem = JModel::getInstance('orderItem', 'enmasseModel')->getById($invty->order_item_id ? $invty->order_item_id : 0);
         $order = JModel::getInstance('order', 'enmasseModel')->getById($orderItem->order_id ? $orderItem->order_id : 0);
         $deal = JModel::getInstance('deal', 'enmasseModel')->getById($invty->pdt_id ? $invty->pdt_id : 0);
         $merchant = JModel::getInstance('merchant', 'enmasseModel')->getById($deal->merchant_id ? $deal->merchant_id : 0);
         $merchant->branches = json_decode($merchant->branches);
         $deliveryDetail = json_decode($order->delivery_detail);
         $varList = array();
         $varList['dealName'] = $deal->name;
         $varList['serial'] = $invty->name;
         /** phuocndt
          * Get status value of Coupon
          */
         $varList['qr_code'] = $invty->name;
         $varList['detail'] = $deal->short_desc;
         $varList['merchantName'] = '';
         if ($merchant != null) {
             if (isset($merchant->branches->branch1)) {
                 $varList['merchantName'] .= $merchant->branches->branch1->name;
                 $varList['merchantName'] .= '<br />' . $merchant->branches->branch1->address;
                 $varList['merchantName'] .= '<br />' . $merchant->branches->branch1->telephone;
             }
         }
         $varList['highlight'] = $deal->highlight;
         $varList['personName'] = $deliveryDetail->name;
         $varList['term'] = $deal->terms;
     } else {
         $varList['serial'] = "";
         $varList['qr_code'] = "";
     }
     /** phuocndt
      * Debug QR code
      */
     //echo '<pre>'; print_r($varList); echo '</pre>'; die;
     if ($token != EnmasseHelper::generateCouponToken($varList['serial'])) {
         $msg = JText::_(INVALID_COUPON_TOKEN);
         $link = JRoute::_("/", false);
         JFactory::getApplication()->redirect($link, $msg);
     } else {
         $this->assignRef('varList', $varList);
         $this->assignRef('elementList', $elementList);
         $this->assignRef('bgImageUrl', $bgImageUrl);
         parent::display($tpl);
         exit(0);
     }
 }
Esempio n. 16
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. 17
0
 function display($tpl = null)
 {
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     TOOLBAR_enmasse::_SMENU();
     TOOLBAR_enmasse::_SETTING();
     $setting = JModel::getInstance('setting', 'enmasseModel')->getSetting($cid[0]);
     $countryJOptList = JModel::getInstance('setting', 'enmasseModel')->listCountryJOpt('country', $setting->country, true);
     $taxList = JModel::getInstance('tax', 'enmasseModel')->listAllPublished();
     $this->assignRef('setting', $setting);
     $this->assignRef('countryJOptList', $countryJOptList);
     $this->assignRef('taxList', $taxList);
     $this->userGroupList = EnmasseHelper::getJoomlaUserGroups();
     parent::display($tpl);
 }
Esempio n. 18
0
 function sendMail()
 {
     $post = JRequest::get('post');
     $share_url = JURI::base() . 'index.php?option=com_enmasse&controller=deal&task=view&id=' . $post['dealid'];
     if ($post['userid'] != '0') {
         $share_url .= '&referralid=' . $post['userid'];
     }
     $share_url .= '&Itemid=' . $post['itemid'];
     $content = $post['content'] . "<br/>" . JText::_('DEAL_LINK') . ": " . $share_url;
     if (EnmasseHelper::sendMail($post['recipient'], $post['subject'], $content)) {
         $this->setRedirect('index.php?option=com_enmasse&controller=mail&task=mailForm&tmpl=component&success=1');
     } else {
         $this->setRedirect('index.php?option=com_enmasse&controller=mail&task=mailForm&tmpl=component');
     }
 }
Esempio n. 19
0
 function doRefund()
 {
     $post = JRequest::get('post');
     $orderId = $post['orderid'];
     $pointRefund = $post['point'];
     $buyerId = $post['buyerid'];
     //Get Id of current user
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $pointPaid = EnmasseHelper::getPointPaidByOrderId($orderId);
     $totalPrice = EnmasseHelper::getTotalPriceByOrderId($orderId);
     $orderStatus = EnmasseHelper::getOrderStatusByOrderId($orderId);
     $refundedAmount = EnmasseHelper::getRefundedAmountByOrderId($orderId);
     //Check the last time to be sure we do for right buyer and do on a right order
     $pass = true;
     if ($pointRefund == '') {
         $msg = JText::_('INVALID_POINT');
         $pass = false;
     }
     if ($pointPaid < 0) {
         $msg = JText::_('NOT_PAID_WITH_POINT');
         $pass = false;
     }
     if ($pointRefund > $totalPrice) {
         $msg = JText::_('POINT_NOT_GREATE_TOTAL_PRICE');
         $pass = false;
     }
     if ($buyerId != $userId) {
         $msg = JText::_('NOT_OWNER');
         $pass = false;
     }
     if ($refundedAmount != 0) {
         $msg = JText::_('ALREADY_REQUESTED');
         $pass = false;
     }
     if ($pass) {
         if (JModel::getInstance('point', 'enmasseModel')->doRefund($userId, $orderId, $pointRefund)) {
             $msg = JText::_('REFUND_SUCCESSFULLY');
         } else {
             $msg = JText::_('REFUND_FAILED');
         }
         $link = JRoute::_("index.php?option=com_enmasse&controller=point&task=refundForm&orderid=" . $orderId . "&buyerid=" . $buyerid, false);
         JFactory::getApplication()->redirect($link, $msg);
     } else {
         $link = JRoute::_("index.php?option=com_enmasse&controller=point&task=refundForm&orderid=" . $orderId . "&buyerid=" . $buyerid, false);
         JFactory::getApplication()->redirect($link, $msg);
     }
 }
Esempio n. 20
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. 21
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. 22
0
 function submit_review()
 {
     $nDealId = JRequest::getVar('nDealId');
     $nRating = JRequest::getVar('nRating');
     $sReviewBody = JRequest::getVar('sReviewBody');
     // Be sure this is a valid deal id
     if ($nDealId > 0) {
         // Check for a valid rating number and review content
         // User has to select his/her rating (the number is from 1 to 5)
         // and has enter his/her review
         if ($nRating <= 0 || $nRating > 5) {
             $sMessage = JText::_('PLEASE_RATE');
             $sRedirectUrl = JRoute::_('index.php?option=com_enmasse&controller=deal&task=comment&id=' . $nDealId, false);
         } elseif ($sReviewBody == '') {
             $sMessage = JText::_('PLEASE_ENTER_REVIEW');
             $sRedirectUrl = JRoute::_('index.php?option=com_enmasse&controller=deal&task=comment&id=' . $nDealId, false);
         } else {
             if (EnmasseHelper::checkSpammer(JFactory::getUser()->get('id'))) {
                 // If this user is a spammer, lie to him/her that the review is submitted but actually we store nothing
                 $sMessage = JText::_('REVIEW_SUBMITTED_SUCCESSFULLY');
                 $sRedirectUrl = JRoute::_('index.php?option=com_enmasse&controller=deal&task=comment&id=' . $nDealId, false);
             } else {
                 $aComment = array();
                 $aComment['deal_id'] = $nDealId;
                 $aComment['user_id'] = JFactory::getUser()->get('id');
                 $aComment['comment'] = $sReviewBody;
                 $aComment['rating'] = $nRating;
                 $aComment['created_at'] = DatetimeWrapper::getDatetimeOfNow();
                 $aComment['status'] = 0;
                 $oRow = JModel::getInstance('comment', 'enmasseModel')->store($aComment);
                 if ($oRow->success) {
                     $sMessage = JText::_('REVIEW_SUBMITTED_SUCCESSFULLY');
                 } else {
                     $sMessage = JText::_('SAVE_REVIEW_FAILED');
                 }
                 $sRedirectUrl = JRoute::_('index.php?option=com_enmasse&controller=deal&task=comment&id=' . $nDealId, false);
             }
         }
     } else {
         $sMessage = JText::_('SAVE_REVIEW_FAILED');
         $sRedirectUrl = JRoute::_('index.php?option=com_enmasse&view=dealtoday', false);
     }
     $this->setRedirect($sRedirectUrl, $sMessage);
 }
Esempio n. 23
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. 24
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. 25
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. 26
0
 function display($tpl = null)
 {
     $task = JRequest::getWord('task');
     if ($task == 'edit') {
         TOOLBAR_enmasse::_LOCATION_NEW();
         $cid = JRequest::getVar('cid', array(0), '', 'array');
         $row = JModel::getInstance('location', 'enmasseModel')->getById($cid[0]);
         $this->assignRef('location', $row);
     } elseif ($task == 'add') {
         TOOLBAR_enmasse::_LOCATION_NEW();
     } else {
         /// load pagination
         $pagination =& $this->get('Pagination');
         $state =& $this->get('state');
         // get order values
         $order['order_dir'] = $state->get('filter_order_dir');
         $order['order'] = $state->get('filter_order');
         TOOLBAR_enmasse::_SMENU();
         $nNumberOfLocations = JModel::getInstance('location', 'enmasseModel')->countAll();
         if ($nNumberOfLocations == 0) {
             TOOLBAR_enmasse::_LOCATION_EMPTY();
         } else {
             //------------------------
             //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();
             $integrationObject->addMenu();
             TOOLBAR_enmasse::_LOCATION();
         }
         $locationList = JModel::getInstance('location', 'enmasseModel')->search();
         $this->assignRef('locationList', $locationList);
         $this->assignRef('pagination', $pagination);
         $this->assignRef('order', $order);
     }
     parent::display($tpl);
 }
Esempio n. 27
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. 28
0
 function doRefund($userId, $orderId, $point)
 {
     $db = JFactory::getDBO();
     $query = "UPDATE #__enmasse_order SET refunded_amount = '" . $point . "' WHERE id = '" . $orderId . "' AND refunded_amount = '0'";
     $db->setQuery($query);
     $db->query();
     if ($this->_db->getErrorNum()) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //------------------------
     //generate integration class
     $isPointSystemEnabled = EnmasseHelper::isPointSystemEnabled();
     if ($isPointSystemEnabled == true) {
         $integrationClass = EnmasseHelper::getPointSystemClassFromSetting();
         $integrateFileName = $integrationClass . '.class.php';
         require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "pointsystem" . DS . $integrationClass . DS . $integrateFileName;
         $integrationObject = new $integrationClass();
         $integrationObject->integration($userId, 'refunddeal', $point);
         return true;
     }
     return false;
 }
Esempio n. 29
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();