function getInput()
    {
        $js = '
//<![CDATA[
		jQuery(document).ready(function( $ ) {

		    jQuery("#paybox_getpaybox_link").click( function() {
				 if ( $("#paybox_getpaybox_show_hide").is(":visible") ) {
				  $("#paybox_getpaybox_show_hide").hide("slow");
			        $("#paybox_getpaybox_link").html("' . addslashes(vmText::_('VMPAYMENT_PAYBOX_ALREADY_ACCOUNT')) . '");
				} else {
				 $("#paybox_getpaybox_show_hide").show("slow");
			       $("#paybox_getpaybox_link").html("' . addslashes(vmText::_('VMPAYMENT_PAYBOX_GET_PAYBOX_HIDE')) . '");
			    }
		    });
		});
//]]>
';
        vmJsApi::addJScript("vm.getPaybox", $js);
        vmJsApi::addJScript('/plugins/vmpayment/paybox/paybox/assets/js/admin.js');
        vmJsApi::css('admin', 'plugins/vmpayment/paybox/paybox/assets/css/');
        $cid = vRequest::getvar('cid', NULL, 'array');
        if (is_Array($cid)) {
            $virtuemart_paymentmethod_id = $cid[0];
        } else {
            $virtuemart_paymentmethod_id = $cid;
        }
        $query = "SELECT * FROM `#__virtuemart_paymentmethods` WHERE  virtuemart_paymentmethod_id = '" . $virtuemart_paymentmethod_id . "'";
        $db = JFactory::getDBO();
        $db->setQuery($query);
        $params = $db->loadObject();
        $html = '<img src="http://virtuemart.boutique-paybox.com/PayboxLogo.jpg" width="200px"/><br />';
        if ($params->created_on == $params->modified_on) {
            $id = "paybox_getpaybox_link";
            $html .= '<a href="#" id="' . $id . '">' . vmText::_('VMPAYMENT_PAYBOX_GET_PAYBOX_HIDE') . '</a>';
            $display = '';
            $html .= '<div id="paybox_getpaybox_show_hide" align=""' . $display . ' >';
        } else {
            $id = "paybox_getpaybox_link";
            $html .= '<a href="#" id="' . $id . '">' . vmText::_('VMPAYMENT_PAYBOX_ALREADY_ACCOUNT') . '</a>';
            $display = ' style="display: none;"';
            $html .= '<div id="paybox_getpaybox_show_hide" align=""' . $display . ' >';
        }
        $id = "";
        $lang = $this->getLang();
        if ($lang == 'fr') {
            $url = "http://virtuemart.boutique-paybox.com/PayboxPres.html";
        } else {
            $url = "http://virtuemart.boutique-paybox.com/PayboxPres.html";
        }
        $html .= '<iframe src="' . $url . '" scrolling="yes" style="x-overflow: none;" frameborder="0" height="1400px" width="800px"></iframe>';
        $html .= "</div>";
        return $html;
    }
Exemple #2
0
 protected function getInput()
 {
     vmJsApi::addJScript('/plugins/vmpayment/realex_hpp_api/realex_hpp_api/assets/js/admin.js');
     vmJsApi::css('admin', 'plugins/vmpayment/realex_hpp_api/realex_hpp_api/assets/css/');
     $url = "http://www.realexpayments.com/partner-referral?id=tsmart";
     $logo = '<img src="http://www.realexpayments.com/images/logo_realex_large.png" width="150"/>';
     $html = '<p><a target="_blank" href="' . $url . '"  >' . $logo . '</a></p>';
     $html .= '<p><a target="_blank" href="' . $url . '" class="signin-button-link">' . tsmText::_('VMPAYMENT_REALEX_HPP_API_REGISTER') . '</a>';
     $html .= ' <a target="_blank" href="http://docs.tsmart.net/manual/shop-menu/payment-methods/realex-hpp-and-api.html" class="signin-button-link">' . tsmText::_('VMPAYMENT_REALEX_HPP_API_DOCUMENTATION') . '</a></p>';
     return $html;
 }
Exemple #3
0
 protected function getInput()
 {
     JHtml::_('behavior.colorpicker');
     vmJsApi::addJScript('/plugins/vmpayment/paypal/paypal/assets/js/admin.js');
     vmJsApi::css('paypal', 'plugins/vmpayment/paypal/paypal/assets/css/');
     $url = "https://www.paypal.com/us/webapps/mpp/referral/paypal-payments-standard?partner_id=83EP5DJG9FU6L";
     $logo = '<img src="https://www.paypalobjects.com/en_US/i/logo/PayPal_mark_60x38.gif" />';
     $html = '<p><a target="_blank" href="' . $url . '"  >' . $logo . '</a></p>';
     $html .= '<p><a target="_blank" href="' . $url . '" class="signin-button-link">' . vmText::_('VMPAYMENT_PAYPAL_REGISTER') . '</a>';
     $html .= ' <a target="_blank" href="http://docs.virtuemart.net/manual/shop-menu/payment-methods/paypal.html" class="signin-button-link">' . vmText::_('VMPAYMENT_PAYPAL_DOCUMENTATION') . '</a></p>';
     return $html;
 }
Exemple #4
0
 function getInput()
 {
     vmJsApi::addJScript('/plugins/vmpayment/klikandpay/klikandpay/assets/js/admin.js');
     $lang = $this->getLang();
     if ($lang == 'fr') {
         $url = "https://www.klikandpay.com/cgi-bin/connexion.pl?FROM=869B834067";
     } else {
         $url = "https://www.klikandpay.com/cgi-bin/connexion.pl?FROM=869B834067&L=en";
     }
     $logo = '<img src="https://www.klikandpay.com/images/logo_en.png" style="width: 150px;">';
     $html = '<p><a target="_blank" href="' . $url . '"  >' . $logo . '</a></p>';
     $html .= '<p><a class="signin-button-link" href="' . $url . '" target="_blank">' . vmText::_('VMPAYMENT_KLIKANDPAY_GET') . '</a>';
     $html .= ' <a target="_blank" href="https://www.youtube.com/watch?v=DVcUU3FiuMM" class="signin-button-link">' . vmText::_('VMPAYMENT_KLIKANDPAY_DOCUMENTATION') . '</a></p>';
     return $html;
 }
    function getInput()
    {
        vmJsApi::addJScript('/plugins/vmpayment/klarnacheckout/klarnacheckout/assets/js/admin.js');
        vmJsApi::css('klarnacheckout', 'plugins/vmpayment/klarnacheckout/klarnacheckout/assets/css/');
        $jlang = JFactory::getLanguage();
        $lang = $jlang->getTag();
        $langArray = explode("-", $lang);
        $lang = strtolower($langArray[1]);
        $countriesData = KlarnaHandler::countriesData();
        $signLang = "en";
        foreach ($countriesData as $countryData) {
            if ($countryData['country_code'] == $lang) {
                $signLang = $lang;
                break;
            }
        }
        /*
        		$logo = '<a href="https://merchants.klarna.com/signup?locale=' . $signLang . '&partner_id=7829355537eae268a17667c199e7c7662d3391f7" target="_blank">
        	             <img src="' . JURI::root () . VMKLARNAPLUGINWEBROOT . '/klarna/assets/images/logo/get_klarna_now.png" /></a> ';
        */
        $logo = '<img src="' . JURI::root() . VMKLARNAPLUGINWEBROOT . '/klarna/assets/images/logo/get_klarna_now.jpg" style="margin-bottom: 10px"/>';
        $html = '<p><a href="#" id="klarna_getklarna_link" ">' . $logo . '</a></p>';
        // https://merchants.klarna.com/signup?locale=en&partner_id=7829355537eae268a17667c199e7c7662d3391f7&utm_campaign=Platform&utm_medium=Partners&utm_source=Virtuemart
        $html .= '<div id="klarna_getklarna_show_hide" >';
        $url = "https://merchants.klarna.com/signup/?locale=" . $signLang . "&partner_id=7829355537eae268a17667c199e7c7662d3391f7&utm_campaign=Platform&utm_medium=Partners&utm_source=Virtuemart";
        $js = '
		jQuery(document).ready(function( $ ) {
			$("#klarna_getklarna_show_hide").hide();
			jQuery("#klarna_getklarna_link").click( function() {
				 if ( $("#klarna_getklarna_show_hide").is(":visible") ) {
				  $("#klarna_getklarna_show_hide").hide("slow");
			        $("#klarna_getklarna_link").html("' . addslashes($logo) . '");
				} else {
				 $("#klarna_getklarna_show_hide").show("slow");
			       $("#klarna_getklarna_link").html("' . addslashes(vmText::_('VMPAYMENT_KLARNA_GET_KLARNA_HIDE')) . '");
			    }
		    });
		});
';
        vmJsApi::addJScript('vm.getKlarna', $js);
        $html .= '<iframe src="' . $url . '" scrolling="yes" style="x-overflow: none;" frameborder="0" height="600px" width="850px"></iframe>';
        $html .= '</div>';
        $html .= '<p><a target="_blank" href="http://cdn.klarna.com/1.0/shared/content/integration/guide/virtuemart.pdf" class="signin-button-link">' . vmText::_('VMPAYMENT_KLARNA_DOCUMENTATION') . '</a></p>';
        return $html;
    }
