Example #1
0
 function display($tpl = null)
 {
     $this->packages = $this->get('Packages');
     $this->companyId = JRequest::getVar("claimCompanyId");
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     parent::display($tpl);
 }
Example #2
0
 function display($tpl = null)
 {
     $this->companies = $this->get('UserCompanies');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $this->states = JBusinessDirectoryHelper::getStatuses();
     $this->translations = JBusinessDirectoryTranslations::getAllTranslations(OFFER_DESCRIPTION_TRANSLATION, $this->item->id);
     $this->languages = JBusinessUtil::getLanguages();
     //check if user has access to offer
     $user = JFactory::getUser();
     $found = false;
     foreach ($this->companies as $company) {
         if ($company->userId == $user->id && $this->item->companyId == $company->id) {
             $found = true;
         }
     }
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->categoryOptions = JBusinessUtil::getCategoriesOptions(true);
     //redirect if the user has no access and the event is not new
     if (!$found && $this->item->id != 0) {
         $msg = JText::_("LNG_ACCESS_RESTRICTED");
         $app =& JFactory::getApplication();
         $app->redirect(JRoute::_('index.php?option=com_jbusinessdirectory&view=managecompanyoffers', $msg));
     }
     parent::display($tpl);
 }
Example #3
0
 function display($tpl = null)
 {
     $state = $this->get('State');
     $this->params = $state->get("parameters.menu");
     $this->offers = $this->get('Offers');
     $this->orderBy = JRequest::getVar("orderBy", "");
     $this->categorySearch = JRequest::getVar('categorySearch', null);
     $this->citySearch = JRequest::getVar('citySearch', null);
     $this->regionSearch = JRequest::getVar('regionSearch', null);
     $this->zipCode = JRequest::getVar('zipcode');
     $searchkeyword = JRequest::getVar('searchkeyword');
     if (isset($searchkeyword)) {
         $this->searchkeyword = $searchkeyword;
     }
     $this->categories = JRequest::getVar("Categories");
     $categoryId = $this->get('CategoryId');
     if (!empty($categoryId)) {
         $this->categoryId = $categoryId;
         $this->category = $this->get('Category');
     }
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     if ($this->appSettings->enable_search_filter_offers) {
         $this->searchFilter = $this->get('SeachFilter');
     }
     $this->location = $this->get("Location");
     $session = JFactory::getSession();
     $this->radius = $session->get('radius');
     $this->pagination = $this->get('Pagination');
     $this->sortByOptions = $this->get('SortByConfiguration');
     parent::display($tpl);
 }
Example #4
0
 function display($tpl = null)
 {
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $this->translations = JBusinessDirectoryTranslations::getAllTranslations(BUSSINESS_DESCRIPTION_TRANSLATION, $this->item->id);
     $this->translationsSlogan = JBusinessDirectoryTranslations::getAllTranslations(BUSSINESS_SLOGAN_TRANSLATION, $this->item->id);
     $this->languages = JBusinessUtil::getLanguages();
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->categoryOptions = JBusinessUtil::getCategoriesOptions(true);
     //get all upgrade packages - cannot downgrade
     $price = 0;
     if (!empty($this->item->lastActivePackage) && $this->item->lastActivePackage->expired == false) {
         $price = $this->item->lastActivePackage->price;
     }
     $this->packageOptions = JBusinessDirectoryHelper::getPackageOptions($price);
     $this->location = $this->get('Location');
     $user = JFactory::getUser();
     if ($this->item->userId != $user->id && $this->item->id != 0) {
         $msg = JText::_("LNG_ACCESS_RESTRICTED");
         $app =& JFactory::getApplication();
         $app->redirect(JRoute::_('index.php?option=com_jbusinessdirectory&view=managecompanies', $msg));
     }
     $layout = JRequest::getVar("layout");
     if (!empty($layout)) {
         $this->setLayout($layout);
     }
     parent::display($tpl);
 }
