Example #1
0
    function checkout()
    {
        $Itemid=JRequest::getInt('Itemid');
        $price=JRequest::getFloat('amount');
        if ($price<=0){
            JError::raiseWarning(510,JText::_("FACTORY_AMOUNT_MUST_BE"));
            $this->setRedirect("index.php?option=".APP_EXTENSION."&task=balance.addfunds&Itemid=".$Itemid);
            return;
        }
        $currency= JModelLegacy::getInstance('currency','JTheFactoryModel');
        $default_currency=$currency->getDefault();

        $modelorder=JTheFactoryPricingHelper::getModel('orders');
        $item=new stdClass();
        $item->itemname=$this->name;
        $item->itemdetails=JText::_($this->description);
        $item->iteminfo=null;
        $item->price=$price;
        $item->currency=$default_currency;
        $item->quantity=1;
        $item->params='';

        $order=$modelorder->createNewOrder($item,$price,$default_currency,null,'P');
        $this->setRedirect("index.php?option=".APP_EXTENSION."&task=orderprocessor.checkout&orderid=$order->id&Itemid=".$Itemid);

    }
Example #2
0
 function search()
 {
     $session =& JFactory::getSession();
     /* kiem tra neu ko phai o trang chu thi se ko chay vao day lan nua
      * Session van se con...
      */
     // start debug
     //		echo "<pre>";
     //		print_r($_GET['limitstart']);
     //		echo "</pre>";
     //		// end debug
     //			if( isset($_POST['Itemid']) && $_POST['Itemid'] == 1)
     //		{
     $params = array('key_search' => JRequest::getVar('key_search', ''), 'project_group_id' => JRequest::getInt('project_group_id', 0), 'Itemid' => JRequest::getInt('Itemid', 0), 'cat' => JRequest::getVar('cat', ''), 'type_id' => JRequest::getInt('type_id', 0), 'department_id' => JRequest::getInt('department_id', 0), 'town_id' => JRequest::getInt('town_id', 0), 'budget_min' => JRequest::getFloat('gia_tu', 0.0), 'budget_max' => JRequest::getFloat('gia_den', 0.0), 'living_space_min' => JRequest::getInt('dientich_tu', 0), 'living_space_max' => JRequest::getInt('dientich_den', 0), 'rooms_min' => JRequest::getInt('rooms_min', 0), 'advantages' => JRequest::getVar('loaidiaoc', array(), '', 'array'), 'directions' => JRequest::getInt('directions', 0));
     $session->set('params', $params, 'jea_search');
     //		}
     if (JRequest::getVar('catDirect', '') != '') {
         $params = array();
         $session->set('params', $params, 'jea_search');
     } else {
         $params = $session->get('params', array(), 'jea_search');
     }
     // Bug correction on search pagination
     if ($limit = JRequest::getInt('limit', 0)) {
         $params['limit'] = $limit;
         $session->set('params', $params, 'jea_search');
     }
     if (!empty($params)) {
         JRequest::set($params, 'POST');
     } else {
         $params = array('key_search' => JRequest::getVar('key_search', ''));
         JRequest::set($params, 'POST');
     }
     $this->display();
 }
 /**
  * @return null
  * @throws KlarnaApiException
  */
 public function languagepack()
 {
     $sSubAction = JRequest::getWord('subAction');
     if (!isset($this->template['name']) || $this->template['name'] == '') {
         $this->template['name'] = "default";
     }
     if ($sSubAction == "klarna_box") {
         $sNewISO = JRequest::getWord('newIso');
         $sCountry = JRequest::getWord('country');
         $iSum = JRequest::getFloat('sum', 0);
         $iInvoiceFee = JRequest::getFloat('fee', 0);
         $iFlag = JRequest::getInt('flag');
         $sType = JRequest::getWord('type');
         $aParams = JRequest::getVar('params');
         $aValues = JRequest::getVar('values');
         // foreach($aValues as $key => $value) {
         // $aValues[$key] = utf8_encode($value);
         // }
         // foreach($aParams as $key => $value) {
         // $aParams[$key] = utf8_decode($value);
         // }
         if ($sType != "part" && $sType != "invoice" && $sType != "spec") {
             throw new KlarnaApiException("Invalid parameters");
         }
         $this->api->setCountry($sCountry);
         if ($sType == 'spec') {
             $types = array(KlarnaPClass::SPECIAL);
         } else {
             $types = array(KlarnaPClass::CAMPAIGN, KlarnaPClass::ACCOUNT, KlarnaPClass::FIXED);
         }
         $oApi = new KlarnaAPI($sCountry, $sNewISO, $sType, $iSum, $iFlag, $this->api, $types, VMKLARNAPLUGINWEBROOT);
         // $oApi->addSetupValue ('web_root', $this->webroot);
         // $oApi->setPaths ();
         $oApi->addSetupValue('eid', $this->eid);
         if ($sType == 'invoice') {
             $oApi->setInvoiceFee($iInvoiceFee);
         }
         $oApi->setCurrency($this->api->getCurrency());
         if (count($this->coSetup) > 0) {
             $oApi->addMultipleSetupValues($this->coSetup);
         }
         return $oApi->retrieveLayout($aParams, $aValues);
         // if ($sType == 'spec') {
         // return $oApi->retrieveHTML($aParams, $aValues, null, $this->template);
         // } else {
         // return $oApi->retrieveHTML ($aParams, $aValues);
         // }
     } else {
         if ($sSubAction == 'jsLanguagePack') {
             $sNewISO = JRequest::getWord('newIso');
             $sFetch = "";
         } else {
             throw new KlarnaApiException("Invalid sub-action");
         }
     }
 }
Example #4
0
 function display($tpl = null)
 {
     jincimport('statistics.statisticfactory');
     JHTML::stylesheet('administrator/components/com_jinc/assets/css/jinc_admin.css');
     JToolBarHelper::title(JText::_('COM_JINC_STATISTICS'), 'jinc');
     jincimport('utility.jinchelper');
     JINCHelper::helpOnLine(91);
     $session =& JFactory::getSession();
     $config =& JFactory::getConfig();
     $tzoffset = $config->getValue('config.offset');
     $this->news_id = JRequest::getInt('id', 0);
     $this->stat_type = JRequest::getInt('stat_type', STATISTICFACTORY_SUBS_TYPE);
     $this->time_type = JRequest::getInt('time_type', STATISTICFACTORY_STAT_DAILY);
     $start_date = JRequest::getFloat('start_date', time());
     $end_date = JRequest::getFloat('end_date', time());
     $sdate =& JFactory::getDate($start_date, $tzoffset);
     $edate =& JFactory::getDate($end_date, $tzoffset);
     $this->start_time = $sdate;
     $this->end_time = $edate;
     $this->values = $session->get('stats.values');
     $this->legend = $session->get('stats.legend');
     parent::display($tpl);
 }
 public function getAmount($param)
 {
     //$amount = JRequest::getFloat('Amount','');
     //converto in euro l'importo pagato
     $amount = number_format(JRequest::getFloat('udf4'), 2, '.', '');
     return $amount;
     //return parent::getResult($param);;
 }