Exemple #6
0
	function sendPostRequest () {
		$post_variables = $this->getPostVariables();

		$jump_url = $this->getJumpUrl();

		$html = '';
		if ($this->_method->debug) {
			$html .= '<form action="' . $jump_url . '" method="post" name="vm_realex_form" target="realex">';
		} else {
			if (vmconfig::get('css')) {
				$msg = vmText::_('VMPAYMENT_REALEX_HPP_API_REDIRECT_MESSAGE', true);
			} else {
				$msg='';
			}

			vmJsApi::addJScript('vm.paymentFormAutoSubmit', '
  			jQuery(document).ready(function($){
   				jQuery("body").addClass("vmLoading");
  				var msg="'.$msg.'";
   				jQuery("body").append("<div class=\"vmLoadingDiv\"><div class=\"vmLoadingDivMsg\">"+msg+"</div></div>");
    			jQuery("#vmPaymentForm").submit();
			})
		');
			$html .= '<form action="' . $jump_url . '" method="post" name="vm_realex_form" id="vmPaymentForm" accept-charset="UTF-8">';
		}
		$html .= '<input type="hidden" name="charset" value="utf-8">';

		foreach ($post_variables as $name => $value) {
			$html .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
		}

		if ($this->_method->debug) {

			$html .= '<div style="background-color:red;color:white;padding:10px;">
						<input type="submit"  value="The method is in debug mode. Click here to be redirected to Realex" />
						</div>';
			$this->debugLog($post_variables, 'sendPostRequest:', 'debug');

		}
		$html .= '</form>';

		return $html;
	}
 private function showActionOrderBEPayment($virtuemart_order_id, $virtuemart_paymentmethod_id, $payments)
 {
     $orderModel = VmModel::getModel('orders');
     $order = $orderModel->getOrder($virtuemart_order_id);
     $options = array();
     if ($this->isDelayedSettlement()) {
         $options[] = JHTML::_('select.option', 'settlePayment', vmText::_('VMPAYMENT_REALEX_HPP_API_ORDER_BE_CAPTURE'), 'value', 'text');
     }
     $options[] = JHTML::_('select.option', 'rebatePayment', vmText::_('VMPAYMENT_REALEX_HPP_API_ORDER_BE_REBATE'), 'value', 'text');
     $actionList = JHTML::_('select.genericlist', $options, 'action', '', 'value', 'text', 'capturePayment', 'action', true);
     $html = '<table class="adminlist table"  >' . "\n";
     $html .= $this->getHtmlHeaderBE();
     $html .= '<form action="index.php" method="post" name="updateOrderBEPayment" id="updateOrderBEPayment">';
     $html .= '<tr ><td >';
     $html .= $actionList;
     $html .= ' </td><td>';
     $html .= '<input type="text" id="amount" name="amount" size="20" value="" class="required" maxlength="25"  placeholder="' . vmText::sprintf('VMPAYMENT_REALEX_HPP_API_ORDER_BE_AMOUNT', shopFunctions::getCurrencyByID($payments[0]->payment_currency, 'currency_code_3')) . '"/>';
     $html .= '<input type="hidden" name="type" value="vmpayment"/>';
     $html .= '<input type="hidden" name="name" value="realex_hpp_api"/>';
     $html .= '<input type="hidden" name="view" value="plugin"/>';
     $html .= '<input type="hidden" name="option" value="com_virtuemart"/>';
     $html .= '<input type="hidden" name="virtuemart_order_id" value="' . $virtuemart_order_id . '"/>';
     $html .= '<input type="hidden" name="virtuemart_paymentmethod_id" value="' . $virtuemart_paymentmethod_id . '"/>';
     $html .= '<a class="updateOrderBEPayment btn btn-small" href="#"   >' . vmText::_('COM_VIRTUEMART_SAVE') . '</a>';
     $html .= '</form>';
     $html .= ' </td></tr>';
     vmJsApi::addJScript('vmRealex.updateOrderBEPayment', "\n\t\tjQuery(document).ready( function(\$) {\n\t\t\tjQuery('.updateOrderBEPayment').click(function() {\n\t\t\t\tdocument.updateOrderBEPayment.submit();\n\t\t\t\treturn false;\n\n\t});\n});\n");
     //$html .= '</table>'  ;
     return $html;
 }
Exemple #8
0
    public static function addCheckRequiredJs()
    {
        $j = 'jQuery(document).ready(function(){
    jQuery(".required").change(function(){
    	var count = 0;
    	var hit = 0;
    	jQuery.each(jQuery(".required"), function (key, value){
    		count++;
    		if(jQuery(this).attr("checked")){
        		hit++;
       		}
    	});
        if(count==hit){
        	console.log("Now fire");
        	var form = jQuery("#checkoutFormSubmit");
        	//document.checkoutForm.task = "checkout";
			document.checkoutForm.submit()
        }
    });
});';
        vmJsApi::addJScript('autocheck', $j);
    }
 * @subpackage
 * @author Max Milbers, Valerie Isaksen
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2014 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: default_showprices.php 8024 2014-06-12 15:08:59Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
static $ask_recommened_loaded = false;
if ($ask_recommened_loaded) {
    return '';
}
$product = $viewData['product'];
// addon for joomla modal Box
JHtml::_('behavior.modal');
if (VmConfig::get('usefancy', 1)) {
    vmJsApi::addJScript('fancybox/jquery.fancybox-1.3.4.pack', false);
    vmJsApi::css('jquery.fancybox-1.3.4');
    $Modal = "\n\t\t\t\$('a.ask-a-question, a.printModal, a.recommened-to-friend, a.manuModal').click(function(event){\n              event.preventDefault();\n\t\t      \$.fancybox({\n\t\t        href: \$(this).attr('href'),\n\t\t        type: 'iframe',\n\t\t        height: 550\n\t\t        });\n\t\t      });\n\t\t\t";
} else {
    vmJsApi::addJScript('facebox', false);
    vmJsApi::css('facebox');
    $Modal = "\n    \t\t\$('a.ask-a-question, a.printModal, a.recommened-to-friend, a.manuModal').click(function(event){\n\t\t      event.preventDefault();\n\t\t      \$.facebox({\n\t\t        iframe: \$(this).attr('href'),\n\t\t        rev: 'iframe|550|550'\n\t\t        });\n\t\t      });\n    \t\t";
}
vmJsApi::addJScript('popups', "\n//<![CDATA[\n\tjQuery(document).ready(function(\$) {\n\t\t" . $Modal . "\n\t});\n//]]>\n");
Exemple #10
0
<?php

defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.modal');
$js = "\njQuery(document).ready(function () {\n    jQuery('.orderlistcontainer').hover(\n        function() { jQuery(this).find('.orderlist').stop().show()},\n        function() { jQuery(this).find('.orderlist').stop().hide()}\n    )\n\t\n\t// Click Button\n\tfunction display(view) {\n\t\tjQuery('.browse-view .row').removeClass('vm-list vm-grid').addClass(view);\n\t\tjQuery('.icon-list-grid .vm-view').removeClass('active');\n\t\tif(view == 'vm-list') {\n\t\t\tjQuery('.browse-view .product').addClass('col-lg-12');\n\t\t\tjQuery('.products-list .product .vm-product-media-container').addClass('col-md-4');\n\t\t\tjQuery('.products-list .product .product-info').addClass('col-md-8');\n\t\t\tjQuery('.icon-list-grid .' + view).addClass('active');\n\t\t}else{\n\t\t\tjQuery('.browse-view .product').removeClass('col-lg-12');\n\t\t\tjQuery('.products-list .product .vm-product-media-container').removeClass('col-md-4');\n\t\t\tjQuery('.products-list .product .product-info').removeClass('col-md-8');\n\t\t\tjQuery('.icon-list-grid .' + view).addClass('active');\n\t\t}\n\t}\n\t\t\n    jQuery('.vm-view-list .vm-view').each(function() {\n        var ua = navigator.userAgent,\n        event = (ua.match(/iPad/i)) ? 'touchstart' : 'click';\n        jQuery(this).bind(event, function() {\n            jQuery(this).addClass(function() {\n                if(jQuery(this).hasClass('active')) return '';\n                return 'active';\n            });\n            jQuery(this).siblings('.vm-view').removeClass('active');\n\t\t\tcatalog_mode = jQuery(this).data('view');\n\t\t\tdisplay(catalog_mode);\n\t\t\t\n        });\n\n    });\n});\n";
vmJsApi::addJScript('vm.hover', $js);
if (empty($this->keyword) and !empty($this->category)) {
    ?>
<div class="category_description">
	
	<?php 
    //echo $this->category->images;
    ?>
	<?php 
    echo $this->category->category_description;
    ?>
</div>
<?php 
}
// Show child categories
if (VmConfig::get('showCategory', 1) and empty($this->keyword)) {
    if (!empty($this->category->haschildren)) {
        echo ShopFunctionsF::renderVmSubLayout('categories', array('categories' => $this->category->children));
    }
}
if ($this->showproducts) {
    ?>
<div class="browse-view">
<?php 
    if (!empty($this->keyword)) {
        //id taken in the view.html.php could be modified
Exemple #11
0
<!-- End View Category -->


</div>

<?php 
}
?>
</div>


<?php 
// Show child categories
// Show child categories
if (VmConfig::get('showCategory', 1) and empty($this->keyword)) {
    if (!empty($this->category->haschildren)) {
        echo ShopFunctionsF::renderVmSubLayout('categories', array('categories' => $this->category->children));
    }
}
?>





<?php 
$j = "Virtuemart.container = jQuery('.category-view');\nVirtuemart.containerSelector = '.category-view';";
vmJsApi::addJScript('ajaxContent', $j);
?>
<!-- end browse-view -->
Exemple #12
0
    public static function addCheckRequiredJs()
    {
        $updF = '';
        if (VmConfig::get('oncheckout_ajax', false)) {
            $updF = 'Virtuemart.updForm();';
        }
        $j = 'jQuery(document).ready(function(){

    jQuery(".output-shipto").find(":radio").change(function(){
        var form = jQuery("#checkoutFormSubmit");
        jQuery(this).vm2front("startVmLoading");
		document.checkoutForm.submit();
    });
    jQuery("#checkoutForm").change(function(){

		jQuery("#checkoutFormSubmit").attr("name","checkout");
		jQuery("#checkoutFormSubmit").html("<span>' . vmText::_('COM_VIRTUEMART_CHECKOUT_TITLE') . '</span>");
    });
    jQuery(".required").change(function(){
    	var count = 0;
    	var hit = 0;
    	jQuery.each(jQuery(".required"), function (key, value){
    		count++;
    		if(jQuery(this).attr("checked")){
        		hit++;
       		}
    	});
        if(count==hit){
        	//jQuery(this).vm2front("startVmLoading");

        	var form = jQuery("#checkoutFormSubmit");
        	form.attr("task","checkout");

			' . $updF . '
			form.submit();
        	//jQuery(this).vm2front("stopVmLoading");
        }
    });

});';
        vmJsApi::addJScript('autocheck', $j);
    }
Exemple #13
0
    /**
     * @param $post_variables
     * @return string
     */
    function getConfirmedHtml($post_variables)
    {
        $pbxServer = $this->getPayboxServerUrl();
        // add spin image
        $html = '';
        if ($this->_method->debug) {
            $html .= '<form action="' . $pbxServer . '" method="post" name="vm_paybox_form" target="paybox">';
        } else {
            if (tsmConfig::get('css')) {
                $msg = tsmText::_('VMPAYMENT_PAYBOX_REDIRECT_MESSAGE', true);
            } else {
                $msg = '';
            }
            vmJsApi::addJScript('vm.paymentFormAutoSubmit', '
  			jQuery(document).ready(function($){
   				jQuery("body").addClass("vmLoading");
  				var msg="' . $msg . '";
   				jQuery("body").append("<div class=\\"vmLoadingDiv\\"><div class=\\"vmLoadingDivMsg\\">"+msg+"</div></div>");
    			jQuery("#vmPaymentForm").submit();
			})
		');
            $html .= '<form action="' . $pbxServer . '" method="post" name="vm_paybox_form" id="vmPaymentForm">';
        }
        foreach ($post_variables as $name => $value) {
            $html .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
        }
        if ($this->_method->debug) {
            $this->plugin->debugLog($this->_method->virtuemart_paymentmethod_id, 'sendPostRequest: payment method', 'debug');
            $this->plugin->debugLog($pbxServer, 'sendPostRequest: Server', 'debug');
            $html .= '<div style="background-color:red;color:white;padding:10px;">
						<input type="submit"  value="The method is in debug mode. Click here to be redirected to Paybox" />
						</div>';
            $this->plugin->debugLog($post_variables, 'sendPostRequest:', 'debug');
        } else {
            $html .= '<input type="submit"  value="' . tsmText::_('VMPAYMENT_PAYBOX_REDIRECT_MESSAGE') . '" />';
        }
        $html .= '</form>';
        return $html;
    }
 *
 * @package	tsmart
 * @subpackage Orders
 * @author Oscar van Eijk
 * @link http://www.tsmart.net
 * @copyright Copyright (c) 2004 - 2010 tsmart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * tsmart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: order_editstatus.php 8682 2015-02-04 23:21:06Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
vmJsApi::addJScript('orderstatus', "\n\n\t\tfunction cancelOrderStatFormEdit(e) {\n\t\t\tjQuery('#orderStatForm').each(function(){\n\t\t\t\tthis.reset();\n\t\t\t});\n\t\t\tjQuery('#order_items_status')\n\t\t\t\t.find('option:selected').prop('selected', true)\n\t\t\t\t.end().trigger('liszt:updated');\n\t\t\tjQuery('div#updateOrderStatus').hide();\n\t\t\te.preventDefault();\n\t\t}\n\n\t\t");
?>

<form action="index.php" method="post" name="orderStatForm" id="orderStatForm">
<fieldset>
<table class="admintable table" >
	<tr>
		<td align="center" colspan="2">
		<h1><?php 
echo tsmText::_('com_tsmart_ORDER_UPDATE_STATUS');
?>
</h1>
		</td>
	</tr>
	<tr>
		<td class="key"><?php 
    /**
     * Admin UI Tabs Imitation
     * Gives A Tab Based Navigation Back And Loads The Templates With A Nice Design
     * @param $return = return the start tag or the closing tag - choose 'start' or 'end'
     * @params $language = pass the language string
     */
    static function imitateTabs($return, $language = '')
    {
        if ($return == 'start') {
            vmJsApi::addJScript('vm.cookietab', '
			var virtuemartcookie="vm-tab";
			');
            $html = '<div id="admin-ui-tabs">
							<div class="tabs" title="' . vmText::_($language) . '">';
            echo $html;
        }
        if ($return == 'end') {
            $html = '		</div>
						</div>';
            echo $html;
        }
    }
    $doc->setMetaData('viewport', "width=device-width, initial-scale=1, maximum-scale=1");
}
if (!$jsAWLoaded) {
    vmJsApi::addJScript('/plugins/vmpayment/amazon/assets/js/amazon.js');
    if ($viewData['include_amazon_css']) {
        vmJsApi::css('amazon', 'plugins/vmpayment/amazon/assets/css/');
    }
    //vmJsApi::js('plugins/vmpayment/amazon/amazon/assets/js/site', '');
    $js = "\njQuery(document).ready( function(\$) {\n\tamazonPayment.initPayment('" . $viewData['sellerId'] . "','" . $viewData['amazonOrderReferenceId'] . "', '" . $viewData['addressbook_designWidth'] . "', '" . $viewData['addressbook_designHeight'] . "', '" . $isMobile . "', '" . $viewData['virtuemart_paymentmethod_id'] . "', '" . $viewData['readOnlyWidgets'] . "');\n});\n";
    vmJsApi::addJScript('vm.initAmazonPayment', $js);
    if ($viewData['renderAddressBook']) {
        $js = "\njQuery(document).ready( function(\$) {\n\tamazonPayment.showAmazonAddress();\n});\n";
        vmJsApi::addJScript('vm.showAmazonAddress', $js);
    }
    if ($viewData['renderWalletBook']) {
        $js = "\njQuery(document).ready( function(\$) {\n\tamazonPayment.showAmazonWallet();\n});\n";
        vmJsApi::addJScript('vm.showAmazonWallet', $js);
    }
    $js = "\njQuery(document).ready( function(\$) {\n\$('#leaveAmazonCheckout').click(function(){\n\tamazonPayment.leaveAmazonCheckout();\n\t});\n});\n";
    vmJsApi::addJScript('vm.leaveAmazonCheckout', $js);
    if ($viewData['captureNow']) {
        $js = "\njQuery(document).ready( function(\$) {\n\tamazonPayment.displayCaptureNowWarning('" . vmText::_('VMPAYMENT_AMAZON_CHARGE_NOW') . "');\n});\n";
        vmJsApi::addJScript('vm.displayAmazonCaptureNowWarning', $js);
    }
}
?>




VmConfig::loadConfig();

VmConfig::loadJLang('mod_virtuemart_cart', true);
VmConfig::loadJLang('com_virtuemart', true);
vmJsApi::jQuery();

//$doc = JFactory::getDocument();
vmJsApi::addJScript("/modules/mod_virtuemart_cart/assets/js/update_cart.js",false,false);
$js = '
jQuery(document).ready(function(){
    jQuery("body").live("updateVirtueMartCartModule", function(e) {
        jQuery("#vmCartModule").updateVirtueMartCartModule();
    });
});
';
vmJsApi::addJScript('vm.CartModule.UpdateModule',$js);

$jsVars  = ' jQuery(document).ready(function(){
	jQuery(".vmCartModule").productUpdate();
});' ;
//vmJsApi::addJScript('vm.CartModule.UpdateProduct',$jsVars);