Example #5
0
 function display($tpl = null)
 {
     $state = $this->get('State');
     $this->params = $state->get("parameters.menu");
     $categoryId = JRequest::getVar('categoryId');
     $this->assignRef('categoryId', $categoryId);
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $events = $this->get('Events');
     $this->assignRef('events', $events);
     //dump($events);
     $categories = $this->get('Categories');
     $this->assignRef('categories', $categories);
     if ($this->appSettings->enable_search_filter_events) {
         $serachFilter = $this->get('SeachFilter');
         $this->assignRef('searchFilter', $serachFilter);
     }
     $categoryId = $this->get('CategoryId');
     if (!empty($categoryId)) {
         $this->categoryId = $categoryId;
         $this->category = $this->get('Category');
     }
     $pagination = $this->get('Pagination');
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Example #6
0
 function display($tpl = null)
 {
     $offerId = JRequest::getVar('offerId');
     $this->assignRef('offerId', $offerId);
     $offers = $this->get('Offer');
     $this->assignRef('offer', $offers);
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     parent::display($tpl);
 }
Example #7
0
 function __construct()
 {
     parent::__construct();
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->searchFilter = array();
     $this->keyword = JRequest::getVar('searchkeyword');
     $this->categoryId = JRequest::getVar('categoryId', null);
     $this->typeSearch = JRequest::getVar('typeSearch', null);
     $this->categorySearch = JRequest::getVar('categorySearch');
     $this->startDate = JRequest::getVar('startDate');
     $this->endDate = JRequest::getVar('endDate');
     $this->preserve = JRequest::getVar('preserve', null);
     $resetSearch = JRequest::getVar('resetSearch', null);
     if (isset($this->categorySearch) || isset($this->preserve)) {
         $this->categoryId = $this->categorySearch;
     }
     $session = JFactory::getSession();
     if (isset($this->categoryId) || !empty($resetSearch)) {
         $session->set('ev-categorySearch', $this->categoryId);
         $session->set('ev-searchkeyword', "");
         $session->set('ev-typeSearch', "");
         $session->set('ev-startDate', "");
         $session->set('ev-endDate', "");
     }
     if (isset($this->typeSearch)) {
         $session->set('ev-typeSearch', $this->typeSearch);
     }
     if (isset($this->startDate)) {
         $session->set('ev-startDate', $this->startDate);
     }
     if (isset($this->endDate)) {
         $session->set('ev-endDate', $this->endDate);
     }
     if (isset($this->keyword)) {
         $session->set('ev-searchkeyword', $this->keyword);
     }
     $this->keyword = $session->get('ev-searchkeyword');
     $this->startDate = $session->get('ev-startDate');
     $this->typeSearch = $session->get('ev-typeSearch');
     $this->endDate = $session->get('ev-endDate');
     $this->categorySearch = $session->get('ev-categorySearch');
     $mainframe = JFactory::getApplication();
     // Get pagination request variables
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     $appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->enablePackages = $appSettings->enable_packages;
     $this->showPendingApproval = $appSettings->show_pending_approval == 1;
 }
Example #8
0
 function display($tpl = null)
 {
     $state = $this->get('State');
     $this->params = $state->get("parameters.menu");
     $categoryId = JRequest::getVar('categoryId');
     $this->letter = JRequest::getVar('letter');
     $this->companies = $this->get('CompaniesByLetter');
     $this->letters = $this->get('UsedLetter');
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $pagination = $this->get('Pagination');
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Example #9
0
 function display($tpl = null)
 {
     $layout = JRequest::getVar('layout', null);
     if (isset($layout)) {
         $tpl = $layout;
     }
     $this->paymentMethods = $this->get('paymentMethods');
     $this->order = $this->get('Order');
     $this->state = $this->get('State');
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->companyId = JRequest::getVar("companyId");
     $this->discount_code = JRequest::getVar("discount_code", "");
     parent::display($tpl);
 }
Example #10
0
 public static function sendApprovalEmail($company)
 {
     $applicationSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $templ = self::getEmailTemplate("Approve Email");
     $content = str_replace(EMAIL_COMPANY_NAME, $applicationSettings->company_name, $templ->email_content);
     $content = str_replace(EMAIL_BUSINESS_NAME, $company->name, $content);
     $subject = $templ->email_subject;
     $toEmail = $company->email;
     $from = $applicationSettings->company_email;
     $fromName = $applicationSettings->company_name;
     $isHtml = true;
     $bcc = array();
     return self::sendEmail($from, $fromName, $from, $toEmail, null, $bcc, $subject, $content, $isHtml);
 }
Example #11
0
 function display($tpl = null)
 {
     $tabId = JRequest::getVar('tabId');
     if (!isset($tabId)) {
         $tabId = 1;
     }
     $this->tabId = $tabId;
     $this->company = $this->get('Company');
     $this->companyAttributes = $this->get('CompanyAttributes');
     $this->pictures = $this->get('CompanyImages');
     $this->videos = $this->get('CompanyVideos');
     $this->offers = $this->get('CompanyOffers');
     $this->events = $this->get('CompanyEvents');
     $this->reviews = $this->get('Reviews');
     $this->reviewCriterias = $this->get('ReviewCriterias');
     $this->rating = $this->get('UserRating');
     $this->ratingCount = $this->get('RatingsCount');
     //$this->userCompany = $this->get('UserCompanies');
     $this->viewCount = $this->get('ViewCount');
     $this->package = $this->get('package');
     if (!empty($this->package)) {
         $this->videos = array_slice($this->videos, 0, $this->package->max_videos);
         $this->pictures = array_slice($this->pictures, 0, $this->package->max_pictures);
     }
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     if (JRequest::getVar('layout2') != '') {
         $tpl = JRequest::getVar('layout2');
     } else {
         if ($this->appSettings->company_view == 1) {
             $tpl = null;
         } else {
             if ($this->appSettings->company_view == 2) {
                 $tpl = "style_3";
             } else {
                 if ($this->appSettings->company_view == 4) {
                     $tpl = "style_4";
                 } else {
                     $tpl = "onepage";
                 }
             }
         }
     }
     if ($this->company->state == 0 || $this->company->approved == COMPANY_STATUS_DISAPPROVED || $this->appSettings->enable_packages && empty($this->package)) {
         $tpl = "inactive";
     }
     $session = JFactory::getSession();
     $this->location = $session->get('location');
     parent::display($tpl);
 }
Example #12
0
 function __construct()
 {
     parent::__construct();
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->searchFilter = array();
     $this->prepareSearchAttribtues();
     $mainframe = JFactory::getApplication();
     // Get pagination request variables
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
 }
Example #13
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $layout = JRequest::getVar("layout");
     if (isset($layout)) {
         $tpl = $layout;
     }
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     parent::display($tpl);
 }
Example #14
0
 function __construct()
 {
     $this->letter = JRequest::getVar('letter');
     parent::__construct();
     $mainframe = JFactory::getApplication();
     // Get pagination request variables
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     $appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->enablePackages = $appSettings->enable_packages;
     $this->showPendingApproval = $appSettings->show_pending_approval == 1;
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
 }
Example #15
0
 function display($tpl = null)
 {
     $state = $this->get('State');
     $this->params = $state->get("parameters.menu");
     $categories = $this->get('Categories');
     $this->assignRef('categories', $categories);
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     if ($this->appSettings->category_view == 1) {
         $tpl = "accordion";
     } else {
         if ($this->appSettings->category_view == 3) {
             $tpl = "grid";
         } else {
             $tpl = null;
         }
     }
     parent::display($tpl);
 }
Example #16
0
 function getOrder($orderId)
 {
     $orderTable = JTable::getInstance("Order", "JTable", array());
     $orderTable->load($orderId);
     $properties = $orderTable->getProperties(1);
     $order = JArrayHelper::toObject($properties, 'JObject');
     $discountCode = JRequest::getVar("discount_code");
     $ignoreCount = false;
     if (empty($discountCode) && !empty($order->discount_code)) {
         $discountCode = $order->discount_code;
         $ignoreCount = true;
     }
     $appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $order->discount_amount = 0;
     if (!empty($discountCode)) {
         $discountTable = JTable::getInstance("Discount", "JTable", array());
         $discount = $discountTable->getDiscount($discountCode, $ignoreCount);
         if (!empty($discount)) {
             $discount->package_ids = explode(",", $discount->package_ids);
             if (in_array($order->package_id, $discount->package_ids)) {
                 $order->discount = $discount;
                 if ($discount->price_type == 1) {
                     $order->discount_amount = $discount->value;
                 } else {
                     $order->discount_amount = $order->initial_amount * $discount->value / 100;
                 }
             }
         }
     }
     $order->amount = $order->initial_amount - $order->discount_amount;
     $order->vat_amount = $appSettings->vat * $order->amount / 100;
     $order->amount += $order->vat_amount;
     $packageTable = JTable::getInstance("Package", "JTable", array());
     $order->package = $packageTable->getPackage($order->package_id);
     $user = JFactory::getUser();
     $billingDetailsTable = JTable::getInstance("BillingDetails", "JTable", array());
     $order->billingDetails = $billingDetailsTable->getBillingDetails($user->id);
     return $order;
 }
Example #17
0
 function display($tpl = null)
 {
     $session = JFactory::getSession();
     $this->companies = $this->get('Items');
     $this->viewType = JRequest::getVar("view-type", LIST_VIEW);
     $categoryId = $this->get('CategoryId');
     $filterActive = JRequest::getVar("filter_active");
     if (!empty($categoryId) && empty($filterActive)) {
         $this->categoryId = $categoryId;
         $this->category = $this->get('Category');
     }
     $this->selectedCategories = $this->get("SelectedCategories");
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->categories = implode(";", $this->get("SelectedCategories"));
     if (!empty($this->categories)) {
         $this->categories .= ";";
     }
     $searchkeyword = JRequest::getVar('searchkeyword');
     if (isset($searchkeyword)) {
         $this->searchkeyword = $searchkeyword;
     }
     $this->location = $this->get("Location");
     $this->radius = $session->get('radius');
     if ($this->appSettings->enable_search_filter) {
         $this->searchFilter = $this->get('SearchFilter');
     }
     $this->pagination = $this->get('Pagination');
     $this->orderBy = JRequest::getVar("orderBy", "packageOrder desc");
     $this->categorySearch = JRequest::getVar('categorySearch', null);
     $this->citySearch = JRequest::getVar('citySearch', null);
     $this->regionSearch = JRequest::getVar('regionSearch', null);
     $this->zipCode = JRequest::getVar('zipcode');
     $this->maincategories = $this->get("MainCategories");
     $this->subcategories = $this->get("SubCategories");
     $this->sortByOptions = $this->get('SortByConfiguration');
     $session = JFactory::getSession();
     $this->location = $session->get('location');
     parent::display($tpl);
 }
Example #18
0
# Technical Support:  Forum - http://www.cmsjunkie.com/forum/j-businessdirectory/?p=1
-------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');
require_once JPATH_COMPONENT_SITE . '/classes/attributes/attributeservice.php';
$user = JFactory::getUser();
$document = JFactory::getDocument();
$config = new JConfig();
$title = JText::_("LNG_CATALOG") . ' | ' . $config->sitename;
$description = $this->appSettings->meta_description;
$document->setTitle($title);
$document->setDescription($description);
$document->setMetaData('keywords', $this->appSettings->meta_keywords);
jimport('joomla.application.module.helper');
// this is where you want to load your module position
$modules = JModuleHelper::getModules('categories-catalog');
$appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
$fullWidth = true;
?>

<?php 
if (!empty($this->params) && $this->params->get('show_page_heading', 1)) {
    ?>
    <div class="page-header">
        <h1 class="title"> <?php 
    echo $this->escape($this->params->get('page_heading'));
    ?>
 </h1>
    </div>
<?php 
}
?>
Example #19
0
 function display($tpl = null)
 {
     $this->orders = $this->get('Orders');
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     parent::display($tpl);
 }
Example #20
0
 function __construct()
 {
     parent::__construct();
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->eventId = JRequest::getVar('eventId');
 }
Example #21
0
 function __construct()
 {
     parent::__construct();
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->searchFilter = array();
     $this->keyword = JRequest::getVar('searchkeyword');
     $this->categoryId = JRequest::getVar('categoryId', null);
     $this->citySearch = JRequest::getVar('citySearch', null);
     $this->regionSearch = JRequest::getVar('regionSearch', null);
     $this->categorySearch = JRequest::getVar('categorySearch');
     $this->zipCode = JRequest::getVar('zipcode');
     $this->radius = JRequest::getVar('radius');
     $this->preserve = JRequest::getVar('preserve', null);
     $this->orderBy = JRequest::getVar("orderBy", "");
     if (isset($this->categorySearch) || isset($this->preserve)) {
         $this->categoryId = $this->categorySearch;
     }
     $session = JFactory::getSession();
     if (isset($this->categoryId)) {
         $session->set('of-categorySearch', $this->categoryId);
         $session->set('of-searchkeyword', "");
         $session->set('of-citySearch', "");
         $session->set('of-regionSearch', "");
     }
     if (isset($this->citySearch)) {
         $session->set('of-citySearch', $this->citySearch);
     }
     if (isset($this->regionSearch)) {
         $session->set('of-regionSearch', $this->regionSearch);
     }
     if (isset($this->keyword)) {
         $session->set('of-searchkeyword', $this->keyword);
     }
     if (isset($this->zipCode)) {
         $session->set('of-zipcode', $this->zipCode);
     }
     if (isset($this->radius)) {
         $session->set('of-radius', $this->radius);
     }
     $this->keyword = $session->get('of-searchkeyword');
     $this->citySearch = $session->get('of-citySearch');
     $this->regionSearch = $session->get('of-regionSearch');
     $this->categorySearch = $session->get('of-categorySearch');
     $this->zipCode = $session->get('of-zipcode');
     $this->radius = $session->get('of-radius');
     $this->location = null;
     if ($this->appSettings->metric == 0) {
         $this->radius = $this->radius * 0.621371;
     }
     $mainframe = JFactory::getApplication();
     // Get pagination request variables
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     $appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $this->enablePackages = $appSettings->enable_packages;
     $this->showPendingApproval = $appSettings->show_pending_approval == 1;
     if (isset($this->zipCode) && $this->zipCode != "") {
         $this->location = JBusinessUtil::getCoordinates($this->zipCode);
     }
 }
Example #22
0
 function __construct()
 {
     parent::__construct();
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
 }
Example #23
0
 function prepareEmail($company, $templEmail, $data)
 {
     $fistName = isset($data["firstName"]) ? $data["firstName"] : "";
     $lastName = isset($data["lastName"]) ? $data["lastName"] : "";
     $description = isset($data["description"]) ? $data["description"] : "";
     $email = isset($data["email"]) ? $data["email"] : "";
     $abuseTxt = isset($data["description"]) ? $data["description"] : "";
     $expDays = isset($data["nrDays"]) ? $data["nrDays"] : "";
     $reviewName = isset($data["reviewName"]) ? $data["reviewName"] : "";
     $category = isset($data["category"]) ? $data["category"] : "";
     $reviewLink = JRoute::_('index.php?option=com_jbusinessdirectory&controller=companies&task=showcompany&view=companies&tabId=3&companyId=' . $company->id, true, -1);
     $reviewLink = '<a href="' . $reviewLink . '">' . $reviewLink . '</a>';
     $companyLink = JBusinessUtil::getCompanyLink($company);
     $companyLink = '<a href="' . $companyLink . '">' . $company->name . '</a>';
     $templEmail = str_replace(EMAIL_CATEGORY, $category, $templEmail);
     $templEmail = str_replace(EMAIL_FIRST_NAME, $fistName, $templEmail);
     $templEmail = str_replace(EMAIL_LAST_NAME, $lastName, $templEmail);
     $templEmail = str_replace(EMAIL_REVIEW_LINK, $reviewLink, $templEmail);
     $templEmail = str_replace(EMAIL_BUSINESS_NAME, $companyLink, $templEmail);
     $templEmail = str_replace(EMAIL_CONTACT_EMAIL, $email, $templEmail);
     $templEmail = str_replace(EMAIL_CONTACT_CONTENT, $description, $templEmail);
     $templEmail = str_replace(EMAIL_ABUSE_DESCRIPTION, $description, $templEmail);
     $templEmail = str_replace(EMAIL_EXPIRATION_DAYS, $expDays, $templEmail);
     $templEmail = str_replace(EMAIL_REVIEW_NAME, $reviewName, $templEmail);
     $applicationSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $templEmail = str_replace(EMAIL_COMPANY_NAME, $applicationSettings->company_name, $templEmail);
     return "<div style='width: 600px;'>" . $templEmail . '</div>';
 }
Example #24
0
 public function processTransaction($data)
 {
     $appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $language = JBusinessUtil::getCurrentLanguageCode();
     $this->returnUrl = urlencode(JRoute::_('index.php?option=com_jbusinessdirectory&task=payment.processResponse&processor=eway', false, -1));
     $this->cancelUrl = urlencode(JRoute::_('index.php?option=com_jbusinessdirectory&task=payment.processCancelResponse&processor=eway', false, -1));
     $result = new stdClass();
     $result->transaction_id = 0;
     $result->amount = $data->amount;
     $result->payment_date = date("Y-m-d");
     $result->response_code = 0;
     $result->order_id = $data->id;
     $result->currency = $data->currency;
     $result->processor_type = $this->type;
     $ewayurl = "";
     $ewayurl .= "?CustomerID=" . $this->customerId;
     $ewayurl .= "&UserName="******"&Amount=" . $data->amount;
     $ewayurl .= "&Currency=" . $data->currency;
     $ewayurl .= "&PageTitle=" . $data->service;
     $ewayurl .= "&PageDescription=" . $data->service . " " . $data->description;
     $ewayurl .= "&Language=" . $language;
     $ewayurl .= "&CompanyName=" . $appSettings->company_name;
     $ewayurl .= "&CustomerFirstName=" . $data->billingDetails->first_name;
     $ewayurl .= "&CustomerLastName=" . $data->billingDetails->last_name;
     $ewayurl .= "&CustomerAddress=" . $data->billingDetails->address;
     $ewayurl .= "&CustomerCity=" . $data->billingDetails->city;
     $ewayurl .= "&CustomerState=" . $data->billingDetails->region;
     $ewayurl .= "&CustomerPostCode=" . $data->billingDetails->postal_code;
     $ewayurl .= "&CustomerCountry=" . $data->billingDetails->country;
     $ewayurl .= "&CustomerPhone=" . $data->billingDetails->phone;
     $ewayurl .= "&CustomerEmail=" . $data->billingDetails->email;
     $ewayurl .= "&InvoiceDescription=" . $data->service . " " . $data->description;
     $ewayurl .= "&CancelURL=" . $this->cancelUrl;
     $ewayurl .= "&ReturnUrl=" . $this->returnUrl;
     //$ewayurl.="&CompanyLogo=".$_POST['CompanyLogo'];
     //$ewayurl.="&PageBanner=".$_POST['(PageBanner'];
     $ewayurl .= "&MerchantReference=" . $data->id;
     //$ewayurl.="&MerchantInvoice=".$_POST['Invoice'];
     $spacereplace = str_replace(" ", "%20", $ewayurl);
     $posturl = "https://nz.ewaygateway.com/Request/{$spacereplace}";
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $posturl);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_HEADER, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     if (defined("CURL_PROXY_REQUIRED") && CURL_PROXY_REQUIRED == 'True') {
         $proxy_tunnel_flag = defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE' ? false : true;
         curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag);
         curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
         curl_setopt($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS);
     }
     $response = curl_exec($ch);
     $responsemode = $this->fetch_data($response, '<result>', '</result>');
     $responseurl = $this->fetch_data($response, '<uri>', '</uri>');
     $this->paymentUrl = $responseurl;
     if ($responsemode == "True") {
         $result->status = PAYMENT_REDIRECT;
         $result->payment_status = PAYMENT_STATUS_PENDING;
     } else {
         $result->status = PAYMENT_ERROR;
         $result->payment_status = PAYMENT_STATUS_FAILURE;
     }
     return $result;
 }
