/**
  * Select the products to list on the product list page
  */
 public function getRatings()
 {
     $where = array();
     $tables = ' FROM `#__virtuemart_ratings` AS `r` JOIN `#__virtuemart_products_' . VMLANG . '` AS `p`
  			USING (`virtuemart_product_id`) ';
     if ($filter_ratings = jrequest::getvar('filter_ratings')) {
         $where[] = 'product_name like "%' . $this->_db->escape($filter_ratings) . '%"';
     }
     $published = JRequest::getvar('filter_published');
     if ($published === '1') {
         $where[] = "`r`.`published` = 1 ";
     } else {
         if ($published === '0') {
             $where[] = "`r`.`published` = 0 ";
         }
     }
     if (!empty($where)) {
         $whereString = 'where ' . implode(" AND ", $where);
     } else {
         $whereString = '';
     }
     echo $whereString;
     $this->_data = $this->exeSortSearchListQuery(0, ' r.*,p.`product_name` ', $tables, $whereString, '', $this->_getOrdering());
     // 	    $this->_data = $this->_getList($q, $this->getState('limitstart'), $this->getState('limit'));
     // set total for pagination
     // 		$this->_total = $this->_getListCount($q) ;
     // 		if(empty($this->_data)) $this->_data = array();
     // 		if(!isset($this->_total)) $this->_total = 0;
     return $this->_data;
 }
