예제 #1
0
 function display($tpl = null)
 {
     // load language:
     $model = $this->getModel();
     $model->loadVirtuemart();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     $config = new JModelConfig();
     $config->loadVmConfig();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'listfactory.php';
     $this->statuses = $config->getOrderStatuses();
     // Get data from the model
     $pagination = $this->get('Pagination');
     $items = $this->get('Data');
     $total = $this->get('Total');
     $ehelper = new OnepageTemplateHelper();
     $templates = $ehelper->getExportTemplates('ALL');
     $templates = $model->getTemplates();
     //$order_data = $model->getOrderData();
     //$ehelper = new OnepageTemplateHelper($order_id);
     $this->assignRef('ehelper', $ehelper);
     $this->assignRef('templates', $templates);
     $this->assignRef('model', $model);
     // push data into the template
     $this->assignRef('items', $items);
     $this->assignRef('total', $total);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
예제 #2
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $model = $this->getModel();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'videohelp.php';
     //$config = JController::getModel('config', 'JModel');
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     $config = new JModelConfig();
     $config->loadVmConfig();
     //var_dump($config); die();
     $this->statuses = $config->getOrderStatuses();
     $this->trackingfiles = $config->getPhpTrackingThemes();
     $this->forms = $model->getJforms($this->trackingfiles);
     $this->isEnabled = $model->isEnabled();
     $this->tracking_order = $model->isEnabled(true);
     $this->config = $model->getStatusConfig($this->statuses);
     $rand_order = JRequest::getVar('show_order_vars', false);
     $named = array();
     $this->orderVars = $model->getOrderVars($named);
     $this->named = $named;
     $this->model =& $model;
     $this->aba_enabled = $model->getAba();
     if ($rand_order) {
         $model->showOrderVars();
         JFactory::getApplication()->close();
     }
     //debug_zval_dump ($this->forms['adwordstracking']); die();
     parent::display($tpl);
 }
예제 #3
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $model = $this->getModel();
     //$config = JController::getModel('config', 'JModel');
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     $config = new JModelConfig();
     $config->loadVmConfig();
     $this->data = $model->getData();
     $this->model = $model;
     $this->cats = $model->getVmCats();
     //debug_zval_dump ($this->forms['adwordstracking']); die();
     parent::display($tpl);
 }
예제 #4
0
    function store()
    {
        require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
        if (!OPCmini::tableExists('virtuemart_shipment_plg_pickup_or_free_conf')) {
            $db = JFactory::getDBO();
            $q = '
	
CREATE TABLE IF NOT EXISTS `#__virtuemart_shipment_plg_pickup_or_free_conf` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `from` int(11) NOT NULL,
  `to` int(11) NOT NULL,
  `route` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci AUTO_INCREMENT=1 ;';
            $db->setQuery($q);
            $db->query();
            $e = $db->getErrorMsg();
            if (!empty($e)) {
                return $e;
            }
        }
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
        /*	
        if (!OPCJ3)
        	{
        	 require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_onepage'.DS.'helpers'.DS.'opcparameters.php'); 
        	}
        	else
        	{
        
        	}
        */
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'jformrender.php';
        require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
        $config = new JModelConfig();
        $config->loadVmConfig();
        $files = $config->getPhpTrackingThemes();
        $statuses = $config->getOrderStatuses();
        $data = JRequest::get('post');
        jimport('joomla.filesystem.file');
        return;
    }
예제 #5
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $model = $this->getModel();
     //$config = JController::getModel('config', 'JModel');
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     $config = new JModelConfig();
     $config->loadVmConfig();
     $model->getGeneral($this);
     //var_dump($config); die();
     $this->avai = $model->getAvai();
     $this->model =& $model;
     $this->numprods = $model->getNumProducts();
     $this->trackingfiles = $model->getPhpExportThemes();
     $this->forms = $model->getJforms($this->trackingfiles);
     $this->shoppergroups = $model->getShopperGroups();
     $this->langs = $model->getLanguages();
     $this->isEnabled = $model->isEnabled();
     $model->checkCompression($this);
     $this->xml_export_customs = OPCconfig::getValue('xmlexport_config', 'xml_export_customs', 0, false);
     //debug_zval_dump ($this->forms['adwordstracking']); die();
     parent::display($tpl);
 }