Example #25
0
 function requestQuoteCompanyAjax()
 {
     // Check for request forgeries.
     $appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     $data = JRequest::get('post');
     $errorFlag = false;
     $message = "";
     if ($appSettings->captcha && false) {
         $namespace = "jbusinessdirectory.contact";
         $captcha = JCaptcha::getInstance("recaptcha", array('namespace' => $namespace));
         if (!$captcha->checkAnswer($post['recaptcha_response_field'])) {
             $error = $captcha->getError();
             $this->setMessage("Captcha error!", 'warning');
             $message = "Captcha error";
             $errorFlag = true;
             return;
         }
     }
     $model = $this->getModel('companies');
     $result = $model->requestQuoteCompany($data);
     if ($result) {
         $this->setMessage(JText::_('COM_JBUSINESS_DIRECTORY_COMPANY_CONTACTED'));
     } else {
         $this->setMessage(JText::_('COM_JBUSINESS_DIRECTORY_COMPANY_NOT_CONTACTED'));
         $message = "JText::_('COM_JBUSINESS_DIRECTORY_COMPANY_NOT_CONTACTED')";
         $errorFlag = true;
     }
     echo '<?xml version="1.0" encoding="utf-8" ?>';
     echo '<category_statement>';
     echo '<answer error="' . (!$errorFlag ? "0" : "1") . '" errorMessage="' . $message . '"/>';
     echo '</category_statement>';
     echo '</xml>';
     exit;
 }
