/**
  * 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;
    }
Example #3
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 #4
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;
 }
Example #5
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'];