Exemple #1
0
	public function __construct()
	{
		parent::__construct();
		$this->useSSL = VmConfig::get('useSSL',0);
		$this->useXHTML = true;

	}
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     if ($field = JRequest::getVar('field')) {
         if (strpos($field, 'plugin') !== false) {
             if (JVM_VERSION === 1) {
                 $table = '#__plugins';
                 //$ext_id = 'id';
             } else {
                 $table = '#__extensions';
                 //$ext_id = 'extension_id';
             }
             $field = substr($field, 6);
             $q = 'SELECT `params`,`element` FROM `' . $table . '` WHERE `element` = "' . $field . '"';
             $db->setQuery($q);
             $this->plugin = $db->loadObject();
             if (!class_exists('vmParameters')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'parameterparser.php';
             }
             $parameters = new vmParameters($this->plugin, $this->plugin->element, 'plugin', 'vmuserfield');
             $lang = JFactory::getLanguage();
             $filename = 'plg_vmuserfield_' . $this->plugin->element;
             if (VmConfig::get('enableEnglish', 1)) {
                 $lang->load($filename, JPATH_ADMINISTRATOR, 'en-GB', true);
             }
             $lang->load($filename, JPATH_ADMINISTRATOR, $lang->getDefault(), true);
             $lang->load($filename, JPATH_ADMINISTRATOR, null, true);
             echo $parameters->render();
             //echo '<input type="hidden" value="'.$this->plugin->element.'" name="custom_value">';
             jExit();
         }
     }
     jExit();
 }
 function getLangTag(&$order)
 {
     $lang = JFactory::getLanguage();
     $lang = $lang->getDefault();
     if (!class_exists('VmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
         VmConfig::loadConfig();
     }
     if (!empty($order['details']['BT'])) {
         if (!empty($order['details']['BT']->order_language)) {
             $lang = $order['details']['BT']->order_language;
         } else {
             $langs = VmConfig::get('active_languages', array($lang));
             foreach ($langs as $lang2) {
                 $lang = $lang2;
                 break;
             }
         }
     }
     $vmlang = strtolower($lang);
     $vmlang = str_replace('-', '_', $vmlang);
     if (defined('VMLANG')) {
         $vmlang_c = VMLANG;
         if (empty($vmlang) && !empty($vmlang_c)) {
             $vmlang = VMLANG;
         }
     }
     return $vmlang;
 }
Exemple #4
0
 function linkIcon($link, $altText = '', $boutonName, $verifyConfigValue = false, $modal = true, $use_icon = true, $use_text = false, $class = '')
 {
     if ($verifyConfigValue) {
         if (!VmConfig::get($verifyConfigValue, 0)) {
             return '';
         }
     }
     $folder = 'media/system/images/';
     //shouldn't be root slash before media, as it automatically tells to look in root directory, for media/system/ which is wrong it should append to root directory.
     $text = '';
     if ($use_icon) {
         $text .= JHtml::_('image', $folder . $boutonName . '.png', vmText::_($altText), null, false, false);
     }
     //$folder shouldn't be as alt text, here it is: image(string $file, string $alt, mixed $attribs = null, boolean $relative = false, mixed $path_rel = false) : string, you should change first false to true if images are in templates media folder
     if ($use_text) {
         $text .= '&nbsp;' . vmText::_($altText);
     }
     if ($text == '') {
         $text .= '&nbsp;' . vmText::_($altText);
     }
     if ($modal) {
         return '<a ' . $class . ' class="modal" rel="{handler: \'iframe\', size: {x: 700, y: 550}}" title="' . vmText::_($altText) . '" href="' . JRoute::_($link, FALSE) . '">' . $text . '</a>';
     } else {
         return '<a ' . $class . ' title="' . vmText::_($altText) . '" href="' . JRoute::_($link, FALSE) . '">' . $text . '</a>';
     }
 }
Exemple #5
0
 /**
  * This function does not allow unicode, replacement for JPath::clean
  * and makesafe
  * @param      $string
  * @param bool $forceNoUni
  * @return mixed|string
  */
 static function filterPath($str)
 {
     if (empty($str)) {
         vmError('filterPath empty string check your paths ');
         vmTrace('Critical error, empty string in filterPath');
         return VMPATH_ROOT;
     }
     $str = trim($str);
     // Delete all '?'
     $str = str_replace('?', '', $str);
     // Replace double byte whitespaces by single byte (East Asian languages)
     $str = preg_replace('/\\xE3\\x80\\x80/', ' ', $str);
     $unicodeslugs = VmConfig::get('transliterateSlugs', false);
     if ($unicodeslugs) {
         $lang = JFactory::getLanguage();
         $str = $lang->transliterate($str);
     }
     //This is a path, so remove all strange slashes
     $str = str_replace('/', DS, $str);
     //Clean from possible injection
     while (strpos($str, '..') !== false) {
         $str = str_replace('..', '', $str);
     }
     $str = preg_replace('#[/\\\\]+#', DS, $str);
     $str = filter_var($str, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
     return $str;
 }
 function linkIcon($link, $altText = '', $boutonName, $verifyConfigValue = false, $modal = true, $use_icon = true, $use_text = false)
 {
     if ($this->document->_type == 'pdf') {
         return;
     }
     if ($verifyConfigValue) {
         if (!VmConfig::get($verifyConfigValue, 0)) {
             return '';
         }
     }
     // $folder = '/media/system/images/'; // use of relative path, $folder is not needed in j3
     $text = '';
     // if ( $use_icon ) $text .= JHtml::_('image', $boutonName.'.png', JText::_($altText),  null, true);
     if ($use_icon) {
         $text .= '<span class="' . $boutonName . '"> </span>';
     }
     //JHtml::_('image', $boutonName.'.png', JText::_($altText),  null, true);
     if ($use_text) {
         $text .= '&nbsp;' . JText::_($altText);
     }
     if ($text == '') {
         $text .= '&nbsp;' . JText::_($altText);
     }
     if ($modal) {
         return '<a class="modal btn btn-default" rel="{handler: \'iframe\', size: {x: 700, y: 550}}" title="' . JText::_($altText) . '" href="' . JRoute::_($link) . '">' . $text . '</a>';
     } else {
         return '<a class="btn btn-default" title="' . JText::_($altText) . '" href="' . JRoute::_($link, FALSE) . '">' . $text . '</a>';
     }
 }
 /**
  * Paste the table  in json format
  *
  */
 public function paste()
 {
     // TODO Test user ?
     $json = array();
     $json['fields'] = 'error';
     $json['msg'] = 'Invalid Token';
     $json['structure'] = 'empty';
     if (!JSession::checkToken('get')) {
         echo json_encode($json);
         jexit();
     }
     $lang = JRequest::getvar('lg');
     $langs = VmConfig::get('active_languages', array());
     $language = JFactory::getLanguage();
     if (!in_array($lang, $langs)) {
         $json['msg'] = 'Invalid language ! ' . $lang;
         $json['langs'] = $langs;
         echo json_encode($json);
         jexit();
     }
     $lang = strtolower($lang);
     // Remove tag if defaut or
     // if ($language->getDefault() == $lang ) $dblang ='';
     $dblang = strtr($lang, '-', '_');
     $id = JRequest::getInt('id', 0);
     $viewKey = JRequest::getWord('editView');
     // we have here 2 access user & vendor give same results
     if ($viewKey == 'user') {
         $viewKey = 'vendor';
     }
     // Not needed , vendor is checked in constructor
     //if ($viewKey == 'vendor') $id = 1 ;
     $tables = array('category' => 'categories', 'product' => 'products', 'manufacturer' => 'manufacturers', 'manufacturercategories' => 'manufacturercategories', 'vendor' => 'vendors', 'paymentmethod' => 'paymentmethods', 'shipmentmethod' => 'shipmentmethods');
     if (!isset($tables[$viewKey])) {
         $json['msg'] = "Invalid view " . $viewKey;
         echo json_encode($json);
         jExit();
     }
     $tableName = '#__virtuemart_' . $tables[$viewKey] . '_' . $dblang;
     $db = JFactory::getDBO();
     $q = 'select * FROM `' . $tableName . '` where `virtuemart_' . $viewKey . '_id` =' . $id;
     $db->setQuery($q);
     if ($json['fields'] = $db->loadAssoc()) {
         $json['structure'] = 'filled';
         $json['msg'] = jText::_('COM_VIRTUEMART_SELECTED_LANG') . ':' . $lang;
     } else {
         $json['structure'] = 'empty';
         $db->setQuery('SHOW COLUMNS FROM ' . $tableName);
         $tableDescribe = $db->loadAssocList();
         array_shift($tableDescribe);
         $fields = array();
         foreach ($tableDescribe as $key => $val) {
             $fields[$val['Field']] = $val['Field'];
         }
         $json['fields'] = $fields;
         $json['msg'] = JText::sprintf('COM_VIRTUEMART_LANG_IS_EMPTY', $lang, jText::_('COM_VIRTUEMART_' . strtoupper($viewKey)));
     }
     echo json_encode($json);
     jExit();
 }
Exemple #8
0
 public function display($tpl = null)
 {
     $user =& JFactory::getUser();
     $db =& JFactory::getDBO();
     $session = JFactory::getSession();
     $cmp = $session->get('compare', '');
     $listpid = explode(",", $cmp);
     if (empty($cmp)) {
         $valid = 0;
         $this->assignRef('valid', $valid);
         //$app =& JFactory::getApplication();
         //$app->enqueueMessage('Your Wishlist is Empty Please Add any product to Wishlist', 'error');
         //$app->redirect('index.php');
         //exit;
     } else {
         $valid = 1;
         $this->assignRef('valid', $valid);
         $this->assignRef('wids', $wids);
         $productModel = VmModel::getModel('product');
         $products = $productModel->getProducts($listpid);
         //echo "<pre>";
         //print_r($wishlist);
         //exit;
         $productModel->addImages($products, 1);
         $this->assignRef('products', $products);
         foreach ($products as $product) {
             $product->stock = $productModel->getStockIndicator($product);
         }
         $show_prices = VmConfig::get('show_prices', 1);
         if ($show_prices == '1') {
             if (!class_exists('calculationHelper')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
             }
         }
         $this->assignRef('show_prices', $show_prices);
         if (!class_exists('Permissions')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
         }
         $showBasePrice = Permissions::getInstance()->check('admin');
         //todo add config settings
         $this->assignRef('showBasePrice', $showBasePrice);
         $currency = CurrencyDisplay::getInstance();
         $this->assignRef('currency', $currency);
         $pagination = $productModel->getPagination(3);
         $this->assignRef('vmPagination', $pagination);
         /*** rating ***/
         $ratingModel = VmModel::getModel('ratings');
         $showRating = $ratingModel->showRating($product->virtuemart_product_id);
         $this->assignRef('showRating', $showRating);
         if ($showRating) {
             $vote = $ratingModel->getVoteByProduct($product->virtuemart_product_id);
             $this->assignRef('vote', $vote);
             $rating = $ratingModel->getRatingByProduct($product->virtuemart_product_id);
             $this->assignRef('rating', $rating);
         }
     }
     parent::display($tpl);
 }
 function display()
 {
     if (VmConfig::get('shop_is_offline') == '1') {
         $this->input->set('layout', 'off_line');
     }
     // Display it all
     $safeurlparams = array('virtuemart_category_id' => 'INT', 'virtuemart_currency_id' => 'INT', 'return' => 'BASE64', 'lang' => 'CMD');
     return parent::display(true, $safeurlparams);
 }
 function __construct()
 {
     parent::__construct();
     if (VmConfig::get('shop_is_offline') == '1') {
         vRequest::setVar('layout', 'off_line');
     } else {
         vRequest::setVar('layout', 'default');
     }
 }
 /**
  * Send the ask question email.
  * @author Kohl Patrick, Christopher Roussel
  */
 public function mailAskquestion()
 {
     vRequest::vmCheckToken();
     if (!class_exists('shopFunctionsF')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $model = VmModel::getModel('vendor');
     $mainframe = JFactory::getApplication();
     $vars = array();
     $min = VmConfig::get('asks_minimum_comment_length', 50) + 1;
     $max = VmConfig::get('asks_maximum_comment_length', 2000) - 1;
     $commentSize = vRequest::getString('comment');
     if (function_exists('mb_strlen')) {
         $commentSize = mb_strlen($commentSize);
     } else {
         $commentSize = strlen($commentSize);
     }
     $validMail = filter_var(vRequest::getVar('email'), FILTER_VALIDATE_EMAIL);
     $virtuemart_vendor_id = vRequest::getInt('virtuemart_vendor_id', 1);
     if (!class_exists('VirtueMartModelVendor')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
     }
     $userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id);
     //$vendorUser = JFactory::getUser($userId);
     if ($commentSize < $min || $commentSize > $max || !$validMail) {
         $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&view=vendor&task=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE), vmText::_('COM_VIRTUEMART_COMMENT_NOT_VALID_JS'));
         return;
     }
     $user = JFactory::getUser();
     $fromMail = vRequest::getVar('email');
     //is sanitized then
     $fromName = vRequest::getVar('name', '');
     //is sanitized then
     $fromMail = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromMail);
     $fromName = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromName);
     if (!empty($user->id)) {
         if (empty($fromMail)) {
             $fromMail = $user->email;
         }
         if (empty($fromName)) {
             $fromName = $user->name;
         }
     }
     $vars['user'] = array('name' => $fromName, 'email' => $fromMail);
     $VendorEmail = $model->getVendorEmail($virtuemart_vendor_id);
     $vars['vendor'] = array('vendor_store_name' => $fromName);
     if (shopFunctionsF::renderMail('vendor', $VendorEmail, $vars, 'vendor')) {
         $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
     } else {
         $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
     }
     $mainframe->enqueueMessage(vmText::_($string));
     // Display it all
     $view = $this->getView('vendor', 'html');
     $view->setLayout('mail_confirmed');
     $view->display();
 }