Example #6
0
 function delBid()
 {
     header("Content-type: text/html; charset=utf-8");
     $app = JFactory::getApplication();
     $id = JRequest::getInt('id', 0);
     $cid = JRequest::getInt('cid', 0);
     $bid = JRequest::getFloat('bid', 0);
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $itemid = JRequest::getVar('Itemid');
     $par = JComponentHelper::getParams('com_djclassifieds');
     $m_type = '';
     $query = "SELECT i.*, c.name as c_name, c.alias as c_alias FROM #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON c.id=i.cat_id " . "WHERE i.id = " . $id . " ";
     $db->setQuery($query);
     $item = $db->loadObject();
     if (!$item->alias) {
         $item->alias = DJClassifiedsSEO::getAliasName($item->name);
     }
     if (!$item->c_alias) {
         $item->c_alias = DJClassifiedsSEO::getAliasName($item->c_name);
     }
     $link = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
     if ($user->id > 0) {
         if ($item) {
             if ($item->user_id == $user->id && $item->user_id > 0) {
                 $query = "DELETE FROM #__djcf_auctions WHERE item_id = " . $item->id . " AND id=" . $bid;
                 $db->setQuery($query);
                 $db->query();
                 $price_start = $item->price_start;
                 $query = "SELECT a.* FROM #__djcf_auctions a " . " WHERE a.item_id=" . $item->id . " ORDER BY a.date DESC LIMIT 1";
                 $db->setQuery($query);
                 $last_bid = $db->loadObject();
                 if ($last_bid) {
                     $price_start = $last_bid->price;
                 }
                 $query = "UPDATE #__djcf_items SET price='" . $price_start . "' " . " WHERE id=" . $item->id;
                 $db->setQuery($query);
                 $db->query();
                 $msg = JText::_('COM_DJCLASSIFIEDS_BID_DELETED');
             } else {
                 $msg = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
                 $m_type = 'error';
             }
         } else {
             $msg = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
             $m_type = 'error';
         }
     } else {
         $msg = JText::_('COM_DJCLASSIFIEDS_PLEASE_LOGIN');
         $m_type = 'error';
     }
     $link = JRoute::_($link);
     $app->redirect($link, $msg, $m_type);
     die('aaaa');
 }
 function getItems($catlist = '')
 {
     $par = JComponentHelper::getParams('com_djclassifieds');
     $limit = JRequest::getVar('limit', $par->get('limit_djitem_show'), '', 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $app = JFactory::getApplication();
     $where = '';
     if ($catlist) {
         $where = ' AND i.cat_id IN (' . $catlist . ') ';
     }
     $uid = JRequest::getVar('uid', '0', '', 'int');
     if ($uid > 0) {
         $where .= " AND i.user_id=" . $uid . " ";
     }
     $fav_s = '';
     $fav_lj = '';
     if ($par->get('favourite', '1') && $user->id > 0) {
         $fav_lj = "LEFT JOIN ( SELECT * FROM #__djcf_favourites WHERE user_id=" . $user->id . ") f ON i.id=f.item_id ";
         $fav_s = ',f.id as f_id ';
         $fav = JRequest::getVar('fav', '0', '', 'int');
         if ($fav > 0) {
             $where .= " AND f.id IS NOT NULL ";
         }
     }
     $search = '';
     $search_fields = '';
     $cat_id = 0;
     $reg_id = 0;
     $search_radius_v = '';
     $search_radius_h = '';
     if (JRequest::getVar('se', '0', '', 'string') != '0') {
         if (JRequest::getVar('search', JText::_('COM_DJCLASSIFIEDS_SEARCH'), '', 'string') != JText::_('COM_DJCLASSIFIEDS_SEARCH')) {
             $search_word = $db->Quote('%' . $db->escape(JRequest::getVar('search', '', '', 'string'), true) . '%');
             $search = " AND (CONCAT_WS(i.name,i.intro_desc,i.description) LIKE " . $search_word . " OR c.name LIKE " . $search_word . " OR r.name LIKE " . $search_word . " ) ";
         }
         if (isset($_GET['se_cats'])) {
             $cat_id = end($_GET['se_cats']);
             if ($cat_id == '' && count($_GET['se_cats']) > 2) {
                 $cat_id = $_GET['se_cats'][count($_GET['se_cats']) - 2];
             }
         }
         $cat_id = str_ireplace('p', '', $cat_id);
         if ($cat_id > 0) {
             $cats = DJClassifiedsCategory::getSubCat($cat_id, 1);
             $catlist = $cat_id;
             foreach ($cats as $c) {
                 $catlist .= ',' . $c->id;
             }
             $search .= ' AND i.cat_id IN (' . $catlist . ') ';
             $search_fields = $this->getSearchFields();
         }
         if (isset($_GET['se_regs'])) {
             $reg_id = end($_GET['se_regs']);
             if ($reg_id == '' && count($_GET['se_regs']) > 2) {
                 $reg_id = $_GET['se_regs'][count($_GET['se_regs']) - 2];
             }
             $reg_id = (int) $reg_id;
         }
         if ($reg_id > 0) {
             $regs = DJClassifiedsRegion::getSubReg($reg_id, 1);
             $reglist = $reg_id;
             foreach ($regs as $r) {
                 $reglist .= ',' . $r->id;
             }
             $search .= ' AND i.region_id IN (' . $reglist . ') ';
         }
         $se_price_from = JRequest::getInt('se_price_f', '');
         $se_price_to = JRequest::getInt('se_price_t', '');
         if ($se_price_from) {
             $search .= " AND ABS(i.price) >= " . $se_price_from . " ";
         }
         if ($se_price_to && $se_price_to > $se_price_from) {
             $search .= " AND ABS(i.price) <= " . $se_price_to . " ";
         }
         $type_id = JRequest::getInt('se_type_id', '0');
         if ($type_id > 0) {
             $where .= " AND i.type_id=" . $type_id . " ";
         }
         $days_l = JRequest::getInt('days_l', '0');
         if ($days_l > 0) {
             $date_limit = date("Y-m-d H:i:s", mktime(date("H"), date("i"), date("s"), date("m"), date("d") - $days_l, date("Y")));
             $where .= " AND i.date_start >= '" . $date_limit . "' ";
         }
         $only_img = JRequest::getInt('se_only_img', 0);
         if ($only_img == 1) {
             $search .= " AND img.img_c>0 ";
         }
         $only_video = JRequest::getInt('se_only_video', 0);
         if ($only_video == 1) {
             $search .= " AND i.video!='' ";
         }
         $postcode = JRequest::getVar('se_postcode', '');
         $radius = JRequest::getFloat('se_radius', 0);
         if ($postcode != '' && $postcode != JText::_('COM_DJCLASSIFIEDS_SEARCH_MODULE_POSTCODE') && $radius) {
             $postcode_country = JRequest::getVar('se_postcode_c', '');
             $post_coord = DJClassifiedsGeocode::getLocationPostCode($postcode, $postcode_country);
             $radius_unit = JRequest::getCmd('se_radius_unit', 'km');
             if ($radius_unit == 'mile') {
                 $radius_unit_v = 3959;
             } else {
                 $radius_unit_v = 6371;
             }
             if ($post_coord) {
                 $search_radius_v = ', ( ' . $radius_unit_v . ' * acos( cos( radians(' . $post_coord['lat'] . ') ) * cos( radians( i.latitude ) ) * cos( radians( i.longitude ) - radians(' . $post_coord['lng'] . ') ) + sin( radians(' . $post_coord['lat'] . ') ) * sin( radians( i.latitude ) ) ) ) AS distance ';
                 $search_radius_h = 'HAVING distance < ' . $radius . ' ';
             } else {
                 $app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_SORRY_WE_CANT_FIND_COORDINATES_FROM_POSTCODE_WE_OMIITED_RANGE_RESTRICTION'), 'notice');
             }
         }
     }
     $distance_v = '';
     if ($par->get('column_distance', '0') && isset($_COOKIE["djcf_latlon"])) {
         $distance_unit = JRequest::getCmd('column_distance_unit', 'km');
         $user_latlog = explode('_', $_COOKIE["djcf_latlon"]);
         if ($distance_unit == 'mile') {
             $distance_unit_v = 3959;
         } else {
             $distance_unit_v = 6371;
         }
         $distance_v = ', ( ' . $distance_unit_v . ' * acos( cos( radians(' . $user_latlog[0] . ') ) * cos( radians( i.latitude ) ) * cos( radians( i.longitude ) - radians(' . $user_latlog[1] . ') ) + sin( radians(' . $user_latlog[0] . ') ) * sin( radians( i.latitude ) ) ) ) AS distance_latlon ';
     }
     $order = JRequest::getCmd('order', $par->get('items_ordering', 'date_e'));
     $ord_t = JRequest::getCmd('ord_t', $par->get('items_ordering_dir', 'desc'));
     $ord = "i.date_exp ";
     if ($order == "title") {
         $ord = "i.name ";
     } elseif ($order == "cat") {
         $ord = "c.name ";
     } elseif ($order == "loc") {
         $ord = "r.name ";
     } elseif ($order == "price") {
         $ord = "ABS(i.price) ";
     } elseif ($order == "display") {
         $ord = "i.display ";
     } elseif ($order == "date_a") {
         $ord = "i.date_start ";
     } elseif ($order == "date_e") {
         $ord = "i.date_exp ";
     } elseif ($order == "date_sort") {
         $ord = "i.date_sort ";
     } elseif ($order == "distance") {
         $ord = $distance_v ? "distance_latlon " : "i.date_exp ";
     } elseif ($order == "random") {
         $ord = "RAND() ";
     }
     if ($ord_t == 'desc') {
         $ord .= 'DESC';
     } else {
         $ord .= 'ASC';
     }
     $date_time = JFactory::getDate();
     $date_exp = $date_time->toSQL();
     $query = "SELECT i.*, c.name AS c_name,c.alias AS c_alias, c.id as c_id, r.name as r_name, r.id as r_id, img.img_c " . $fav_s . $search_radius_v . $distance_v . " FROM " . $search_fields . " #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON i.cat_id = c.id " . "LEFT JOIN #__djcf_regions r ON i.region_id = r.id " . "LEFT JOIN ( SELECT COUNT(img.id) as img_c, img.item_id FROM #__djcf_images img\r\n\t\t\t\t\t\t\t\t WHERE img.type='item' GROUP BY item_id ) img ON i.id=img.item_id " . $fav_lj . "WHERE i.date_exp > NOW() AND i.published=1 " . $where;
     if ($search_fields) {
         $query .= " AND sf.item_id=i.id ";
     }
     if (JRequest::getVar('format', '') == 'feed') {
         $query .= $search_radius_h . $search . " ORDER BY i.date_start DESC ";
         $items = $this->_getList($query, 0, 100);
     } else {
         $query .= $search_radius_h . $search . " ORDER BY i.special DESC, " . $ord . "";
         $items = $this->_getList($query, $limitstart, $limit);
     }
     //echo '<pre>';print_r($db);print_r($items);echo '<pre>';die();
     if (count($items)) {
         $id_list = '';
         foreach ($items as $item) {
             if ($id_list) {
                 $id_list .= ',' . $item->id;
             } else {
                 $id_list .= $item->id;
             }
         }
         $query = "SELECT fv.item_id, fv.field_id, fv.value, fv.value_date,f.label, f.type FROM #__djcf_fields_values fv,#__djcf_fields f " . "WHERE fv.item_id IN (" . $id_list . ") AND f.id=fv.field_id AND (f.in_table>0 OR f.in_blog=1) AND f.access=0 AND f.published=1 " . "ORDER BY fv.item_id, f.label";
         $db->setQuery($query);
         $custom_fields = $db->loadObjectList();
         //echo '<pre>';print_r($custom_fields);die();
         $items_img = DJClassifiedsImage::getAdsImages($id_list);
         for ($i = 0; $i < count($items); $i++) {
             $cf_found = 0;
             $items[$i]->fields = array();
             foreach ($custom_fields as $cf) {
                 if ($items[$i]->id == $cf->item_id) {
                     $cf_found = 1;
                     if ($cf->type == 'date') {
                         if ($cf->value_date != '0000-00-00') {
                             $items[$i]->fields[$cf->field_id] = $cf->value_date;
                         }
                     } else {
                         $items[$i]->fields[$cf->field_id] = $cf->value;
                     }
                 } else {
                     if ($cf_found) {
                         break;
                     }
                 }
             }
             $img_found = 0;
             $items[$i]->images = array();
             foreach ($items_img as $img) {
                 if ($items[$i]->id == $img->item_id) {
                     $img_found = 1;
                     $items[$i]->images[] = $img;
                 } else {
                     if ($img_found) {
                         break;
                     }
                 }
             }
         }
     }
     //$db= &JFactory::getDBO();$db->setQuery($query);$items=$db->loadObjectList();
     //echo '<pre>';print_r($db);print_r($items);echo '<pre>';die();
     return $items;
 }
Example #8
0
    function suggest() {

        $database = JFactory::getDBO();
        $my = JFactory::getUser();
        $cfg = BidsHelperTools::getConfig();

        $auction_id = JRequest::getInt('id', 0);
        $suggest_id = JRequest::getInt('s_id', 0);
        $suggest = JRequest::getFloat('bid_suggest', 0);
        $q = JRequest::getInt('quantity', 1);

        $bidsSuggest = JTable::getInstance('bidsuggestion');

        $auctionmodel = $this->getModel('auction');
        if (!$auctionmodel->load($auction_id)) {
            $this->setRedirect('index.php?option=com_bids', JText::_('COM_BIDS_DOES_NOT_EXIST'));
            return;
        }
        $auction = $auctionmodel->get('auction');

        $redirect_link = JHtml::_('auctiondetails.auctionDetailsURL', $auction, false);

        if (!$suggest_id && $auction->userid == $my->id) {
            $this->setRedirect($redirect_link, JText::_('COM_BIDS_ERR_NO_SELF_BIDDING'));
            return;
        }

        if (!$cfg->bin_opt_price_suggestion
                || $auction->auction_type != AUCTION_TYPE_BIN_ONLY
                || !$auction->params["price_suggest"]) {
            $this->setRedirect($redirect_link, JText::_('COM_BIDS_ERR_NO_PRICE_SUGGEST'));
            return;
        }
        if ($suggest<=0) {
            $this->setRedirect($redirect_link, JText::_('COM_BIDS_ERR_VALID_SUGGEST'));
            return;
        }

        $database->setQuery('SELECT COUNT(1) FROM #__bid_suggestions WHERE userid = '.$database->quote($my->id).' AND auction_id='.$database->quote($auction_id));
        $nrSuggestions = $database->loadResult();

        if ($cfg->bin_opt_limit_suggestions <= $nrSuggestions) {
            $this->setRedirect($redirect_link, JText::_('COM_BIDS_ERR_PRICE_SUGGESTED'));
            return;
        }

        $bidsSuggest->auction_id = $auction_id;
        $bidsSuggest->userid = $my->id;
        $bidsSuggest->modified = gmdate('Y-m-d H:i');
        $bidsSuggest->bid_price = $suggest;
        $bidsSuggest->parent_id = $suggest_id;
        $bidsSuggest->quantity = $q;

        if ($auction->params["price_suggest_min"] <= $suggest) {
            $bidsSuggest->status = 2;
            $msg = JText::_('COM_BIDS_MSG_PRICE_SUGGESTED');
        } else {
            // suggested price must be higher than the lowest suggestion allowed
            $bidsSuggest->status = 0;
            $msg = JText::_('COM_BIDS_ERR_LOW_PRICE_SUGGESTED');
        }
        JTheFactoryEventsHelper::triggerEvent('onBeforeSaveSuggestion',array($auction,$bidsSuggest));
        $bidsSuggest->store();
        JTheFactoryEventsHelper::triggerEvent('onAfterSaveSuggestion',array($auction,$bidsSuggest));
        if ($bidsSuggest->status===0){
            JTheFactoryEventsHelper::triggerEvent('onRejectSuggestion',array($auction,$bidsSuggest));            
        }
        $this->setRedirect($redirect_link, $msg);
    }
 /**
  * Test JRequest::getFloat
  *
  * @return  void
  */
 public function testGetFloat()
 {
     $this->assertTrue(0.0 === JRequest::getFloat('nonExistant'));
 }
Example #10
0
 function display($tpl = NULL, $preparecontent = false)
 {
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
     // Initialise variables
     $state = $this->get('State');
     $actionmode = JRequest::getVar('actionmode', "");
     $item = $this->get('Item');
     $params =& $state->params;
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('language', $language);
     $this->assignRef('item', $item);
     $this->assignRef('actionmode', $actionmode);
     if ($actionmode == "orderpayment") {
         //recupero quanti pagamenti sono stati effettuati
         $item->paymentCount = BFCHelper::getTotalOrderPayments($item->order->OrderId);
         $item->overrideAmount = JRequest::getFloat('overrideAmount');
         //sostituisco i dati dell'ordine da pagare con i dati passati e l'ordine con un suffisso in più
         /*$item = $this->get('Item');*/
         /*$item = "fet";*/
     }
     if ($actionmode != '' && $actionmode != 'cancel' && $actionmode != 'donation' && $actionmode != 'orderpayment') {
         if ($item->order->Status != 5) {
             $hasPayed = $this->processPayment($actionmode, $item->order->OrderId);
             /* eccezione per setefi che pretende un url di ritorno */
         } else {
             //$hasPayed = true;
             $hasPayed = $this->processOrderPayment($actionmode, $item->order->OrderId, $language);
         }
         /*
         $link = '';
         if ($hasPayed){
          	
         }
         $app = JFactory::getApplication();
         $app->redirect($link, $msg);
         */
     }
     if ($actionmode == '' && $actionmode != 'donation') {
         if ($item->order->Status != 5) {
             $this->inizializePayment($item->order->OrderId);
         }
     }
     if ($actionmode == 'orderpaid') {
         $hasPayed = $item->order->Status == 5;
     }
     // assegno il riferimento dopo gli altri altrimenti non ho nessuna associazione
     $this->assignRef('hasPayed', $hasPayed);
     /*
     		$items		= $this->get('Items');
     		$pagination	= $this->get('Pagination');
     		$sortColumn 	= $state->get('list.ordering');
     		$sortDirection 	= $state->get('list.direction');
     
     // Check for errors.
     		if (count($errors = $this->get('Errors'))) {
     			JError::raiseWarning(500, implode("\n", $errors));
     			return false;
     		}
     $pagination->setAdditionalUrlParam("filter_order", $ordering);
     		$pagination->setAdditionalUrlParam("filter_order_Dir", $direction);
     
     
     $this->assignRef('items', $items);
     		$this->assignRef('pagination', $pagination);
     */
     // Display the view
     parent::display($tpl);
 }
Example #11
0
 public function getIssuesZipped()
 {
     //get request
     $showComments = JRequest::getInt('showComments');
     $limit = JRequest::getInt('limit');
     //get boundaries
     $x0up = JRequest::getFloat('x0up');
     $x0down = JRequest::getFloat('x0down');
     $y0up = JRequest::getFloat('y0up');
     $y0down = JRequest::getFloat('y0down');
     //get model and items
     $items = array();
     if (!empty($x0up) && !empty($x0down) && !empty($y0up) && !empty($y0down)) {
         $model = $this->getModel('issues');
         $items = $model->getItemsInBoundaries($x0up, $x0down, $y0up, $y0down, $limit);
     } else {
         $model = $this->getModel('issues');
         $items = $model->getItems();
     }
     //clean up and prepare for json
     foreach ($items as $item) {
         unset($item->params);
         if (!$showComments) {
             unset($item->discussion);
         }
     }
     //$document = &JFactory::getDocument();
     //$document->setMimeEncoding('text/xml');
     if (function_exists('ob_gzhandler')) {
         $document =& JFactory::getDocument();
         //$document->setMimeEncoding('application/json', true);
         //JResponse::setHeader('Content-Encoding','gzip');
         JResponse::setheader("Content-Type: text/html; charset=ISO-8859-1", true);
         //ob_start('ob_gzhandler');
         //echo json_encode($items);
         //$var = ob_get_clean();//ob_end_flush();
         //echo $var;
         //echo gzcompress(json_encode($items), 9);
         echo gzdeflate(json_encode($items), 1);
         return;
     }
     echo json_encode($items);
     return;
 }
Example #12
0
 function getProperties($all = false)
 {
     $result = array();
     $mainframe =& JFactory::getApplication();
     $params =& ComJea::getParams();
     $default_limit = $params->get('list_limit', 10);
     if ($all === false) {
         $limit = $mainframe->getUserStateFromRequest('com_jea.limit', 'limit', $default_limit, 'int');
     } else {
         $limit = 0;
     }
     $limitstart = JRequest::getInt('limitstart', 0);
     $order = $this->_db->getEscaped(JRequest::getCmd('filter_order', 'id'));
     $order_dir = $this->_db->getEscaped(JRequest::getCmd('filter_order_Dir', 'desc'));
     $select = $this->_getSqlBaseSelect();
     // $where = 'WHERE published=1 AND tp.is_renting=';
     $cat = JRequest::getCmd('cat', $params->get('cat', 'all'));
     if (JRequest::getVar('catDirect')) {
         $cat = JRequest::getVar('catDirect');
     }
     if (JRequest::getVar('searchDirect')) {
         $cat = 'selling';
     }
     //echo "cat ne:$cat";
     //Minh them code cho phan search
     if ($cat == 'all') {
         $where = 'WHERE tp.published=1 AND tp.success = 0 ';
         if (JRequest::getInt('area_id')) {
             $where .= " AND tp.area_id=" . JRequest::getInt('area_id');
         }
     } else {
         if ($cat != 'selling' && $cat != 'renting' && $cat != 'needbuying' && $cat != 'needrenting') {
             $where = 'WHERE tp.published=1 AND tp.success = 0 ';
         } else {
             $where = 'WHERE tp.published=1 AND tp.success = 0  AND tp.kind_id=';
             if ($cat == 'selling') {
                 $where .= '1';
             }
             if ($cat == 'renting') {
                 $where .= '2';
             }
             if ($cat == 'needbuying') {
                 $where .= '3';
             }
             if ($cat == 'needrenting') {
                 $where .= '4';
             }
         }
         if (JRequest::getInt('area_id')) {
             $where .= " AND tp.area_id=" . JRequest::getInt('area_id');
         }
     }
     //Ket thuc
     //$where .= ($cat == 'renting') ? '1' : '0' ;  code cu
     //if(JRequest::getVar('catDirect') || JRequest::getInt('area_id'))
     if (0) {
     } else {
         /* Tim theo ma tai san */
         $maTs = JRequest::getVar('mataisan');
         if ($maTs != NULL) {
             if (is_numeric($maTs)) {
                 global $mainframe;
                 $mainframe->redirect('index.php?option=com_jea&view=properties&Itemid=10&id= ' . $maTs);
             } else {
                 $msgbox = JText::_('NOSEARCHMTS');
                 echo "<script>alert('{$msgbox}');document.location.href='index.php'</script>";
             }
         }
         if ($key_search = JRequest::getVar('key_search', $params->get('key_search', ''))) {
             $where .= " AND ( tp.ref LIKE '%{$key_search}%' OR tp.address LIKE '%{$key_search}%' OR tp.description LIKE '%{$key_search}%' OR tp.name_vl LIKE '%{$key_search}%' OR tp.address_vl LIKE '%{$key_search}%')";
         }
         if ($type_id = JRequest::getInt('type_id', $params->get('type_id', 0))) {
             $where .= ' AND tp.type_id = ' . intval($type_id);
         }
         if ($department_id = JRequest::getInt('department_id', $params->get('department_id', 0))) {
             $where .= ' AND tp.department_id = ' . intval($department_id);
         }
         if ($town_id = JRequest::getInt('town_id', $params->get('town_id', 0))) {
             $where .= ' AND tp.town_id = ' . intval($town_id);
         }
         if ($area_id = JRequest::getInt('area_id', $params->get('area_id', 0))) {
             $where .= ' AND tp.area_id = ' . intval($area_id);
         }
         $budget_min = JRequest::getFloat('budget_min', 0.0);
         $budget_max = JRequest::getFloat('budget_max', 0.0);
         $session =& JFactory::getSession();
         if ($budget_min != 0) {
             @($_SESSION["gia_tu1"] = $budget_min);
             @($_SESSION["gia_den1"] = $budget_max);
         } else {
             if ($budget_min == 0 && $budget_max == 0) {
                 @($budget_min = $_SESSION["gia_tu1"]);
                 @($budget_max = $_SESSION["gia_den1"]);
             }
         }
         /* neu ton tai loai tin dang, loai dia oc, dia diem thi se gan gia tu gia den vao*/
         if (isset($_GET['catDirect']) || isset($_GET['type_id']) || isset($_GET['town_id']) || isset($_GET['limitstart'])) {
             /* neu ton tai gia tu gia den se lay gia tu gia den */
             if (isset($_GET['gia_tu']) && isset($_GET['gia_den'])) {
                 $budget_min = $_GET['gia_tu'];
                 $budget_max = $_GET['gia_den'];
             } else {
                 @($budget_min = $_SESSION["gia_tu1"]);
                 @($budget_max = $_SESSION["gia_den1"]);
             }
         }
         //print_r("gia tu".$budget_min);
         //print_r("gia tu".$budget_max);
         // -1 -> -1: tat ca
         // 0 -> 0 : thuong luong
         // tat ca
         if ($budget_min != -1 && $budget_min != -1) {
             // thuong luong - gia = -5
             if ($budget_min == -5 && $budget_max == -5) {
                 $where .= ' AND (tp.price = 0) ';
             } else {
                 if ($budget_min && $budget_max) {
                     $where .= ' AND ((tp.price * pu.rate >= ' . $budget_min . ' AND tp.price * pu.rate <= ' . $budget_max . ') ';
                     $where .= ' OR (tp.price * pu.rate * tp.living_space >= ' . $budget_min . ' AND tp.price * pu.rate * tp.living_space <= ' . $budget_max . ' AND pau.id = 1 AND tp.living_space > 0)) AND tp.price > 0 ';
                 } else {
                     if ($budget_min) {
                         $where .= ' AND ((tp.price * pu.rate >= ' . $budget_min . ') ';
                         $where .= ' OR (tp.price * pu.rate * tp.living_space >= ' . $budget_min . ' AND pau.id = 1 AND tp.living_space > 0)) AND tp.price > 0 ';
                     } else {
                         if ($budget_max) {
                             $where .= ' AND ((tp.price * pu.rate <= ' . $budget_max . ') ';
                             $where .= ' OR (tp.price * pu.rate * tp.living_space <= ' . $budget_max . ' AND pau.id = 1 AND tp.living_space > 0)) AND tp.price > 0 ';
                         }
                     }
                 }
             }
         }
         //print_r($where);
         if ($living_space_min = JRequest::getInt('living_space_min', 0)) {
             $where .= ' AND tp.living_space > ' . $this->_db->getEscaped($living_space_min);
         }
         if ($living_space_max = JRequest::getInt('living_space_max', 0)) {
             $where .= ' AND tp.living_space < ' . $this->_db->getEscaped($living_space_max);
         }
         if ($rooms_min = JRequest::getInt('rooms_min', 0)) {
             $where .= ' AND tp.rooms >= ' . $this->_db->getEscaped($rooms_min);
         }
         // add search for project group id
         if ($project_group_id = JRequest::getInt('project_group_id', 0)) {
             $where .= ' AND tp.project_group_id = ' . $this->_db->getEscaped($project_group_id);
         }
         if (JRequest::getVar('searchDirect')) {
             $datban = JRequest::getVar('searchDirect');
             if ($datban == 'datban') {
                 $likes = ' tp.type_id IN (7,8,9,10,11,0)';
             } else {
                 $likes = ' tp.type_id IN (1,2,0)';
             }
             $where .= ' AND ' . $likes;
         } else {
             if ($advantages = JRequest::getVar('advantages', array(), '', 'array')) {
                 /*$likes = array();
                 		
                 		foreach( $advantages as $id ){
                 			$likes[] = ' tp.advantages LIKE \'%-' .  $id .'-%\' ' ;
                 		}
                 		
                 		$where .= ' AND ' . implode('AND', $likes) ; */
                 $likes = ' tp.type_id IN (';
                 foreach ($advantages as $id) {
                     $likes .= " {$id}, ";
                 }
                 $likes .= '0)';
                 $where .= ' AND ' . $likes;
             }
         }
         /* Search theo huong */
         $directions = JRequest::getInt('directions', 0);
         if ($directions != 0) {
             $where .= ' AND direction_id= ' . $directions;
         }
     }
     $sql = $select . $where . ' ORDER BY tp.emphasis DESC, ' . $order . ' ' . strtoupper($order_dir);
     $rows = $this->_getList($sql, $limitstart, $limit);
     if (!$this->_db->getErrorNum()) {
         $result['limitstart'] = $limitstart;
         $result['limit'] = $limit;
         $result['total'] = $this->_getListCount($sql);
         $result['rows'] = $rows;
         $result['order'] = $order;
         $result['order_dir'] = $order_dir;
     } else {
         JError::raiseWarning(200, $this->_db->getErrorMsg());
         return false;
     }
     return $result;
 }
    function display($tpl = NULL, $preparecontent = false)
    {
        $document = JFactory::getDocument();
        $language = $document->getLanguage();
        // load scripts
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
        $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
        // Initialise variables
        $trackorder = false;
        $state = $this->get('State');
        $actionmode = JRequest::getVar('actionmode', "");
        $item = $this->get('Item');
        $params =& $state->params;
        $this->assignRef('state', $state);
        $this->assignRef('params', $params);
        $this->assignRef('language', $language);
        $this->assignRef('item', $item);
        $this->assignRef('actionmode', $actionmode);
        if ($actionmode == "orderpayment") {
            //recupero quanti pagamenti sono stati effettuati
            $item->paymentCount = BFCHelper::getTotalOrderPayments($item->order->OrderId);
            $item->overrideAmount = JRequest::getFloat('overrideAmount');
            //sostituisco i dati dell'ordine da pagare con i dati passati e l'ordine con un suffisso in più
            /*$item = $this->get('Item');*/
            /*$item = "fet";*/
        }
        if ($actionmode == "orderpaid") {
            $trackorder = true;
        }
        if ($actionmode != '' && $actionmode != 'cancel' && $actionmode != 'donation' && $actionmode != 'orderpayment') {
            if ($item->order->Status != 5) {
                $hasPayed = $this->processPayment($actionmode, $item->order->OrderId);
                /* eccezione per setefi che pretende un url di ritorno */
            } else {
                //$hasPayed = true;
                $hasPayed = $this->processOrderPayment($actionmode, $item->order->OrderId, $language);
            }
            /*
            $link = '';
            if ($hasPayed){
             	
            }
            $app = JFactory::getApplication();
            $app->redirect($link, $msg);
            */
        }
        if ($actionmode == '' && $actionmode != 'donation') {
            if ($item->order->Status != 5) {
                $this->inizializePayment($item->order->OrderId);
            }
        }
        if ($actionmode == 'orderpaid') {
            $hasPayed = $item->order->Status == 5;
        }
        if (isset($trackorder) && $trackorder) {
            $merchants = array();
            $merchants[] = $item->order->MerchantId;
            $criteoConfig = BFCHelper::getCriteoConfiguration(4, $merchants, $item->order->OrderId);
            if (isset($criteoConfig) && isset($criteoConfig->enabled) && $criteoConfig->enabled && count($criteoConfig->merchants) > 0) {
                $document->addScript('//static.criteo.net/js/ld/ld.js');
                $document->addScriptDeclaration('window.criteo_q = window.criteo_q || []; 
				window.criteo_q.push( 
					{ event: "setAccount", account: ' . $criteoConfig->campaignid . '}, 
					{ event: "setSiteType", type: "d" }, 
					{ event: "setEmail", email: "" }, 
					{ event: "trackTransaction", id: "' . $criteoConfig->transactionid . '",  item: [' . json_encode($criteoConfig->orderdetails) . '] }
				);');
            }
            $analyticsEnabled = $this->checkAnalytics("Sales Resource List");
            if ($analyticsEnabled && $config->get('eecenabled', 0) == 1) {
                $purchaseObject = new stdClass();
                $purchaseObject->id = "" . $item->order->OrderId;
                $purchaseObject->affiliation = "" . $item->order->Label;
                $purchaseObject->revenue = "" . $item->order->TotalAmount;
                $purchaseObject->tax = 0.0;
                $allobjects = array();
                $svcTotal = 0;
                $allservices = array_values(array_filter(simpledom_load_string($order->NotesData)->xpath("//price"), function ($prc) {
                    return (string) $prc->tag == "extrarequested";
                }));
                foreach ($allservices as $svc) {
                    $svcObj = new stdClass();
                    $svcObj->id = "" . (int) $svc->priceId . " - Service";
                    $svcObj->name = (string) $svc->name;
                    $svcObj->category = "Services";
                    $svcObj->brand = $item->Name;
                    $svcObj->variant = (string) BFCHelper::getItem($order->NotesData, 'nome', 'unita');
                    $svcObj->price = round((double) $svc->discountedamount / (int) $svc->quantity, 2);
                    $svcObj->quantity = (int) $svc->quantity;
                    $allobjects[] = $svcObj;
                    $svcTotal += (double) $svc->discountedamount;
                }
                $mainObj = new stdClass();
                $mainObj->id = "" . $item->order->RequestedItemId . " - Resource";
                $mainObj->name = (string) BFCHelper::getItem($order->NotesData, 'nome', 'unita');
                $mainObj->variant = (string) BFCHelper::getItem($order->NotesData, 'refid', 'rateplan');
                $mainObj->category = $item->MainCategoryName;
                $mainObj->brand = $item->Name;
                $mainObj->price = $item->order->TotalAmount - $svcTotal;
                $mainObj->quantity = 1;
                $allobjects[] = $mainObj;
                $document->addScriptDeclaration('callAnalyticsEEc("addProduct", ' . json_encode($allobjects) . ', "purchase", "", ' . json_encode($purchaseObject) . ');');
            }
        }
        // assegno il riferimento dopo gli altri altrimenti non ho nessuna associazione
        $this->assignRef('hasPayed', $hasPayed);
        /*
        		$items		= $this->get('Items');
        		$pagination	= $this->get('Pagination');
        		$sortColumn 	= $state->get('list.ordering');
        		$sortDirection 	= $state->get('list.direction');
        
        // Check for errors.
        		if (count($errors = $this->get('Errors'))) {
        			JError::raiseWarning(500, implode("\n", $errors));
        			return false;
        		}
        $pagination->setAdditionalUrlParam("filter_order", $ordering);
        		$pagination->setAdditionalUrlParam("filter_order_Dir", $direction);
        
        
        $this->assignRef('items', $items);
        		$this->assignRef('pagination', $pagination);
        */
        // Display the view
        parent::display($tpl);
    }
	function __construct($paypal_email,$type = 'paypal_express') {
		// Notify string
		$this->paypal_mode = $type;
		if($type == 'paypal_express')
		{
			$this->paypal_email= $paypal_email;
			$this->paypal_receiver_email= $paypal_email;
			$this->business= JRequest :: getVar('business'); //trim(stripslashes($this->_POST['business']));
			$this->item_name= JRequest :: getVar('item_name'); //trim(stripslashes($this->_POST['item_name']));
			$this->item_number= JRequest :: getVar('item_number'); //trim(stripslashes(@ $this->_POST['item_number']));
			$this->payment_status= JRequest :: getVar('payment_status'); //trim(stripslashes($this->_POST['payment_status']));
			// The order total amount including taxes, shipping and discounts
			$this->mc_gross= JRequest :: getVar('mc_gross'); //trim(stripslashes($this->_POST['mc_gross']));
			// Can be USD, GBP, EUR, CAD, JPY
			$this->currency_code= JRequest :: getVar('mc_currency'); //trim(stripslashes($this->_POST['mc_currency']));
			$this->txn_id= JRequest :: getVar('txn_id'); //trim(stripslashes($this->_POST['txn_id']));
			$this->receiver_email= JRequest :: getVar('receiver_email'); //trim(stripslashes($this->_POST['receiver_email']));
			$this->payer_email= JRequest :: getVar('payer_email'); //trim(stripslashes($this->_POST['payer_email']));
			$this->payment_date= JRequest :: getVar('payment_date'); //trim(stripslashes($this->_POST['payment_date']));
			// The Order Number (not order_id !)
			$this->invoice= JRequest :: getVar('invoice',JRequest :: getCmd('parent_txn_id')); //trim(stripslashes($this->_POST['invoice']));
			$this->amount= JRequest :: getVar('amount'); //trim(stripslashes(@ $this->_POST['amount']));
			$this->quantity= JRequest :: getVar('quantity'); //trim(stripslashes($this->_POST['quantity']));
			$this->pending_reason= JRequest :: getVar('pending_reason'); //trim(stripslashes(@ $this->_POST['pending_reason']));
			$this->payment_method= JRequest :: getVar('payment_method'); //trim(stripslashes(@ $this->_POST['payment_method'])); // deprecated
			$this->payment_type= JRequest :: getVar('payment_type'); //trim(stripslashes(@ $this->_POST['payment_type']));
			// Billto
			$this->first_name= JRequest :: getVar('first_name'); //trim(stripslashes($this->_POST['first_name']));
			$this->last_name= JRequest :: getVar('last_name'); //trim(stripslashes($this->_POST['last_name']));
			$this->address_street= JRequest :: getVar('address_street'); //trim(stripslashes(@ $this->_POST['address_street']));
			$this->address_city= JRequest :: getVar('address_city'); //trim(stripslashes(@ $this->_POST['address_city']));
			$this->address_state= JRequest :: getVar('address_state'); //trim(stripslashes(@ $this->_POST['address_state']));
			$this->address_zipcode= JRequest :: getVar('address_zip'); //trim(stripslashes(@ $this->_POST['address_zip']));
			$this->address_country= JRequest :: getVar('address_country'); //trim(stripslashes(@ $this->_POST['address_country']));
			$this->residence_country= JRequest :: getVar('residence_country'); //trim(stripslashes(@ $this->_POST['residence_country']));
			$this->address_status= JRequest :: getVar('address_status'); //trim(stripslashes(@ $this->_POST['address_status']));
			$this->payer_status= JRequest :: getVar('payer_status'); //trim(stripslashes($this->_POST['payer_status']));
			$this->notify_version= JRequest :: getVar('notify_version'); //trim(stripslashes($this->_POST['notify_version']));
			$this->verify_sign= JRequest :: getVar('verify_sign'); //trim(stripslashes($this->_POST['verify_sign']));
			$this->custom= JRequest :: getVar('custom'); //trim(stripslashes(@ $this->_POST['custom']));
			$this->txn_type= JRequest :: getVar('txn_type'); //trim(stripslashes($this->_POST['txn_type']));
			$this->subscr_id= JRequest :: getVar('subscr_id');
		}
		else
		{
			$this->first_name= JRequest :: getCmd('first_name'); //trim(stripslashes($this->_POST['first_name']));
			$this->last_name= JRequest :: getCmd('last_name'); //trim(stripslashes($this->_POST['last_name']));
			$this->address_street= JRequest :: getString('address_street'); //trim(stripslashes(@ $this->_POST['address_street']));
			$this->address_city= JRequest :: getString('address_city'); //trim(stripslashes(@ $this->_POST['address_city']));
			$this->address_state= JRequest :: getString('address_state'); //trim(stripslashes(@ $this->_POST['address_state']));
			$this->address_zipcode= JRequest :: getCmd('address_zip'); //trim(stripslashes(@ $this->_POST['address_zip']));
			$this->address_country= JRequest :: getString('address_country'); //trim(stripslashes(@ $this->_POST['address_country']));
			$this->residence_country= JRequest :: getString('residence_country'); //trim(stripslashes(@ $this->_POST['residence_country']));
			$this->address_status= JRequest :: getCmd('address_status'); //trim(stripslashes(@ $this->_POST['address_status']));
			 //trim(stripslashes($this->_POST['payer_status']));
			$this->custom= JRequest :: getCmd('custom');

			// common
			$this->business = JRequest :: getString('business');
			$this->receiver_email = JRequest :: getString('receiver_email');
			$this->payer_email = JRequest :: getString('payer_email');
			$this->test_ipn = JRequest :: getString('test_ipn');
			$this->payer_status= JRequest :: getCmd('payer_status');

			$this->payment_date= JRequest :: getString('payment_date');
			$this->notify_version= JRequest :: getCmd('notify_version'); //trim(stripslashes($this->_POST['notify_version']));
			$this->verify_sign= JRequest :: getCmd('verify_sign');

			// common variables between profile created & recurring payment
			$this->init_txn_id = JRequest :: getCmd('initial_payment_txn_id');
			$this->init_txn_status = JRequest :: getCmd('initial_payment_status');
			$this->init_payment_amount = JRequest :: getCmd('initial_payment_amount');
			$this->profile_status = JRequest :: getCmd('profile_status');

			$this->currency_code = JRequest :: getCmd('currency_code'); // Can be USD, GBP, EUR, CAD, JPY
			$this->recurring_payment_id = JRequest :: getCmd('recurring_payment_id');
			$this->amount= JRequest :: getFloat('amount');
			$this->amount_per_cycle= JRequest :: getFloat('amount_per_cycle');
			$this->payment_cycle = JRequest :: getFloat('payment_cycle');
			$this->txn_type= JRequest :: getCmd('txn_type');

			// recurring payment
			$this->mc_gross = JRequest :: getFloat('mc_gross');
			$this->mc_fee = JRequest :: getFloat('mc_fee');
			$this->payment_fee = JRequest :: getFloat('payment_fee');
			$this->payment_gross = JRequest :: getFloat('payment_gross');
			$this->txn_id = JRequest :: getCmd('txn_id');
			$this->payment_status = JRequest :: getCmd('payment_status');

			$this->mc_currency = JRequest :: getCmd('mc_currency'); // Can be USD, GBP, EUR, CAD, JPY

			// transaction refunded
			$this->parent_txn_id = JRequest :: getCmd('parent_txn_id');
			$this->reason_code = JRequest :: getString('reason_code');
			$this->invoice= JRequest :: getVar('invoice',JRequest :: getCmd('parent_txn_id'));
			$this->rp_invoice_id = JRequest :: getVar('rp_invoice_id',null);
			if (!empty($this->rp_invoice_id) && empty($this->invoice))
			{
				$this->invoice = $this->rp_invoice_id;
			}
		}


	}
Example #15
0
 /**
  *  Funkce pro zobrazení nastavení komponenty
  */
 public function config()
 {
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'config.php';
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'config' . DS . 'config.html.php';
     $configModel = new ConfigModel();
     $view = new MappingViewConfig();
     $view->assignRef('configModel', $configModel);
     /*pokud máme odeslané nastavení, tak ho uložíme...*/
     if (JRequest::getString('submitConfig', "") == "ok") {
         foreach ($_POST as $key => $value) {
             if (ereg("^config#", $key)) {
                 /*jde o naše nastavení*/
                 $keynameArr = split("#", $key);
                 switch ($keynameArr) {
                     case "matchRate":
                         $valueX = JRequest::getFloat($key, 1);
                         break;
                     case "assignClass":
                         $valueX = JRequest::getInt($key, 1);
                         break;
                     default:
                         $valueX = $value;
                         break;
                 }
                 $configModel->saveConfigValue($keynameArr[1], $keynameArr[2], $valueX);
             }
         }
         $view->assign('message', JText::_('SETTINGS_SAVED'));
     }
     /**/
     $view->display();
 }
Example #16
0
 /**
  * Saves the AJAX preference and the minimum execution time
  * @return bool
  */
 private function applyminexec()
 {
     // Get the user parameters
     $iframes = JRequest::getInt('iframes', 0);
     $minexec = JRequest::getFloat('minecxec', 2.0);
     // Save the settings
     $profile_id = AEPlatform::getInstance()->get_active_profile();
     $config = AEFactory::getConfiguration();
     $config->set('akeeba.basic.useiframe', $iframes);
     $config->set('akeeba.tuning.min_exec_time', $minexec * 1000);
     AEPlatform::getInstance()->save_configuration($profile_id);
     // Enforce the min exec time
     $timer = AEFactory::getTimer();
     $timer->enforce_min_exec_time(false);
     // Done!
     return true;
 }
';" />
			<input type="hidden" name="se_postcode_c"  value="<?php 
    echo $params->get('postcode_country', '');
    ?>
"  />
			<input type="hidden" name="se_radius_unit"  value="<?php 
    echo $radius_unit;
    ?>
"  />
			<select autocomplete="off" name="se_radius" class="inputbox" >
				<option value=""><?php 
    echo JText::_('COM_DJCLASSIFIEDS_SEARCH_SEARCH_RANGE');
    ?>
</option>
				<?php 
    echo JHtml::_('select.options', $radius_list, 'value', 'text', JRequest::getFloat('se_radius', $params->get('default_radius', '50')), true);
    ?>
			</select>
		</div>
<?php 
}
if ($params->get('show_loc', '1') == 1) {
    ?>
<div class="search_regions">	
	<?php 
    $reg_sel = '<select autocomplete="off" class="inputbox" id="se' . $module->id . '_reg_0" name="se_regs[]" onchange="se' . $module->id . '_new_reg(0,this.value);"><option value="0">' . JText::_('COM_DJCLASSIFIEDS_SELECT_LOCALIZATION') . '</option>';
    $parent_id = 0;
    $lc = 0;
    $lcount = count($regions);
    foreach ($regions as $l) {
        $lc++;
Example #18
0
 function save()
 {
     //print_r('co vao save');
     //	exit;
     global $mainframe;
     $row =& $this->getRow();
     $curprice = JRequest::getFloat('price', 0.0, 'POST');
     if (JRequest::getInt('price_unit', 0, 'POST') == '8') {
         $price_unit = "1";
         $price = $curprice * 1000000;
     } else {
         if (JRequest::getInt('price_unit', 0, 'POST') == '7') {
             $price_unit = "1";
             $price = $curprice * 1000000000;
         } else {
             $price_unit = JRequest::getInt('price_unit', 0, 'POST');
             $price = JRequest::getFloat('price', 0.0, 'POST');
         }
     }
     $datas = array('type_id' => JRequest::getInt('type_id', 0, 'POST'), 'town_id' => JRequest::getInt('town_id', 0, 'POST'), 'area_id' => JRequest::getInt('area_id', 0, 'POST'), 'direction_id' => JRequest::getInt('direction_id', 0, 'POST'), 'project_id' => JRequest::getInt('project_id', 0, 'POST'), 'project_group_id' => JRequest::getInt('project_group_id', 0, 'POST'), 'living_space' => JRequest::getVar('living_space', 0, 'POST'), 'rooms' => JRequest::getInt('rooms', 0, 'POST'), 'mainrooms' => JRequest::getInt('mainrooms', 0, 'POST'), 'bed_room' => JRequest::getInt('bed_room', 0, 'POST'), 'bathrooms' => JRequest::getInt('bathrooms', 0, 'POST'), 'toilets' => JRequest::getInt('toilets', 0, 'POST'), 'floor' => JRequest::getInt('floor', 0, 'POST'), 'published' => JRequest::getVar('published', 0, 'POST'), 'emphasis' => JRequest::getInt('emphasis', 0, 'POST'), 'contact_phone' => JRequest::getVar('phone_vl', '', 'POST'), 'living_width' => JRequest::getVar('living_width', '', 'POST'), 'living_length' => JRequest::getVar('living_length', '', 'POST'), 'legal_id' => JRequest::getInt('legal_status', 0, 'POST'), 'price_area_unit' => JRequest::getInt('price_area_unit', 0, 'POST'), 'position_id' => JRequest::getInt('position', 0, 'POST'), 'area_length' => JRequest::getVar('kv_length', 0, 'POST'), 'area_width' => JRequest::getVar('kv_width', 0, 'POST'), 'construction_length' => JRequest::getVar('xd_length', 0, 'POST'), 'construction_width' => JRequest::getVar('xd_width', 0, 'POST'), 'traffic_id' => JRequest::getVar('trafficmovement', array(), 'POST', 'array'), 'newsest' => JRequest::getInt('newsest', 0, 'POST'), 'curency_id' => $price_unit, 'price' => $price, 'realtor_id' => JRequest::getInt('realtor', 0, 'POST'), 'transaction_type_id' => JRequest::getInt('kind_id', 0, 'POST'), 'map_lat' => JRequest::getFloat('map_lat', 0, 'POST'), 'map_lng' => JRequest::getFloat('map_lng', 0, 'POST'), 'pro_total_info' => JRequest::getVar('pro_total_info', 0, 'POST'), 'advantages' => JRequest::getVar('advantagesGetValue', 0, 'POST'), 'street' => JRequest::getVar('street', 0, 'POST'), 'ward' => JRequest::getVar('ward', 0, 'POST'), 'contact_email' => JRequest::getVar('contact_email', 0, 'POST'), 'street' => JRequest::getVar('street', 0, 'POST'), 'title' => JRequest::getVar('vi_hidden_ref', '', 'POST'), 'address' => JRequest::getVar('vi_hidden_address', '', 'POST'), 'description' => JRequest::getVar('vi_hidden_description', '', 'POST', 'string', JREQUEST_ALLOWRAW), 'contact_name' => JRequest::getVar('vi_hidden_name_vl', '', 'POST'), 'contact_address' => JRequest::getVar('vi_hidden_address_vl', '', 'POST'), 'contact_note' => JRequest::getVar('vi_hidden_ghichu', 0, 'POST'), 'page_title' => JRequest::getVar('vi_hidden_page_title', 0, 'POST'), 'page_keywords' => JRequest::getVar('vi_hidden_page_keywords', 0, 'POST'), 'page_description' => JRequest::getVar('vi_hidden_page_description', 0, 'POST'), 'properties_code' => JRequest::getVar('vi_hidden_properties_key', 0, 'POST'), 'vi_title' => JRequest::getVar('vi_hidden_ref', '', 'POST'), 'vi_address' => JRequest::getVar('vi_hidden_address', '', 'POST'), 'vi_description' => JRequest::getVar('vi_hidden_description', '', 'POST', 'string', JREQUEST_ALLOWRAW), 'vi_contact_name' => JRequest::getVar('vi_hidden_name_vl', '', 'POST'), 'vi_contact_address' => JRequest::getVar('vi_hidden_address_vl', '', 'POST'), 'vi_contact_note' => JRequest::getVar('vi_hidden_ghichu', 0, 'POST'), 'vi_page_title' => JRequest::getVar('vi_hidden_page_title', 0, 'POST'), 'vi_page_keywords' => JRequest::getVar('vi_hidden_page_keywords', 0, 'POST'), 'vi_page_description' => JRequest::getVar('vi_hidden_page_description', 0, 'POST'), 'vi_properties_code' => JRequest::getVar('vi_hidden_properties_key', 0, 'POST'), 'en_title' => JRequest::getVar('en_hidden_ref', '', 'POST'), 'en_address' => JRequest::getVar('en_hidden_address', '', 'POST'), 'en_description' => JRequest::getVar('en_hidden_description', '', 'POST', 'string', JREQUEST_ALLOWRAW), 'en_contact_name' => JRequest::getVar('en_hidden_name_vl', '', 'POST'), 'en_contact_address' => JRequest::getVar('en_hidden_address_vl', '', 'POST'), 'en_contact_note' => JRequest::getVar('en_hidden_ghichu', 0, 'POST'), 'en_page_title' => JRequest::getVar('en_hidden_page_title', 0, 'POST'), 'en_page_keywords' => JRequest::getVar('en_hidden_page_keywords', 0, 'POST'), 'en_page_description' => JRequest::getVar('en_hidden_page_description', 0, 'POST'), 'en_properties_code' => JRequest::getVar('en_hidden_properties_key', 0, 'POST'));
     /*
     ordering
     date_created
     checked_out
     date_modified
     checked_out_time
      $datas['success'] = 0;
     */
     // print_r($datas);
     //exit;
     if ($created_by = JRequest::getInt('created_by', 0, 'POST')) {
         $datas['created_by'] = $created_by;
     }
     if (!$row->bind($datas)) {
         JError::raiseWarning(200, $row->getError());
         return false;
     }
     //Nam Hai chinh sua
     $token_save = $this->isRenting();
     //  print_r($row);
     ///exit;
     //         print_r($row);
     //             exit;
     //$row->is_renting = $this->isRenting() ? 1 : 0;
     //        $row->kind_id = $token_save;
     if (!$row->check()) {
         JError::raiseWarning(200, $row->getError());
         return false;
     }
     if (!$row->store()) {
         JError::raiseWarning(200, $row->getError());
         return false;
     }
     //print_r($row);
     //  exit;
     //check newsletter
     $row->checkin();
     if (!$this->_uploadImages($row->id)) {
         JError::raiseWarning(200, 'Image upload error');
         return false;
     }
     $this->_lastId = $row->id;
     if (JRequest::getVar('re_link', 0, 'POST')) {
         $dd = JRequest::getVar('re_link', 0, 'POST');
         if ($dd == 1) {
             $mainframe->redirect('index.php?option=com_jea&task=search&view=properties&catDirect=selling&Itemid=10&lang=vi&layout=default&id=' . $row->id);
         } else {
             //				echo "<script>alert('Tin đã được lưu')</script>";
             $mainframe->redirect('index.php?option=com_jea&view=manage&Itemid=8&lang=vi');
         }
     }
 }
 /**
  * Test JRequest::getFloat
  *
  * @return  void
  */
 public function testGetFloat()
 {
     $_POST['teststr'] = '1.337';
     $this->assertTrue(1.337 === JRequest::getFloat('teststr', null, 'post'));
 }
Example #20
0
 function getCountItems($catlist = '')
 {
     $par = JComponentHelper::getParams('com_djclassifieds');
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $cid = JRequest::getInt('cid', 0);
     $app = JFactory::getApplication();
     $where = '';
     if ($catlist) {
         $where = ' AND i.cat_id IN (' . $catlist . ') ';
     }
     $uid = JRequest::getVar('uid', '0', '', 'int');
     if ($uid > 0) {
         $where .= " AND i.user_id=" . $uid . " ";
     }
     $fav_lj = '';
     if ($par->get('favourite', '1') && $user->id > 0) {
         $fav_lj = "LEFT JOIN ( SELECT * FROM #__djcf_favourites WHERE user_id=" . $user->id . ") f ON i.id=f.item_id ";
         $fav = JRequest::getVar('fav', '0', '', 'int');
         if ($fav > 0) {
             $where .= " AND f.id IS NOT NULL ";
         }
     }
     $search = '';
     $search_fields = '';
     $cat_id = 0;
     $reg_id = 0;
     $search_radius_v = '';
     $search_radius_h = '';
     $search_img_count_lj = '';
     if (JRequest::getVar('se', '0', '', 'string') != '0') {
         if (JRequest::getVar('search', JText::_('COM_DJCLASSIFIEDS_SEARCH'), '', 'string') != JText::_('COM_DJCLASSIFIEDS_SEARCH')) {
             if ($par->get('search_type_phrase', 0) == 1) {
                 $se_words = explode(' ', $db->escape(JRequest::getVar('search', '', '', 'string'), true));
                 foreach ($se_words as $se_w) {
                     if (strlen($se_w) > 2) {
                         $search .= " AND (CONCAT_WS(i.name,i.intro_desc,i.description) LIKE " . $db->Quote('%' . $se_w . '%') . " OR c.name LIKE " . $db->Quote('%' . $se_w . '%') . " OR r.name LIKE " . $db->Quote('%' . $se_w . '%') . " OR i.id=" . $db->Quote($se_w) . " ) ";
                     }
                 }
             } else {
                 $search_word = $db->Quote('%' . $db->escape(JRequest::getVar('search', '', '', 'string'), true) . '%');
                 $search_word2 = $db->Quote($db->escape(JRequest::getVar('search', '', '', 'string'), true));
                 $search = " AND (CONCAT_WS(i.name,i.intro_desc,i.description) LIKE " . $search_word . " OR c.name LIKE " . $search_word . " OR r.name LIKE " . $search_word . "  OR i.id=" . $search_word2 . "  ) ";
             }
         }
         if (isset($_GET['se_cats'])) {
             if (is_array($_GET['se_cats'])) {
                 $cat_id = end($_GET['se_cats']);
                 if ($cat_id == '' && count($_GET['se_cats']) > 2) {
                     $cat_id = $_GET['se_cats'][count($_GET['se_cats']) - 2];
                 }
             } else {
                 $cat_ids = explode(',', JRequest::getVar('se_cats'));
                 $cat_id = end($cat_ids);
             }
             $cat_id = (int) $cat_id;
         }
         $cat_id = str_ireplace('p', '', $cat_id);
         if ($cat_id > 0) {
             $cats = DJClassifiedsCategory::getSubCat($cat_id, 1);
             $catlist = $cat_id;
             foreach ($cats as $c) {
                 $catlist .= ',' . $c->id;
             }
             $search .= ' AND i.cat_id IN (' . $catlist . ') ';
         }
         $se_ef = JRequest::getInt('ef', 0);
         if ($cat_id > 0 || $se_ef) {
             $search_fields = $this->getSearchFields($cat_id, $se_ef);
         }
         if (isset($_GET['se_regs'])) {
             if (is_array($_GET['se_regs'])) {
                 $reg_id = end($_GET['se_regs']);
                 if ($reg_id == '' && count($_GET['se_regs']) > 2) {
                     $reg_id = $_GET['se_regs'][count($_GET['se_regs']) - 2];
                 }
             } else {
                 $reg_ids = explode(',', JRequest::getVar('se_regs'));
                 $reg_id = end($reg_ids);
             }
             $reg_id = (int) $reg_id;
         }
         if ($reg_id > 0) {
             $regs = DJClassifiedsRegion::getSubReg($reg_id, 1);
             $reglist = $reg_id;
             foreach ($regs as $r) {
                 $reglist .= ',' . $r->id;
             }
             $search .= ' AND i.region_id IN (' . $reglist . ') ';
         }
         $se_price_from = JRequest::getInt('se_price_f', '');
         $se_price_to = JRequest::getInt('se_price_t', '');
         if ($se_price_from) {
             $search .= " AND ABS(i.price) >= '" . $se_price_from . "' ";
         }
         if ($se_price_to && $se_price_to > $se_price_from) {
             $search .= " AND ABS(i.price) <= '" . $se_price_to . "' ";
         }
         $type_id = JRequest::getInt('se_type_id', '0');
         if ($type_id > 0) {
             $where .= " AND i.type_id=" . $type_id . " ";
         }
         $days_l = JRequest::getInt('days_l', '0');
         if ($days_l > 0) {
             $date_limit = date("Y-m-d H:i:s", mktime(date("H"), date("i"), date("s"), date("m"), date("d") - $days_l, date("Y")));
             $where .= " AND i.date_start >= '" . $date_limit . "' ";
         }
         $only_img = JRequest::getInt('se_only_img', 0);
         if ($only_img == 1) {
             $search .= " AND img.img_c>0 ";
             $search_img_count_lj = "LEFT JOIN ( SELECT COUNT(img.id) as img_c, img.item_id FROM #__djcf_images img\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE img.type='item' GROUP BY item_id ) img ON i.id=img.item_id ";
         }
         $only_video = JRequest::getInt('se_only_video', 0);
         if ($only_video == 1) {
             $search .= " AND i.video!='' ";
         }
         $only_auctions = JRequest::getInt('se_only_auctions', 0);
         if ($only_auctions == 1) {
             $search .= " AND i.auction = 1 ";
         }
         $postcode = JRequest::getVar('se_postcode', '');
         $radius = JRequest::getFloat('se_radius', 0);
         $se_address = JRequest::getVar('se_address', '');
         $se_geoloc = JRequest::getVar('se_geoloc', '');
         if ($radius) {
             $radius_unit = JRequest::getCmd('se_radius_unit', 'km');
             if ($radius_unit == 'mile') {
                 $radius_unit_v = 3959;
             } else {
                 $radius_unit_v = 6371;
             }
             if ($se_geoloc) {
                 $user_latlog = explode('_', $_COOKIE["djcf_latlon"]);
                 $search_radius_v = ', ( ' . $radius_unit_v . ' * acos( cos( radians(' . $user_latlog[0] . ') ) * cos( radians( i.latitude ) ) * cos( radians( i.longitude ) - radians(' . $user_latlog[1] . ') ) + sin( radians(' . $user_latlog[0] . ') ) * sin( radians( i.latitude ) ) ) ) AS distance ';
                 $search_radius_h = 'HAVING distance < ' . $radius . ' ';
             } else {
                 if ($postcode != '' && $postcode != JText::_('COM_DJCLASSIFIEDS_SEARCH_MODULE_POSTCODE')) {
                     $postcode_country = JRequest::getVar('se_postcode_c', '');
                     $post_coord = DJClassifiedsGeocode::getLocationPostCode($postcode, $postcode_country);
                     if ($post_coord) {
                         $search_radius_v = ', ( ' . $radius_unit_v . ' * acos( cos( radians(' . $post_coord['lat'] . ') ) * cos( radians( i.latitude ) ) * cos( radians( i.longitude ) - radians(' . $post_coord['lng'] . ') ) + sin( radians(' . $post_coord['lat'] . ') ) * sin( radians( i.latitude ) ) ) ) AS distance ';
                         $search_radius_h = 'HAVING distance < ' . $radius . ' ';
                     } else {
                         //$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_SORRY_WE_CANT_FIND_COORDINATES_FROM_POSTCODE_WE_OMIITED_RANGE_RESTRICTION'),'notice');
                     }
                 } else {
                     if ($se_address != '' && $se_address != JText::_('COM_DJCLASSIFIEDS_SEARCH_MODULE_ADDRESS')) {
                         $se_address_coord = DJClassifiedsGeocode::getLocation($se_address);
                         if ($se_address_coord) {
                             $search_radius_v = ', ( ' . $radius_unit_v . ' * acos( cos( radians(' . $se_address_coord['lat'] . ') ) * cos( radians( i.latitude ) ) * cos( radians( i.longitude ) - radians(' . $se_address_coord['lng'] . ') ) + sin( radians(' . $se_address_coord['lat'] . ') ) * sin( radians( i.latitude ) ) ) ) AS distance ';
                             $search_radius_h = 'HAVING distance < ' . $radius . ' ';
                         } else {
                             //$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_SORRY_WE_CANT_FIND_COORDINATES_FROM_ADDRESS_WE_OMIITED_RANGE_RESTRICTION'),'notice');
                         }
                     }
                 }
             }
         }
         if (JRequest::getInt('se_also_18', 0) == 0) {
             $search .= " AND c.restriction_18=0 ";
         }
     } else {
         if ($par->get('restriction_18_allads', 0) == 1 && !isset($_COOKIE["djcf_warning18"])) {
             $where .= " AND c.restriction_18=0 ";
         }
     }
     $groups_acl = '0,' . implode(',', $user->getAuthorisedViewLevels());
     $where .= " AND c.access_view IN (" . $groups_acl . ") ";
     $date_time = JFactory::getDate();
     $date_exp = $date_time->toSQL();
     $date_now = date("Y-m-d H:i:s");
     $query = "SELECT count(i.id) FROM (SELECT i.id " . $search_radius_v . " FROM " . $search_fields . " #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON i.cat_id = c.id " . "LEFT JOIN #__djcf_regions r ON i.region_id = r.id " . $search_img_count_lj . $fav_lj . "WHERE i.date_exp > '" . $date_now . "' AND i.published=1 AND c.published=1 " . $where . $search;
     if ($search_fields) {
         $query .= " AND sf.item_id=i.id ";
     }
     $query .= $search_radius_h;
     $query .= " ) as i ";
     $db->setQuery($query);
     $items_count = $db->loadResult();
     //	echo '<pre>';print_r($db);print_r($items_count);echo '<pre>';die();
     return $items_count;
 }
Example #21
0
 function SavePayment()
 {
     $amount = JRequest::getFloat('amount');
     $currency = JRequest::getVar('currency');
     $refnumber = JRequest::getVar('refnumber');
     $paymentstatus = JRequest::getString('paymentstatus');
     $userid = JRequest::getInt('userid');
     $paylog = JTable::getInstance('PaymentLogTable', 'JTheFactory');
     $date = new JDate();
     $paylog->date = $date->toMySQL();
     $paylog->amount = $amount;
     $paylog->currency = $currency;
     $paylog->refnumber = $refnumber;
     $paylog->invoice = -1;
     $paylog->status = $paymentstatus;
     $paylog->userid = $userid;
     $paylog->payment_method = 'manual_payment';
     $paylog->store();
     if ($paylog->status == 'ok') {
         $model = JModel::getInstance('Balance', 'JTheFactoryModel');
         $model->increaseBalance($amount, $userid);
     }
     $this->setRedirect('index.php?option=' . APP_EXTENSION . '&task=payments.listing', JText::_("FACTORY_PAYMENT_SAVED_USER_ACCOUNT_CREDITED"));
 }
Example #22
0
 function updatePaypalOrderInfo()
 {
     $result = array();
     $id = JRequest::getInt('id');
     $order_number = JRequest::getCmd('order_number');
     $serial_number = JRequest::getCmd('payment_serial_number');
     $payment_price = JRequest::getFloat('payment_price');
     $email = JRequest::getString('email');
     $db = oseDB::instance();
     $query = " SELECT * FROM `#__osemsc_order_fix`" . " WHERE `member_id` = '{$id}'";
     $db->setQuery($query);
     $item = oseDB::loadItem('obj');
     if (empty($item)) {
         $query = " SELECT * FROM `#__osemsc_member`" . " WHERE `id` = '{$id}'";
         $db->setQuery($query);
         $memInfo = oseDB::loadItem('obj');
         // generate order and order item
         // we can copy other order to modify
         $query = " SELECT b.*,a.`params` as `oiParams` FROM `#__osemsc_order_item` AS a" . " INNER JOIN `#__osemsc_order` AS b ON a.`order_id` = b.`order_id`" . " WHERE a.`entry_id` = '{$memInfo->msc_id}' AND b.`order_status`='confirmed'" . " AND b.`payment_mode` = 'a'" . " AND b.`payment_method` = 'paypal'" . " ORDER BY b.`order_id` DESC" . " LIMIT 1";
         $db->setQuery($query);
         $oItem = oseDB::loadItem();
         unset($oItem['order_id']);
         $oItem['order_number'] = empty($order_number) ? $this->generateOrderNumber($item->user_id) : $order_number;
         $oItem['create_date'] = oseHtml::getDateTime();
         //$oItem['payment_serial_number'] = $serial_number;
         $oItem['payment_method'] = 'paypal';
         $oItem['user_id'] = $memInfo->member_id;
         // check the order number
         if (!empty($order_number)) {
             $query = " SELECT * FROM `#__osemsc_order`" . " WHERE `order_number` = " . $db->Quote($order_number) . " AND `user_id` = '{$memInfo->member_id}'";
             $db->setQUery($query);
             $fitem = oseDB::loadItem('obj');
             if (!empty($fitem)) {
                 $noItem = array();
                 $noItem['order_id'] = $fitem->order_id;
                 if (strlen($fitem->order_number) >= 32) {
                     $noItem['order_number'] = $this->generateOrderNumber($item->user_id);
                 } else {
                     $noItem['order_number'] = $fitem->order_number . '_no';
                 }
                 $updated = oseDB::update('#__osemsc_order', 'order_id', $noItem);
             }
             $updated = oseDB::insert('#__osemsc_order', $oItem);
         } else {
             $updated = oseDB::insert('#__osemsc_order', $oItem);
         }
         if (!$updated) {
             $result['success'] = false;
             $result['title'] = JText::_('ERROR');
             $result['content'] = JText::_('ERROR1');
             oseExit(oseJSON::encode($result));
         }
         $oVals = array();
         $oVals['order_id'] = $updated;
         $oVals['entry_id'] = $memInfo->msc_id;
         $oVals['payment_price'] = $oItem['payment_price'];
         $oVals['payment_currency'] = $oItem['payment_currency'];
         $oVals['params'] = $oItem['oiParams'];
         $updated = oseDB::insert('#__osemsc_order_item', $oVals);
         if (!$updated) {
             oseDB::delete('#__osemsc_order', array('order_id' => $updated));
             $result['success'] = false;
             $result['title'] = JText::_('ERROR');
             $result['content'] = JText::_('ERROR2');
             oseExit(oseJSON::encode($result));
         }
         // update member table params
         $mVals = array();
         $mVals['params'] = array();
         $mVals['id'] = $id;
         $mVals['params']['order_id'] = $oVals['order_id'];
         $mVals['params']['order_item_id'] = $updated;
         $mVals['params']['payment_mode'] = 'a';
         $mVals['params'] = oseJson::encode($mVals['params']);
         oseDB::update("#__osemsc_member", 'id', $mVals);
         // update the order paypal status
         $ofVals = array();
         $ofVals['order_id'] = $oVals['order_id'];
         $ofVals['order_item_id'] = $updated;
         $ofVals['member_id'] = $id;
         $ofVals['msc_id'] = $memInfo->msc_id;
         $ofVals['user_id'] = $memInfo->member_id;
         $ofVals['hasParams'] = 1;
         $ofVals['payment_method'] = 'paypal';
         $ofVals['payment_mode'] = 'a';
         $ofVals['status'] = 'updated';
         $ofVals['create_date'] = oseHtml::getDateTime();
         $ofVals['params'] = $oItem['params'];
         $ofVals['email'] = $email;
         oseDB::insert("#__osemsc_order_fix", $ofVals);
     } elseif (empty($item->order_id)) {
         $query = " SELECT * FROM `#__osemsc_member`" . " WHERE `id` = '{$id}'";
         $db->setQuery($query);
         $memInfo = oseDB::loadItem('obj');
         // generate order and order item
         // we can copy other order to modify
         $query = " SELECT b.*,a.`params` as `oiParams` FROM `#__osemsc_order_item` AS a" . " INNER JOIN `#__osemsc_order` AS b ON a.`order_id` = b.`order_id`" . " WHERE a.`entry_id` = '{$memInfo->msc_id}' AND b.`order_status`='confirmed'" . " AND b.`payment_mode` = 'a'" . " AND b.`payment_method` = 'paypal'" . " ORDER BY b.`order_id` DESC" . " LIMIT 1";
         $db->setQuery($query);
         $oItem = oseDB::loadItem();
         unset($oItem['order_id']);
         $oItem['order_number'] = empty($order_number) ? $this->generateOrderNumber($item->user_id) : $order_number;
         $oItem['create_date'] = oseHtml::getDateTime();
         //$oItem['payment_serial_number'] = $serial_number;
         $oItem['user_id'] = $memInfo->member_id;
         $oItem['payment_method'] = 'paypal';
         if (!empty($serial_number)) {
             $oItem['payment_serial_number'] = $serial_number;
         }
         if (!empty($payment_price)) {
             $oItem['payment_price'] = $payment_price;
             $oParams = oseJson::decode($oItem['params']);
             $oParams->subtotal = $oParams->next_total = $oParams->total = $payment_price;
             $oItem['params'] = oseJson::encode($oParams);
         }
         // check the order number
         if (!empty($order_number)) {
             $query = " SELECT * FROM `#__osemsc_order`" . " WHERE `order_number` = " . $db->Quote($order_number) . " AND `user_id` = '{$item->user_id}'";
             $db->setQUery($query);
             $fitem = oseDB::loadItem('obj');
             if (!empty($fitem)) {
                 $noItem = array();
                 $noItem['order_id'] = $fitem->order_id;
                 if (strlen($fitem->order_number) >= 32) {
                     $noItem['order_number'] = $this->generateOrderNumber($item->user_id);
                 } else {
                     $noItem['order_number'] = $fitem->order_number . '_no';
                 }
                 $updated = oseDB::update('#__osemsc_order', 'order_id', $noItem);
             }
             $updated = oseDB::insert('#__osemsc_order', $oItem);
         } else {
             $updated = oseDB::insert('#__osemsc_order', $oItem);
         }
         if (!$updated) {
             $result['success'] = false;
             $result['title'] = JText::_('ERROR');
             $result['content'] = JText::_('ERROR1');
             oseExit(oseJSON::encode($result));
         }
         $oVals = array();
         $oVals['order_id'] = $updated;
         $oVals['entry_id'] = $memInfo->msc_id;
         $oVals['payment_price'] = $oItem['payment_price'];
         $oVals['payment_currency'] = $oItem['payment_currency'];
         $oVals['params'] = $oItem['oiParams'];
         $updated = oseDB::insert('#__osemsc_order_item', $oVals);
         if (!$updated) {
             oseDB::delete('#__osemsc_order', array('order_id' => $updated));
             $result['success'] = false;
             $result['title'] = JText::_('ERROR');
             $result['content'] = JText::_('ERROR2');
             oseExit(oseJSON::encode($result));
         }
         // update member table params
         $mVals = array();
         $mVals['params'] = array();
         $mVals['id'] = $id;
         $mVals['params']['order_id'] = $oVals['order_id'];
         $mVals['params']['order_item_id'] = $updated;
         $mVals['params']['payment_mode'] = 'a';
         $mVals['params'] = oseJson::encode($mVals['params']);
         oseDB::update("#__osemsc_member", 'id', $mVals);
         // update the order paypal status
         $ofVals = array();
         $ofVals['id'] = $item->id;
         $ofVals['order_id'] = $oVals['order_id'];
         $ofVals['order_item_id'] = $updated;
         $ofVals['hasParams'] = 1;
         $ofVals['payment_method'] = 'paypal';
         $ofVals['payment_mode'] = 'a';
         $ofVals['status'] = 'updated';
         $ofVals['params'] = $oItem['params'];
         $ofVals['email'] = $email;
         oseDB::update("#__osemsc_order_fix", 'id', $ofVals);
     } else {
         $oItem = array();
         $oItem['order_id'] = $item->order_id;
         /*if(!in_array( $item->payment_method,array('paypal','system','') ) )
         		{
         			$result['success'] = false;
         			$result['title'] = JText::_('ERROR');
         			$result['content'] = 'This member does not pay by paypal';
         			
         			$result = oseJSON::encode($result);
         			oseExit($result);
         		}*/
         if (!empty($order_number)) {
             $oItem['order_number'] = $order_number;
         }
         if (!empty($order_number)) {
             $query = " SELECT * FROM `#__osemsc_order`" . " WHERE `order_number` = " . $db->Quote($order_number) . " AND `order_id` != '{$item->order_id}'" . " AND `user_id` = '{$item->user_id}'";
             $db->setQUery($query);
             $fitem = oseDB::loadItem('obj');
             if (!empty($fitem) && $fitem->order_id < $item->order_id) {
                 $noItem = array();
                 $noItem['order_id'] = $fitem->order_id;
                 if (strlen($fitem->order_number) >= 32) {
                     $noItem['order_number'] = $this->generateOrderNumber($item->user_id);
                 } else {
                     $noItem['order_number'] = $fitem->order_number . '_no';
                 }
                 $updated = oseDB::update('#__osemsc_order', 'order_id', $noItem);
             } elseif (!empty($fitem) && $fitem->order_id > $item->order_id) {
                 $query = " SELECT `order_item_id` FROM `#__osemsc_order_item`" . " WHERE `order_id` = '{$fitem->order_id}'" . " LIMIT 1";
                 $db->setQUery($query);
                 $f_order_item_id = $db->loadResult();
                 $item->order_item_id = $f_order_item_id;
                 $item->order_id = $fitem->order_id;
                 $oItem['order_id'] = $item->order_id;
                 $oItem['order_item_id'] = $item->order_item_id;
             }
         }
         if (!empty($serial_number)) {
             $oItem['payment_serial_number'] = $serial_number;
         }
         if (!empty($payment_price)) {
             $oItem['payment_price'] = $payment_price;
             $query = "SELECT `params` FROM `#__osemsc_order`" . " WHERE `order_id` = '{$item->order_id}'";
             $db->setQuery($query);
             $oParams = $db->loadResult();
             $oParams = oseJson::decode($oParams);
             $oParams->subtotal = $oParams->next_total = $oParams->total = $payment_price;
             $oItem['params'] = oseJson::encode($oParams);
             $oiVals = array();
             $oiVals['order_item_id'] = $item->order_item_id;
             $oiVals['payment_price'] = $payment_price;
             oseDB::update("#__osemsc_order_item", 'order_item_id', $oiVals);
         }
         $oItem['payment_mode'] = 'a';
         $oItem['payment_method'] = 'paypal';
         oseDB::update("#__osemsc_order", 'order_id', $oItem);
         /*$query = " UPDATE `#__osemsc_order`"
         				." SET `order_number` = ".$db->Quote($order_number)
         				.",`payment_serial_number` = ".$db->Quote($serial_number)
         				." WHERE `order_id` = '{$item->order_id}'"
         				;
         		$db->setQuery($query);
         		oseDB::query();*/
         //
         $oItem['id'] = $item->id;
         if (!empty($email)) {
             $oItem['email'] = $email;
         }
         if ($item->status == 'failed') {
             $oItem['status'] = 'updated';
         }
         oseDB::update("#__osemsc_order_fix", 'id', $oItem);
         // update member table params
         $mVals = array();
         $mVals['params'] = array();
         $mVals['id'] = $id;
         $mVals['params']['order_id'] = $item->order_id;
         $mVals['params']['order_item_id'] = $item->order_item_id;
         $mVals['params']['payment_mode'] = 'a';
         $mVals['params'] = oseJson::encode($mVals['params']);
         oseDB::update("#__osemsc_member", 'id', $mVals);
     }
     $result['success'] = true;
     $result['title'] = JText::_('SUCCESS');
     $result['content'] = JText::_('SUCCESS');
     $result = oseJSON::encode($result);
     oseExit($result);
 }
 public function getAmount($param)
 {
     //$amount = JRequest::getFloat('Amount','');
     //converto in euro l'importo pagato
     $amount = number_format(JRequest::getFloat('Amount') / COM_BOOKINGFORCONNECTOR_CONVERSIONCURRENCY, 2, '.', '');
     return $amount;
     //return parent::getResult($param);;
 }
Example #24
0
 public function getResponsePost()
 {
     $secret_seed = '78a5550430521d64d9fb5d8cd3f9b690';
     $payment_id = JRequest::getInt('id');
     $sum = JRequest::getFloat('sum');
     $clientid = JRequest::getInt('clientid');
     $order_id = JRequest::getInt('orderid');
     $key = JRequest::getString('key');
     if ($key != md5($payment_id . sprintf("%.2lf", $sum) . $clientid . $order_id . $secret_seed)) {
         echo "Error! Hash mismatch";
         exit;
     }
     $payments =& JTable::getInstance('payments', 'VideoTranslationTable');
     $payments->load($order_id);
     if ($payments->status == 0 && $payments->payment_id == 0 && $payments->user_id == $clientid) {
         $row = array();
         $row['status'] = 1;
         $row['sum'] = $sum;
         $row['payment_id'] = $payment_id;
         if (!$payments->bind($row)) {
             return JError::raiseWarning(500, $row->getError());
         }
         if (!$payments->store()) {
             JError::raiseError(500, $row->getError());
         }
         $credits =& JTable::getInstance('credit', 'VideoTranslationTable');
         $creditId = $credits->getIdByUserId($clientid);
         $row = array();
         if ($clientid) {
             $credits->load($creditId);
         } else {
             $row['id'] = '';
         }
         $row['user_id'] = $clientid;
         $row['amount'] = $credits->amount + $sum;
         if (!$credits->bind($row)) {
             return JError::raiseWarning(500, $row->getError());
         }
         if (!$credits->store()) {
             JError::raiseError(500, $row->getError());
         }
     }
     $hash = md5($payment_id . $secret_seed);
     echo "OK {$hash}";
     //        echo "<pre>";
     //        print_r($payments->id); die;
     // multiple recipients
     //        $to  = '*****@*****.**'; // note the comma
     //
     //
     //        // subject
     //        $subject = 'post response';
     //
     //        //$string = print_r($_REQUEST);
     //
     //        // message
     //        //$message= "<pre>";
     //        $message = http_build_query($_REQUEST);
     //
     //        // Mail it
     //        mail($to, $subject, $message);
 }
Example #25
0
 /**
  * Update inventory
  */
 public function update()
 {
     // get the hotel
     $hotel = $this->getHotel();
     if (!$hotel) {
         $this->setError(JText::_('COM_CHPANEL_MANAGE_ERROR_HOTEL'));
         return false;
     }
     // prepare check
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $date_format = CHPanelHelper::getDateFormat(JText::_('COM_CHPANEL_LOCALE'));
     // start
     $start = $app->getUserStateFromRequest('com_chpanel.manage.start', 'start', JFactory::getDate()->format($date_format), 'string');
     $date_start = new JDate(CHPanelHelper::correctDateFormat($start));
     $this->start_date = $date_start->format('Y-m-d');
     // end
     $end = $app->getUserStateFromRequest('com_chpanel.manage.end', 'end', JFactory::getDate('+ 1 day')->format($date_format), 'string');
     $date_end = new JDate(CHPanelHelper::correctDateFormat($end));
     $this->end_date = $date_end->format('Y-m-d');
     // check dates
     if (!$this->start_date || !$this->end_date) {
         $this->setError(JText::_('COM_CHPANEL_MANAGE_ERROR_DATES'));
         return false;
     }
     // check period
     if ($date_end->format('Ymd') < $date_start->format('Ymd')) {
         $this->setError(JText::_('COM_CHPANEL_MANAGE_ERROR_DATES'));
         return false;
     }
     // check values
     $rids = array();
     foreach ($hotel->rooms as $room) {
         if (JRequest::getString('availability_' . $room->id, '', 'post') != '') {
             $rids[] = $room->id;
         }
         if (JRequest::getString('rate_' . $room->id, '', 'post') != '') {
             $rids[] = $room->id;
         }
     }
     if (!$rids) {
         $this->setError(JText::_('COM_CHPANEL_MANAGE_ERROR_INVENTORY'));
         return false;
     }
     // set filter_month state
     JFactory::getApplication()->setUserState('com_chpanel.manage.filter.month', $date_start->format('m-Y'));
     // get the rooms ids
     $room_ids = array_unique($rids);
     // update inventory per room
     foreach ($room_ids as $room_id) {
         // get the room default rate
         foreach ($hotel->rooms as $room) {
             if ($room->id == $room_id) {
                 $default_rate = $room->rate;
             }
         }
         // get the room current inventory
         $inventory_rows = $this->getRoomInventory($room_id);
         // prepare loop dates
         $date = $date_start->toUnix();
         $while_date = $date_start->format('Ymd');
         $while_end = $date_end->format('Ymd');
         $current_date = $date_start->format('Y-m-d');
         // update inventory
         while ($while_date <= $while_end) {
             // new object query
             $row = new stdClass();
             // get row values
             if (JRequest::getString('availability_' . $room_id, '', 'post') != '') {
                 $row->availability = JRequest::getInt('availability_' . $room_id, 0, 'post');
             }
             if (JRequest::getString('rate_' . $room_id, '', 'post') != '') {
                 $row->rate = JRequest::getFloat('rate_' . $room_id, 0, 'post');
             }
             // update or insert inventory row
             if (isset($inventory_rows[$current_date])) {
                 // update row
                 $row->id = $inventory_rows[$current_date]->id;
                 $db->updateObject('#__chpanel_inventory', $row, 'id');
             } else {
                 // default availability, 0 for new rows
                 if (!isset($row->availability)) {
                     $row->availability = 0;
                 }
                 // default rate, room rack rate
                 if (!isset($row->rate)) {
                     $row->rate = $default_rate;
                 }
                 // insert row
                 $row->room_id = $room_id;
                 $row->date = $current_date;
                 $db->insertObject('#__chpanel_inventory', $row);
             }
             // update loop conditions
             $date = strtotime('+1 day', $date);
             $j_date = JFactory::getDate($date);
             $while_date = $j_date->format('Ymd');
             $current_date = $j_date->format('Y-m-d');
         }
     }
     // return ok
     JFactory::getApplication()->enqueueMessage(JText::_('COM_CHPANEL_MANAGE_APPLY_OK'));
     return true;
 }
Example #26
0
 function getSearchParameters()
 {
     $html = '';
     $model =& $this->getModel();
     $cat = JRequest::getCmd('cat', 'all');
     if (JRequest::getVar('catDirect')) {
         $cat = JRequest::getVar('catDirect');
     }
     if (JRequest::getVar('searchDirect')) {
         $cat = 'selling';
     }
     if (isset($_GET['type_id'])) {
         if ($type_id = JRequest::getInt('type_id', 0)) {
             $type =& $model->getFeature('types');
             $type->load($type_id);
             $html .= '<strong>' . $type->value . ' ' . Jtext::_($cat) . '</strong><br />' . PHP_EOL;
         }
     } else {
         $html .= '<strong>Loại Tin: ' . Jtext::_($cat) . '</strong><br />' . PHP_EOL;
         if ($type_id = JRequest::getInt('type_id', 0)) {
             $type =& $model->getFeature('types');
             $type->load($type_id);
             $html .= '<strong>' . Jtext::_('Property type') . ': </strong>' . $type->value . '<br />' . PHP_EOL;
         }
     }
     if ($department_id = JRequest::getInt('department_id', 0)) {
         $department =& $model->getFeature('departments');
         $department->load($department_id);
         $html .= '<strong>' . Jtext::_('Department') . ': </strong>' . $department->value . '<br />' . PHP_EOL;
     }
     if ($town_id = JRequest::getInt('town_id', 0)) {
         $town =& $model->getFeature('towns');
         $town->load($town_id);
         $html .= '<strong>' . Jtext::_('Town') . ': </strong>' . $town->value . '<br />' . PHP_EOL;
     }
     // In ra tham so Area o trang ket qua tim kiem
     if ($area_id = JRequest::getInt('area_id', 0)) {
         $area =& $model->getFeature('areas');
         $area->load($area_id);
         $html .= '<strong>' . Jtext::_('Area') . ': </strong>' . $area->value . '<br />' . PHP_EOL;
     }
     $budget_min = JRequest::getFloat('budget_min', -1);
     $budget_max = JRequest::getFloat('budget_max', -1);
     // thuong luong
     if ($budget_min == -5 && $budget_max == -5) {
         $html .= '<strong>' . Jtext::_('PRICE') . ': </strong>' . Jtext::_('CALL_PRICE');
     } else {
         if ($budget_min > 0) {
             $html .= '<strong>' . Jtext::_('Budget min') . ': </strong>' . reFormatPrice($budget_min) . '<br />' . PHP_EOL;
         }
         if ($budget_max > 0) {
             $html .= '<strong>' . Jtext::_('Budget max') . ': </strong>' . reFormatPrice($budget_max) . '<br />' . PHP_EOL;
         }
     }
     if ($living_space_min = JRequest::getInt('living_space_min', 0, 'jea_search')) {
         $html .= '<strong>' . Jtext::_('Living space min') . ': </strong>' . $living_space_min . ' ' . $this->params->get('surface_measure') . '<br />' . PHP_EOL;
     }
     if ($living_space_max = JRequest::getInt('living_space_max', 0, 'jea_search')) {
         $html .= '<strong>' . Jtext::_('Living space max') . ': </strong>' . $living_space_max . ' ' . $this->params->get('surface_measure') . '<br />' . PHP_EOL;
     }
     if ($rooms_min = JRequest::getInt('rooms_min', 0, 'jea_search')) {
         $html .= '<strong>' . Jtext::_('Minimum number of rooms') . ': </strong>' . $rooms_min . '<br />' . PHP_EOL;
     }
     if (JRequest::getVar('catDirect') == false) {
         $arrLoai = array();
         if (JRequest::getVar('searchDirect')) {
             $searchDirect = JRequest::getVar('searchDirect');
             if ($searchDirect == 'datban') {
                 $arrLoai[0] = 7;
                 $arrLoai[1] = 8;
                 $arrLoai[2] = 9;
                 $arrLoai[3] = 10;
                 $arrLoai[4] = 11;
             } else {
                 $arrLoai[0] = 1;
                 $arrLoai[1] = 2;
             }
             $advantages = $arrLoai;
             $options = $model->getFeatureList('types');
             array_shift($options);
             $temp = array();
             foreach ($options as $advantage) {
                 $temp[$advantage->value] = $advantage->text;
             }
             $html .= '<strong>Loại địa ốc: </strong>' . PHP_EOL . '<ul>' . PHP_EOL;
             foreach ($advantages as $id) {
                 if (isset($temp[$id])) {
                     $html .= '<li>' . $temp[$id] . '</li>' . PHP_EOL;
                 }
             }
             $html .= '</ul>' . PHP_EOL;
         } else {
             if ($advantages = JRequest::getVar('advantages', array(), '', 'array')) {
                 $options = $model->getFeatureList('types');
                 array_shift($options);
                 $temp = array();
                 foreach ($options as $advantage) {
                     $temp[$advantage->value] = $advantage->text;
                 }
                 $html .= '<strong>Loại địa ốc: </strong>' . PHP_EOL . '<ul>' . PHP_EOL;
                 foreach ($advantages as $id) {
                     if (isset($temp[$id])) {
                         $html .= '<li>' . $temp[$id] . '</li>' . PHP_EOL;
                     }
                 }
                 $html .= '</ul>' . PHP_EOL;
             }
         }
     }
     // huong
     $directions = JRequest::getInt('directions', 0);
     if ($directions > 0) {
         $directions_Value =& $model->getFeature('directions');
         $directions_Value->load($directions);
         $html .= '<strong>' . Jtext::_('directions') . ': ' . $directions_Value->value . '</strong><br />' . PHP_EOL;
     }
     return $html;
 }
Example #27
0
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
$Itemid = JRequest::getInt('Itemid');
$texpricemin = JRequest::getFloat('texpricemin');
$texpricemax = JRequest::getFloat('texpricemax');
$count = JRequest::getInt('count');
$image = JRequest::getString('image');
$thumbwidth = JRequest::getInt('thumbwidth');
$thumbheight = JRequest::getInt('thumbheight');
$show_price = JRequest::getFloat('show_price');
$show_readmore = JRequest::getBool('show_readmore');
$show_addtocart = JRequest::getBool('show_addtocart');
$show_discountpricelayout = JRequest::getBool('show_discountpricelayout');
$k = 0;
$configobj = new Redconfiguration();
// Get product helper
require_once JPATH_ROOT . '/components/com_redshop/helpers/product.php';
$producthelper = new producthelper();
?>
<table border="0" cellpadding="2" cellspacing="2">
	<?php 
for ($i = 0; $i < count($this->prdlist); $i++) {
    $row = $this->prdlist[$i];
    $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id);
    $pricetext = '';