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}
 .vm2admin .subhead,.vmadmin{margin:0px;}
body {margin:0px}
.page-title{font-size:150%;}
.navbar-fixed-top {
 margin-bottom: 0px;
Beispiel #2
0
    static function jDate($date = '', $name = "date", $id = NULL, $resetBt = TRUE, $yearRange = '')
    {
        if ($yearRange) {
            $yearRange = 'yearRange: "' . $yearRange . '",';
        }
        if ($date == "0000-00-00 00:00:00") {
            $date = 0;
        }
        if (empty($id)) {
            $id = $name;
        }
        static $jDate;
        $dateFormat = JText::_('COM_VIRTUEMART_DATE_FORMAT_INPUT_J16');
        //="m/d/y"
        $search = array('m', 'd');
        $replace = array('mm', 'dd');
        $jsDateFormat = str_replace($search, $replace, $dateFormat);
        if ($date) {
            if (JVM_VERSION === 1) {
                $search = array('m', 'd', 'y');
                $replace = array('%m', '%d', '%y');
                $dateFormat = str_replace($search, $replace, $dateFormat);
            }
            $formatedDate = JHTML::_('date', $date, $dateFormat);
        } else {
            $formatedDate = JText::_('COM_VIRTUEMART_NEVER');
        }
        $display = '<input class="datepicker-db" id="' . $id . '" type="hidden" name="' . $name . '" value="' . $date . '" />';
        $display .= '<input id="' . $id . '_text" class="datepicker" type="text" value="' . $formatedDate . '" />';
        if ($resetBt) {
            $display .= '<span class="vmicon vmicon-16-logout icon-nofloat js-date-reset"></span>';
        }
        // If exist exit
        if ($jDate) {
            return $display;
        }
        $front = 'components/com_virtuemart/assets/';
        $document = JFactory::getDocument();
        $document->addScriptDeclaration('
			jQuery(document).ready( function($) {
			$(".datepicker").live( "focus", function() {
				$( this ).datepicker({
					changeMonth: true,
					changeYear: true,
					' . $yearRange . '
					dateFormat:"' . $jsDateFormat . '",
					altField: $(this).prev(),
					altFormat: "yy-mm-dd"
				});
			});
			$(".js-date-reset").click(function() {
				$(this).prev("input").val("' . JText::_('COM_VIRTUEMART_NEVER') . '").prev("input").val("0");
			});
		});
		');
        vmJsApi::js('jquery.ui.core', FALSE, '', TRUE);
        vmJsApi::js('jquery.ui.datepicker', FALSE, '', TRUE);
        vmJsApi::css('jquery.ui.all', $front . 'css/ui');
        $lg = JFactory::getLanguage();
        $lang = $lg->getTag();
        $existingLang = array("af", "ar", "ar-DZ", "az", "bg", "bs", "ca", "cs", "da", "de", "el", "en-AU", "en-GB", "en-NZ", "eo", "es", "et", "eu", "fa", "fi", "fo", "fr", "fr-CH", "gl", "he", "hr", "hu", "hy", "id", "is", "it", "ja", "ko", "kz", "lt", "lv", "ml", "ms", "nl", "no", "pl", "pt", "pt-BR", "rm", "ro", "ru", "sk", "sl", "sq", "sr", "sr-SR", "sv", "ta", "th", "tj", "tr", "uk", "vi", "zh-CN", "zh-HK", "zh-TW");
        if (!in_array($lang, $existingLang)) {
            $lang = substr($lang, 0, 2);
        } elseif (!in_array($lang, $existingLang)) {
            $lang = "en-GB";
        }
        vmJsApi::js('jquery.ui.datepicker-' . $lang, $front . 'js/i18n');
        $jDate = TRUE;
        return $display;
    }
Beispiel #3
0
 * @package	VirtueMart
 * @subpackage
 * @author Max Milbers, Valerie Isaksen

 * @link http://www.virtuemart.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: default_images.php 6188 2012-06-29 09:38:30Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
vmJsApi::js( 'fancybox/jquery.fancybox-1.3.4.pack');
vmJsApi::css('jquery.fancybox-1.3.4');
$document = JFactory::getDocument ();
$imageJS = '
jQuery(document).ready(function() {
	jQuery("a[rel=vm-additional-images]").fancybox({
		"titlePosition" 	: "inside",
		"transitionIn"	:	"elastic",
		"transitionOut"	:	"elastic"
	});
	jQuery(".additional-images .product-image").click(function() {
		jQuery(".main-image img").attr("src",this.src );
		jQuery(".main-image img").attr("alt",this.alt );
		jQuery(".main-image a").attr("href",this.src );
		jQuery(".main-image a").attr("title",this.alt );
	}); 
    public static function getUserInfoST(&$ref, &$OPCloader)
    {
        include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
        if (empty($ref->cart)) {
            $ref->cart = VirtueMartCart::getCart();
        }
        //$ref->cart->ST = 0;
        if (method_exists($ref->cart, 'prepareAddressDataInCart')) {
            $ref->cart->prepareAddressDataInCart('ST', 1);
        }
        if (method_exists($ref->cart, 'prepareAddressFieldsInCart')) {
            $ref->cart->prepareAddressFieldsInCart();
        }
        if (!empty($ref->cart->ST)) {
            $STaddress = $ref->cart->STaddress['fields'];
            foreach ($STaddress as $k => $val) {
                $kk = str_replace('shipto_', '', $STaddress[$k]['name']);
                if (empty($STaddress[$k]['value']) && !empty($ref->cart->ST) && !empty($ref->cart->ST[$kk])) {
                    $STaddress[$k]['value'] = $ref->cart->ST[$kk];
                }
                $STaddress[$k]['value'] = trim($STaddress[$k]['value']);
                if ($val['name'] == 'agreed') {
                    unset($STaddress[$k]);
                }
            }
            $STnamed = $STaddress;
            $STnamed = $OPCloader->setCountryAndState($STnamed);
        } else {
            $STaddress = array();
        }
        //$bt_user_info = $ref->cart->BTaddress->user_infoid;
        /*
        				if (!class_exists('VirtuemartModelUser'))
        				require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'user.php');
        */
        require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
        $umodel = OPCmini::getModel('user');
        //new VirtuemartModelUser();
        $virtuemart_userinfo_id = 0;
        $currentUser = JFactory::getUser();
        $uid = $currentUser->get('id');
        $userDetails = $umodel->getUser();
        $virtuemart_userinfo_id = $umodel->getBTuserinfo_id();
        $userFields = $umodel->getUserInfoInUserFields('default', 'BT', $virtuemart_userinfo_id);
        /*
        if (empty($userFields[$virtuemart_userinfo_id]))
        $virtuemart_userinfo_id = $umodel->getBTuserinfo_id();
        else $virtuemart_userinfo_id = $userFields[$virtuemart_userinfo_id]; 
        */
        //$id = $umodel->getId();
        if (empty($virtuemart_userinfo_id)) {
            return false;
        }
        $STaddressList = $umodel->getUserAddressList($uid, 'ST');
        $STaddressListOrig = $STaddressList;
        $addressCount = count($STaddressListOrig);
        if ($addressCount > 10) {
            $addressCountAjax = true;
        } else {
            $addressCountAjax = false;
        }
        // getUserAddressList uses references/pointers for it's objects, therefore we need to create a copy manually:
        /*
        if (false)
        {
        $STaddressListOrig = array(); 
        if (!empty($STaddressList))
        foreach ($STaddressList as $k => $v)
        {
         foreach ($v as $n=>$r)
          {
            $STaddressListOrig[$k]->$n = $r;       
          }
        }
        }
        */
        if (isset($ref->cart->STaddress['fields'])) {
            $BTaddress = $ref->cart->STaddress['fields'];
        } else {
            $BTaddress = $ref->cart->BTaddress['fields'];
        }
        if (!empty($ref->cart->savedST)) {
            foreach ($STaddressList as $key2 => $adr2) {
                foreach ($ref->cart->savedST as $key => $val) {
                    foreach ($adr2 as $keya => $vala) {
                        if ($keya == $key) {
                            if ($val == $vala) {
                                if (!isset($bm[$key2])) {
                                    $bm[$key2] = 0;
                                }
                                $bm[$key2]++;
                            }
                        }
                    }
                }
            }
            $largest = 0;
            $largest_key = 0;
            if (!empty($bm)) {
                foreach ($bm as $key => $bc) {
                    if ($bc >= $largest) {
                        $largest = $bc;
                        $largest_key = $key;
                    }
                }
            }
            if (!empty($largest)) {
                $selected_id = $STaddressList[$largest_key]->virtuemart_userinfo_id;
            }
        }
        $x = VmVersion::$RELEASE;
        $useSSL = VmConfig::get('useSSL', 0);
        foreach ($STaddressList as $ke => $address) {
            $STaddressList[$ke] = $OPCloader->setCountryAndState($STaddressList[$ke]);
            if (empty($address->address_type_name)) {
                $address->address_type_name = OPCLang::_('COM_VIRTUEMART_USER_FORM_ADDRESS_LABEL');
                //$address->address_type_name = OPCLang::_('JACTION_EDIT');
            }
            $link = self::getEditLink($uid, $address->virtuemart_userinfo_id);
            $STaddressList[$ke]->edit_link = $link;
        }
        $new_address_link = '#" onclick="return Onepage.op_showEditST();';
        //version_compare(
        //vm204: index.php?option=com_virtuemart&view=user&task=editaddresscart&new=1&addrtype=ST&cid[]=51
        // don't use ST
        if (empty($only_one_shipping_address)) {
            $arr = array('virtuemart_userinfo_id' => $virtuemart_userinfo_id, 'STaddressList' => $STaddressList);
            $html3 = $OPCloader->fetch($OPCloader, 'list_select_address.tpl', $arr);
            $bm = array();
            if (empty($html3)) {
                //theme file not found, please create or copy /overrides/list_select_address.tpl.php to your theme directory
                if (!$addressCountAjax) {
                    $html3 = '<select class="opc_st_select" name="ship_to_info_id" id="id' . $virtuemart_userinfo_id . '" onchange="return Onepage.changeST(this);" >';
                } else {
                    if (defined('OPC_DETECTED_DEVICE') && OPC_DETECTED_DEVICE != 'DESKTOP') {
                        $nochosen = true;
                    } else {
                        $nochosen = false;
                    }
                    if ($nochosen) {
                        $html3 = '<select class="opc_st_select" name="ship_to_info_id" id="id' . $virtuemart_userinfo_id . '" onchange="return Onepage.changeSTajax(this);" >';
                    } else {
                        $html3 = '<select class="opc-chzn-select opc_st_select" name="ship_to_info_id" id="id' . $virtuemart_userinfo_id . '" onchange="return Onepage.changeSTajax(this);" >';
                    }
                }
                $html3 .= '<option value="' . $virtuemart_userinfo_id . '">' . OPCLang::_('COM_VIRTUEMART_USER_FORM_ST_SAME_AS_BT') . '</option>';
                foreach ($STaddressList as $stlist) {
                    $html3 .= '<option value="' . $stlist->virtuemart_userinfo_id . '">';
                    if (!empty($stlist->address_type_name)) {
                        $html3 .= $stlist->address_type_name;
                    }
                    if (isset($stlist->address_1)) {
                        $html3 .= ',' . $stlist->address_1;
                    }
                    if (isset($stlist->city)) {
                        $html3 .= ',' . $stlist->city;
                    }
                    $html3 .= '</option>';
                }
                $html3 .= '<option value="new">' . OPCLang::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL') . '</option>';
                $html3 .= '</select>';
            }
            if (!empty($selected_id)) {
                $html3 = str_replace('value="' . $selected_id . '"', 'value="' . $selected_id . '" selected="selected" ', $html3);
            }
            $html3 .= '<input type="hidden" name="sa" id="sachone" value="" />';
        } else {
            // load single_shipping_address.tpl.php
            if (!empty($STaddressList)) {
                $adr1 = reset($STaddressListOrig);
                foreach ($adr1 as $k => $v) {
                    $ada[$k] = $v;
                    $ada['shipto_' . $k] = $v;
                }
                $ref->cart->ST = $ada;
            } else {
                $ref->cart->ST = 0;
            }
            if (!empty($ref->cart->ST['virtuemart_country_id'])) {
                $dc = $ref->cart->ST['virtuemart_country_id'];
            } else {
                $dc = OPCloader::getDefaultCountry($ref->cart, true);
            }
            $htmlsingle = $OPCloader->getSTfields($ref, true, false, $dc);
            if (!empty($adr1)) {
                $htmlsingle .= '<input type="hidden" name="shipto_logged" value="' . $adr1->virtuemart_userinfo_id . '" />';
            } else {
                $htmlsingle .= '<input type="hidden" name="shipto_logged" value="new" />';
            }
            // a default BT address
            $htmlbt = '<input type="hidden" name="ship_to_info_id_bt" id="ship_to_info_id_bt" value="' . $virtuemart_userinfo_id . '"  class="stradio"/>';
            $htmlsingle .= $htmlbt;
            $ref->cart->ST = 0;
            return $htmlsingle;
            // end of load single shipping address for a logged in user
        }
        $i = 2;
        $BTaddressNamed = $BTaddress;
        $BTaddressNamed = $OPCloader->setCountryAndState($BTaddressNamed);
        if (!empty($STaddressList) && empty($htmlsingle)) {
            if (!$addressCountAjax) {
                foreach ($STaddressListOrig as $ind => $adr1) {
                    $html2 = self::renderNamed($BTaddressNamed, $adr1, $ref->cart, $OPCloader, $virtuemart_userinfo_id);
                }
            } else {
                // we have a problem, the too many addresses will cause a memory leak, therefore we load them over ajax
            }
        }
        // add a new address:
        if (empty($htmlsingle)) {
            $ref->cart->ST = 0;
            $dc = OPCloader::getDefaultCountry($ref->cart, true);
            $html22 = $OPCloader->getSTfields($ref, true, true, $dc);
            $html22 .= '<input type="hidden" name="shipto_logged" value="new" />';
            //$html2 .= '<div id="hidden_st_" style="display: none;">'.$html22.'</div>';
            $html22 = str_replace('id="', 'id="REPLACEnewREPLACE', $html22);
            $html22 = str_replace('name="', 'name="REPLACEnewREPLACE', $html22);
            $html22 = '<div id="hidden_st_new" style="display: none;">' . $html22 . '<div id="opc_st_new">&nbsp;</div><input type="hidden" name="opc_st_changed_new" id="opc_st_changed_new" value="1" /></div>';
            if (!isset(OPCloader::$extrahtml)) {
                OPCloader::$extrahtml = '';
            }
            OPCloader::$extrahtml .= $html22;
            $html22 = '';
            if (!isset($html2)) {
                $html2 = '';
            }
        } else {
            $html2 = '';
        }
        $ref->cart->ST = 0;
        $STnamed = $STaddress;
        $STnamed = $OPCloader->setCountryAndState($STnamed);
        $vars = array('STaddress' => $STnamed, 'bt_user_info_id' => $virtuemart_userinfo_id, 'BTaddress' => $BTaddress, 'STaddressList' => $STaddressList, 'uid' => $uid, 'cart' => $ref->cart, 'new_address_link' => $new_address_link);
        // a default BT address
        $htmlbt = '<input type="hidden" name="ship_to_info_id_bt" id="ship_to_info_id_bt" value="' . $virtuemart_userinfo_id . '"  class="stradio"/>';
        $html2 .= '<div id="hidden_st_' . $virtuemart_userinfo_id . '" style="display: none;">' . $htmlbt . '</div>';
        //$ref->cart->STaddress = $STaddress;
        //$ref->cart->BTaddress = $BTaddress;
        if (empty($html3) && empty($htmlsingle)) {
            $html = $OPCloader->fetch($OPCloader, 'list_shipto_addresses.tpl', $vars);
        } else {
            $html = '';
        }
        //if (!empty($html) && (!empty($html2)))
        if (!empty($html2)) {
            $html = $html3 . '<div id="edit_address_list_st_section">' . $html . '</div>' . $html2;
        }
        foreach ($STaddressList as $ST) {
            $html = str_replace('for="' . $ST->virtuemart_userinfo_id . '"', ' for="id' . $ST->virtuemart_userinfo_id . '" ', $html);
            $html = str_replace('id="' . $ST->virtuemart_userinfo_id . '"', ' id="id' . $ST->virtuemart_userinfo_id . '" onclick="javascript:Onepage.op_runSS(this);" ', $html);
        }
        $html = str_replace('for="' . $virtuemart_userinfo_id . '"', ' for="id' . $virtuemart_userinfo_id . '" ', $html);
        $html = str_replace('id="' . $virtuemart_userinfo_id . '"', ' id="id' . $virtuemart_userinfo_id . '" onclick="javascript:Onepage.op_runSS(this);" ', $html);
        if (!empty($selected_id)) {
            $jsst = '
//<![CDATA[				  
if (typeof jQuery != \'undefined\')
jQuery(document).ready(function($) {
				  var elst = document.getElementById(\'id' . $virtuemart_userinfo_id . '\'); 
				  if (elst != null)
				   {
				   ';
            if ($addressCountAjax) {
                $jsst .= '
				  Onepage.changeSTajax(elst);
				    ';
            } else {
                $jsst .= '
				  Onepage.changeST(elst);
				    ';
            }
            $jsst .= '
				   }
				  });
//]]>				  
				  ';
            $doc = JFactory::getDocument();
            $doc->addScriptDeclaration($jsst);
        }
        if (defined('OPC_DETECTED_DEVICE') && OPC_DETECTED_DEVICE != 'DESKTOP') {
            $nochosen = true;
        } else {
            $nochosen = false;
        }
        if (!$nochosen) {
            if ($addressCountAjax) {
                if (OPCJ3) {
                    JHtml::_('jquery.framework');
                    JHtml::_('jquery.ui');
                    JHtml::_('formbehavior.chosen', 'select');
                } else {
                    vmJsApi::js('chosen.jquery.min');
                    vmJsApi::css('chosen');
                }
                $document = JFactory::getDocument();
                $document->addScriptDeclaration('
//<![CDATA[
		 if (typeof jQuery != \'undefined\')
		 jQuery( function() {
			var d = jQuery(".opc-chzn-select"); 
			if (typeof d.chosen != \'undefined\')
			d.chosen({
			    enable_select_all: false,
				});
		});
//]]>
				');
            }
        }
        return $html;
    }
* @version $Id: edit.php 6472 2012-09-19 08:46:21Z alatak $
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
//AdminMenuHelper::startAdminArea();
// vmdebug('User edit',$this);
// Implement Joomla's form validation
JHTML::_('behavior.formvalidation');
JHTML::stylesheet('vmpanels.css', JURI::root() . 'components/com_virtuemart/assets/css/');
// VM_THEMEURL
if ($this->userDetails->user_is_vendor) {
    JHtml::_('jquery.ui');
    vmJsApi::js('jquery.ui.autocomplete.html');
    vmJsApi::js('fancybox/jquery.fancybox-1.3.4.pack');
    vmJsApi::js('jquery.coookie', JURI::root() . 'administrator/components/com_virtuemart/assets/js');
    vmJsApi::js('vm2admin', JURI::root() . 'administrator/components/com_virtuemart/assets/js');
}
?>
<style type="text/css">
.invalid {
	border-color: #f00;
	background-color: #ffd;
	color: #000;
}
label.invalid {
	background-color: #fff;
	color: #f00;
}
</style>
<script language="javascript">
function myValidator(f, t)
Beispiel #6
0
 function lVendor()
 {
     // If the current user is a vendor, load the store data
     if ($this->_userDetails->user_is_vendor) {
         $front = JURI::root(true) . '/components/com_virtuemart/assets/';
         $admin = JURI::root(true) . '/administrator/components/com_virtuemart/assets/';
         $document = JFactory::getDocument();
         $document->addScript($front . 'js/fancybox/jquery.mousewheel-3.0.4.pack.js');
         $document->addScript($front . 'js/fancybox/jquery.easing-1.3.pack.js');
         $document->addScript($front . 'js/fancybox/jquery.fancybox-1.3.4.pack.js');
         vmJsApi::js('jquery-ui', FALSE, '', TRUE);
         vmJsApi::js('jquery.ui.autocomplete.html');
         vmJsApi::js('jquery.noConflict');
         $document->addScript($admin . 'js/vm2admin.js');
         $currencymodel = VmModel::getModel('currency', 'VirtuemartModel');
         $currencies = $currencymodel->getCurrencies();
         $this->assignRef('currencies', $currencies);
         if (!$this->_orderList) {
             $this->lOrderlist();
         }
         $vendorModel = VmModel::getModel('vendor');
         if (Vmconfig::get('multix', 'none') === 'none') {
             $vendorModel->setId(1);
         } else {
             $vendorModel->setId($this->_userDetails->virtuemart_vendor_id);
         }
         $vendor = $vendorModel->getVendor();
         $vendorModel->addImages($vendor);
         $this->assignRef('vendor', $vendor);
     }
 }
Beispiel #7
0
    $task = '';
    $basePath = JPATH_VM_SITE;
} else {
    /* Front-end helpers */
    if (!class_exists('VmImage')) {
        require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
    }
    //dont remove that file it is actually in every view except the state view
    if (!class_exists('shopFunctionsF')) {
        require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
    }
    //dont remove that file it is actually in every view
    /* Loading jQuery and VM scripts. */
    //vmJsApi::jPrice();    //in create button
    define('JQUERY_DEFINED', "1");
    vmJsApi::js('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.2', '', TRUE);
    /*vmJsApi::jQuery();*/
    vmJsApi::jSite();
    vmJsApi::cssSite();
    $_controller = JRequest::getWord('view', JRequest::getWord('controller', 'virtuemart'));
    $trigger = 'onVmSiteController';
    // 	$task = JRequest::getWord('task',JRequest::getWord('layout',$_controller) );		$this makes trouble!
    $task = JRequest::getWord('task');
    if (($_controller == 'product' || $_controller == 'category') && ($task == 'save' || $task == 'edit')) {
        $app = JFactory::getApplication();
        if (!class_exists('Permissions')) {
            require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
        }
        if (Permissions::getInstance()->check("admin,storeadmin")) {
            $jlang = JFactory::getLanguage();
            $jlang->load('com_virtuemart', JPATH_ADMINISTRATOR, null, true);
Beispiel #8
0
 /**
  *
  *
  * @author Valérie Isaksen
  */
 function plgVmConfirmedOrder($cart, $order)
 {
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return null;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return false;
     }
     $this->order_id = $order['details']['BT']->order_number;
     $url = JURI::root();
     vmJsApi::js('facebox');
     vmJsApi::css('facebox');
     // carrega os js e css
     $doc =& JFactory::getDocument();
     $url_lib = $url . DS . 'plugins' . DS . 'vmpayment' . DS . 'moip' . DS;
     $url_js = $url_lib . 'assets' . DS . 'js' . DS;
     $this->url_imagens = $url_lib . 'imagens' . DS;
     $url_css = $url_lib . 'assets' . DS . 'css' . DS;
     // redirecionar dentro do componente para validar
     $url_redireciona_moip = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id);
     $url_pedidos = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=orders');
     $url_recibo_moip = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on=' . $this->order_id . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id);
     // carrega ou não o squeezebox
     $load_squeezebox = $method->load_squeezebox;
     $sq_js = '<script type="text/javascript" language="javascript" src="' . $url_js . 'SqueezeBox.js"></script>';
     $sq_css = '<link href="' . $url_css . 'SqueezeBox.css" rel="stylesheet" type="text/css"/>';
     $doc->addCustomTag('
        <script language="javascript">
         jQuery.noConflict();
         var redireciona_moip = "' . $url_redireciona_moip . '";
         var url_pedidos = "' . $url_pedidos . '";
         var url_recibo_moip = "' . $url_recibo_moip . '";
     </script>
     <script type="text/javascript" language="javascript" src="' . $url_js . 'jquery.mask.js"></script>
     <script type="text/javascript" charset="utf-8" language="javascript" src="' . $url_js . 'moip.js"></script>
     <script type="text/javascript" language="javascript" src="' . $url_js . 'jquery.card.js"></script>
     <script type="text/javascript" language="javascript" src="' . $url_js . 'validar_cartao.js"></script>
     ' . ($load_squeezebox != 0 ? $sq_js : '') . '
     <link href="' . $url_css . 'css_pagamento.css" rel="stylesheet" type="text/css"/>
     <link href="' . $url_css . 'card.css" rel="stylesheet" type="text/css"/>
     ' . ($load_squeezebox != 0 ? $sq_css : '') . '
     ');
     $lang = JFactory::getLanguage();
     $filename = 'com_virtuemart';
     $lang->load($filename, JPATH_ADMINISTRATOR);
     $vendorId = 0;
     $this->logInfo('plgVmConfirmedOrder order number: ' . $order['details']['BT']->order_number, 'message');
     $html = "";
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $this->getPaymentCurrency($method);
     $q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
     $db =& JFactory::getDBO();
     $db->setQuery($q);
     $currency_code_3 = $db->loadResult();
     $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
     $totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total, false), 2);
     $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
     // pega o nome do método de pagamento
     $dbValues['payment_name'] = $this->renderPluginName($method);
     $html = '<table>' . "\n";
     $html .= $this->getHtmlRowBE('MOIP_PAYMENT_NAME', $dbValues['payment_name']);
     if (!empty($payment_info)) {
         $lang =& JFactory::getLanguage();
         if ($lang->hasKey($method->payment_info)) {
             $payment_info = JText::_($method->payment_info);
         } else {
             $payment_info = $method->payment_info;
         }
         $html .= $this->getHtmlRowBE('MOIP_INFO', $payment_info);
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
     }
     $currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
     $html .= $this->getHtmlRowBE('MOIP_ORDER_NUMBER', $order['details']['BT']->order_number);
     $html .= $this->getHtmlRowBE('MOIP_AMOUNT', $currency->priceDisplay($order['details']['BT']->order_total));
     $html .= '
     <input type="hidden" name="order_id" id="order_id" value="' . $order['details']['BT']->order_number . '"/>
 </table>' . "\n";
     $this->chave_moip = $this->getChaveMoip($method);
     $this->token_moip = $this->getAfiliacaoMoip($method);
     if ($method->modo_teste) {
         // url do ambiente de desenvolvimento
         $this->setaUrlRequest('https://desenvolvedor.moip.com.br/sandbox/ws/alpha/EnviarInstrucao/Unica');
         $this->setaUrlJs('https://desenvolvedor.moip.com.br/sandbox/transparente/MoipWidget-v2.js');
     } else {
         // url do ambiente de produção
         $this->setaUrlRequest('https://www.moip.com.br/ws/alpha/EnviarInstrucao/Unica');
         $this->setaUrlJs('https://www.moip.com.br/transparente/MoipWidget-v2.js');
     }
     $arr_pagamento = $this->solicitaToken($method, $order);
     $this->_virtuemart_paymentmethod_id = $order['details']['BT']->virtuemart_paymentmethod_id;
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['virtuemart_paymentmethod_id'] = $this->_virtuemart_paymentmethod_id;
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_currency'] = $currency_code_3;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency;
     $dbValues['tax_id'] = $method->tax_id;
     $dbValues['token_api'] = (string) $arr_pagamento['token'];
     $this->storePSPluginInternalData($dbValues);
     // grava os dados do pagamento
     //$this->gravaDados($method,0,$arr_pagamento['status']);
     if ($arr_pagamento['status'] == "Sucesso") {
         $this->token_api = $arr_pagamento['token'];
         $this->erro_api = $arr_pagamento['erro'];
         // monta o formulário na ultima página
         $html .= $this->Moip_mostraParcelamento($method, $order);
         JFactory::getApplication()->enqueueMessage(utf8_encode(JText::_('VMPAYMENT_MOIP_ORDER_OK')));
         // envia emails e redireciona
         $novo_status = $method->transacao_nao_finalizada;
         return $this->processConfirmedOrderPaymentResponse(1, $cart, $order, $html, $dbValues['payment_name'], $novo_status);
     } else {
         $this->token_api = null;
         $this->erro_api = $arr_pagamento['erro'];
         JFactory::getApplication()->enqueueMessage(utf8_encode($this->erro_api), 'error');
         return false;
     }
 }
Beispiel #9
0
    function datePicker($jsDateFormat, $name, $id, $date = '', $placeholder = '')
    {
        $display = '<input class="datepicker-db" id="' . $id . '" type="hidden" name="' . $name . '" value="' . $date . '" />';
        $formatedDate = $date;
        //JFactory::getDate($date);
        $display .= '<input id="' . $id . '_text" class="datepicker" type="text" value="' . $formatedDate . '" placeholder="' . $placeholder . '" />';
        // If exist exit
        $front = 'components/com_virtuemart/assets/';
        $document = JFactory::getDocument();
        $document->addScriptDeclaration('
//<![CDATA[
			jQuery(document).ready( function($) {
			$("#' . $id . '_text").live( "focus", function() {
				$( this ).datepicker({
					changeMonth: true,
					changeYear: true,
					dateFormat:"' . $jsDateFormat . '",
					altField: $(this).prev(),
					altFormat: "yy-mm-dd"
				});
			});
			$(".js-date-reset").click(function() {
				$(this).prev("input").val("' . $placeholder . '").prev("input").val("0");
			});
		});
//]]>
		');
        vmJsApi::js('jquery.ui.core', FALSE, '', TRUE);
        vmJsApi::js('jquery.ui.datepicker', FALSE, '', TRUE);
        vmJsApi::css('jquery.ui.all', $front . 'css/ui');
        $lg = JFactory::getLanguage();
        $lang = $lg->getTag();
        $existingLang = array("af", "ar", "ar-DZ", "az", "bg", "bs", "ca", "cs", "da", "de", "el", "en-AU", "en-GB", "en-NZ", "eo", "es", "et", "eu", "fa", "fi", "fo", "fr", "fr-CH", "gl", "he", "hr", "hu", "hy", "id", "is", "it", "ja", "ko", "kz", "lt", "lv", "ml", "ms", "nl", "no", "pl", "pt", "pt-BR", "rm", "ro", "ru", "sk", "sl", "sq", "sr", "sr-SR", "sv", "ta", "th", "tj", "tr", "uk", "vi", "zh-CN", "zh-HK", "zh-TW");
        if (!in_array($lang, $existingLang)) {
            $lang = substr($lang, 0, 2);
        } elseif (!in_array($lang, $existingLang)) {
            $lang = "en-GB";
        }
        vmJsApi::js('jquery.ui.datepicker-' . $lang, $front . 'js/i18n');
        return $display;
    }
Beispiel #10
0
 static function JvalideForm($name = '#adminForm')
 {
     static $jvalideForm;
     // If exist exit
     if ($jvalideForm === $name) {
         return;
     }
     $document = JFactory::getDocument();
     $document->addScriptDeclaration("\n//<![CDATA[\n\t\t\tjQuery(document).ready(function() {\n\t\t\t\tjQuery('" . $name . "').validationEngine();\n\t\t\t});\n//]]>\n");
     if ($jvalideForm) {
         return;
     }
     vmJsApi::js('jquery.validationEngine');
     $lg = JFactory::getLanguage();
     $lang = substr($lg->getTag(), 0, 2);
     /*$existingLang = array("cz", "da", "de", "en", "es", "fr", "it", "ja", "nl", "pl", "pt", "ro", "ru", "tr");
     		if (!in_array ($lang, $existingLang)) {
     			$lang = "en";
     		}*/
     $vlePath = vmJsApi::setPath('languages/jquery.validationEngine-' . $lang, FALSE, '', $minified = NULL, 'js', true);
     if (file_exists($vlePath) and !is_dir($vlePath)) {
         vmJsApi::js('languages/jquery.validationEngine-' . $lang);
     } else {
         vmJsApi::js('languages/jquery.validationEngine-en');
     }
     vmJsApi::css('validationEngine.template');
     vmJsApi::css('validationEngine.jquery');
     $jvalideForm = $name;
 }
			main = jQuery(".main-image"),
			ext = href.substring(href.length-4),
			isImg ;
		ext = ext.toLowerCase();
		isImg = (ext ==".png" || ext ==".jpg" || ext =="jpeg" || ext ==".gif");
		if (isImg) {
			main.find("img").attr("src",this.href ).attr("alt",this.title );
			main.find("a").attr("href",this.href ).attr("alt",this.title );
			$(this).parent().addClass("active").siblings().removeClass("active");
			return false;
		}
	}); 

';
if ($isSlide) {
    vmJsApi::js('jquery.lightSlider.min');
    vmJsApi::css('lightSlider');
    $imageJS .= '
		var $slideBar = $(".additional-images .row-fluid");
		var lightSlider =
			$slideBar.lightSlider({
				  minSlide:' . $imgagesPerRow . ',
				  maxSlide:' . $imgagesPerRow . ',
				  slideMove:' . $imgagesPerRow . ',
				  pager:false,
				  gallery:true,
				  prevHtml:\'<span class="icon-previous"></span>\',
				  nextHtml:\'<span class="icon-next"></span>\',
				  onAfterSlide: function() {
					$slideBar.children(".active").children().trigger("click");
					// console.log($slideBar.children(".active"),this);
Beispiel #12
0
 if (!class_exists('shopFunctionsF')) {
     require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
 }
 //dont remove that file it is actually in every view
 /* Loading jQuery and VM scripts. */
 //vmJsApi::jPrice();    //in create button
 vmJsApi::jQuery();
 vmJsApi::jSite();
 vmJsApi::cssSite();
 $_controller = JRequest::getWord('view', JRequest::getWord('controller', 'virtuemart'));
 $trigger = 'onVmSiteController';
 // 	$task = JRequest::getWord('task',JRequest::getWord('layout',$_controller) );		$this makes trouble!
 $task = JRequest::getWord('task', '');
 if (($_controller == 'product' || $_controller == 'category') && ($task == 'save' || $task == 'edit')) {
     $app = JFactory::getApplication();
     vmJsApi::js('vmsite');
     vmJsApi::jQuery(FALSE);
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (Permissions::getInstance()->check("admin,storeadmin")) {
         $jlang = JFactory::getLanguage();
         $jlang->load('com_virtuemart', JPATH_ADMINISTRATOR, null, true);
         $basePath = JPATH_VM_ADMINISTRATOR;
         $trigger = 'onVmAdminController';
     } else {
         $app->redirect('index.php?option=com_virtuemart', jText::_('COM_VIRTUEMART_RESTRICTED_ACCESS'));
     }
 } elseif ($_controller) {
     $basePath = JPATH_VM_SITE;
 }
    /**
     * Close out the adminstrator area table.
     * @author RickG, Max Milbers, Patrick Kohl
     * @boolean $ajaxResults, in case of raw/ajax result exist, include the file
     * Note the script must be set after joomla javascript declaration to overide it.
     */
    static function endAdminArea($ajaxResults = false)
    {
        if (!self::$backEnd) {
            echo '</div></div></div></div>';
            vmJsApi::js('jquery.ui.autocomplete.html');
            if ($ajaxResults) {
                include 'ajax/results.html.php';
            }
            include 'front/langs.html.php';
            return;
        }
        self::$vmAdminAreaStarted = false;
        if (VmConfig::get('debug') == '1') {
            //TODO maybe add debuggin again here
            //		include(JPATH_VM_ADMINISTRATOR.'debug.php');
        }
        ?>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
			</div>
		</div>
		</div>

		<?php 
        // add ajax results script
        if ($ajaxResults) {
            include 'ajax/results.html.php';
        }
    }
    require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
VmConfig::loadConfig();
if (method_exists('vmJsApi', 'js')) {
    $app = JFactory::getApplication();
    $jq = $app->get('jquery');
    if (empty($jq) && !OPCJ3) {
        vmJsApi::js('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.6.4', '', TRUE);
        vmJsApi::js('jquery-ui', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16', '', TRUE);
    }
    if (OPCJ3) {
        JHtml::_('jquery.framework');
        JHtml::_('jquery.ui');
        JHtml::_('formbehavior.chosen', 'select');
    } else {
        vmJsApi::js('chosen.jquery.min');
        vmJsApi::css('chosen');
    }
    $document->addScriptDeclaration('
//<![CDATA[
		var vm2string ={' . $vm2string . '} ;
		 jQuery( function($) {
			$(".vm-chzn-select").chosen({enable_select_all: true,select_all_text : vm2string.select_all_text,select_some_options_text:vm2string.select_some_options_text});
		});
//]]>
				');
} else {
    vmJsApi::jQuery();
}
$base = JURI::base();
$jbase = str_replace('/administrator', '', $base);
    /**
     * Admin UI Tabs
     * Gives A Tab Based Navigation Back And Loads The Templates With A Nice Design
     * @param $load_template = a key => value array. key = template name, value = Language File contraction
     * @example 'shop' => 'COM_VIRTUEMART_ADMIN_CFG_SHOPTAB'
     */
    function buildTabs($load_template = array())
    {
        vmJsApi::js('vmtabs');
        $html = '<div id="ui-tabs">';
        $i = 1;
        foreach ($load_template as $tab_content => $tab_title) {
            $html .= '<div id="tab-' . $i . '" class="tabs" title="' . JText::_($tab_title) . '">';
            $html .= $this->loadTemplate($tab_content);
            $html .= '<div class="clear"></div>
			    </div>';
            $i++;
        }
        $html .= '</div>';
        echo $html;
    }
    $this->newlayout = JRequest::getCmd('layout', 'default');
    if ($layout != 'default') {
        $this->setLayout($this->newlayout);
        echo $this->loadTemplate();
    }
    // var_dump($this);
}
// addon for joomla modal Box
// JHTML::_('behavior.modal');
// JHTML::_('behavior.tooltip');
if (VmConfig::get('usefancy', 0)) {
    vmJsApi::js('fancybox/jquery.fancybox-1.3.4.pack');
    vmJsApi::css('jquery.fancybox-1.3.4');
    $box = "\$.fancybox({\n\t\t\t\thref: '" . $this->askquestion_url . "',\n\t\t\t\ttype: 'iframe',\n\t\t\t\theight: '550'\n\t\t\t});";
} else {
    vmJsApi::js('facebox');
    vmJsApi::css('facebox');
    $box = "\$.facebox({\n\t\t\t\tiframe: '" . $this->askquestion_url . "',\n\t\t\t\trev: 'iframe|550|550'\n\t\t\t});";
}
if (VmConfig::get('ask_question', 1) == 1) {
    $document = JFactory::getDocument();
    $document->addScriptDeclaration("\n\t//<![CDATA[\n\t\tjQuery(function(\$) {\n\t\t\t\$('a.ask-a-question').click( function(){\n\t\t\t\t" . $box . "\n\t\t\t\treturn false ;\n\t\t\t});\n\t\t});\n\t//]]>\n\t");
}
/* Let's see if we found the product */
if (empty($this->product)) {
    echo JText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
    echo '<br /><br />  ' . $this->continue_link_html;
    return;
}
?>
* @link http://www.virtuemart.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: edit.php 6350 2012-08-14 17:18:08Z Milbo $
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
AdminUIHelper::startAdminArea();
// $editor = JFactory::getEditor();
// autocomplet missing in Front-end edit
JHtml::_('jquery.ui');
vmJsApi::js('jquery.ui.autocomplete.html');
?>

<form action="index.php" method="post" id="adminForm" name="adminForm" enctype="multipart/form-data">

	
	<fieldset>
		<legend><?php 
echo JText::_('COM_VIRTUEMART_CATEGORY');
?>
<div class="pull-right"><?php 
echo $this->langList;
?>
</div></legend>
		<div class="row-fluid">
			<table class="span6">