Exemple #12
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $coupon = $model->getCoupon();
     $this->SetViewTitle('', $coupon->coupon_code);
     $layoutName = vRequest::getCmd('layout', 'default');
     // 		if(Vmconfig::get('multix','none')!=='none'){
     // 				$vendorList= ShopFunctions::renderVendorList($coupon->virtuemart_vendor_id);
     // 				$this->assignRef('vendorList', $vendorList);
     // 		}
     $vendorModel = VmModel::getModel('Vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $currencyModel = VmModel::getModel('Currency');
     $currencyModel = $currencyModel->getCurrency($vendor->vendor_currency);
     $this->assignRef('vendor_currency', $currencyModel->currency_symbol);
     if ($layoutName == 'edit') {
         if ($coupon->virtuemart_coupon_id < 1) {
             // Set a default expiration date
             $_expTime = explode(',', VmConfig::get('coupons_default_expire', '14,D'));
             if (!empty($_expTime[1]) && $_expTime[1] == 'W') {
                 $_expTime[0] = $_expTime[0] * 7;
                 $_expTime[1] = 'D';
             }
             if (version_compare(PHP_VERSION, '5.3.0', '<')) {
                 $_dtArray = getdate(time());
                 if ($_expTime[1] == 'D') {
                     $_dtArray['mday'] += $_expTime[0];
                 } elseif ($_expTime[1] == 'M') {
                     $_dtArray['mon'] += $_expTime[0];
                 } elseif ($_expTime[1] == 'Y') {
                     $_dtArray['year'] += $_expTime[0];
                 }
                 $coupon->coupon_expiry_date = mktime($_dtArray['hours'], $_dtArray['minutes'], $_dtArray['seconds'], $_dtArray['mon'], $_dtArray['mday'], $_dtArray['year']);
             } else {
                 $_expDate = new DateTime();
                 $_expDate->add(new DateInterval('P' . $_expTime[0] . $_expTime[1]));
                 $coupon->coupon_expiry_date = $_expDate->format("U");
             }
         }
         $this->assignRef('coupon', $coupon);
         $this->addStandardEditViewCommands();
     } else {
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $coupons = $model->getCoupons();
         $this->assignRef('coupons', $coupons);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
Exemple #13
0
    private static function addtocart($product)
    {
        $output = '';
        ob_start();
        if (!VmConfig::get('use_as_catalog', 0)) {
            ?>
                <div class="ns2-addtocart">

				<form method="post" class="product" action="index.php">
					<input type="hidden" class="quantity-input" name="quantity[]" value="1" />
					<?php 
            $button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
            $button_cls = '';
            // Display the add to cart button
            $stockhandle = VmConfig::get('stockhandle', 'none');
            if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and $product->product_in_stock - $product->product_ordered < 1) {
                $button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
                $button_cls = 'notify-button';
                $button_name = 'notifycustomer';
            }
            ?>
					<?php 
            // Display the add to cart button
            ?>
					<input type="submit" name="addtocart"  class="addtocart-button" value="<?php 
            echo $button_lbl;
            ?>
" title="<?php 
            echo $button_lbl;
            ?>
" />
                    <div class="clear"></div>
                    <input type="hidden" class="pname" value="<?php 
            echo $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="<?php 
            echo $product->virtuemart_product_id;
            ?>
" />
                    <input type="hidden" name="virtuemart_category_id[]" value="<?php 
            echo $product->virtuemart_category_id;
            ?>
" />
                </form>
				<div class="clear"></div>
            </div>
        <?php 
        }
        $output = ob_get_clean();
        return $output;
    }
Exemple #14
0
 function getVmLink($id, &$errorMsg)
 {
     if (JComponentHelper::isEnabled('com_virtuemart', true)) {
         if ((int) $id < 1) {
             return "";
         }
     } else {
         return "";
     }
     $db =& JFactory::getDBO();
     $query = 'SELECT c.virtuemart_category_id AS catid, a.virtuemart_product_id AS id, a.published AS published, a.product_in_stock AS product_in_stock' . ' FROM #__virtuemart_product_categories AS c' . ' LEFT JOIN #__virtuemart_products AS a ON a.virtuemart_product_id = c.virtuemart_product_id' . ' WHERE c.virtuemart_product_id = ' . (int) $id;
     $db->setQuery($query, 0, 1);
     $product = $db->loadObject();
     if (!$db->query()) {
         $this->setError($db->getErrorMsg());
         $errorMsg = 'VirtueMart Product Not Found';
         return false;
     }
     $catPart = '';
     if (!empty($product->catid)) {
         $catPart = '&virtuemart_category_id=' . $product->catid;
     }
     $itemId = PhocaGalleryVirtueMart::_getVmItemid();
     $link = 'index.php?option=com_virtuemart&view=productdetails' . '&virtuemart_product_id=' . (int) $id . $catPart . '&itemId=' . (int) $itemId;
     // Check PUBLISHED
     if (isset($product->published) && $product->published == 0) {
         $errorMsg = 'VirtueMart Product Not Published';
         return '';
         //don't display cart icon for unpublished product
     }
     // Check Stock if check stock feature is enabled
     //$component			=	'com_virtuemart';
     //$paramsC			= JComponentHelper::getParams($component) ;
     if (is_file(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php')) {
         require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
         VmConfig::loadConfig();
         if (VmConfig::get('check_stock', 0) == 1) {
             // Check STOCK
             if (isset($product->product_in_stock) && $product->product_in_stock == 0) {
                 $errorMsg = 'VirtueMart Product Not On Stock';
                 return '';
                 //don't display cart icon for non stock products
             }
         }
     } else {
         $errorMsg = 'VirtueMart Config Not Found';
         return false;
     }
     return $link;
 }
Exemple #15
0
 /**
  * Constructor
  *
  * @param object $subject The object to observe
  * @param array  $config  An array that holds the plugin configuration
  * @since 1.5
  */
 function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     $this->_psType = substr($this->_type, 2);
     $lang = JFactory::getLanguage();
     $filename = 'plg_' . $this->_type . '_' . $this->_name;
     if (VmConfig::get('enableEnglish', 1)) {
         $lang->load($filename, JPATH_ADMINISTRATOR, 'en-GB', true);
         $lang->load($filename, JPATH_ADMINISTRATOR, $lang->getDefault(), true);
     }
     $lang->load($filename, JPATH_ADMINISTRATOR, $lang->getUsed(), true);
     if (!class_exists('JParameter')) {
         require JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'parameter.php';
     }
     $this->_tablename = '#__virtuemart_' . $this->_psType . '_plg_' . $this->_name;
     $this->_tableChecked = false;
 }
Exemple #16
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $mainframe = JFactory::getApplication();
     $pathway = $mainframe->getPathway();
     if (!class_exists('VmImage')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
     }
     $virtuemart_manufacturer_id = vRequest::getInt('virtuemart_manufacturer_id', 0);
     $mf_category_id = vRequest::getInt('mf_category_id', 0);
     // get necessary models
     $model = VmModel::getModel('manufacturer');
     if ($virtuemart_manufacturer_id != 0) {
         $manufacturer = $model->getManufacturer();
         $model->addImages($manufacturer, 1);
         $manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"', false);
         if (VmConfig::get('enable_content_plugin', 0)) {
             if (!class_exists('shopFunctionsF')) {
                 require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
             }
             shopFunctionsF::triggerContentPlugin($manufacturer, 'manufacturer', 'mf_desc');
         }
         $document->setTitle(vmText::_('COM_VIRTUEMART_MANUFACTURER_DETAILS') . ' ' . strip_tags($manufacturer->mf_name));
         //added so that the canonical points to page with visible products thx to P2Peter
         // remove joomla canonical before adding it
         foreach ($document->_links as $k => $array) {
             if ($array['relation'] == 'canonical') {
                 unset($document->_links[$k]);
                 break;
             }
         }
         $document->addHeadLink(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' . $virtuemart_manufacturer_id, FALSE), 'canonical', 'rel', '');
         $this->assignRef('manufacturerImage', $manufacturerImage);
         $this->assignRef('manufacturer', $manufacturer);
         $pathway->addItem(strip_tags($manufacturer->mf_name));
         $this->setLayout('details');
     } else {
         $document->setTitle(vmText::_('COM_VIRTUEMART_MANUFACTURER_PAGE'));
         $manufacturers = $model->getManufacturers(true, true, true);
         $model->addImages($manufacturers, 1);
         $this->assignRef('manufacturers', $manufacturers);
         $this->setLayout('default');
     }
     parent::display($tpl);
 }
Exemple #17
0
		function fetchElement ($name, $value, &$node, $control_name) {

			jimport ('joomla.filesystem.folder');
			jimport ('joomla.filesystem.file');
			$lang = JFactory::getLanguage ();
			$lang->load ('com_virtuemart', JPATH_ADMINISTRATOR);
			// path to images directory
			$folder = $node->attributes ('directory');
			$safePath = VmConfig::get ('forSale_path', '');

			$certificatePath=$safePath.$folder;
			$certificatePath = JPath::clean($certificatePath);
			$class = ($node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : '');

			// Is the path a folder?
			if (!is_dir($certificatePath)){
				return '<span '.$class.'>'.JText::sprintf ('VMPAYMENT_PAYPAL_CERTIFICATE_FOLDER_NOT_EXIST', $certificatePath).'</span>';
			}

			$path = str_replace ('/', DS, $certificatePath);
			$filter = $node->attributes ('filter');
			$exclude = array($node->attributes ('exclude'), '.svn', 'CVS', '.DS_Store', '__MACOSX', 'index.html');
			$pattern = implode ( "|", $exclude);
			$stripExt = $node->attributes ('stripext');

			$files = JFolder::files ($path, $filter, FALSE, FALSE, $exclude);

			$options = array();

			if (is_array ($files)) {
				foreach ($files as $file) {
					if ($exclude) {
						if (preg_match (chr (1) . $pattern . chr (1), $file)) {
							continue;
						}
					}
					if ($stripExt) {
						$file = JFile::stripExt ($file);
					}
					$options[] = JHTML::_ ('select.option', $file, $file);
				}
			}
			$class .= ' size="5" data-placeholder="'.JText::_('COM_VIRTUEMART_DRDOWN_SELECT_SOME_OPTIONS').'"';
			return JHTML::_ ('select.genericlist', $options, '' . $control_name . '[' . $name . ']', $class, 'value', 'text', $value, $control_name . $name);
		}
Exemple #18
0
 function synchronizeMedia()
 {
     if (vmAccess::manager('media')) {
         $configPaths = array('assets_general_path', 'media_category_path', 'media_product_path', 'media_manufacturer_path', 'media_vendor_path');
         foreach ($configPaths as $path) {
             $this->renameFileExtension(VMPATH_ROOT . DS . VmConfig::get($path));
         }
         if (!class_exists('Migrator')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'migrator.php';
         }
         $migrator = new Migrator();
         $result = $migrator->portMedia();
         $this->setRedirect($this->redirectPath, $result);
     } else {
         $msg = 'Forget IT';
         $this->setRedirect('index.php?option=com_virtuemart', $msg);
     }
 }
 function getInput()
 {
     VmConfig::loadConfig();
     if (VmConfig::get('enableEnglish', 1)) {
         $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', JPATH_ADMINISTRATOR, NULL, TRUE);
     }
     $key = $this->element['key_field'] ? $this->element['key_field'] : 'value';
     $val = $this->element['value_field'] ? $this->element['value_field'] : $this->name;
     $model = VmModel::getModel('Orderstatus');
     $orderStatus = $model->getOrderStatusList();
     foreach ($orderStatus as $orderState) {
         $orderState->order_status_name = JText::_($orderState->order_status_name);
     }
     return JHTML::_('select.genericlist', $orderStatus, $this->name, 'class="inputbox" multiple="true" size="1"', 'order_status_code', 'order_status_name', $this->value, $this->id);
 }
Exemple #20
0
 function synchronizeMedia()
 {
     $user = JFactory::getUser();
     if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart')) {
         $configPaths = array('assets_general_path', 'media_category_path', 'media_product_path', 'media_manufacturer_path', 'media_vendor_path');
         foreach ($configPaths as $path) {
             $this->renameFileExtension(JPATH_ROOT . DS . VmConfig::get($path));
         }
         if (!class_exists('Migrator')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'migrator.php';
         }
         $migrator = new Migrator();
         $result = $migrator->portMedia();
         $this->setRedirect($this->redirectPath, $result);
     } else {
         $msg = 'Forget IT';
         $this->setRedirect('index.php?option=com_virtuemart', $msg);
     }
 }