Example #2
0
    function fetchElement($name, $value, &$node, $control_name)
    {
        $js = '
//<![CDATA[
		jQuery(document).ready(function( $ ) {

		    jQuery("#heidelpay_getheidelpay_link").click( function() {
				 if ( $("#heidelpay_getheidelpay_show_hide").is(":visible") ) {
				  $("#heidelpay_getheidelpay_show_hide").hide("slow");
			        $("#heidelpay_getheidelpay_link").html("' . addslashes(JText::_('VMPAYMENT_HEIDELPAY_CREATE_ACCOUNT')) . '");
				} else {
				 $("#heidelpay_getheidelpay_show_hide").show("slow");
			       $("#heidelpay_getheidelpay_link").html("' . addslashes(JText::_('VMPAYMENT_HEIDELPAY_GET_HEIDELPAY_HIDE')) . '");
			    }
		    });
		});
//]]>
';
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        $cid = jrequest::getvar('cid', NULL, 'array');
        if (is_Array($cid)) {
            $virtuemart_paymentmethod_id = $cid[0];
        } else {
            $virtuemart_paymentmethod_id = $cid;
        }
        $query = "SELECT payment_params FROM `#__virtuemart_paymentmethods` WHERE  virtuemart_paymentmethod_id = '" . $virtuemart_paymentmethod_id . "'";
        $db = JFactory::getDBO();
        $db->setQuery($query);
        $params = $db->loadResult();
        $payment_params = explode("|", $params);
        foreach ($payment_params as $payment_param) {
            if (empty($payment_param)) {
                continue;
            }
            $param = explode('=', $payment_param);
            $payment_params[$param[0]] = substr($param[1], 1, -1);
        }
        $id = "";
        if ($payment_params['HEIDELPAY_SECURITY_SENDER'] == '31HA07BC8124AD82A9E96D9A35FAFD2A' or $payment_params['HEIDELPAY_SECURITY_SENDER'] == '') {
            $id = "heidelpay_getheidelpay_link";
            $display = '';
            $html = '<a href="#" id="' . $id . '" class="signin-button-link">' . JText::_('VMPAYMENT_HEIDELPAY_ALREADY_ACCOUNT') . '</a>';
        } else {
            $id = "heidelpay_getheidelpay_link";
            $display = ' style="display: none;"';
            $html = '<a href="#" id="' . $id . '" class="signin-button-link">' . JText::_('VMPAYMENT_HEIDELPAY_CREATE_ACCOUNT') . '</a>';
        }
        $lang = $this->getLang();
        $html .= '<div id="heidelpay_getheidelpay_show_hide" align=""' . $display . '  >';
        $url = "http://demoshops.heidelpay.de/contactform/?campaign=vituemart&shop=vituemart&lang=" . $lang;
        $html .= '<iframe src="' . $url . '" scrolling="yes" style="x-overflow: none;" frameborder="0" height="1400px" width="300px"></iframe>';
        $html .= "</div>";
        $html .= '<a target="_blank" href="http://docs.virtuemart.net/manual/shop-menu/payment-methods/heidelpay.html"  class="signin-button-link">' . vmText::_('VMPAYMENT_AMAZON_DOCUMENTATION') . '</a></p></div>';
        return $html;
    }
 /**
  * Gets a single custom by virtuemart_custom_id
  * .
  * @param string $type
  * @param string $mime mime type of custom, use for exampel image
  * @return customobject
  */
 function getCustom()
 {
     if (empty($this->_data)) {
         //     		JTable::addIncludePath(JPATH_VM_ADMINISTRATOR.DS.'tables');
         $this->_data = $this->getTable('customs');
         $this->_data->load($this->_id);
         if (!$this->_id) {
             $field_type = JRequest::getWord('field_type', 0);
             if (!empty($field_type)) {
                 $this->_data->field_type = $field_type[0];
             } else {
                 var_dump($this->_data);
                 var_dump(jrequest::getVar('params'));
                 jexit('program faillure');
             }
             if ($this->_data->custom_jplugin_id = JRequest::getInt('custom_jplugin_id', 0)) {
                 $q = 'SELECT `element` FROM `#__extensions` WHERE `folder` = "vmcustom" AND `enabled`=1 ';
                 $q .= ' AND `extension_id` = ' . $this->_data->custom_jplugin_id;
                 $this->_db->setQuery($q);
                 $this->_data->custom_element = $this->_db->loadResult();
             }
         }
         $customfields = VmModel::getModel('Customfields');
         $this->_data->field_types = $customfields->getField_types();
         //    		vmdebug('getCustom $data',$this->_data);
         if (!empty($this->_data->custom_element)) {
             // set params
             $registry = new JRegistry();
             $registry->loadString($this->_data->custom_params);
             $this->_data->params = $registry->toArray();
             JPluginHelper::importPlugin('vmcustom');
             $dispatcher = JDispatcher::getInstance();
             //    			$varsToPushParam = $dispatcher->trigger('plgVmDeclarePluginParams',array('custom',$this->_data->custom_element,$this->_data->custom_jplugin_id));
             $retValue = $dispatcher->trigger('plgVmDeclarePluginParamsCustom', array('custom', $this->_data->custom_element, $this->_data->custom_jplugin_id, &$this->_data));
             // Get the payment XML.
             $path = JPath::clean(JPATH_PLUGINS . '/vmcustom/' . $this->_data->custom_element . '/' . $this->_data->custom_element . '.xml');
             if (file_exists($path)) {
                 $this->_data->form = JForm::getInstance('plgForm', $path, array(), true, '//config');
                 // $this->_data->xml = simplexml_load_file($path);
                 $this->_data->form->bind($this->_data);
             } else {
                 $this->_data->form = null;
             }
         } else {
             $this->_data->form = null;
             //Todo this is not working, because the custom is using custom_params, while the customfield is using custom_param !
             //VirtueMartModelCustomfields::bindParameterableByFieldType($this->_data);
         }
     }
     return $this->_data;
 }