예제 #6
0
 function display($tpl = null)
 {
     if (!class_exists('VmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig(true);
     if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php')) {
         include JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     }
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     $model = new JModelConfig();
     //$limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'));
     //limitstart = JRequest::getVar('limitstart', 0);
     /*
     if (!file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'classes'.DS.'ps_onepage.php'))
     {
      $model->install(true);
     }
     */
     $model->loadVmConfig('config');
     require_once JPATH_COMPONENT . DS . 'assets' . DS . 'export_helper.php';
     $this->ehelper = new OnepageTemplateHelper();
     $this->opcexts = $model->getOPCExtensions();
     $countries = $model->getShippingCountries();
     $pms = $model->getPaymentMethods();
     $sty = $model->getClassNames();
     $default_country = $model->getDefaultC();
     $dis = $model->getDisabledOPC();
     $this->assignRef('disable_onepage', $dis);
     $model->checkLangFiles();
     $trackingfiles = $model->getPhpTrackingThemes();
     $this->assignRef('trackingfiles', $trackingfiles);
     $model->getExtLangVars();
     $langs = $model->getLanguages();
     $css = $model->retCss();
     $php = $model->retPhp();
     $sids = $model->getShippingRates();
     if (empty($sids)) {
         $sids = array();
     }
     $coref = array();
     $ulist = $model->getUserFieldsLists($coref);
     $this->assignRef('clist', $coref);
     $this->assignRef('ulist', $ulist);
     $langse = array();
     $exts = array();
     $lext = $model->listExts($exts, $langse);
     $adminxts = array();
     $langse2 = array();
     $lext2 = $model->listExtsaAdmin($adminxts, $langse2);
     $this->assignRef('exts', $exts);
     $this->assignRef('adminxts', $adminxts);
     $this->assignRef('extlangs', $langse);
     $langerr = $model->getlangerr();
     $this->assignRef('langerr', $langerr);
     //$lang_vars = $model->getLangVars();
     $templates = $model->getTemplates();
     $errors = $model->getErrMsgs();
     $statuses = $model->getOrderStatuses();
     $codes = $model->getJLanguages();
     $exthtml = $model->getExtensions();
     $groups = $model->listShopperGroups();
     $vatgroups = $model->listShopperGroupsSelect();
     $lfields = $model->listUserfields();
     //function getArticleSelector($name, $value, $required=false)
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $this->lang_thank_youpage = OPCconfig::getValue('ty_page', 'ty_page', 0, array(0 => ''));
     $this->model =& $model;
     $this->assignRef('groups', $groups);
     $this->assignRef('vatgroups', $vatgroups);
     $this->assignRef('lfields', $lfields);
     $this->assignRef('exthtml', $exthtml);
     $this->assignRef('codes', $codes);
     $this->assignRef('statuses', $statuses);
     $this->assignRef('errors', $errors);
     $this->assignRef('templates', $templates);
     //$this->assignRef('lang_vars', $lang_vars);
     if (empty($pms)) {
         $pms = array();
     }
     $this->assignRef('pms', $pms);
     $this->assignRef('sty', $sty);
     $this->assignRef('countries', $countries);
     $this->assignRef('default_country', $default_country);
     $this->assignRef('langs', $langs);
     // ok
     $this->assignRef('css', $css);
     $this->assignRef('php', $php);
     $this->assignRef('sids', $sids);
     $model2 = $this->getModel();
     $model2->checkTable();
     // $currencies = $model->getAllCurrency($limitstart, $limit);
     // $total = $model->countRows();
     jimport('joomla.html.pagination');
     //$pageNav = new JPagination($total, $limitstart, $limit);
     //$this->assignRef('currencies', $currencies);
     //$this->assignRef('pageNav', $pageNav);
     parent::display($tpl);
 }
예제 #7
0
 public static function checkStatus()
 {
     // ALTER TABLE  `#__virtuemart_order_histories` ADD INDEX (  `virtuemart_order_id` )
     if (method_exists('JApplication', 'getHash')) {
         $hashn = JApplication::getHash('opctracking');
     } else {
         $hashn = JUtility::getHash('opctracking');
     }
     $hash = JRequest::getVar($hashn, false, 'COOKIE');
     if (empty($hash)) {
         return false;
     }
     OPCtrackingHelper::$html = '';
     $tracking_s = OPCtrackingHelper::getLines(0, 0, $hash);
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'tracking.php';
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     jimport('joomla.filesystem.file');
     jimport('joomla.utilities.date');
     if (empty($tracking_s)) {
         return;
     }
     foreach ($tracking_s as $tracking) {
         self::$actions = array();
         $order_id = (int) $tracking['virtuemart_order_id'];
         if (empty($order_id)) {
             continue;
         }
         //
         $config = new JModelConfig();
         $config->loadVmConfig();
         //$files = $config->getPhpTrackingThemes();
         $statuses = $config->getOrderStatuses();
         $trackingModel = new JModelTracking();
         self::$config = $config = $trackingModel->getStatusConfig($statuses);
         $min_a = array();
         foreach (self::$config as $status => $t) {
             foreach ($t as $mkey => $val) {
                 if (stripos($mkey, 'since')) {
                     if (is_numeric($val)) {
                         $min_a[$val] = $val;
                     }
                 }
             }
         }
         $time = time() - 24 * 60 * 60 * 30;
         if (!empty($min_a)) {
             $min = min($min_a);
             //only take orders less than one month
             // only run tracking since it was enabled and ignore one month old data
             if (is_numeric($min)) {
                 if ($min > $time) {
                     $time = $min;
                 }
             }
         }
         $date = new JDate($time);
         if (method_exists($date, 'toSql')) {
             $dd = $date->toSql();
         } else {
             $dd = date("Y-m-d H:i:s", $time);
         }
         $q = 'select * from #__virtuemart_order_histories where virtuemart_order_id = ' . $order_id . ' and created_on > \'' . $dd . '\' order by virtuemart_order_history_id desc';
         $db = JFactory::getDBO();
         $db->setQuery($q);
         $res = $db->loadAssocList();
         if (empty($res)) {
             continue;
         }
         // this should not happen
         $ind = 0;
         foreach ($res as $state) {
             if (empty($config[$state['order_status_code']])) {
                 continue;
             } else {
                 $lc = $config[$state['order_status_code']];
             }
             if (!empty($lc->only_when)) {
                 $newa = array_slice($res, $ind + 1);
                 foreach ($newa as $ns) {
                     if ($ns['order_status_code'] == $lc->only_when) {
                         //OK, do an action
                         if (!empty($config[$state['order_status_code']]->code)) {
                             self::prepareAction($state['order_status_code'], 'code', $config[$state['order_status_code']]->code);
                         }
                         foreach ($lc as $key => $file) {
                             // inbuilt limitations
                             if ($file == 'only_when') {
                                 continue;
                             }
                             if ($file == 'code') {
                                 continue;
                             }
                             if (stripos($file, 'since') === 0) {
                                 continue;
                             }
                             $file = JFile::makeSafe($file);
                             if (empty($lc->{$key . '_enabled'})) {
                                 continue;
                             }
                             if (empty($lc->{$file})) {
                                 continue;
                             }
                             self::prepareAction($state['order_status_code'], $file);
                         }
                     }
                 }
             } else {
                 if (!empty($config[$state['order_status_code']]->code)) {
                     self::prepareAction($state['order_status_code'], 'code', $config[$state['order_status_code']]->code);
                 }
                 // only when is not set:
                 $cx = 0;
                 foreach ($lc as $key => $file) {
                     $cx++;
                     // inbuilt limitations
                     if (stripos($file, 'since') === 0) {
                         continue;
                     }
                     if ($file == 'only_when') {
                         continue;
                     }
                     if ($file == 'code') {
                         continue;
                     }
                     if (empty($lc->{$key . '_enabled'})) {
                         continue;
                     }
                     //echo $cx.' '.$key.' '.$file."<br />\n";
                     self::prepareAction($state['order_status_code'], $file);
                 }
             }
             $ind++;
         }
         self::checkActions($tracking);
         self::doActions($tracking);
     }
     if (!empty(OPCtrackingHelper::$html)) {
         return true;
     }
     return false;
 }
예제 #8
0
 function getShopperGroups()
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $config = new JModelConfig();
     $config->loadVmConfig();
     return $config->listShopperGroups();
 }