Exemple #21
0
    function addtocart($product)
    {
        $app = JFactory::getApplication();
        if (!VmConfig::get('use_as_catalog', 0)) {
            $stockhandle = VmConfig::get('stockhandle', 'none');
            if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and $product->product_in_stock - $product->product_ordered < 1) {
                $button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
                $button_cls = 'notify-button';
                $button_name = 'notifycustomer';
                ?>
				<div style="display:inline-block;">
			<a href="<?php 
                echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=' . $product->virtuemart_product_id);
                ?>
" class="notify"><?php 
                echo JText::_('COM_VIRTUEMART_CART_NOTIFY');
                ?>
</a>
				</div>
			<?php 
            } else {
                $basepath = JPATH_SITE . '/modules/mod_javmproducts/tmpl/';
                $templatepath = 'templates/' . $app->getTemplate() . '/html/mod_javmproducts/';
                if (file_exists(JPATH_SITE . '/' . $templatepath . 'cart.php')) {
                    $carttemp = JPATH_SITE . '/' . $templatepath . 'cart.php';
                } else {
                    $carttemp = $basepath . 'cart.php';
                }
                ?>
			<div class="addtocart-area">
				<?php 
                ob_start();
                require $carttemp;
                $contents = ob_get_contents();
                ob_end_clean();
                echo $contents;
                ?>
				<div class="clear"></div>
			</div>
			<?php 
            }
        }
    }