Example #4
0
    function fetchElement($name, $value, &$node, $control_name)
    {
        //return;
        //TODO SELFCALL AJAX
        // Base name of the HTML control.
        $ctrl = $control_name . '[' . $name . ']';
        JHTML::script('klarna_admin.js', VMKLARNAPLUGINWEBASSETS . '/js/', false);
        JHTML::stylesheet('klarna_admin.css', VMKLARNAPLUGINWEBASSETS . '/css/', false);
        $cid = jrequest::getvar('cid', null, 'array');
        if (is_Array($cid)) {
            $vmMethoId = $cid[0];
        } else {
            $vmMethoId = $cid;
        }
        $pclassesLink = JURI::root() . 'administrator/index.php?option=com_virtuemart&view=plugin&type=vmpayment&name=klarna&call=getPclasses&cid=' . (int) $vmMethoId;
        $html = '
		<fieldset id="klarna_pclasses" class="klarna">
		<legend id="pclass_field"><span class="expand_arrow"></span>PClasses </legend>
		<span id="PClassesSuccessResult" style="font-size: 15px;"></span>
		<div id="pclasses">';
        ob_start();
        require JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'pclasses_html.php';
        $html .= ob_get_clean();
        if ($total == 0) {
            $html .= '
		<span class="no_pclasses">' . JText::_('VMPAYMENT_KLARNA_CONF_NO_PCLASSES') . '<a href="' . $pclassesLink . '">' . JText::_('VMPAYMENT_KLARNA_CONF_FETCH_PCLASSES') . '</a></span></br>';
        }
        $html .= '
		</div>
	</fieldset>
	<span class="update_pclasses">
		<a class="button_klarna" href="' . $pclassesLink . '">' . JText::_('VMPAYMENT_KLARNA_CONF_UPDATE_PCLASSES') . '</a>
	</span><span id="pclasses_update_msg"></span>
	<div class="clear"></div>';
        return $html;
    }
Example #5
0
 /**
  * Create the table for this plugin if it does not yet exist.
  * This functions checks if the called plugin is active one.
  * When yes it is calling the standard method to create the tables
  * @author Valérie Isaksen
  *
  */
 function plgVmOnStoreInstallPaymentPluginTable($jplugin_id)
 {
     /*
      * if the file Klarna.cfg does not exist, then create it
      */
     $filename = VMKLARNA_CONFIG_FILE;
     if (!JFile::exists($filename)) {
         $fileContents = "<?php defined('_JEXEC') or die();\n\tdefine('VMKLARNA_SHIPTO_SAME_AS_BILLTO', '1'); ?>";
         $result = JFile::write($filename, $fileContents);
         if (!$result) {
             VmInfo(JText::sprintf('VMPAYMENT_KLARNA_CANT_WRITE_CONFIG', $filename, $result));
         }
     }
     $method = $this->getPluginMethod(JRequest::getInt('virtuemart_paymentmethod_id'));
     // we have to chek that the following Shopper fields are there
     $required_shopperfields_vm = Klarnahandler::getKlarnaVMGenericShopperFields();
     $required_shopperfields_bycountry = KlarnaHandler::getKlarnaSpecificShopperFields();
     $userFieldsModel = VmModel::getModel('UserFields');
     $switches['published'] = true;
     $userFields = $userFieldsModel->getUserFields('', $switches);
     // TEST that all Vm shopperfields are there
     foreach ($userFields as $userField) {
         $fields_name_vm[] = $userField->name;
     }
     $result = array_intersect($fields_name_vm, $required_shopperfields_vm);
     $vm_required_not_found = array_diff($required_shopperfields_vm, $result);
     if (count($vm_required_not_found)) {
         VmError(JText::sprintf('VMPAYMENT_KLARNA_REQUIRED_USERFIELDS_NOT_FOUND', implode(", ", $vm_required_not_found)));
     } else {
         VmInfo(JText::_('VMPAYMENT_KLARNA_REQUIRED_USERFIELDS_OK'));
     }
     $klarna_required_not_found = array();
     // TEST that all required Klarna shopper fields are there, if not create them
     foreach ($required_shopperfields_bycountry as $key => $shopperfield_country) {
         $active = 'klarna_active_' . strtolower($key);
         if ($method->{$active}) {
             $resultByCountry = array_intersect($fields_name_vm, $shopperfield_country);
             $klarna_required_country_not_found = array_diff($shopperfield_country, $resultByCountry);
             $klarna_required_not_found = array_merge($klarna_required_country_not_found, $klarna_required_not_found);
         }
     }
     $klarna_required_not_found = array_unique($klarna_required_not_found, SORT_STRING);
     if (count($klarna_required_not_found)) {
         VmError(JText::sprintf('VMPAYMENT_KLARNA_REQUIRED_USERFIELDS_NOT_FOUND', implode(", ", $klarna_required_not_found)));
     } else {
         VmInfo(JText::_('VMPAYMENT_KLARNA_REQUIRED_USERFIELDS_OK'));
     }
     //vmDebug('plgVmOnStoreInstallPaymentPluginTable', $create_shopperfield);
     /*
      * TODO: create all required shopperfields
      *
      */
     $result = $this->onStoreInstallPluginTable($jplugin_id);
     if (jrequest::getvar('redirect') == "no" and $result) {
         echo 'ok';
         jexit();
     }
     return $result;
 }