예제 #9
0
 function store()
 {
     $enabled = JRequest::getVar('adwords_enabled_0', false);
     $order = JRequest::getInt('tracking_order', 9999);
     $this->setEnabled($enabled, $order);
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     /*
     	if (!OPCJ3)
     	{
     	 require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_onepage'.DS.'helpers'.DS.'opcparameters.php'); 
     	}
     	else
     	{
     	   require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_onepage'.DS.'helpers'.DS.'jformrender.php'); 
     	}
     */
     $wasEnabled = array();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $config = new JModelConfig();
     $config->loadVmConfig();
     $files = $config->getPhpTrackingThemes();
     $statuses = $config->getOrderStatuses();
     $data = JRequest::get('post');
     jimport('joomla.filesystem.file');
     foreach ($files as $file) {
         $file = JFile::makeSafe($file);
         $path = JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'trackers' . DS . 'php' . DS . $file . '.xml';
         $nd = new stdClass();
         //$params = new OPCparameters($nd, $file, $path, 'opctracking');
         // the item is not enabled:
         if (empty($data[$file])) {
             $data[$file]['enabled'] = 0;
         }
         $config = OPCconfig::buildObject($data[$file]);
         if (!is_object($config)) {
             $config = new stdClass();
         }
         $prevConfig = OPCconfig::getValue('tracking_config', $file, 0, $config);
         $key = 'enabled';
         $is_enabled = (int) JRequest::getVar('plugin_' . $file, -1);
         if (!empty($prevConfig) && is_object($config)) {
             if (empty($prevConfig->enabled) && !empty($is_enabled)) {
                 $config->enabled_since = time();
                 $wasEnabled[$file] = time();
             } else {
                 if (!empty($prevConfig->enabled_since)) {
                     $wasEnabled[$file] = $prevConfig->enabled_since;
                 } else {
                     $wasEnabled[$file] = time();
                 }
                 $config->enabled_since = $wasEnabled[$file];
             }
         }
         foreach ($prevConfig as $kp => $vp) {
             if (!isset($config->{$kp})) {
                 $config->{$kp} = '';
             }
         }
         if (empty($is_enabled)) {
             $wasEnabled[$file] = false;
         }
         $config->{$key} = $is_enabled;
         OPCconfig::store('tracking_config', $file, 0, $config);
     }
     $aba = JRequest::getVar('aba_enabled', false);
     if (!empty($aba)) {
         $aba = true;
     }
     OPCconfig::store('aba', '', 0, $aba);
     foreach ($statuses as $status) {
         $status2 = $status['order_status_code'];
         $default = new stdClass();
         $config = OPCconfig::getValue('tracking', $status2, 0, $default);
         // config is an object of strings ONLY
         if (!empty($config)) {
             foreach ($config as $file => $data2) {
                 if (is_object($data2)) {
                     unset($config->{$file});
                 } else {
                     if (stripos($file, 'since') === 0) {
                         $file2 = substr($file, 5);
                         if (!in_array($file2, $files)) {
                             unset($config->{$file});
                         } else {
                             $config->{$file2 . '_since'} = $data2;
                             unset($config->{$file});
                         }
                     } else {
                         if (stripos($file, '_since') !== false) {
                             $file2 = str_replace('_since', '', $file);
                             if (!in_array($file2, $files)) {
                                 unset($config->{$file});
                             }
                         } else {
                             if (!in_array($file, $files)) {
                                 unset($config->{$file});
                             }
                         }
                     }
                 }
             }
         }
         foreach ($files as $file) {
             /*
             if (!empty($config->$file))
             $wasEnabled = true; 
             else $wasEnabled = false; 
             */
             $enabled = JRequest::getVar($file . '_' . $status2, 0);
             $t1 = JRequest::getVar('plugin_' . $file, -1);
             $is_enabled = (int) JRequest::getVar('plugin_' . $file, -1);
             $key = $file . '_since';
             $ct2 = new stdClass();
             //$ct = OPCconfig::getValue('tracking', $status2, 0, $ct2);
             // stAn - do not ovewrite since time when not altering status
             // enabled per status:
             if ($enabled) {
                 if (empty($config->{$file})) {
                     // if the file was not enabled per this status before
                     $config->{$key} = time();
                 } else {
                     $config->{$key} = $wasEnabled[$file];
                 }
             } else {
                 unset($config->{$key});
                 unset($config->{$file});
                 $enabled = false;
                 $key = $file . '_enabled';
                 // clear database of unneeded data:
                 unset($config->{$key});
                 $key = $file . '_since';
                 unset($config->{$key});
             }
             // gneral enabled (plugin)
             if (empty($is_enabled)) {
                 $enabled = false;
                 $key = $file . '_enabled';
                 // clear database of unneeded data:
                 unset($config->{$key});
                 $key = $file . '_since';
                 unset($config->{$key});
             }
             if (!empty($is_enabled) && !empty($enabled)) {
                 //if (empty($config->$file)) $config->$file = $file;
                 $key = $file . '_enabled';
                 $config->{$key} = true;
                 $config->{$file} = $enabled;
             }
             if (empty($enabled)) {
                 unset($config->{$file});
             } else {
                 $config->{$file} = $enabled;
             }
         }
         $tmp = (array) $config;
         if (empty($tmp)) {
             $checkempty = true;
         } else {
             $checkempty = false;
         }
         $config->code = JRequest::getVar('adwords_code_' . $status2, '', 'post', 'string', JREQUEST_ALLOWRAW);
         $only_when = JRequest::getVar('opc_tracking_only_when_' . $status2, '');
         $config->only_when = $only_when;
         $donotsave = false;
         if ($checkempty) {
             if (empty($config->code)) {
                 OPCconfig::clearConfig('tracking', $status2, 0);
                 $donotsave = true;
             }
         }
         if (!$donotsave) {
             OPCconfig::store('tracking', $status2, 0, $config);
         }
     }
     $negative_statuses = JRequest::getVar('negative_statuses', array());
     if (is_array($negative_statuses)) {
         OPCconfig::store('tracking_negative', 'negative_statuses', 0, $negative_statuses);
     }
     return;
 }