Exemple #22
0
 public static function getShowFullTos(&$ref, $OPCloader)
 {
     include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     $l = OPCloader::logged($ref->cart);
     if (!empty($l)) {
         // logged
         if (!isset($full_tos_logged)) {
             return VmConfig::get('oncheckout_show_legal_info', 0);
         }
         return !empty($full_tos_logged);
     } else {
         // unlogged
         if (!isset($full_tos_unlogged)) {
             return VmConfig::get('oncheckout_show_legal_info', 0);
         }
         return !empty($full_tos_unlogged);
     }
     return VmConfig::get('oncheckout_show_legal_info', 0);
 }
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmConfig')) {
         require JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     if (VmConfig::get('enableEnglish', 1)) {
         $jlang = JFactory::getLanguage();
         $jlang->load('com_virtuemart_countries', JPATH_ADMINISTRATOR, 'en-GB', true);
         $jlang->load('com_virtuemart_countries', JPATH_ADMINISTRATOR, $jlang->getDefault(), true);
         $jlang->load('com_virtuemart_countries', JPATH_ADMINISTRATOR, null, true);
     }
     $this->loadHelper('html');
     $model = VmModel::getModel('country');
     $zoneModel = VmModel::getModel('worldzones');
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         $this->country = $model->getData();
         $this->worldZones = $zoneModel->getWorldZonesSelectList();
         $this->addStandardEditViewCommands();
         $lang = JFactory::getLanguage();
         $prefix = "COM_VIRTUEMART_COUNTRY_";
         $country_string = $lang->hasKey($prefix . $this->country->country_3_code) ? JText::_($prefix . $this->country->country_3_code) : $this->country->country_name;
         $this->SetViewTitle('', $country_string);
     } else {
         if (JRequest::getWord('format', '') === 'raw') {
             $tpl = 'results';
         } else {
             $this->SetViewTitle();
             $this->addStandardDefaultViewCommands(true, false);
         }
         //First the view lists, it sets the state of the model
         $this->addStandardDefaultViewLists($model, 0, 'ASC', 'filter_country');
         $this->countries = $model->getCountries(false, false, $this->lists['filter_country'], true);
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
     if ($tpl === 'results') {
         echo $this->AjaxScripts();
     }
 }