defined('_JEXEC') or die;
// add messgae in bootstrap style
$app = JFactory::getApplication();
$messages = $app->getMessageQueue();
$user = JFactory::getUser();
if (!class_exists('Permissions')) {
    require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
$admin = Permissions::getInstance()->check('admin');
$vendor = VmModel::getModel('vendor');
// $vendor->setId($this->vendorId);
$vendor->setId(Permissions::getInstance()->isSuperVendor());
$store = $vendor->getVendor();
// html code for front-end administration
$view = jrequest::getWord('view');
$task = jrequest::getWord('task');
JHtml::_('script', 'system/core.js', false, true);
$document = JFactory::getDocument();
JHtml::_('jquery.ui');
vmJsApi::js('jquery.ui.autocomplete.html');
vmJsApi::js('template', 'administrator/components/com_virtuemart/assets/js');
$document->addStyleSheet(JURI::root(true) . '/administrator/components/com_virtuemart/assets/css/admin.styles.css');
$j = "\n\tjQuery(function() {\n\t\tjQuery( '#virtuemartSave').click(function(e){\n\t\t\te.preventDefault();\n\t\t\tjQuery( '#media-dialog' ).remove();\n\t\t\tdocument.adminForm.task.value='apply';\n\t\t\tdocument.adminForm.submit();\n\t\t\treturn false;\n\t\t});\n\t\tjQuery('link[rel=stylesheet][href*=\"template\"]').remove();\n\t\tjQuery('.btn-micro').addClass('btn-mini');\n\t\tjQuery('#menu li a').click(function(e)\n\t\t{\n\t\t\t\$('#menu li.open').removeClass('open');\n\t\t\t// console.log('toggle');\n\t\t\t// \$('#menu li a')\n\t\t\t// e.stopPropagation();\n\t\t});\n\t});\n";
$document->addScriptDeclaration($j);
$document->addStyleDeclaration('
@media (max-width: 767px) {
 body { padding-top: 0px;}
 .vm2admin .navbar-fixed-top,.vm2admin .header{ margin:0px;max-width:100%}
 .vm2admin .subhead {margin-left:0px;margin-right:0px}
}
 body,.vmadmin{width:100%;padding:0}
Example #7
0
	/**
	 * @author Patrick Kohl
	 * @param $type
	 * @param $name
	 * @param $render
	 */
	function plgVmOnSelfCallBE ($type, $name, &$render) {
		if ($name != $this->_name || $type != 'vmpayment') {
            return FALSE;
        }
		// fetches PClasses From XML file
		$call = jrequest::getWord ('call');
		$this->$call();
		// 	jexit();
	}
 /**
  * Create and return the pagination page list string, ie. Previous, Next, 1 2 3 ... x.
  *
  * @return  string  Pagination page list string.
  *
  * @since   11.1
  * overide to use bootstrap in j2.5
  */
 public function getPagesLinks()
 {
     $app = JFactory::getApplication();
     if (JVM_VERSION === 3 || $app->isSite() && jrequest::getVar('tmpl') !== 'component') {
         return parent::getPagesLinks();
     }
     // Build the page navigation list.
     $data = $this->_buildDataObject();
     $list = array();
     $list['prefix'] = $this->prefix;
     $itemOverride = false;
     // Build the select list
     if ($data->all->base !== null) {
         $list['all']['active'] = true;
         $list['all']['data'] = $this->pagination_item_active($data->all);
     } else {
         $list['all']['active'] = false;
         $list['all']['data'] = $this->pagination_item_inactive($data->all);
     }
     if ($data->start->base !== null) {
         $list['start']['active'] = true;
         $list['start']['data'] = $this->pagination_item_active($data->start);
     } else {
         $list['start']['active'] = false;
         $list['start']['data'] = $this->pagination_item_inactive($data->start);
     }
     if ($data->previous->base !== null) {
         $list['previous']['active'] = true;
         $list['previous']['data'] = $this->pagination_item_active($data->previous);
     } else {
         $list['previous']['active'] = false;
         $list['previous']['data'] = $this->pagination_item_inactive($data->previous);
     }
     $list['pages'] = array();
     //make sure it exists
     foreach ($data->pages as $i => $page) {
         if ($page->base !== null) {
             $list['pages'][$i]['active'] = true;
             $list['pages'][$i]['data'] = $this->pagination_item_active($page);
         } else {
             $list['pages'][$i]['active'] = false;
             $list['pages'][$i]['data'] = $this->pagination_item_inactive($page);
         }
     }
     if ($data->next->base !== null) {
         $list['next']['active'] = true;
         $list['next']['data'] = $this->pagination_item_active($data->next);
     } else {
         $list['next']['active'] = false;
         $list['next']['data'] = $this->pagination_item_inactive($data->next);
     }
     if ($data->end->base !== null) {
         $list['end']['active'] = true;
         $list['end']['data'] = $this->pagination_item_active($data->end);
     } else {
         $list['end']['active'] = false;
         $list['end']['data'] = $this->pagination_item_inactive($data->end);
     }
     if ($this->total > $this->limit) {
         return $this->pagination_list_render($list);
     } else {
         return '';
     }
 }
Example #9
0
 /**
  * @author Patrick Kohl
  * @param $type
  * @param $name
  * @param $render
  */
 function plgVmOnSelfCallBE($type, $name, &$render)
 {
     // fetches PClasses From XML file
     $call = jrequest::getWord('call');
     $this->{$call}();
     // 	jexit();
 }
Example #10
0
}
// end load language
/** load the html drawing class */
require_once $mosConfig_absolute_path . "/components/com_booklibrary/booklibrary.html.php";
// for 1.6
require_once $mosConfig_absolute_path . "/components/com_booklibrary/booklibrary.class.php";
// for 1.6
require_once $mosConfig_absolute_path . "/components/com_booklibrary/booklibrary.class.lend_request.php";
require_once $mosConfig_absolute_path . "/components/com_booklibrary/booklibrary.class.lend.php";
require_once $mosConfig_absolute_path . "/components/com_booklibrary/booklibrary.class.review.php";
require_once $mosConfig_absolute_path . "/administrator/components/com_booklibrary/admin.booklibrary.class.others.php";
require_once $mosConfig_absolute_path . "/administrator/components/com_booklibrary/admin.booklibrary.class.conf.php";
require_once $mosConfig_absolute_path . "/administrator/components/com_booklibrary/admin.booklibrary.class.ws.php";
jimport('joomla.html.pagination');
jimport('joomla.application.pathway');
if (jrequest::getvar('option') == 'com_comprofiler') {
    global $booklibrary_configuration;
}
$GLOBALS['lendstatus_show'] = $booklibrary_configuration['lendstatus']['show'];
$GLOBALS['lendrequest_registrationlevel'] = $booklibrary_configuration['lendrequest']['registrationlevel'];
$GLOBALS['reviews_show'] = $booklibrary_configuration['reviews']['show'];
$GLOBALS['reviews_registrationlevel'] = $booklibrary_configuration['reviews']['registrationlevel'];
$GLOBALS['ebooks_show'] = $booklibrary_configuration['ebooks']['show'];
$GLOBALS['ebooks_registrationlevel'] = $booklibrary_configuration['ebooks']['registrationlevel'];
$GLOBALS['buy_now_show'] = $booklibrary_configuration['buy_now']['show'];
$GLOBALS['buy_now_allow_categories'] = $booklibrary_configuration['buy_now']['allow']['categories'];
$GLOBALS['price_show'] = $booklibrary_configuration['price']['show'];
$GLOBALS['price_registrationlevel'] = $booklibrary_configuration['price']['registrationlevel'];
$GLOBALS['lendrequest_email_show'] = $booklibrary_configuration['lendrequest_email']['show'];
$GLOBALS['lendrequest_email_address'] = $booklibrary_configuration['lendrequest_email']['address'];
$GLOBALS['lendrequest_email_registrationlevel'] = $booklibrary_configuration['lendrequest_email']['registrationlevel'];