//This is strange we have the whole thing again in controllers/cart.php public function viewJS()
if(!class_exists('VirtueMartCart')) require(VMPATH_SITE.DS.'helpers'.DS.'cart.php');
$cart = VirtueMartCart::getCart(false);

$viewName = vRequest::getString('view',0);
if($viewName=='cart'){
	$checkAutomaticPS = true;
} else {
 *
 * @link http://www.tsmart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id$
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
vmJsApi::jPrice();
$document = JFactory::getDocument();
$js = "\n\t\tfunction setShipment() {\n\t\t    amazonPayment.setShipmentReloadWallet();\n\t\t}\n";
vmJsApi::addJScript('vm.setShipment', $js);
$buttonclass = 'button vm-button-correct';
$buttonclass = 'default';
if (isset($this->found_shipment_method) and $this->found_shipment_method) {
    echo "<h3>" . JText::_('COM_VIRTUEMART_CART_SELECT_SHIPMENT') . "</h3>";
    ?>


	<fieldset>
		<?php 
    // if only one Shipment , should be checked by default
    foreach ($this->shipments_shipment_rates as $shipment_shipment_rates) {
        if (is_array($shipment_shipment_rates)) {
            foreach ($shipment_shipment_rates as $shipment_shipment_rate) {
                $shipment_shipment_rate = str_replace('input', 'input onClick="setShipment();"', $shipment_shipment_rate);
                echo "<div>" . $shipment_shipment_rate . "</div>\n";
Exemple #19
0
" name="vote">
				</div>

				<?php 
            $reviewJavascript = "\n\t\tjQuery(function(\$) {\n\t\t\tjQuery('.rating .ratingbox').mousemove( function(e){\n\t\t\t\tvar steps = " . $maxrating . ";\n\t\t\t\tvar parentPos= \$('.rating .ratingbox').position();\n\t\t\t\tvar boxWidth = \$('.rating .ratingbox').width();// nbr of total pixels\n\t\t\t\tvar starSize = (boxWidth/steps);\n\t\t\t\tvar ratingboxPos= \$('.rating .ratingbox').offset();\n\t\t\t\tvar span = jQuery(this).children();\n\t\t\t\tvar dif = e.pageX-ratingboxPos.left; // nbr of pixels\n\t\t\t\tdifRatio = Math.floor(dif/boxWidth* steps )+1; //step\n\t\t\t\tspan.width(difRatio*starSize);\n\t\t\t\t\$('#vote').val(difRatio);\n\t\t\t\t//console.log('note = ',parentPos, boxWidth, ratingboxPos);\n\t\t\t});\n\t\t});\n\t\t";
            vmJsApi::addJScript('rating_stars', $reviewJavascript);
        }
        // Writing A Review
        if ($this->allowReview and $review_editable) {
            ?>
			<div class="write-reviews">

				<?php 
            // Show Review Length While Your Are Writing
            $reviewJavascript = "\nfunction check_reviewform() {\n\nvar form = document.getElementById('reviewform');\nvar ausgewaehlt = false;\n\n\tif (form.comment.value.length < " . VmConfig::get('reviews_minimum_comment_length', 100) . ") {\n\t\talert('" . addslashes(vmText::sprintf('COM_VIRTUEMART_REVIEW_ERR_COMMENT1_JS', VmConfig::get('reviews_minimum_comment_length', 100))) . "');\n\t\treturn false;\n\t}\n\telse if (form.comment.value.length > " . VmConfig::get('reviews_maximum_comment_length', 2000) . ") {\n\t\talert('" . addslashes(vmText::sprintf('COM_VIRTUEMART_REVIEW_ERR_COMMENT2_JS', VmConfig::get('reviews_maximum_comment_length', 2000))) . "');\n\t\treturn false;\n\t}\n\telse {\n\t\treturn true;\n\t}\n}\n\nfunction refresh_counter() {\n\tvar form = document.getElementById('reviewform');\n\tform.counter.value= form.comment.value.length;\n}\n";
            vmJsApi::addJScript('check_reviewform', $reviewJavascript);
            ?>
				<span
					class="step"><?php 
            echo vmText::sprintf('COM_VIRTUEMART_REVIEW_COMMENT', VmConfig::get('reviews_minimum_comment_length', 100), VmConfig::get('reviews_maximum_comment_length', 2000));
            ?>
</span>
				<br/>
				<textarea class="virtuemart" title="<?php 
            echo vmText::_('COM_VIRTUEMART_WRITE_REVIEW');
            ?>
"
						  class="inputbox" id="comment" onblur="refresh_counter();" onfocus="refresh_counter();"
						  onkeyup="refresh_counter();" name="comment" rows="5"
						  cols="60"><?php 
            if (!empty($this->review->comment)) {
*
* @version $Id: mod_virtuemart_cart.php 9084 2015-12-14 18:04:37Z yourgeek $
* @package VirtueMart
* @subpackage modules
*
* www.virtuemart.net
*/
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
if (!class_exists('VmConfig')) {
    require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
VmConfig::loadConfig();
VmConfig::loadJLang('mod_virtuemart_cart', true);
VmConfig::loadJLang('com_virtuemart', true);
vmJsApi::jQuery();
vmJsApi::addJScript("/modules/mod_virtuemart_cart/assets/js/update_cart.js", false, false);
//This is strange we have the whole thing again in controllers/cart.php public function viewJS()
if (!class_exists('VirtueMartCart')) {
    require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
}
$cart = VirtueMartCart::getCart(false);
$viewName = vRequest::getString('view', 0);
if ($viewName == 'cart') {
    $checkAutomaticPS = true;
} else {
    $checkAutomaticPS = false;
}
$data = $cart->prepareAjaxData();
if (!class_exists('CurrencyDisplay')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
Exemple #21
0
 /**
  * Displays file handler and file selector
  *
  * @author Max Milbers
  * @param array $fileIds
  */
 public function displayFilesHandler($fileIds, $type)
 {
     VmConfig::loadJLang('com_virtuemart_media');
     $html = $this->displayFileSelection($fileIds, $type);
     $html .= $this->displayFileHandler();
     if (empty($this->_db)) {
         $this->_db = JFactory::getDBO();
     }
     $this->_db->setQuery('SELECT FOUND_ROWS()');
     $imagetotal = $this->_db->loadResult();
     //vmJsApi::jQuery(array('easing-1.3.pack','mousewheel-3.0.4.pack','fancybox-1.3.4.pack'),'','fancybox');
     $j = "\n\t\tjQuery(document).ready(function(){ jQuery('#ImagesContainer').vm2admin('media','" . $type . "','0') }); ";
     $j .= "\n\t\tjQuery(document).ready(function(\$){\n\t\tvar medialink = '" . JURI::root(false) . "administrator/index.php?option=com_virtuemart&view=media&task=viewJson&format=json&mediatype=" . $type . "';\n\t\tvar media = \$('#searchMedia').data();\n\t\tvar searchMedia = \$('input#searchMedia');\n\t\tsearchMedia.click(function () {\n\t\t\tif (media.start>0) media.start=0;\n\t\t});\n\t\tsearchMedia.autocomplete({\n\n\t\t\tsource: medialink,\n\t\t\tselect: function(event, ui){\n\t\t\t\t\$('#ImagesContainer').append(ui.item.label);\n\t\t\t\t//\$(this).autocomplete( 'option' , 'source' , '" . JURI::root(false) . "administrator/index.php?option=com_virtuemart&view=product&task=getData&format=json&type=relatedcategories&row='+nextCustom )\n\n\t\t\t},\n\t\t\tminLength:1,\n\t\t\thtml: true\n\t\t});\n\t\t \$('.js-pages').click(function (e) {\n\t\t\te.preventDefault();\n\t\t\tif (searchMedia.val() =='') {\n\t\t\t\tsearchMedia.val(' ');\n\t\t\t\tmedia.start = 0;\n\t\t\t} else if (\$(this).hasClass('js-next')) media.start = media.start+16 ;\n\t\t\telse if (media.start > 0) media.start = media.start-16 ;\n\n\t\t\tsearchMedia.autocomplete( 'option' , 'source' , medialink+'&start='+media.start );\n\t\t\tsearchMedia.autocomplete( 'search');\n\t\t});\n\t\t\$('#ImagesContainer').sortable({\n\t\t\tupdate: function(event, ui) {\n\t\t\t\t\$(this).find('.ordering').each(function(index,element) {\n\t\t\t\t\t\$(element).val(index);\n\t\t\t\t\t//console.log(index+' ');\n\n\t\t\t\t});\n\n\t\t\t}\n\t\t});\n\t\t\$('#upload').change( function (){\n\t\t\t\tif (\$('#media_action0').is(':checked') ) \$('#media_actionupload').attr('checked', true);\n\t\t\t});\n\n\n\t});\n\t";
     vmJsApi::addJScript('mediahandler', $j);
     return $html;
 }
		jQuery(document).ready(function( $ ) {
				if ( $("#oncheckout_opc").is(\':checked\') ) {
					$(".not_opc_param").hide();
				} else {
					$(".not_opc_param").show();
				}
			 $("#oncheckout_opc").click(function() {
				if ( $("#oncheckout_opc").is(\':checked\') ) {
					$(".not_opc_param").hide();
				} else {
					$(".not_opc_param").show();
				}
			});
		});
	';
vmJsApi::addJScript('hideNotOPC', $js);
/*
 <table width="100%">
<tr>
<td valign="top" width="50%"> */
?>
<fieldset>
	<legend><?php 
echo vmText::_('COM_VIRTUEMART_ADMIN_CFG_CHECKOUT_SETTINGS');
?>
</legend>
	<table class="admintable">
		<?php 
echo VmHTML::row('checkbox', 'COM_VIRTUEMART_ADMIN_CFG_ADDTOCART_POPUP', 'addtocart_popup', VmConfig::get('addtocart_popup', 1));
echo VmHTML::row('checkbox', 'COM_VIRTUEMART_CFG_POPUP_REL', 'popup_rel', VmConfig::get('popup_rel', 1));
echo VmHTML::row('checkbox', 'COM_VIRTUEMART_ADMIN_CHECKOUT_OPC', 'oncheckout_opc', VmConfig::get('oncheckout_opc', 1));
Exemple #23
0
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: order.php 9188 2016-02-27 23:10:51Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
AdminUIHelper::startAdminArea($this);
AdminUIHelper::imitateTabs('start', 'COM_VIRTUEMART_ORDER_PRINT_PO_LBL');
// Get the plugins
JPluginHelper::importPlugin('vmshopper');
JPluginHelper::importPlugin('vmshipment');
JPluginHelper::importPlugin('vmpayment');
vmJsApi::addJScript('orderedit', "\n\t\tjQuery( function(\$) {\n\n\t\t\t\$('.orderedit').hide();\n\t\t\t\$('.ordereditI').show();\n\t\t\t\$('.orderedit').css('backgroundColor', 'lightgray');\n\n\t\t\tjQuery('.updateOrderItemStatus').click(function() {\n\t\t\t\tdocument.orderItemForm.task.value = 'updateOrderItemStatus';\n\t\t\t\tdocument.orderItemForm.submit();\n\t\t\t\treturn false\n\t\t\t});\n\n\t\t\tjQuery('select#virtuemart_paymentmethod_id').change(function(){\n\t\t\t\tjQuery('span#delete_old_payment').show();\n\t\t\t\tjQuery('input#delete_old_payment').attr('checked','checked');\n\t\t\t});\n\n\t\t});\n\n\t\tfunction enableEdit(e)\n\t\t{\n\t\t\tjQuery('.orderedit').each( function()\n\t\t\t{\n\t\t\t\tvar d = jQuery(this).css('visibility')=='visible';\n\t\t\t\tjQuery(this).toggle();\n\t\t\t\tjQuery('.orderedit').css('backgroundColor', d ? 'white' : 'lightgray');\n\t\t\t\tjQuery('.orderedit').css('color', d ? 'blue' : 'black');\n\t\t\t});\n\t\t\tjQuery('.ordereditI').each( function()\n\t\t\t{\n\t\t\t\tjQuery(this).toggle();\n\t\t\t});\n\t\t\te.preventDefault();\n\t\t};\n\n\t\tfunction addNewLine(e,i) {\n\n\t\t\tvar row = jQuery('#itemTable').find('#lItemRow').html();\n\t\t\tvar needle = 'item_id['+i+']';\n\t\t\t//var needle = new RegExp('item_id['+i+']','igm');\n\t\t\twhile (row.indexOf(needle) !== -1){\n\t\t\t\trow = row.replace(needle,'item_id[0]');\n\t\t\t}\n\n\t\t\t//alert(needle);\n\t\t\tjQuery('#itemTable').find('#lItemRow').after('<tr>'+row+'</tr>');\n\t\t\te.preventDefault();\n\t\t};\n\n\t\tfunction cancelEdit(e) {\n\t\t\tjQuery('#orderItemForm').each(function(){\n\t\t\t\tthis.reset();\n\t\t\t});\n\t\t\tjQuery('.selectItemStatusCode')\n\t\t\t\t.find('option:selected').prop('selected', true)\n\t\t\t\t.end().trigger('liszt:updated');\n\t\t\tjQuery('.orderedit').hide();\n\t\t\tjQuery('.ordereditI').show();\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tfunction resetOrderHead(e) {\n\t\t\tjQuery('#orderForm').each(function(){\n\t\t\t\tthis.reset();\n\t\t\t});\n\t\t\tjQuery('select#virtuemart_paymentmethod_id')\n\t\t\t\t.find('option:selected').prop('selected', true)\n\t\t\t\t.end().trigger('liszt:updated');\n\t\t\tjQuery('select#virtuemart_shipmentmethod_id')\n\t\t\t\t.find('option:selected').prop('selected', true)\n\t\t\t\t.end().trigger('liszt:updated');\n\t\t\te.preventDefault();\n\t\t}\n\n\t\t");
$j = "\njQuery('.show_element').click(function() {\n  jQuery('.element-hidden').toggle();\n  jQuery('select').trigger('chosen:updated');\n  return false;\n});\njQuery('.updateOrderItemStatus').click(function() {\n\tdocument.orderItemForm.task.value = 'updateOrderItemStatus';\n\tdocument.orderItemForm.submit();\n\treturn false;\n});\njQuery('.updateOrder').click(function() {\n\tdocument.orderForm.submit();\n\treturn false;\n});\njQuery('.createOrder').click(function() {\n\tdocument.orderForm.task.value = 'CreateOrderHead';\n\tdocument.orderForm.submit();\n\treturn false;\n});\njQuery('.newOrderItem').click(function() {\n\tdocument.orderItemForm.task.value = 'newOrderItem';\n\tdocument.orderItemForm.submit();\n\treturn false;\n});\njQuery('.orderStatFormSubmit').click(function() {\n\t//document.orderStatForm.task.value = 'updateOrderItemStatus';\n\tdocument.orderStatForm.submit();\n\n\treturn false;\n});\n\nfunction confirmation(destnUrl) {\n\tvar answer = confirm('" . addslashes(vmText::_('COM_VIRTUEMART_ORDER_DELETE_ITEM_JS')) . "');\nif (answer) {\n\twindow.location = destnUrl;\n\t}\n}\n\nvar editingItem = 0;\n";
vmJsApi::addJScript('ordergui', $j);
?>
<div style="text-align: left;">
<form name='adminForm' id="adminForm">
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="option" value="com_virtuemart" />
		<input type="hidden" name="view" value="orders" />
		<input type="hidden" name="virtuemart_order_id" value="<?php 
echo $this->orderID;
?>
" />
		<?php 
echo JHtml::_('form.token');
?>

Exemple #24
0
} else {
    $url = $this->url;
}
$user = JFactory::getUser();
if ($this->show and $user->id == 0) {
    JHtml::_('behavior.formvalidation');
    //Extra login stuff, systems like openId and plugins HERE
    if (JPluginHelper::isEnabled('authentication', 'openid')) {
        $lang = JFactory::getLanguage();
        $lang->load('plg_authentication_openid', JPATH_ADMINISTRATOR);
        $langScript = '
//<![CDATA[
' . 'var JLanguage = {};' . ' JLanguage.WHAT_IS_OPENID = \'' . vmText::_('WHAT_IS_OPENID') . '\';' . ' JLanguage.LOGIN_WITH_OPENID = \'' . vmText::_('LOGIN_WITH_OPENID') . '\';' . ' JLanguage.NORMAL_LOGIN = \'' . vmText::_('NORMAL_LOGIN') . '\';' . ' var comlogin = 1;
//]]>
                ';
        vmJsApi::addJScript('login_openid', $langScript);
        JHtml::_('script', 'openid.js');
    }
    $html = '';
    JPluginHelper::importPlugin('vmpayment');
    $dispatcher = JDispatcher::getInstance();
    $returnValues = $dispatcher->trigger('plgVmDisplayLogin', array($this, &$html, $this->from_cart));
    if (is_array($html)) {
        foreach ($html as $login) {
            echo $login . '<br />';
        }
    } else {
        echo $html;
    }
    //end plugins section
    //anonymous order section
Exemple #25
0
    function display($tpl = null)
    {
        if (!class_exists('VmImage')) {
            require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
        }
        tsmConfig::loadJLang('com_tsmart_orders', TRUE);
        if (JFactory::getApplication()->isSite()) {
            $bar = JToolBar::getInstance('toolbar');
            $bar->appendButton('Link', 'back', 'com_tsmart_LEAVE', 'index.php?option=com_tsmart&manage=0');
        }
        $layout = $this->getLayout();
        if ($this->manager('report')) {
            vmSetStartTime('report');
            $model = tmsModel::getModel('tsmart');
            $nbrCustomers = $model->getTotalCustomers();
            $this->nbrCustomers = $nbrCustomers;
            $nbrActiveProducts = $model->getTotalActiveProducts();
            $this->nbrActiveProducts = $nbrActiveProducts;
            $nbrInActiveProducts = $model->getTotalInActiveProducts();
            $this->nbrInActiveProducts = $nbrInActiveProducts;
            $nbrFeaturedProducts = $model->getTotalFeaturedProducts();
            $this->nbrFeaturedProducts = $nbrFeaturedProducts;
            $ordersByStatus = $model->getTotalOrdersByStatus();
            $this->ordersByStatus = $ordersByStatus;
            $recentOrders = $model->getRecentOrders();
            if (!class_exists('CurrencyDisplay')) {
                require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
            }
            /* Apply currency This must be done per order since it's vendor specific */
            $_currencies = array();
            // Save the currency data during this loop for performance reasons
            foreach ($recentOrders as $tsmart_order_id => $order) {
                //This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
                if (!array_key_exists('v' . $order->tsmart_vendor_id, $_currencies)) {
                    $_currencies['v' . $order->tsmart_vendor_id] = CurrencyDisplay::getInstance('', $order->tsmart_vendor_id);
                }
                $order->order_total = $_currencies['v' . $order->tsmart_vendor_id]->priceDisplay($order->order_total);
            }
            $this->recentOrders = $recentOrders;
            $recentCustomers = $model->getRecentCustomers();
            $this->recentCustomers = $recentCustomers;
            $reportModel = tmsModel::getModel('report');
            vRequest::setvar('task', '');
            $myCurrencyDisplay = CurrencyDisplay::getInstance();
            $revenueBasic = $reportModel->getRevenue(60, true);
            $this->report = $revenueBasic['report'];
            vmJsApi::addJScript("jsapi", "//google.com/jsapi", false, false, '');
            vmJsApi::addJScript('vm.stats_chart', $revenueBasic['js'], false, true);
            vmTime('Created report', 'report');
        }
        //if($layout=='default'){
        $j = 'jQuery("#feed").ready(function(){
				var datas = "";
				vmSiteurl = "' . JURI::root() . '"
				jQuery.ajax({
						type: "GET",
						async: true,
						cache: false,
						dataType: "json",
						url: vmSiteurl + "index.php?option=com_tsmart&view=tsmart&task=feed",
						data: datas,
						dataType: "html"
					})
					.done(function( data ) {
						jQuery("#feed").append(data);
					});
				})';
        vmJsApi::addJScript('getFeed', $j, false, true);
        //}
        self::showACLPref($this);
        parent::display($tpl);
    }
    echo $tables['fields'];
} else {
    echo $emptyTable;
}
?>
					</tbody>
				</table><!-- custom_fields -->
			</fieldset>
			<!--fieldset style="background-color:#F9F9F9;">
				<legend><?php 
echo vmText::_('COM_VIRTUEMART_CUSTOM_EXTENSION');
?>
</legend>
				<div id="custom_customPlugins"><?php 
echo $tables['customPlugins'];
?>
</div>
			</fieldset-->
		</td>

	</tr>
</table>


<div style="clear:both;"></div>

<?php 
$jsonLink = JURI::root(false) . 'administrator/index.php?option=com_virtuemart&view=product&task=getData&format=json&virtuemart_product_id=' . $this->product->virtuemart_product_id;
$jsCsort = "\n\tnextCustom =" . $i . ";\n\n\tjQuery(document).ready(function(){\n\t\tjQuery('#custom_field').sortable({cursorAt: { top: 0, left: 0 },handle: '.vmicon-16-move'});\n\t\t// Need to declare the update routine outside the sortable() function so\n\t\t// that it can be called when adding new customfields\n\t\tjQuery('#custom_field').bind('sortupdate', function(event, ui) {\n\t\t\tjQuery(this).find('.ordering').each(function(index,element) {\n\t\t\t\tjQuery(element).val(index);\n\t\t\t});\n\t\t});\n\t\tjQuery('#custom_categories').sortable({cursorAt: { top: 0, left: 0 },handle: '.vmicon-16-move'});\n\t\tjQuery('#custom_categories').bind('sortupdate', function(event, ui) {\n\t\t\tjQuery(this).find('.ordering').each(function(index,element) {\n\t\t\t\tjQuery(element).val(index);\n\t\t\t});\n\t\t});\n\t\tjQuery('#custom_products').sortable({cursorAt: { top: 0, left: 0 },handle: '.vmicon-16-move'});\n\t\tjQuery('#custom_products').bind('sortupdate', function(event, ui) {\n\t\t\tjQuery(this).find('.ordering').each(function(index,element) {\n\t\t\t\tjQuery(element).val(index);\n\t\t\t});\n\t\t});\n\t});\n\tjQuery('select#customlist').chosen().change(function() {\n\t\tselected = jQuery(this).find( 'option:selected').val() ;\n\t\tjQuery.getJSON('" . $jsonLink . "&type=fields&id='+selected+'&row='+nextCustom,\n\t\tfunction(data) {\n\t\t\tjQuery.each(data.value, function(index, value){\n\t\t\t\tjQuery('#custom_field').append(value);\n\t\t\t\tjQuery('#custom_field').trigger('sortupdate');\n\t\t\t});\n\t\t});\n\t\tnextCustom++;\n\t});\n\n\tjQuery.each(jQuery('.cvard'), function(i,val){\n\t\tjQuery(val).chosen().change(function() {\n\t\t\tquantity = jQuery(this).parent().find('input[type=\"hidden\"]');\n\t\t\tquantity.val(jQuery(this).val());\n\t\t});\n\t});\n\n\tjQuery('input#relatedproductsSearch').autocomplete({\n\t\tsource: '" . $jsonLink . "&type=relatedproducts&row='+nextCustom,\n\t\tselect: function(event, ui){\n\t\t\tjQuery('#custom_products').append(ui.item.label);\n\t\t\tjQuery('#custom_products').trigger('sortupdate');\n\t\t\tnextCustom++;\n\t\t\tjQuery(this).autocomplete( 'option' , 'source' , '" . $jsonLink . "&type=relatedproducts&row='+nextCustom )\n\t\t\tjQuery('input#relatedproductsSearch').autocomplete( 'option' , 'source' , '" . JURI::root(false) . "administrator/index.php?option=com_virtuemart&view=product&task=getData&format=json&type=relatedproducts&row='+nextCustom )\n\t\t},\n\t\tminLength:1,\n\t\thtml: true\n\t});\n\tjQuery('input#relatedcategoriesSearch').autocomplete({\n\n\t\tsource: '" . $jsonLink . "&type=relatedcategories&row='+nextCustom,\n\t\tselect: function(event, ui){\n\t\t\tjQuery('#custom_categories').append(ui.item.label);\n\t\t\tjQuery('#custom_categories').trigger('sortupdate');\n\t\t\tnextCustom++;\n\t\t\tjQuery(this).autocomplete( 'option' , 'source' , '" . $jsonLink . "&type=relatedcategories&row='+nextCustom )\n\t\t\tjQuery('input#relatedcategoriesSearch').autocomplete( 'option' , 'source' , '" . JURI::root(false) . "administrator/index.php?option=com_virtuemart&view=product&task=getData&format=json&type=relatedcategories&row='+nextCustom )\n\t\t},\n\t\tminLength:1,\n\t\thtml: true\n\t});\n\n\neventNames = 'click.remove keydown.remove change.remove focus.remove'; // all events you wish to bind to\n\nfunction removeParent() {jQuery('#customfieldsParent').remove(); }\n\njQuery('#customfieldsTable').find('input').each(function(i){\n\tcurrent = jQuery(this);\n\tcurrent.click(function(){\n\t\t\tjQuery('#customfieldsParent').remove();\n\t\t});\n});\n    \n";
vmJsApi::addJScript('cSort', $jsCsort);
    /**
     * @param $snippet
     * @param $message
     * @return string
     */
    function displayJSSnippet($hide_BTST)
    {
        // DESKTOP: Width of containing block shall be at least 750px
        // MOBILE: Width of containing block shall be 100% of browser window (No
        // padding or margin)
        vmJsApi::addJScript('/plugins/vmpayment/klarnacheckout/assets/js/klarnacheckout.js', false, false);
        vmJsApi::jPrice();
        $updateCartScript = '
			jQuery(document).ready(function($) {
				window._klarnaCheckout(function(api) {
					api.on({
						"change": function(data) {
							console.log("window._klarnaCheckout calls klarnaCheckoutPayment.updateCart ");
							klarnaCheckoutPayment.updateCart(data,"' . $this->_currentMethod->virtuemart_paymentmethod_id . '");
						}
					});
				});
        });

';
        $updateSnippetScript = '
		jQuery(document).ready(function($) {
			klarnaCheckoutPayment.updateSnippet();
		});
';
        $initPaymentScript = '
		jQuery(document).ready(function($) {
			klarnaCheckoutPayment.initPayment(' . $hide_BTST . ');
		});
';
        vmJsApi::jDynUpdate();
        vmJsApi::addJScript('vm.kco_updatecart', $updateCartScript);
        vmJsApi::addJScript('vm.kco_initpayment', $initPaymentScript);
        //vmJsApi::addJScript('vm.kco_updatesnippet', $updateSnippetScript);
        $hide_BTST = false;
        return;
    }
    public function preparePost()
    {
        $post_variables = $this->initPostVariables($this->_method->payment_type);
        $paymentCurrency = CurrencyDisplay::getInstance($this->_method->payment_currency);
        $order_number_text = $this->getItemName(vmText::_('COM_VIRTUEMART_ORDER_NUMBER'));
        switch ($this->_method->payment_type) {
            case '_xclick':
            case '_donations':
                $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number;
                $post_variables['amount'] = $this->total;
                break;
            case '_oe-gift-certificate':
                $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number;
                //$post_variables['amount'] = round ($paymentCurrency->convertCurrencyTo ($this->_method->payment_currency, $this->order['details']['BT']->order_total, FALSE), 2);;
                $post_variables['fixed_denom'] = vmPSPlugin::getAmountValueInCurrency($this->order['details']['BT']->order_salesPrice, $this->_method->payment_currency);
                //$post_variables['min_denom'] = $this->total;
                //$post_variables['max_denom'] = $this->total;
                $post_variables['shopping_url'] = JURI::root();
                $post_variables['buyer_name'] = $this->order['details']['BT']->first_name . ' ' . $this->order['details']['BT']->last_name;
                if (array_key_exists('ST', $this->order['details'])) {
                    $post_variables['recipient_name'] = $this->order['details']['ST']->first_name . ' ' . $this->order['details']['ST']->last_name;
                }
                break;
            case '_cart':
                $this->addPrices($post_variables);
                break;
            case '_xclick-subscriptions':
                $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number;
                if ($this->_method->subcription_trials) {
                    $post_variables['a1'] = $this->_method->trial1_price ? $this->_method->trial1_price : 0;
                    //Trial1 price.
                    $post_variables['p1'] = $this->getDurationValue($this->_method->trial1_duration);
                    $post_variables['t1'] = $this->getDurationUnit($this->_method->trial1_duration);
                }
                /*if ($this->_method->subcription_trials == 2) {
                			$post_variables['a2']		= ($this->_method->trial2_price) ? $this->_method->trial2_price : 0; //Trial2 price.
                			$post_variables['p2']       = $this->getDurationValue($this->_method->trial2_duration);
                			$post_variables['t2']       = $this->getDurationUnit($this->_method->trial2_duration);
                		}*/
                $post_variables['a3'] = $this->total;
                //Regular subscription price.
                $post_variables['p3'] = $this->getDurationValue($this->_method->subscription_duration);
                $post_variables['t3'] = $this->getDurationUnit($this->_method->subscription_duration);
                $post_variables['src'] = 1;
                //Recurring payments. Subscription payments recur unless subscribers cancel their subscriptions before the end of the current billing cycle or you limit the number of times that payments recur with the value that you specify for srt
                $post_variables['srt'] = $this->_method->subscription_term;
                //Recurring times. Number of times that subscription payments recur. Specify an integer with a minimum value of 1 and a maximum value of 52. Valid only if you specify src="1"
                $post_variables['sra'] = 1;
                //Reattempt on failure. If a recurring payment fails, PayPal attempts to collect the payment two more times before canceling the subscription.
                $post_variables['modify'] = 0;
                //Modification behavior. Allowable values are:
                //0 – allows subscribers only to sign up for new subscriptions,
                //1 – allows subscribers to sign up for new subscriptions and modify their current subscriptions
                //2 – allows subscribers to modify only their current subscriptions
                break;
            case '_xclick-auto-billing':
                $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number;
                //A description of the automatic billing plan.
                $post_variables['max_text'] = $this->_method->payment_desc;
                //Specify whether to let buyers enter maximum billing limits in a text box or choose from a list of maximum billing limits that you specify.
                //Allowable values are:
                //max_limit_own – your button displays a text box for buyers to enter their own maximums above a minimum billing limit that you set with the min_amount variable.
                //max_limit_defined – your button displays a dropdown menu of product options with prices to let buyers choose their maximum billing limits.
                $post_variables['set_customer_limit'] = 'max_limit_defined';
                //The minimum monthly billing limit, if you have one. Valid only if set_customer_limit = max_limit_own.
                //$post_variables['min_amount'] 	= 0;
                $post_variables['min_amount'] = $this->total;
                switch ($this->_method->billing_max_amount_type) {
                    case 'cust':
                        $post_variables["max_amount"] = vmPSPlugin::getAmountValueInCurrency($this->customerData->getVar('autobilling_max_amount'), $this->_method->payment_currency);
                        break;
                    case 'value':
                        $post_variables["max_amount"] = vmPSPlugin::getAmountValueInCurrency($this->_method->billing_max_amount, $this->_method->payment_currency);
                        break;
                    case 'perc':
                        $percentage = $this->_method->billing_max_amount;
                        $max_amount = $this->total * floatval($percentage) / 100 + $this->total;
                        $post_variables['max_amount'] = round($max_amount, 2);
                        break;
                    case 'cart':
                    default:
                        $post_variables['max_amount'] = $this->total;
                        break;
                }
                break;
            case '_xclick-payment-plan':
                $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number;
                $post_variables['disp_tot'] = 'Y';
                //Display the total payment amount to buyers during checkout
                $post_variables['option_index'] = 0;
                $post_variables['option_select0_type'] = 'E';
                //F – pay in full, at checkout, E – pay in equal periods, beginning at checkout or sometime later, V – pay in variable periods, beginning at checkout
                if ($this->_method->payment_plan_defer) {
                    $post_variables['option_select0_a0'] = '0.00';
                    $post_variables['option_select0_p0'] = $this->getDurationValue($this->_method->payment_plan_defer_duration);
                    $post_variables['option_select0_t0'] = $this->getDurationUnit($this->_method->payment_plan_defer_duration);
                    $post_variables['option_select0_n0'] = 1;
                    $post_variables['option_select0_a1'] = round($this->total / $this->_method->payment_plan_term, 2);
                    $post_variables['option_select0_p1'] = $this->getDurationValue($this->_method->payment_plan_duration);
                    $post_variables['option_select0_t1'] = $this->getDurationUnit($this->_method->payment_plan_duration);
                    $post_variables['option_select0_n1'] = $this->_method->payment_plan_term;
                } else {
                    $post_variables['option_select0_a0'] = round($this->total / $this->_method->payment_plan_term, 2);
                    $post_variables['option_select0_p0'] = $this->getDurationValue($this->_method->payment_plan_duration);
                    $post_variables['option_select0_t0'] = $this->getDurationUnit($this->_method->payment_plan_duration);
                    $post_variables['option_select0_n0'] = $this->_method->payment_plan_term;
                }
                $post_variables['os0'] = 'pay-in-' . $this->_method->payment_plan_term;
                $post_variables['option_select0'] = 'pay-in-' . $this->_method->payment_plan_term;
                $post_variables['option_select0_name'] = $this->_method->payment_name;
        }
        $url = $this->_getPayPalUrl();
        if (vmconfig::get('css')) {
            $msg = vmText::_('VMPAYMENT_PAYPAL_REDIRECT_MESSAGE', true);
        } else {
            $msg = '';
        }
        vmJsApi::addJScript('vm.paymentFormAutoSubmit', '
  			jQuery(document).ready(function($){
   				jQuery("body").addClass("vmLoading");
  				var msg="' . $msg . '";
   				jQuery("body").append("<div class=\\"vmLoadingDiv\\"><div class=\\"vmLoadingDivMsg\\">"+msg+"</div></div>");
    			jQuery("#vmPaymentForm").submit();
			})
		');
        $html = '';
        if ($this->_method->debug) {
            $html .= '<form action="' . $url . '" method="post" name="vm_paypal_form" target="paypal">';
        } else {
            $html .= '<form action="' . $url . '" method="post" name="vm_paypal_form" id="vmPaymentForm" accept-charset="UTF-8">';
        }
        $html .= '<input type="hidden" name="charset" value="utf-8">';
        foreach ($post_variables as $name => $value) {
            $html .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
        }
        if ($this->_method->debug) {
            $html .= '<div style="background-color:red;color:white;padding:10px;">
						<input type="submit"  value="The method is in debug mode. Click here to be redirected to PayPal" />
						</div>';
            $this->debugLog($post_variables, 'PayPal request:', 'debug');
        } else {
            $html .= '<input type="submit"  value="' . vmText::_('VMPAYMENT_PAYPAL_REDIRECT_MESSAGE') . '" />';
        }
        $html .= '</form>';
        return $html;
    }
    function addStandardEditViewCommandsNoValidate($id = 0, $object = null)
    {
        $view = vRequest::getCmd('view', vRequest::getCmd('controller', 'tsmart'));
        if (!class_exists('JToolBarHelper')) {
            require JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'toolbar.php';
        }
        JToolBarHelper::divider();
        if (vmAccess::manager($view . '.edit')) {
            JToolBarHelper::save();
            JToolBarHelper::apply();
        }
        JToolBarHelper::cancel();
        //self::showHelp();
        //self::showACLPref($view);
        if ($view != 'shipmentmethod' and $view != 'paymentmethod' and $view != 'media') {
            $validate = true;
        } else {
            $validate = false;
        }
        $this->addJsJoomlaSubmitButtonNoValidate($validate);
        $editView = vRequest::getCmd('view', vRequest::getCmd('controller', ''));
        $params = JComponentHelper::getParams('com_languages');
        $selectedLangue = $params->get('site', 'en-GB');
        $this->lang = strtolower(strtr($selectedLangue, '-', '_'));
        // Get all the published languages defined in Language manager > Content
        $allLanguages = JLanguageHelper::getLanguages();
        foreach ($allLanguages as $jlang) {
            $languagesByCode[$jlang->lang_code] = $jlang;
        }
        // only add if ID and view not null
        if ($editView and $id and count(tsmConfig::get('active_languages')) > 1) {
            if ($editView == 'user') {
                $editView = 'vendor';
            }
            jimport('joomla.language.helper');
            $this->lang = vRequest::getVar('vmlang', $this->lang);
            // list of languages installed in #__extensions (may be more than the ones in the Language manager > Content if the user did not added them)
            $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('VMPATH_ROOT'), true);
            $activeVmLangs = tsmConfig::get('active_languages');
            $flagCss = "";
            foreach ($languages as $k => &$joomlaLang) {
                if (!in_array($joomlaLang['value'], $activeVmLangs)) {
                    unset($languages[$k]);
                } else {
                    $key = $joomlaLang['value'];
                    if (!isset($languagesByCode[$key])) {
                        $img = substr($key, 0, 2);
                        //We try a fallback
                        vmdebug('com_tsmart_MISSING_FLAG', $img, $joomlaLang['text']);
                    } else {
                        $img = $languagesByCode[$key]->image;
                    }
                    $image_flag = VMPATH_ROOT . "/media/mod_languages/images/" . $img . ".gif";
                    $image_flag_url = JURI::root() . "media/mod_languages/images/" . $img . ".gif";
                    if (!file_exists($image_flag)) {
                        vmerror(tsmText::sprintf('com_tsmart_MISSING_FLAG', $image_flag, $joomlaLang['text']));
                    } else {
                        $flagCss .= "td.flag-" . $key . ",.flag-" . $key . "{background: url( " . $image_flag_url . ") no-repeat 0 0; padding-left:20px !important;}\n";
                    }
                }
            }
            JFactory::getDocument()->addStyleDeclaration($flagCss);
            $this->langList = JHtml::_('select.genericlist', $languages, 'vmlang', 'class="inputbox" style="width:176px;"', 'value', 'text', $selectedLangue, 'vmlang');
            if ($editView == 'product') {
                $productModel = tmsModel::getModel('product');
                $childproducts = $productModel->getProductChilds($id) ? $productModel->getProductChilds($id) : '';
            }
            $token = vRequest::getFormToken();
            $j = '
			jQuery(function($) {
				var oldflag = "";
				$("select#vmlang").chosen().change(function() {
					langCode = $(this).find("option:selected").val();
					flagClass = "flag-"+langCode;
					jQuery.ajax({
						type: "GET",
						cache: false,
        				dataType: "json",
        				url: "index.php?option=com_tsmart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $id . '&editView=' . $editView . '&' . $token . '=1",
    				}).done(
						function(data) {
							var items = [];

							var theForm = document.forms["adminForm"];
							if(typeof theForm.vmlang==="undefined"){
							 	var input = document.createElement("input");
								input.type = "hidden";
								input.name = "vmlang";
								input.value = langCode;
								theForm.appendChild(input);
							} else {
								theForm.vmlang.value = langCode;
							}
							if (data.fields !== "error" ) {
								if (data.structure == "empty") alert(data.msg);
								$.each(data.fields , function(key, val) {
									cible = jQuery("#"+key);
									if (oldflag !== "") cible.parent().removeClass(oldflag)
									var tmce_ver = 0;
									if(typeof window.tinyMCE!=="undefined"){
										var tmce_ver=window.tinyMCE.majorVersion;
									}
									if (tmce_ver>="4") {
										if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) {
											tinyMCE.get(key).execCommand("mceSetContent", false,val);
											cible.val(val);
										} else if (data.structure !== "empty") cible.val(val);
									} else {
										if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) {
											tinyMCE.execInstanceCommand(key,"mceSetContent",false,val);
											cible.val(val);
										} else if (data.structure !== "empty") cible.val(val);
									}
									});

							} else alert(data.msg);';
            if ($editView == 'product' && !empty($childproducts)) {
                foreach ($childproducts as $child) {
                    $j .= 'jQuery.ajax({
        						type: "GET",
								cache: false,
        						dataType: "json",
        						url: "index.php?option=com_tsmart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $child->tsmart_product_id . '&editView=' . $editView . '&' . $token . '=1",
    					}).done(
								//	$.getJSON( "index.php?option=com_tsmart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $child->tsmart_product_id . '&editView=' . $editView . '&' . $token . '=1" ,
										function(data) {
											cible = jQuery("#child' . $child->tsmart_product_id . 'product_name");
											if (oldflag !== "") cible.parent().removeClass(oldflag)
											cible.parent().addClass(flagClass);
											cible.val(data.fields.product_name);
											jQuery("#child' . $child->tsmart_product_id . 'slug").val(data.fields["slug"]);
										}
									)
								';
                }
            }
            $j .= 'oldflag = flagClass ;
						}
					)
				});
			})';
            vmJsApi::addJScript('vmlang', $j);
        } else {
            $jlang = JFactory::getLanguage();
            $langs = $jlang->getKnownLanguages();
            $defautName = $selectedLangue;
            $flagImg = $selectedLangue;
            if (isset($languagesByCode[$selectedLangue])) {
                $defautName = $langs[$selectedLangue]['name'];
                $flagImg = JHtml::_('image', 'mod_languages/' . $languagesByCode[$selectedLangue]->image . '.gif', $languagesByCode[$selectedLangue]->title_native, array('title' => $languagesByCode[$selectedLangue]->title_native), true);
            } else {
                vmWarn(tsmText::sprintf('com_tsmart_MISSING_FLAG', $selectedLangue, $selectedLangue));
            }
            $this->langList = '<input name ="vmlang" type="hidden" value="' . $selectedLangue . '" >' . $flagImg . ' <b> ' . $defautName . '</b>';
        }
        if (JFactory::getApplication()->isSite()) {
            $bar = JToolBar::getInstance('toolbar');
            $bar->appendButton('Link', 'back', 'com_tsmart_LEAVE', 'index.php?option=com_tsmart&manage=0');
        }
    }
 static function keepAlive($minlps = 2, $maxlps = 5)
 {
     static $done = false;
     if ($done) {
         return;
     }
     $done = true;
     $config = JFactory::getConfig();
     $refTime = $config->get('lifetime');
     // the longest refresh period is 30 min to prevent integer overflow.
     if ($refTime > 30 || $refTime <= 0) {
         $refTime = 30;
     }
     $url = 'index.php?option=com_virtuemart&view=virtuemart&task=keepalive';
     vmJsApi::addJScript('keepAliveTime', 'var sessMin = ' . $refTime . ';var vmAliveUrl = "' . $url . '";var maxlps = "' . $maxlps . '";var minlps = "' . $minlps . '";', false, true);
     vmJsApi::addJScript('vmkeepalive', false, true, true);
 }