Exemple #24
0
 private function getActiveLanguage()
 {
     if (isset($this->language)) {
         return $this->language;
     }
     $this->language = 'en_gb';
     if (!class_exists('VmConfig')) {
         require_once JPATH_ROOT . '/administrator/components/com_virtuemart/helpers/config.php';
     }
     if (!class_exists('VmConfig')) {
         return $this->language;
     }
     VmConfig::loadConfig();
     $active_languages = VmConfig::get('active_languages', array());
     if (!isset($active_languages['0'])) {
         return $this->language;
     }
     $this->language = str_replace('-', '_', strtolower($active_languages['0']));
     return $this->language;
 }
Exemple #25
0
 public function getPrices()
 {
     $price = $this->cart->getCartPrices();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
     $cdisp = CurrencyDisplay::getInstance();
     //echo "<pre>";print_r($this->cart);exit;
     foreach ($price as $id => $value) {
         if (!is_array($value)) {
             continue;
         }
         $nprice["products"][$id]["subtotal_tax_amount"] = !empty($price[$id]["subtotal_tax_amount"]) ? $cdisp->priceDisplay($price[$id]["subtotal_tax_amount"]) : "";
         $nprice["products"][$id]["subtotal_discount"] = !empty($price[$id]["subtotal_discount"]) ? $cdisp->priceDisplay($price[$id]["subtotal_discount"]) : "";
         if (VmConfig::get('checkout_show_origprice', 1) && !empty($this->cart->pricesUnformatted[$id]['basePriceWithTax']) && $this->cart->pricesUnformatted[$id]['basePriceWithTax'] != $this->cart->pricesUnformatted[$id]['salesPrice']) {
             $nprice["products"][$id]["subtotal_with_tax"] = '<span class="line-through">' . $cdisp->createPriceDiv('basePriceWithTax', '', $this->cart->pricesUnformatted[$id], true, false, $this->cart->products[$id]->quantity) . '</span><br />';
         }
         $nprice["products"][$id]["subtotal_with_tax"] .= $cdisp->createPriceDiv('salesPrice', '', $this->cart->pricesUnformatted[$id], false, false, $this->cart->products[$id]->quantity);
     }
     $nprice["taxAmount"] = !empty($this->cart->pricesUnformatted["taxAmount"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["taxAmount"]) : "";
     $nprice["discountAmount"] = !empty($this->cart->pricesUnformatted["discountAmount"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["discountAmount"]) : "";
     $nprice["salesPrice"] = !empty($this->cart->pricesUnformatted["salesPrice"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["salesPrice"]) : "";
     $nprice["shipmentTax"] = !empty($this->cart->pricesUnformatted["shipmentTax"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["shipmentTax"]) : "";
     $nprice["salesPriceShipment"] = !empty($this->cart->pricesUnformatted["salesPriceShipment"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["salesPriceShipment"]) : "";
     $nprice["paymentTax"] = !empty($this->cart->pricesUnformatted["paymentTax"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["paymentTax"]) : "";
     $nprice["salesPricePayment"] = !empty($this->cart->pricesUnformatted["salesPricePayment"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["salesPricePayment"]) : "";
     $nprice["billTaxAmount"] = !empty($this->cart->pricesUnformatted["billTaxAmount"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["billTaxAmount"]) : "";
     $nprice["billDiscountAmount"] = !empty($this->cart->pricesUnformatted["billDiscountAmount"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["billDiscountAmount"]) : "";
     $nprice["billTotal"] = !empty($this->cart->pricesUnformatted["billTotal"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["billTotal"]) : "";
     /*$nprice["taxAmount"]=!empty($price["taxAmount"])?$cdisp->priceDisplay($price["taxAmount"]):"";
     		$nprice["discountAmount"]=!empty($price["discountAmount"])?$cdisp->priceDisplay($price["discountAmount"]):"";
     		$nprice["salesPrice"]=!empty($price["salesPrice"])?$cdisp->priceDisplay($price["salesPrice"]):"";
     		$nprice["shipmentTax"]=!empty($price["shipmentTax"])?$cdisp->priceDisplay($price["shipmentTax"]):"";
     		$nprice["salesPriceShipment"]=!empty($price["salesPriceShipment"])?$cdisp->priceDisplay($price["salesPriceShipment"]):"";
     		$nprice["paymentTax"]=!empty($price["paymentTax"])?$cdisp->priceDisplay($price["paymentTax"]):"";
     		$nprice["salesPricePayment"]=!empty($price["salesPricePayment"])?$cdisp->priceDisplay($price["salesPricePayment"]):"";
     		$nprice["billTaxAmount"]=!empty($price["billTaxAmount"])?$cdisp->priceDisplay($price["billTaxAmount"]):"";
     		$nprice["billDiscountAmount"]=!empty($price["billDiscountAmount"])?$cdisp->priceDisplay($price["billDiscountAmount"]):"";	
     		$nprice["billTotal"]=!empty($price["billTotal"])?$cdisp->priceDisplay($price["billTotal"]):"";*/
     //echo "<pre>";print_r($nprice);exit;
     return $nprice;
 }
Exemple #26
0
    function __construct($parent)
    {
        $this->parent = $parent;
        NSP_GK5_Product_Gallery::$instances += 1;
        // detect the supported Data Sources
        if (stripos($this->parent->config['data_source'], 'com_content_') !== FALSE) {
            $this->mode = 'com_content';
        } else {
            if (stripos($this->parent->config['data_source'], 'k2_') !== FALSE) {
                $this->mode = 'com_k2';
            } else {
                if (stripos($this->parent->config['data_source'], 'com_virtuemart_') !== FALSE) {
                    $this->mode = 'com_virtuemart';
                } else {
                    $this->mode = false;
                }
            }
        }
        //
        if ($config['vm_add_to_cart'] == 1 && NSP_GK5_Product_Gallery::$instances == 1) {
            $closeimage = JURI::root(TRUE) . '/components/com_virtuemart/assets/images/fancybox/fancy_close.png';
            $vmLangVar = '';
            if (VmConfig::get('vmlang_js', 1)) {
                $vmLangVar .= "vmLang = '&lang=" . substr(VmConfig::$vmlang, 0, 2) . "' ;\n";
            } else {
                $vmLangVar .= 'vmLang = "";' . "\n";
            }
            $doc = JFactory::getDocument();
            $doc->addScriptDeclaration($vmLangVar . '
				vmSiteurl = \'' . JURI::root() . '\' ;
				Virtuemart.addtocart_popup = \'' . VmConfig::get('addtocart_popup', 1) . '\' ; 
				vmCartText = \'' . addslashes(vmText::_('COM_VIRTUEMART_CART_PRODUCT_ADDED')) . '\' ;
				vmCartError = \'' . addslashes(vmText::_('COM_VIRTUEMART_MINICART_ERROR_JS')) . '\' ;
				loadingImage = \'' . JURI::root(TRUE) . '/components/com_virtuemart/assets/images/facebox/loading.gif\' ;
				closeImage = \'' . $closeimage . '\' ; 
				usefancy = false;
				jQuery(document).ready(function() { Virtuemart.product(jQuery("form.product")); });');
        }
    }
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmConfig')) {
         require JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     if (VmConfig::get('enableEnglish', 1)) {
         $jlang = JFactory::getLanguage();
         $jlang->load('com_virtuemart_countries', JPATH_ADMINISTRATOR, 'en-GB', true);
         $jlang->load('com_virtuemart_countries', JPATH_ADMINISTRATOR, $jlang->getDefault(), true);
         $jlang->load('com_virtuemart_countries', JPATH_ADMINISTRATOR, null, true);
     }
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel('country');
     $zoneModel = VmModel::getModel('worldzones');
     $this->SetViewTitle();
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         $country = $model->getData();
         $this->assignRef('country', $country);
         $wzsList = $zoneModel->getWorldZonesSelectList();
         $this->assignRef('worldZones', $wzsList);
         $this->addStandardEditViewCommands();
     } else {
         $this->addStandardDefaultViewCommands(true, false);
         //First the view lists, it sets the state of the model
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         $filter_country = JRequest::getWord('filter_country', false);
         $countries = $model->getCountries(false, false, $filter_country);
         $this->assignRef('countries', $countries);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     $this->loadHelper('image');
     $this->loadHelper('html');
     $model = VmModel::getModel();
     $usermodel = VmModel::getModel('user');
     JToolBarHelper::title(JText::_('COM_VIRTUEMART_CONFIG'), 'head vm_config_48');
     $this->addStandardEditViewCommands();
     $config = VmConfig::loadConfig();
     if (!empty($config->_params)) {
         unset($config->_params['pdf_invoice']);
         // parameter remove and replaced by inv_os
     }
     $this->config = $config;
     $this->userparams = JComponentHelper::getParams('com_users');
     $this->jTemplateList = ShopFunctions::renderTemplateList(JText::_('COM_VIRTUEMART_ADMIN_CFG_JOOMLA_TEMPLATE_DEFAULT'));
     $this->vmLayoutList = $model->getLayoutList('virtuemart', VmConfig::get('vmlayout', 0), 'vmlayout');
     $this->categoryLayoutList = $model->getLayoutList('category', VmConfig::get('categorylayout', 0), 'categorylayout');
     $this->productLayoutList = $model->getLayoutList('productdetails', VmConfig::get('productlayout', 0), 'productlayout');
     $this->noimagelist = $model->getNoImageList();
     $this->orderStatusModel = VmModel::getModel('orderstatus');
     $this->currConverterList = $model->getCurrencyConverterList();
     $this->moduleList = $model->getModuleList();
     $this->activeLanguages = $model->getActiveLanguages(VmConfig::get('active_languages'));
     $this->orderByFields = $model->getProductFilterFields('browse_orderby_fields');
     $this->searchFields = $model->getProductFilterFields('browse_search_fields');
     $this->aclGroups = $usermodel->getAclGroupIndentedTree();
     if (is_Dir(VmConfig::get('vmtemplate') . DS . 'images' . DS . 'availability' . DS)) {
         $imagePath = VmConfig::get('vmtemplate') . '/images/availability/';
     } else {
         $imagePath = '/components/com_virtuemart/assets/images/availability/';
     }
     $this->imagePath = $imagePath;
     shopFunctions::checkSafePath();
     $this->checkVmUserVendor();
     parent::display($tpl);
 }
Exemple #29
0
 function linkIcon($link, $altText = '', $boutonName, $verifyConfigValue = false, $modal = true, $use_icon = true, $use_text = false)
 {
     if ($verifyConfigValue) {
         if (!VmConfig::get($verifyConfigValue, 0)) {
             return '';
         }
     }
     $folder = JVM_VERSION === 1 ? '/images/M_images/' : '/media/system/images/';
     $text = '';
     if ($use_icon) {
         $text .= JHtml::_('image.site', $boutonName . '.png', $folder, null, null, JText::_($altText));
     }
     if ($use_text) {
         $text .= '&nbsp;' . JText::_($altText);
     }
     if ($text == '') {
         $text .= '&nbsp;' . JText::_($altText);
     }
     if ($modal) {
         return '<a class="modal" rel="{handler: \'iframe\', size: {x: 700, y: 550}}" title="' . JText::_($altText) . '" href="' . JRoute::_($link) . '">' . $text . '</a>';
     } else {
         return '<a title="' . JText::_($altText) . '" href="' . JRoute::_($link) . '">' . $text . '</a>';
     }
 }
Exemple #30
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;
    }