Example #26
0
 function processResponse()
 {
     $this->log->LogDebug("process response");
     $data = JRequest::get('post');
     $this->log->LogDebug(serialize($data));
     $processorType = JRequest::getVar("processor");
     $processor = PaymentService::createPaymentProcessor($processorType);
     $paymentDetails = $processor->processResponse($data);
     if ($paymentDetails->status == PAYMENT_CANCELED || $paymentDetails->status == PAYMENT_ERROR) {
         PaymentService::updatePayment($paymentDetails);
         $msg = JText::_("LNG_TRANSACTION_FAILED");
         $this->setRedirect(JRoute::_('index.php?option=com_jbusinessdirectory&view=payment&orderId=' . $paymentDetails->order_id, false), $msg);
     } else {
         $msg = JText::_("LNG_PAYMENT_PROCESSED_SUCCESSFULLY");
         $this->setRedirect(JRoute::_('index.php?option=com_jbusinessdirectory&view=orders', false), $msg);
         $appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
         if ($appSettings->direct_processing) {
             $this->processDirectProccessing($paymentDetails);
         }
         if (isset($paymentDetails->processAutomatically)) {
             $this->processAutomaticResponse();
         }
     }
 }
Example #27
0
 function display($tpl = null)
 {
     $this->item = $this->get('Invoice');
     $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
     parent::display($tpl);
 }