protected function getInput() { $pluginpath = '/plugins/vmshopper/ordernumber/ordernumber/'; $doc = JFactory::getDocument()->addStyleSheet(JURI::root(true) . $pluginpath . 'assets/css/ordernumber.css'); $doc->addScript(JURI::root(true) . $pluginpath . 'assets/js/ordernumber.js'); vmJsApi::jQuery(); $this->makeJSTranslationsAvailable(); // Look up the current counters $db = JFactory::getDBO(); $db->setQuery('SELECT `number_format`, `count` FROM `#__virtuemart_shopper_plg_ordernumber` WHERE `number_type`=' . $db->quote($this->countertype) . ' ORDER BY `number_format`;'); $counters = $db->loadObjectList(); // Joomla 2.x uses <li> for the params and float:left on the controls, so we need to add that too $float = ""; if (version_compare(JVERSION, '3.0', 'lt')) { $float = "float: left; "; } $html = array(); $html[] = "<img src='" . JURI::root(true) . $pluginpath . "assets/images/loading.gif' class='vm-ordernumber-loading' style=\"display: none; position: absolute; top: 2px; left: 0px; z-index: 9999;\"/><table class=\"vmordernumber-countertable table-striped \" style=\"display: inline-table; {$float}\">"; $html[] = " <tr>"; $html[] = " <th class='counter_format'>" . JText::_('PLG_ORDERNUMBER_COUNTERLIST_HEADER_COUNTER') . "</th>"; $html[] = " <th class='counter_value'>" . JText::_('PLG_ORDERNUMBER_COUNTERLIST_HEADER_VALUE') . "</th>"; $html[] = " <th class='counter_buttons'></th>"; $html[] = " </tr>"; $html[] = " <colgroup><col class='counter_type'><col style=\"text-align: center\" ><col ></colgroup>"; foreach ($counters as $c) { $displayfmt = $c->number_format; if ($displayfmt == "") { $displayfmt = JText::_('PLG_ORDERNUMBER_COUNTERLIST_GLOBAL'); } $html[] = " <tr class='counter_row counter_type_{$this->countertype}'>"; $html[] = " <td class='counter_format'>" . (string) $displayfmt . "</td>"; $html[] = " <td class='counter_value'>" . (string) $c->count . "</td>"; $html[] = " <td class='counter_buttons'><div class='ordernumber-ajax-loading'><img src='" . JURI::root(true) . $pluginpath . "assets/images/icon-16-edit.png' class='vmordernumber-counter-editbtn vmordernumber-btn' onClick='ajaxEditCounter(this, {$this->countertype}, " . json_encode($c->number_format) . ", {$c->count})' /></div><div class='ordernumber-ajax-loading'><img src='" . JURI::root(true) . $pluginpath . "assets/images/icon-16-delete.png' class='vmordernumber-counter-deletebtn vmordernumber-btn' onClick='ajaxDeleteCounter(this, {$this->countertype}, " . json_encode($c->number_format) . ", {$c->count})' /></div></td>"; $html[] = " </tr>"; } $html[] = " <tr class='addcounter_row'>"; $html[] = " <td colspan=3 class='counter_add'><div class='vmordernumber-counter-addbtn vmordernumber-btn' onClick='ajaxAddCounter(this, {$this->countertype})'><div class='ordernumber-ajax-loading'><img src='" . JURI::root(true) . $pluginpath . "assets/images/icon-16-new.png' class='vmordernumber-counter-addbtn' /></div>" . JText::_('PLG_ORDERNUMBER_COUNTERLIST_ADD') . "</div></td>"; $html[] = " </tr>"; $html[] = "</table>"; return implode("\n", $html); }
function __construct(&$subject, $config) { //if (self::$_this) // return self::$_this; parent::__construct($subject, $config); $this->_loggable = TRUE; $this->tableFields = array_keys($this->getTableSQLFields()); $this->_tablepkey = 'id'; $this->_tableId = 'id'; $varsToPush = $this->getVarsToPush(); $this->setConfigParameterable($this->_configTableFieldName, $varsToPush); $this->setCryptedFields(array('accessKey', 'secretKey')); $amazon_library = JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'amazon' . DS . 'library'; //set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . "/../../.")); set_include_path($amazon_library); $this->loadAmazonClass('OffAmazonPaymentsService_Client'); if (!JFactory::getApplication()->isSite()) { vmJsApi::jQuery(); JFactory::getDocument()->addScript(JURI::root(true) . '/plugins/vmpayment/amazon/assets/js/admin.js'); JFactory::getDocument()->addStyleSheet(JURI::root(true) . '/plugins/vmpayment/amazon/assets/css/amazon-admin.css'); } }
* @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. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ defined('_JEXEC') or die; $ccData = $viewData['ccData']; JHTML::_('behavior.tooltip'); JHTML::script('vmcreditcard.js', 'components/com_virtuemart/assets/js/', false); VmConfig::loadJLang('com_virtuemart', true); vmJsApi::jCreditCard(); vmJsApi::jQuery(); vmJsApi::chosenDropDowns(); $doc = JFactory::getDocument(); $doc->addScript(JURI::root(true) . '/plugins/vmpayment/realex_hpp_api/realex_hpp_api/assets/js/site.js'); $doc->addStyleSheet(JURI::root(true) . '/plugins/vmpayment/realex_hpp_api/realex_hpp_api/assets/css/realex.css'); $attribute = ''; if ($viewData['dccinfo']) { $attribute = ' readonly '; } ?> <div class="realex remote_cc_form" id="remote_cc_form"> <h3 class="order_amount"><?php echo $viewData['order_amount']; ?> </h3>
static function jPrice() { if (!VmConfig::get('jprice', TRUE) and !self::isAdmin()) { return FALSE; } static $jPrice; // If exist exit if ($jPrice) { return; } vmJsApi::jQuery(); VmConfig::loadJLang('com_virtuemart', true); vmJsApi::jSite(); if (VmConfig::get('addtocart_popup', 1)) { self::loadPopUpLib(); } vmJsApi::addJScript('vmprices', false, false); //Fallbacks! $jsVars = ""; $jsVars .= "vmSiteurl = '" . JURI::root() . "' ;\n"; $jsVars .= 'vmLang = "&lang=' . VmConfig::$vmlangSef . '";' . "\n"; $jsVars .= 'vmLangTag = "' . VmConfig::$vmlangSef . '";' . "\n"; $Get = vRequest::getGet(); if (!empty($Get['Itemid'])) { $jsVars .= "Itemid = '&Itemid=" . (int) $Get['Itemid'] . "';\n"; } else { $jsVars .= 'Itemid = "";' . "\n"; } $onReady = $jsVars . 'jQuery(document).ready(function($) { Virtuemart.addtocart_popup = "' . VmConfig::get('addtocart_popup', 1) . '"' . " ; \n" . ' Virtuemart.product(jQuery("form.product")); });'; vmJsApi::addJScript('ready.vmprices', $onReady); $jPrice = TRUE; return TRUE; }
static function jPrice() { if (!VmConfig::get('jprice', TRUE) and JFactory::getApplication()->isSite()) { return FALSE; } static $jPrice; // If exist exit if ($jPrice) { return; } vmJsApi::jQuery(); //JPlugin::loadLanguage('com_virtuemart'); $lang = JFactory::getLanguage(); $lang->load('com_virtuemart'); vmJsApi::jSite(); $closeimage = JURI::root(TRUE) . '/components/com_virtuemart/assets/images/facebox/closelabel.png'; $jsVars = "vmSiteurl = '" . JURI::root() . "' ;\n"; if (VmConfig::get('vmlang_js', 1)) { $jsVars .= "vmLang = '&lang=" . substr(VMLANG, 0, 2) . "' ;\n"; } else { $jsVars .= 'vmLang = ""' . "\n"; } $jsVars .= "vmCartText = '" . addslashes(JText::_('COM_VIRTUEMART_MINICART_ADDED_JS')) . "' ;\n"; $jsVars .= "vmCartError = '" . addslashes(JText::_('COM_VIRTUEMART_MINICART_ERROR_JS')) . "' ;\n"; $jsVars .= "loadingImage = '" . JURI::root(TRUE) . "/components/com_virtuemart/assets/images/facebox/loading.gif' ;\n"; $jsVars .= "closeImage = '" . $closeimage . "' ; \n"; $jsVars .= "Virtuemart.addtocart_popup = '" . VmConfig::get('addtocart_popup', 1) . "' ; \n"; // $jsVars .= 'faceboxHtml = \'<div id="facebox" style="display:none;"><div class="popup"><div class="content"></div> <a href="#" class="close"><img src="'.$closeimage.'" title="close" alt="X" class="close_image" /></a></div></div>\' '."\n"; $jsVars .= 'faceboxHtml = \'<div id="facebox" style="display:none;"><div class="popup"><div class="content"></div> <a href="#" class="close"></a></div></div>\' ' . " ;\n"; $document = JFactory::getDocument(); $document->addScriptDeclaration($jsVars); vmJsApi::js('facebox'); vmJsApi::js('vmprices'); vmJsApi::css('facebox'); $jPrice = TRUE; return TRUE; }
/** * Render a simple country list * * @author jseros, Max Milbers, Valérie Isaksen * * @param int $countryId Selected country id * @param boolean $multiple True if multiple selections are allowed (default: false) * @param mixed $_attrib string or array with additional attributes, * e.g. 'onchange=somefunction()' or array('onchange'=>'somefunction()') * @param string $_prefix Optional prefix for the formtag name attribute * @return string HTML containing the <select /> */ public static function renderCountryList($countryId = 0, $multiple = FALSE, $_attrib = array(), $_prefix = '', $required = 0) { $countryModel = VmModel::getModel('country'); $countries = $countryModel->getCountries(TRUE, TRUE, FALSE); $attrs = array(); $name = 'country_name'; $id = 'virtuemart_country_id'; $idA = $_prefix . 'virtuemart_country_id'; $attrs['class'] = 'virtuemart_country_id'; $attrs['class'] = 'vm-chzn-select'; // Load helpers and languages files if (!class_exists('VmConfig')) { require JPATH_COMPONENT_ADMINISTRATOR . '/helpers/config.php'; } VmConfig::loadConfig(); VmConfig::loadJLang('com_virtuemart_countries'); vmJsApi::jQuery(); vmJsApi::chosenDropDowns(); $sorted_countries = array(); $lang = JFactory::getLanguage(); $prefix = "COM_VIRTUEMART_COUNTRY_"; foreach ($countries as $country) { $country_string = $lang->hasKey($prefix . $country->country_3_code) ? vmText::_($prefix . $country->country_3_code) : $country->country_name; $sorted_countries[$country->virtuemart_country_id] = $country_string; } asort($sorted_countries); $countries_list = array(); $i = 0; foreach ($sorted_countries as $key => $value) { $countries_list[$i] = new stdClass(); $countries_list[$i]->{$id} = $key; $countries_list[$i]->{$name} = $value; $i++; } if ($required != 0) { $attrs['class'] .= ' required'; } if ($multiple) { $attrs['multiple'] = 'multiple'; $idA .= '[]'; } else { $emptyOption = JHtml::_('select.option', '', vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), $id, $name); array_unshift($countries_list, $emptyOption); } if (is_array($_attrib)) { $attrs = array_merge($attrs, $_attrib); } else { $_a = explode('=', $_attrib, 2); $attrs[$_a[0]] = $_a[1]; } return JHtml::_('select.genericlist', $countries_list, $idA, $attrs, $id, $name, $countryId); }
static function jPrice() { if (!VmConfig::get('jprice', TRUE) and !self::isAdmin()) { return FALSE; } static $jPrice; // If exist exit if ($jPrice) { return; } vmJsApi::jQuery(); VmConfig::loadJLang('com_virtuemart', true); vmJsApi::jSite(); $jsVars = ""; $jsVars .= "vmSiteurl = '" . JURI::root() . "' ;\n"; $jsVars .= 'vmLang = "&lang=' . VmConfig::$vmlangSef . '";' . "\n"; $jsVars .= 'vmLangTag = "' . VmConfig::$vmlangSef . '";' . "\n"; $Get = vRequest::getGet(); if (!empty($Get['Itemid'])) { $jsVars .= "Itemid = '&Itemid=" . (int) $Get['Itemid'] . "';\n"; } else { $jsVars .= 'Itemid = "";' . "\n"; } if (VmConfig::get('addtocart_popup', 1)) { $jsVars .= "Virtuemart.addtocart_popup = '" . VmConfig::get('addtocart_popup', 1) . "' ; \n"; if (VmConfig::get('usefancy', 1)) { $jsVars .= "usefancy = true;"; vmJsApi::addJScript('fancybox/jquery.fancybox-1.3.4.pack', false); vmJsApi::css('jquery.fancybox-1.3.4'); } else { //This is just there for the backward compatibility $jsVars .= "vmCartText = '" . addslashes(vmText::_('COM_VIRTUEMART_CART_PRODUCT_ADDED')) . "' ;\n"; $jsVars .= "vmCartError = '" . addslashes(vmText::_('COM_VIRTUEMART_MINICART_ERROR_JS')) . "' ;\n"; //This is necessary though and should not be removed without rethinking the whole construction $jsVars .= "usefancy = false;"; vmJsApi::addJScript('facebox'); vmJsApi::css('facebox'); } } self::addJScript('jsVars', $jsVars); vmJsApi::addJScript('vmprices', false, false); $onReady = 'jQuery(document).ready(function($) { Virtuemart.product(jQuery("form.product")); /*$("form.js-recalculate").each(function(){ if ($(this).find(".product-fields").length && !$(this).find(".no-vm-bind").length) { var id= $(this).find(\'input[name="virtuemart_product_id[]"]\').val(); Virtuemart.setproducttype($(this),id); } });*/ });'; vmJsApi::addJScript('ready.vmprices', $onReady); $jPrice = TRUE; return TRUE; }
static function jPrice() { if (!VmConfig::get('jprice', TRUE) and JFactory::getApplication()->isSite()) { return FALSE; } static $jPrice; // If exist exit if ($jPrice) { return; } vmJsApi::jQuery(); $lang = JFactory::getLanguage(); $lang->load('com_virtuemart'); vmJsApi::jSite(); $closeimage = JURI::root(TRUE) . '/components/com_virtuemart/assets/images/fancybox/fancy_close.png'; $jsVars = "//<![CDATA[ \n"; $jsVars .= "vmSiteurl = '" . JURI::root() . "' ;\n"; if (VmConfig::get('vmlang_js', 1)) { //$jsVars .= "vmLang = '" . substr (VmConfig::$vmlang, 0, 2) . "' ;\n"; $jsVars .= "vmLang = '&lang=" . substr(VmConfig::$vmlang, 0, 2) . "' ;\n"; } else { $jsVars .= 'vmLang = "";' . "\n"; } if (VmConfig::get('addtocart_popup', 1)) { $jsVars .= "Virtuemart.addtocart_popup = '" . VmConfig::get('addtocart_popup', 1) . "' ; \n"; if (VmConfig::get('usefancy', 0)) { $jsVars .= "usefancy = true;"; vmJsApi::js('fancybox/jquery.fancybox-1.3.4.pack'); vmJsApi::css('jquery.fancybox-1.3.4'); } else { //This is just there for the backward compatibility $jsVars .= "vmCartText = '" . addslashes(vmText::_('COM_VIRTUEMART_CART_PRODUCT_ADDED')) . "' ;\n"; $jsVars .= "vmCartError = '" . addslashes(vmText::_('COM_VIRTUEMART_MINICART_ERROR_JS')) . "' ;\n"; $jsVars .= "loadingImage = '" . JURI::root(TRUE) . "/components/com_virtuemart/assets/images/facebox/loading.gif' ;\n"; $jsVars .= "closeImage = '" . $closeimage . "' ; \n"; //This is necessary though and should not be removed without rethinking the whole construction $jsVars .= "usefancy = false;"; vmJsApi::js('facebox'); vmJsApi::css('facebox'); } } $jsVars .= ' //]]> '; $document = JFactory::getDocument(); $document->addScriptDeclaration($jsVars); vmJsApi::js('vmprices'); $jPrice = TRUE; return TRUE; }
function get_store($config, $id) { // if the VM is available if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(); // Load the language file of com_virtuemart. JFactory::getLanguage()->load('com_virtuemart'); // load necessary classes if (!class_exists('calculationHelper')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php'; } if (!class_exists('CurrencyDisplay')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php'; } if (!class_exists('VirtueMartModelVendor')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'vendor.php'; } if (!class_exists('VmImage')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'image.php'; } if (!class_exists('shopFunctionsF')) { require JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctionsf.php'; } if (!class_exists('calculationHelper')) { require JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'cart.php'; } if (!class_exists('VirtueMartModelProduct')) { JLoader::import('product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models'); } // load the base $mainframe = JFactory::getApplication(); $virtuemart_currency_id = $mainframe->getUserStateFromRequest("virtuemart_currency_id", 'virtuemart_currency_id', JRequest::getInt('virtuemart_currency_id', 0)); $currency = CurrencyDisplay::getInstance(); $cSymbol = $currency->getSymbol(); $cDecimals = $currency->getNbrDecimals(); $cDecSymbol = $currency->getDecimalSymbol(); // $productModel = new VirtueMartModelProduct(); $product = $productModel->getProduct($id, 100, true, true, true); $price = strip_tags($currency->createPriceDiv($config['vm_show_price_type'], '', $product->prices)); // remove currency $price = str_replace($cSymbol, '', $price); // prepare price - apply correct format and decimal separator $price = str_replace('.', $cDecSymbol, $price); if ($config['vm_currency_position'] == 'before') { $price = $cSymbol . ' ' . $price; } else { $price = $price . ' ' . $cSymbol; } // if ($config['vm_add_to_cart'] == 1) { vmJsApi::jQuery(); vmJsApi::jPrice(); } $news_price = '<div class="PricebasePriceWithTax">'; // if ($config['vm_show_price_type'] != 'none') { if ($config['vm_display_type'] == 'text_price') { $news_price .= '<span class="PricebasePriceWithTax">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_PRICE') . ' ' . $price . '</span>'; } else { $news_price .= '<span class="PricebasePriceWithTax">' . $price . '</span>'; } } $news_price .= '</div>'; // display discount if ($config['vm_show_discount_amount'] == 1) { $news_price .= '<div class="PricetaxAmount">'; $disc_amount = str_replace('.', $cDecSymbol, number_format($product->prices['discountAmount'], $cDecimals)); if ($config['vm_currency_position'] == 'before') { $disc_amount = $cSymbol . ' ' . $disc_amount; } else { $disc_amount = $disc_amount . ' ' . $cSymbol; } $news_price .= JText::_('MOD_NEWS_PRO_GK5_PRODUCT_DISCOUNT_AMOUNT') . $disc_amount; $news_price .= '</div>'; } // display tax if ($config['vm_show_tax'] == 1) { $news_price .= '<div class="PricetaxAmount">'; $taxAmount = str_replace('.', $cDecSymbol, number_format($product->prices['taxAmount'], $cDecimals)); if ($config['vm_currency_position'] == 'before') { $taxAmount = $cSymbol . ' ' . $taxAmount; } else { $taxAmount = $taxAmount . ' ' . $cSymbol; } $news_price .= JText::_('MOD_NEWS_PRO_GK5_PRODUCT_TAX_AMOUNT') . $taxAmount; $news_price .= '</div>'; } // 'Add to cart' button $news_cart = ''; //if($config['vm_add_to_cart'] == 1) { $code = '<form method="post" class="product" action="index.php">'; $code .= '<div class="addtocart-bar">'; $code .= '<span class="quantity-box" style="display: none"><input type="text" class="quantity-input" name="quantity[]" value="1" /></span>'; $button_lbl = JText::_('MOD_NEWS_PRO_GK5_COM_VIRTUEMART_CART_ADD_TO'); $button_cls = ''; $stockhandle = VmConfig::get('stockhandle', 'none'); $code .= '<span class="addtocart-button"><input type="submit" name="addtocart" class="addtocart-button" value="' . $button_lbl . '" title="' . $button_lbl . '" /></span>'; $code .= '</div> <input type="hidden" class="pname" value="' . $product->product_name . '"/> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="view" value="cart" /> <noscript><input type="hidden" name="task" value="add" /></noscript> <input type="hidden" name="virtuemart_product_id[]" value="' . $product->virtuemart_product_id . '" /> <input type="hidden" name="virtuemart_category_id[]" value="' . $product->virtuemart_category_id . '" /> </form>'; $news_cart .= $code; //} // restults return array("price" => $news_price, "cart" => $news_cart); }
function loadVirtuemart() { if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(); $jlang = JFactory::getLanguage(); $jlang->load('com_virtuemart', JPATH_ADMINISTRATOR, 'en-GB', true); $jlang->load('com_virtuemart', JPATH_ADMINISTRATOR, $jlang->getDefault(), true); $jlang->load('com_virtuemart_orders', JPATH_SITE, 'en-GB', true); $jlang->load('com_virtuemart_orders', JPATH_SITE, $jlang->getDefault(), true); $jlang->load('com_virtuemart_shoppers', JPATH_SITE, 'en-GB', true); $jlang->load('com_virtuemart_shoppers', JPATH_SITE, $jlang->getDefault(), true); $jlang->load('com_virtuemart', JPATH_ADMINISTRATOR, null, true); vmJsApi::jQuery(); if (!class_exists('AdminUIHelper')) { // require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'adminui.php'); } $front = JURI::root(true) . '/components/com_virtuemart/assets/'; $admin = JURI::root(true) . '/administrator/components/com_virtuemart/assets/'; $document = JFactory::getDocument(); //loading defaut admin CSS $document->addStyleSheet($admin . 'css/admin_ui.css'); //$document->addStyleSheet($admin.'css/admin_menu.css'); $document->addStyleSheet($admin . 'css/admin.styles.css'); $document->addStyleSheet($admin . 'css/toolbar_images.css'); $document->addStyleSheet($admin . 'css/menu_images.css'); $document->addStyleSheet($front . 'css/chosen.css'); $document->addStyleSheet($front . 'css/vtip.css'); $document->addStyleSheet($front . 'css/jquery.fancybox-1.3.4.css'); $document->addStyleSheet($front . 'css/ui/jquery.ui.all.css'); //$document->addStyleSheet($admin.'css/jqtransform.css'); //loading defaut script $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'); $document->addScript($admin . 'js/jquery.coookie.js'); $document->addScript($front . 'js/chosen.jquery.min.js'); $document->addScript($admin . 'js/vm2admin.js'); $vm2string = "editImage: 'edit image',select_all_text: '" . JText::_('COM_VIRTUEMART_DRDOWN_SELALL') . "',select_some_options_text: '" . JText::_('COM_VIRTUEMART_DRDOWN_AVA2ALL') . "'"; $document->addScriptDeclaration("\n//<![CDATA[\n\t\tvar tip_image='" . JURI::root(true) . "/components/com_virtuemart/assets/js/images/vtip_arrow.png';\n\t\tvar vm2string ={" . $vm2string . "} ;\n\t\t jQuery( function(\$) {\n\n\t\t\t\$('dl#system-message').hide().slideDown(400);\n\t\t\t\$('.virtuemart-admin-area .toggler').vm2admin('toggle');\n\t\t\t\$('#admin-ui-menu').vm2admin('accordeon');\n\t\t\tif ( \$('#admin-ui-tabs').length ) {\n\n\t\t\t\t\$('#admin-ui-tabs').vm2admin('tabs',virtuemartcookie).find('select').chosen({enable_select_all: true,select_all_text : vm2string.select_all_text,select_some_options_text:vm2string.select_some_options_text}); \n\t\t\t}\n\n\t\t\t\$('#content-box [title]').vm2admin('tips',tip_image);\n\t\t\t\$('.modal').fancybox();\n\t\t\t\$('.reset-value').click( function(e){\n\t\t\t\te.preventDefault();\n\t\t\t\tnone = '';\n\t\t\t\tjQuery(this).parent().find('.ui-autocomplete-input').val(none);\n\t\t\t\t\n\t\t\t});\n\n\t\t});\n//]]>\n\t\t"); }
function store_vm($config, $news_id, $news_cid, $news_price, $news_price_currency, $news_discount_amount, $news_discount_is_percent, $news_discount_start, $news_discount_end, $news_tax, $news_manufacturer) { // if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(); // Load the language file of com_virtuemart. JFactory::getLanguage()->load('com_virtuemart'); if (!class_exists('calculationHelper')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php'; } if (!class_exists('CurrencyDisplay')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php'; } if (!class_exists('VirtueMartModelVendor')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'vendor.php'; } if (!class_exists('VmImage')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'image.php'; } if (!class_exists('shopFunctionsF')) { require JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctionsf.php'; } if (!class_exists('calculationHelper')) { require JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'cart.php'; } if (!class_exists('VirtueMartModelProduct')) { JLoader::import('product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models'); } $mainframe = Jfactory::getApplication(); $virtuemart_currency_id = $mainframe->getUserStateFromRequest("virtuemart_currency_id", 'virtuemart_currency_id', JRequest::getInt('virtuemart_currency_id', 0)); $currency = CurrencyDisplay::getInstance(); $productModel = new VirtueMartModelProduct(); $product = $productModel->getProduct($news_id, 100, true, true, true); if ($config['vm_add_to_cart'] == 1) { vmJsApi::jQuery(); vmJsApi::jPrice(); vmJsApi::cssSite(); } $news_price = ''; if ($config['vm_show_price_type'] != 'none' && $config['vm_show_price_type'] == 'base') { if ($config['vm_show_price_with_tax'] == 1) { if ($config['vm_display_type'] == 'text_price') { $news_price .= $currency->createPriceDiv('basePriceWithTax', 'MOD_NEWS_PRO_GK4_PRODUCT_BASEPRICE_WITHTAX', $product->prices); } else { $news_price .= $currency->createPriceDiv('basePriceWithTax', '', $product->prices); } } else { if ($config['vm_display_type'] == 'text_price') { $news_price .= $currency->createPriceDiv('priceWithoutTax', 'MOD_NEWS_PRO_GK4_PRODUCT_BASEPRICE_WITHOUTTAX', $product->prices); } else { $news_price .= $currency->createPriceDiv('priceWithoutTax', '', $product->prices); } } } if ($config['vm_show_price_type'] != 'none' && $config['vm_show_price_type'] == 'sale') { if ($config['vm_show_price_with_tax'] == 1) { if ($config['vm_display_type'] == 'text_price') { $news_price .= $currency->createPriceDiv('salesPrice', 'MOD_NEWS_PRO_GK4_PRODUCT_SALESPRICE', $product->prices); } else { $news_price .= $currency->createPriceDiv('salesPrice', '', $product->prices); } } else { if ($config['vm_display_type'] == 'text_price') { $news_price .= $currency->createPriceDiv('priceWithoutTax', 'MOD_NEWS_PRO_GK4_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices); } else { $news_price .= $currency->createPriceDiv('priceWithoutTax', '', $product->prices); } } } if ($config['vm_add_to_cart'] == 1) { $code = ''; $code .= '<form method="post" class="product" action="index.php">'; $code .= '<div class="addtocart-bar">'; $code .= '<span class="quantity-box" style="display: none"> <input type="text" class="quantity-input" name="quantity[]" value="1" /> </span>'; $button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO'); $button_cls = ''; $stockhandle = VmConfig::get('stockhandle', 'none'); $code .= '<span class="addtocart-button"> <input type="submit" name="addtocart" class="addtocart-button" value="' . $button_lbl . '" title="' . $button_lbl . '" /></span>'; $code .= '<div class="clear"></div></div> <input type="hidden" class="pname" value="' . $product->product_name . '"/> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="view" value="cart" /> <noscript><input type="hidden" name="task" value="add" /></noscript> <input type="hidden" name="virtuemart_product_id[]" value="' . $product->virtuemart_product_id . '" /> <input type="hidden" name="virtuemart_category_id[]" value="' . $product->virtuemart_category_id . '" /> </form>'; $news_price .= $code; } if ($config['vm_show_discount_amount'] == 1) { $disc_amount = $currency->createPriceDiv('discountAmount', 'MOD_NEWS_PRO_GK4_PRODUCT_DISCOUNT_AMOUNT', $product->prices); $disc_amount = strip_tags($disc_amount, '<div>'); $news_price .= $disc_amount; } if ($config['vm_show_tax'] == 1) { $taxAmount = $currency->createPriceDiv('taxAmount', 'MOD_NEWS_PRO_GK4_PRODUCT_TAX_AMOUNT', $product->prices); $taxAmount = strip_tags($taxAmount, '<div>'); $news_price .= $taxAmount; } return $news_price != '' ? '<div class="nspVmStore">' . $news_price . '</div>' : ''; }
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; } }
if($_controller!='updatesmigration' and !VmConfig::isSuperVendor()){ $app = JFactory::getApplication(); vmError( 'Access restricted to Vendor and Administrator only (you are admin and should not see this messsage?)','Access restricted to Vendors and Administrator only' ); $app->redirect('index.php'); } else if($_controller=='updatesmigration'){ $user = JFactory::getUser(); if(!$user->authorise('core.admin', 'com_virtuemart')){ $app = JFactory::getApplication(); vmError( 'Access restricted to Administrators only (you are admin and should not see this messsage?)','Access restricted to Vendors and Administrator only' ); $app->redirect('index.php'); } } VmConfig::loadJLang('com_virtuemart'); vmJsApi::jQuery(0); vmJsApi::jSite(); // Require specific controller if requested if($_controller) { if (file_exists(VMPATH_ADMIN.DS.'controllers'.DS.$_controller.'.php')) { // Only if the file exists, since it might be a Joomla view we're requesting... require (VMPATH_ADMIN.DS.'controllers'.DS.$_controller.'.php'); } else { // try plugins JPluginHelper::importPlugin('vmextended'); $dispatcher = JDispatcher::getInstance(); $results = $dispatcher->trigger('onVmAdminController', array($_controller)); if (empty($results)) { $app = JFactory::getApplication();
function get_store($config, $id) { // if the VM is available if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(); // Load the language file of com_virtuemart. JFactory::getLanguage()->load('com_virtuemart'); // load necessary classes if (!class_exists('calculationHelper')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php'; } if (!class_exists('CurrencyDisplay')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php'; } if (!class_exists('VirtueMartModelVendor')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'vendor.php'; } if (!class_exists('VmImage')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'image.php'; } if (!class_exists('shopFunctionsF')) { require JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctionsf.php'; } if (!class_exists('calculationHelper')) { require JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'cart.php'; } if (!class_exists('VirtueMartModelProduct')) { JLoader::import('product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models'); } // load the base $mainframe = JFactory::getApplication(); $virtuemart_currency_id = $mainframe->getUserStateFromRequest("virtuemart_currency_id", 'virtuemart_currency_id', JRequest::getInt('virtuemart_currency_id', 0)); $currency = CurrencyDisplay::getInstance(); $productModel = new VirtueMartModelProduct(); $product = $productModel->getProduct($id, 100, true, true, true); //if($config['vm_add_to_cart'] == 1) { vmJsApi::jQuery(); vmJsApi::jPrice(); vmJsApi::cssSite(); //} $news_price = ''; $news_price .= $currency->createPriceDiv('basePriceWithTax', '', $product->prices); // calculate tax $taxAmount = $currency->createPriceDiv('taxAmount', 'MOD_NEWS_PRO_GK5_PRODUCT_TAX_AMOUNT', $product->prices); $taxAmount = strip_tags($taxAmount, '<div>'); $news_price .= $taxAmount; // 'Add to cart' button $news_cart = ''; //if($config['vm_add_to_cart'] == 1) { $code = '<form method="post" class="product" action="index.php">'; $code .= '<div class="addtocart-bar">'; $code .= '<span class="quantity-box" style="display: none"><input type="text" class="quantity-input" name="quantity[]" value="1" /></span>'; $button_lbl = JText::_('MOD_NEWS_PRO_GK5_COM_VIRTUEMART_CART_ADD_TO'); $button_cls = ''; $stockhandle = VmConfig::get('stockhandle', 'none'); $code .= '<span class="addtocart-button"><input type="submit" name="addtocart" class="addtocart-button" value="' . $button_lbl . '" title="' . $button_lbl . '" /></span>'; $code .= '</div> <input type="hidden" class="pname" value="' . $product->product_name . '"/> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="view" value="cart" /> <noscript><input type="hidden" name="task" value="add" /></noscript> <input type="hidden" name="virtuemart_product_id[]" value="' . $product->virtuemart_product_id . '" /> <input type="hidden" name="virtuemart_category_id[]" value="' . $product->virtuemart_category_id . '" /> </form>'; $news_cart .= $code; //} // restults return array("price" => $news_price, "cart" => $news_cart); }