/**
     * This displays a media handler. It displays the full and the thumb (icon) of the media.
     * It also gives a possibility to upload/change/thumbnail media
     *
     * @param string $imageArgs html atttributes, Just for displaying the fullsized image
     */
    public function displayFileHandler()
    {
        if (!class_exists('VmHTML')) {
            require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
        }
        VmConfig::loadJLang('com_virtuemart_media');
        $identify = '';
        // ':'.$this->virtuemart_media_id;
        if (Permissions::getInstance()->isSuperVendor() > 1) {
            $params = JComponentHelper::getParams('com_virtuemart', true);
            $max_uploads = $params->get('max_uploads', 1);
            if (!$max_uploads) {
                return;
            }
        }
        $this->addHiddenByType();
        $html = '
		<div class="accordion-group">
			<div class="accordion-heading">
				<a class="accordion-toggle" data-toggle="collapse" href="#image_desc_accordion">
					' . JText::_('COM_VIRTUEMART_IMAGE_INFORMATION') . '<i class="pull-right icon icon-info-2"></i>
				</a>
			</div>
			<div id="image_desc_accordion" class="accordion-body collapse">
				<div class="accordion-inner">
					<div class="vm__img_autocrop">
						' . $this->displayMediaFull('id="vm_display_image" ', false, '', false) . '
					</div>
					<div class="row-fluid">
						<table class="adminform span6"> ';
        if ($this->published || $this->virtuemart_media_id === 0) {
            $checked = 1;
        } else {
            $checked = 0;
        }
        //  The following was removed bacause the check box (publish/unpublish) was not functioning...
        // 			$this->media_published = $this->published;
        $html .= VmHTML::row('booleanlist', 'COM_VIRTUEMART_FILES_FORM_FILE_PUBLISHED', 'media_published', $checked);
        if (!$this->file_url_thumb) {
            $thumbnail = '';
        } else {
            $thumbnail = 'src="' . juri::root() . $this->file_url_thumb . '"';
        }
        $html .= VmHTML::row('raw', '<img ' . $thumbnail . ' alt="' . $this->file_meta . '" title="' . $this->file_meta . '" id="vm_thumb_image">', '');
        if (!class_exists('Permissions')) {
            require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
        }
        if (!Permissions::getInstance()->check('admin')) {
            $readonly = 'readonly';
        } else {
            $readonly = '';
        }
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_TITLE', 'file_title');
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_DESCRIPTION', 'file_description');
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_META', 'file_meta');
        $html .= '</table><table class="span6">';
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_URL', 'file_url', $readonly);
        //remove the file_url_thumb in case it is standard
        if (!empty($this->file_url_thumb) and is_a($this, 'VmImage')) {
            $file_url_thumb = $this->createThumbFileUrl();
            //vmdebug('my displayFileHandler ',$this,$file_url_thumb);
            if ($this->file_url_thumb == $file_url_thumb) {
                $this->file_url_thumb = JText::sprintf('COM_VIRTUEMART_DEFAULT_URL', $file_url_thumb);
            }
        }
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_URL_THUMB', 'file_url_thumb', $readonly);
        $this->addMediaAttributesByType();
        $html .= '
						<tr>
							<td class="key">' . JText::_('COM_VIRTUEMART_FILES_FORM_ROLE') . '</td>
							<td><fieldset class="checkboxes radio btn-group">' . JHTML::_('select.radiolist', $this->getOptions($this->_mRoles), 'media_roles' . $identify, '', 'value', 'text', $this->media_role) . '</fieldset>
							</td>
						</tr>';
        // 			$html .= '<tr><td class="key">'.VmHTML::checkbox('file_is_forSale', $this->file_is_forSale);
        // 			$html .= VmHTML::checkbox('file_is_downloadable', $this->file_is_downloadable);
        if (!empty($this->file_type)) {
            $html .= '
							<tr>
								<td class="key">' . JText::_('COM_VIRTUEMART_FILES_FORM_LOCATION') . '</td>
								<td><fieldset class="checkboxes radio">' . JText::_('COM_VIRTUEMART_FORM_MEDIA_SET_' . strtoupper($this->file_type)) . '</fieldset></td>
							</tr>';
        } else {
            $mediaattribtemp = $this->media_attributes;
            if (empty($this->media_attributes)) {
                $mediaattribtemp = 'product';
            }
            $html .= '
							<tr>
								<td class="key">' . JText::_('COM_VIRTUEMART_FILES_FORM_LOCATION') . '</td>
								<td><fieldset class="checkboxes radio btn-group">' . JHTML::_('select.radiolist', $this->getOptions($this->_mLocation), 'media_attributes' . $identify, '', 'value', 'text', $mediaattribtemp) . '</fieldset>
								</td>
							</tr>';
        }
        // select language for image
        if (count(vmconfig::get('active_languages')) > 1) {
            $selectedLangue = explode(",", $this->file_lang);
            $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('JPATH_SITE'), true);
            $html .= '
							<tr>
								<td class="key"><span class="hasTip" title="' . JText::_('COM_VIRTUEMART_FILES_FORM_LANGUAGE_TIP') . '">' . JText::_('COM_VIRTUEMART_FILES_FORM_LANGUAGE') . '</span></td>
								<td><fieldset class="inputbox">' . JHTML::_('select.genericlist', $languages, 'vmlangimg[]', 'size="10" multiple="multiple"', 'value', 'text', $selectedLangue) . '</fieldset></td>
							</tr>';
        }
        $html .= '
						</table>
					</div>
				</div>
			</div>
		</div>';
        $this->addMediaActionByType();
        $html .= '
		<div class="accordion-group">
		<div class="accordion-heading">
			<a class="accordion-toggle" data-toggle="collapse"  href="#image_upload_accordeon">
				' . JText::_('COM_VIRTUEMART_FILE_UPLOAD') . '<i class="pull-right icon icon-plus"></i>
			</a>
		</div>
		<div id="image_upload_accordeon" class="accordion-body collapse">
			<div class="accordion-inner">
				<input type="file" name="uploads[]" id="uploads" multiple data-show-upload="false" data-show-caption="true">
				' . JText::_('COM_VIRTUEMART_IMAGE_ACTION') . '
				<div class="checkboxes radio btn-group">
					' . JHTML::_('select.radiolist', $this->getOptions($this->_actions), 'media_action' . $identify, '', 'value', 'text', 0) . '
				</div>
				<br style="clear:both" />
				<br />
				<small>' . $this->displaySupportedImageTypes() . '</small><br />
			</div>
		</div>
		</div>';
        $html .= $this->displayFoldersWriteAble();
        $html .= $this->displayHidden();
        //		$html .= '</form>';
        return $html;
    }
Example #2
0
 function display($tpl = null)
 {
     if (!class_exists('VirtueMartModelConfig')) {
         require VMPATH_ADMIN . 'models/config.php';
     }
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $layoutName = $this->getLayout();
     $task = vRequest::getCmd('task', $layoutName);
     $this->assignRef('task', $task);
     $this->user = $user = JFactory::getUser();
     if ($layoutName == 'edit') {
         $category = $model->getCategory('', false);
         // Toolbar
         $text = '';
         if (isset($category->category_name)) {
             $name = $category->category_name;
         } else {
             $name = '';
         }
         if (!empty($category->virtuemart_category_id)) {
             $text = '<a href="' . juri::root() . 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id . '" target="_blank" >' . $name . '<span class="vm2-modallink"></span></a>';
         }
         $this->SetViewTitle('CATEGORY', $text);
         $model->addImages($category);
         if ($category->virtuemart_category_id > 1) {
             $relationInfo = $model->getRelationInfo($category->virtuemart_category_id);
             $this->assignRef('relationInfo', $relationInfo);
         }
         $parent = $model->getParentCategory($category->virtuemart_category_id);
         $this->assignRef('parent', $parent);
         if (!class_exists('ShopFunctions')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
         }
         $templateList = ShopFunctions::renderTemplateList(vmText::_('COM_VIRTUEMART_CATEGORY_TEMPLATE_DEFAULT'));
         $this->assignRef('jTemplateList', $templateList);
         $categoryLayoutList = VirtueMartModelConfig::getLayoutList('category');
         $this->assignRef('categoryLayouts', $categoryLayoutList);
         $productLayouts = VirtueMartModelConfig::getLayoutList('productdetails');
         $this->assignRef('productLayouts', $productLayouts);
         //Nice fix by Joe, the 4. param prevents setting an category itself as child
         $categorylist = ShopFunctions::categoryListTree(array($parent->virtuemart_category_id), 0, 0, (array) $category->virtuemart_category_id);
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $vendorList = ShopFunctions::renderVendorList($category->virtuemart_vendor_id, false);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->assignRef('category', $category);
         $this->assignRef('categorylist', $categorylist);
         $this->addStandardEditViewCommands($category->virtuemart_category_id, $category);
     } else {
         $this->SetViewTitle('CATEGORY_S');
         $keyWord = '';
         $this->assignRef('catmodel', $model);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model, 'category_name');
         $categories = $model->getCategoryTree(0, 0, false, $this->lists['search']);
         $this->assignRef('categories', $categories);
         $pagination = $model->getPagination();
         $this->assignRef('catpagination', $pagination);
         //we need a function of the FE shopfunctions helper to cut the category descriptions
         if (!class_exists('shopFunctionsF')) {
             require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
         }
     }
     parent::display($tpl);
 }
    private function fullPaths($data)
    {
        $this->Creator .= ' ' . $this->jdoc->engineName;
        $header = $footer = '';
        if (!strpos($data, 'html>')) {
            $full = juri::root();
            $short = juri::root(true) . '/';
            if (!empty($this->jdoc->header_title)) {
                $title = $this->jdoc->header_title;
            } else {
                $title = $this->jdoc->title;
            }
            $langTag = JFactory::getLanguage()->getTag();
            // missing header create it
            $header = '
			<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $langTag . '" lang="' . $langTag . '" dir="' . $this->directionality . '">
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
				<title>' . $title . '</title>
				<meta name="title" content="' . $title . '" />
				<meta name="generator" content="' . $this->Creator . '" />
				<meta name="description" content="' . $this->Subject . '" />
				<meta name="keywords" content="' . $this->Keywords . '" />';
            // add scripts
            // foreach ($this->jdoc->_scripts as $src => $script) {
            // if ($src[1] === "/" ) $src = str_replace($short, $full, $src);
            // $header.='<script src="'.$src.'" type="'.$script['mime'].'"></script>';
            // }
            // add css
            foreach ($this->jdoc->_styleSheets as $src => $css) {
                // relative to absolute path
                $pos = strpos($src, $short);
                if ($pos === 0) {
                    $src = str_replace($short, $full, $src);
                }
                // relative path with missing joomla root
                $pos = strpos($src, '//');
                if ($pos === false) {
                    $src = $full . $src;
                }
                $header .= '<link rel="stylesheet"  href="' . $src . '" type="' . $css['mime'] . '">';
            }
            $header .= '</head>';
            $footer = '</html>';
            //public 'HTMLHeader' => string '<h1>Amazon Kindle Fire HD 8,9</h1>' (length=34)
            if (!strpos($data, 'body>')) {
                // add renderengine class to body
                $header .= '<body class="' . $this->jdoc->engineName . '">';
                $footer = '</body>' . $footer;
            }
        }
        if (!empty($this->HTMLHeader)) {
            // $logo_height = $this->jdoc->params->get('logo_height',48);
            // $header .='
            // <style>
            // #HTMLHeader { position: fixed; padding-left:'.$this->jdoc->_margin_left.'mm; padding-right:'.$this->jdoc->_margin_right.'mm; padding-top:'.$this->jdoc->_margin_header.'mm; left: 0px; top: 0px; right: 0px; height: 30px; text-align: right;}
            // #HTMLHeader h1{margin:0px}
            // #HTMLHeader img{ position: fixed; padding-left:'.$this->jdoc->_margin_left.'mm; padding-right:'.$this->jdoc->_margin_right.'mm; padding-top:'.$this->jdoc->_margin_header.'mm; left: 0px; top: 0px; right: 0px; height: '.$logo_height.'px;}
            // </style>
            // ';
            // $header .= '<div id="HTMLHeader">'.$this->HTMLHeader.'</div>' ;
        }
        if (!empty($this->HTMLfooter)) {
            //@page { margin: 180px 50px; }
            $header .= '<div id="HTMLfooter">' . $this->HTMLfooter . '</div>';
        } else {
            $siteUrl = JURI::getInstance()->toString();
            $siteUrl = str_replace("format=pdf", "", $siteUrl);
            $app = JFactory::getApplication();
            $title = $app->getCfg('sitename') . ' - ' . $this->Title;
            $path = dirname(__FILE__) . DIRECTORY_SEPARATOR;
            if (file_exists($path . 'header.html')) {
                $this->setOptions(array('header-html' => $path . 'header.html'));
            }
            // $date =& JFactory::getDate();
            // $jDate = JHTML::_('date',$date,JText::_('DATE_FORMAT_LC3'));
            // $header .='
            // <style>
            // .pdf-footer,#HTMLPages { position: fixed; padding-left:'.$this->jdoc->_margin_left.'mm; padding-right:'.$this->jdoc->_margin_right.'mm; padding-top:'.$this->jdoc->_margin_footer.'mm;  bottom: -10px; height: 40px; text-align: left;}
            // </style>
            // ';
            // $header .= '<div class="pdf-footer" style="left:'.$this->jdoc->_margin_left.'mm"><a href="'.$siteUrl.'">'.$title.'</a>
            // <div id="HTMLPages" style="right:'.$this->jdoc->_margin_right.'mm">Page <span id="page_current">page</span> of <span id="page_count">toPage]</span></div></div>
            // <script>
            // var pdfInfo = {};
            // var x = document.location.search.substring(1).split("&");
            // for (var i in x) { var z = x[i].split("=",2); pdfInfo[z[0]] = unescape(z[1]); }
            // function getPdfInfo() {
            // var page = pdfInfo.page || 1;
            // var pageCount = pdfInfo.topage || 1;
            // document.getElementById("page_current").textContent = page;
            // document.getElementById("page_count").textContent = pageCount;
            // }
            // </script> ';
        }
        // $options= array();
        // $option['header-right']= '""Page [page] of [toPage]""';
        // $option['footer-right']= '""[date]""';
        // $option[1]= 'grayscale';
        // $this->setOptions($option);
        // $break = '<div class="page-breaker"></div>';
        $data = $header . $data . $footer;
        // make absolute links
        $full = '"' . juri::root();
        $short = '"' . juri::root(true) . '/';
        // echo $full.' '.$short; jexit();
        $data = str_replace($short, $full, $data);
        $full = "'" . juri::root();
        $short = "'" . juri::root(true) . '/';
        $data = str_replace($short, $full, $data);
        return $data;
    }
    /**
     * Formatting admin display by roles
     * input Types for product only !
     * $field->is_cart_attribute if can have a price
     */
    public function displayProductCustomfieldBE($field, $product_id, $row)
    {
        // $vendor_currency as static, because is called for same user session
        static $vendor_currency = null;
        $field->custom_value = empty($field->custom_value) ? $field->value : $field->custom_value;
        if ($field->is_cart_attribute) {
            if ($vendor_currency === null) {
                JLoader::register('VmModel', JPATH_VM_ADMINISTRATOR . 'helpers/vmmodel.php');
                $vendor_model = VmModel::getModel('vendor');
                $vendor_model->setId(1);
                // todo SUTDIO42, perhaps check the vendors ?
                $vendor = $vendor_model->getVendor();
                $currencyModel = VmModel::getModel('currency');
                $currencyModel->setId($vendor->vendor_currency);
                $vendor_currency = $currencyModel->getData();
            }
            $priceInput = '<div class="input-append"><input class="input-mini" type="text" size="4" style="text-align:right;" value="' . (isset($field->custom_price) ? $field->custom_price : '0') . '" name="field[' . $row . '][custom_price]" /><span class="add-on">' . $vendor_currency->currency_symbol . "</span></div>";
        } else {
            $priceInput = ' ';
        }
        if ($field->is_list) {
            $options = array();
            $values = explode(';', $field->value);
            foreach ($values as $key => $val) {
                $options[] = array('value' => $val, 'text' => $val);
            }
            $currentValue = $field->custom_value;
            return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', null, 'value', 'text', $currentValue) . '</td><td>' . $priceInput;
        } else {
            switch ($field->field_type) {
                case 'A':
                    //vmdebug('displayProductCustomfieldBE $field',$field);
                    if (!isset($field->withParent)) {
                        $field->withParent = 0;
                    }
                    if (!isset($field->parentOrderable)) {
                        $field->parentOrderable = 0;
                    }
                    //vmdebug('displayProductCustomfieldFE',$field);
                    JLoader::register('VmHTML', JPATH_VM_ADMINISTRATOR . 'helpers/html.php');
                    $html = JText::_('COM_VIRTUEMART_CUSTOM_WP') . VmHTML::checkbox('field[' . $row . '][withParent]', $field->withParent, 1, 0, '') . '<br />';
                    $html .= JText::_('COM_VIRTUEMART_CUSTOM_PO') . VmHTML::checkbox('field[' . $row . '][parentOrderable]', $field->parentOrderable, 1, 0, '');
                    $options = array();
                    // 					$options[] = array( 'value' => 'product_name' ,'text' =>JText::_('COM_VIRTUEMART_PRODUCT_FORM_NAME')); Is anyway displayed there
                    $options[] = array('value' => 'product_sku', 'text' => JText::_('COM_VIRTUEMART_PRODUCT_SKU'));
                    $options[] = array('value' => 'slug', 'text' => JText::_('COM_VIRTUEMART_PRODUCT_ALIAS'));
                    $options[] = array('value' => 'product_length', 'text' => JText::_('COM_VIRTUEMART_PRODUCT_LENGTH'));
                    $options[] = array('value' => 'product_width', 'text' => JText::_('COM_VIRTUEMART_PRODUCT_WIDTH'));
                    $options[] = array('value' => 'product_height', 'text' => JText::_('COM_VIRTUEMART_PRODUCT_HEIGHT'));
                    $options[] = array('value' => 'product_weight', 'text' => JText::_('COM_VIRTUEMART_PRODUCT_WEIGHT'));
                    $html .= JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', '', 'value', 'text', $field->custom_value) . '</td><td>' . $priceInput;
                    return $html;
                    // 					return 'Automatic Childvariant creation (later you can choose here attributes to show, now product name) </td><td>';
                    break;
                    // variants
                // variants
                case 'V':
                    return '<input type="text" class="input-medium" value="' . $field->custom_value . '" name="field[' . $row . '][custom_value]" /></td><td>' . $priceInput;
                    break;
                    /*
                     * Stockable (group of) child variants
                     * Special type setted by the plugin
                     */
                /*
                 * Stockable (group of) child variants
                 * Special type setted by the plugin
                 */
                case 'G':
                    return;
                    break;
                    /*Extended by plugin*/
                /*Extended by plugin*/
                case 'E':
                    $html = '<input type="hidden" value="' . $field->value . '" name="field[' . $row . '][custom_value]" />';
                    JLoader::register('vmCustomPlugin', JPATH_VM_PLUGINS . '/vmcustomplugin.php');
                    JPluginHelper::importPlugin('vmcustom', $field->custom_element);
                    $dispatcher = JDispatcher::getInstance();
                    $retValue = '';
                    $dispatcher->trigger('plgVmOnProductEdit', array($field, $product_id, &$row, &$retValue));
                    return $html . $retValue . '</td><td>' . $priceInput;
                    break;
                case 'D':
                    return vmJsApi::jDate($field->custom_value, 'field[' . $row . '][custom_value]', 'field_' . $row . '_customvalue') . '</td><td>' . $priceInput;
                    break;
                case 'T':
                    //TODO Patrick
                    return '<input type="text" class="input-medium" value="' . $field->custom_value . '" name="field[' . $row . '][custom_value]" /></td><td>' . $priceInput;
                    break;
                    /* string or integer */
                /* string or integer */
                case 'S':
                case 'I':
                    // FIX studio42 tmlspecialchars: "
                    return '<input type="text" class="input-medium" value="' . htmlspecialchars($field->custom_value) . '" name="field[' . $row . '][custom_value]" /></td><td>' . $priceInput;
                    break;
                    //'X'=>'COM_VIRTUEMART_CUSTOM_EDITOR',
                //'X'=>'COM_VIRTUEMART_CUSTOM_EDITOR',
                case 'X':
                    return '<textarea class="mceInsertContentNew" name="field[' . $row . '][custom_value]" id="field-' . $row . '-custom_value">' . $field->custom_value . '</textarea>
						<script type="text/javascript">// Creates a new editor instance
							tinymce.execCommand("mceAddControl",true,"field-' . $row . '-custom_value")
						</script></td><td>' . $priceInput;
                    //return '<input type="text" value="'.$field->custom_value.'" name="field['.$row.'][custom_value]" /></td><td>'.$priceInput;
                    break;
                    //'Y'=>'COM_VIRTUEMART_CUSTOM_TEXTAREA'
                //'Y'=>'COM_VIRTUEMART_CUSTOM_TEXTAREA'
                case 'Y':
                    return '<textarea id="field[' . $row . '][custom_value]" name="field[' . $row . '][custom_value]" class="inputbox" cols=80 rows=50 >' . $field->custom_value . '</textarea></td><td>' . $priceInput;
                    //return '<input type="text" value="'.$field->custom_value.'" name="field['.$row.'][custom_value]" /></td><td>'.$priceInput;
                    break;
                case 'editorta':
                    jimport('joomla.html.editor');
                    $editor = JFactory::getEditor();
                    //TODO This is wrong!
                    $_return['fields'][$_fld->name]['formcode'] = $editor->display($_prefix . $_fld->name, $_return['fields'][$_fld->name]['value'], 300, 150, $_fld->cols, $_fld->rows);
                    break;
                    /* bool */
                /* bool */
                case 'B':
                    return JHTML::_('select.booleanlist', 'field[' . $row . '][custom_value]', 'class="inputbox"', $field->custom_value) . '</td><td>' . $priceInput;
                    break;
                    /* parent */
                /* parent */
                case 'P':
                    return $field->custom_value . '<input type="hidden" value="' . $field->custom_value . '" name="field[' . $row . '][custom_value]" /></td><td>';
                    break;
                    /* related category*/
                /* related category*/
                case 'Z':
                    if (!$field->custom_value) {
                        return '';
                    }
                    // special case it's category ID !
                    $q = 'SELECT * FROM `#__virtuemart_categories_' . VMLANG . '` JOIN `#__virtuemart_categories` AS p using (`virtuemart_category_id`) WHERE `published`=1 AND `virtuemart_category_id`= "' . (int) $field->custom_value . '" ';
                    $this->_db->setQuery($q);
                    //echo $this->_db->_sql;
                    if ($category = $this->_db->loadObject()) {
                        $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_category_medias` WHERE `virtuemart_category_id`= "' . (int) $field->custom_value . '" ';
                        $this->_db->setQuery($q);
                        $thumb = '';
                        if ($media_id = $this->_db->loadResult()) {
                            $thumb = $this->displayCustomMedia($media_id, 'category');
                        }
                        $display = '<input type="hidden" value="' . $field->custom_value . '" name="field[' . $row . '][custom_value]" />';
                        return $display . JHTML::link(JRoute::_('index.php?option=com_virtuemart&view=category&task=edit&virtuemart_category_id=' . (int) $field->custom_value, FALSE), $thumb . ' ' . $category->category_name, array('title' => $category->category_name)) . $display;
                    } else {
                        return 'no result/unpublished';
                    }
                    /* related product*/
                /* related product*/
                case 'R':
                    /* product kit(bundle)*/
                /* product kit(bundle)*/
                case 'K':
                    if (!$field->custom_value) {
                        return '';
                    }
                    $param = json_decode($field->custom_param);
                    if (!empty($param->is_hidden)) {
                        $isHidden = 1;
                    } else {
                        $isHidden = 0;
                    }
                    $pModel = VmModel::getModel('product');
                    $related = $pModel->getProduct((int) $field->custom_value, FALSE, FALSE, FALSE, 1, FALSE);
                    $thumb = '';
                    if (!empty($related->virtuemart_media_id[0])) {
                        $thumb = $this->displayCustomMedia($related->virtuemart_media_id[0]) . ' ';
                    } else {
                        $thumb = $this->displayCustomMedia(0) . ' ';
                    }
                    $display = '<input type="hidden" value="' . $field->custom_value . '" name="field[' . $row . '][custom_value]" />';
                    $display .= JHTML::link(juri::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $related->virtuemart_product_id . '&virtuemart_category_id=' . $related->virtuemart_category_id, $thumb . $related->product_name, array('title' => $related->product_name, 'target' => 'blank'));
                    $display .= JText::_('COM_VIRTUEMART_CUSTOM_IS_HIDDEN') . ' ' . VmHTML::checkbox('custom_param[' . $row . '][is_hidden]', $isHidden, 1, 0, '');
                    return $display;
                    break;
                    /* image */
                /* image */
                case 'M':
                    if (empty($product)) {
                        $vendorId = 1;
                    } else {
                        $vendorId = $product->virtuemart_vendor_id;
                    }
                    $q = 'SELECT `virtuemart_media_id` as value,`file_title` as text FROM `#__virtuemart_medias` WHERE `published`=1
					AND (`virtuemart_vendor_id`= "' . $vendorId . '" OR `shared` = "1")';
                    $this->_db->setQuery($q);
                    $options = $this->_db->loadObjectList();
                    return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', '', 'value', 'text', $field->custom_value) . '</td><td>' . $priceInput;
                    break;
                    /* Child product Group */
                /* Child product Group */
                case 'G':
                    break;
                    /* Child product */
                    /*				case 'C':
                    					if (empty($product)){
                    				   $virtuemart_product_id = JRequest::getInt('virtuemart_product_id', 0);
                    				   } else {
                    				   $virtuemart_product_id = $product->virtuemart_product_id;
                    				   }
                    				   $html = '';
                    				   $q='SELECT concat(`product_sku`,":",`product_name`) as text ,`virtuemart_product_id`,`product_in_stock` FROM `#__virtuemart_products` WHERE `published`=1
                    				   AND `virtuemart_product_id`= "'.$field->custom_value.'"';
                    				   //$db->setQuery(' SELECT virtuemart_product_id, product_name FROM `#__virtuemart_products` WHERE `product_parent_id` ='.(int)$product_id);
                    				   $this->_db->setQuery($q);
                    				   if ($child = $this->_db->loadObject()) {
                    				   $html .= JHTML::link ( JRoute::_ ( 'index.php?option=com_virtuemart&view=product&task=edit&virtuemart_product_id='.$field->custom_value), $child->text.' ('.$field->custom_value.')', array ('title' => $child->text ));
                    				   $html .= ' '.JText::_('COM_VIRTUEMART_PRODUCT_FORM_IN_STOCK').':'.$child->product_in_stock ;
                    				   $html .= '<input type="hidden" value="'.$child->virtuemart_product_id.'" name="field['.$row.'][custom_value]" /></div><div>'.$priceInput;
                    				   return $html;
                    				   //					return '<input type="text" value="'.$field->custom_value.'" name="field['.$row.'][custom_value]" />';
                    				   }
                    				   else return JText::_('COM_VIRTUEMART_CUSTOM_NO_CHILD_PRODUCT');
                    				   break;*/
            }
        }
    }
 function display($tpl = null)
 {
     // Get the task
     $task = JRequest::getWord('task', $this->getLayout());
     vmdebug('VirtuemartViewProduct ' . $task);
     $this->task = $task;
     // Load helpers
     $this->loadHelper('currencydisplay');
     $this->loadHelper('html');
     $this->loadHelper('image');
     $model = VmModel::getModel();
     // Handle any publish/unpublish
     switch ($task) {
         case 'add':
         case 'edit':
             VmConfig::loadJLang('com_virtuemart_orders', TRUE);
             VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
             $this->jsonPath = JFactory::getApplication()->isSite() ? juri::root() : '';
             $virtuemart_product_id = JRequest::getVar('virtuemart_product_id', array());
             if (is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0) {
                 $virtuemart_product_id = (int) $virtuemart_product_id[0];
             } else {
                 $virtuemart_product_id = (int) $virtuemart_product_id;
             }
             $product = $model->getProductSingle($virtuemart_product_id, false);
             $product_parent = $model->getProductParent($product->product_parent_id);
             $mf_model = VmModel::getModel('manufacturer');
             $manufacturers = $mf_model->getManufacturerDropdown($product->virtuemart_manufacturer_id);
             $this->manufacturers = $manufacturers;
             // set category in front edit link
             if ($task == 'add') {
                 if ($category_id = jRequest::getInt('virtuemart_category_id', 0)) {
                     $product->categories = array($category_id);
                 }
             }
             // Get the category tree
             if (isset($product->categories)) {
                 $this->category_tree = ShopFunctions::categoryListTree($product->categories);
             } else {
                 $this->category_tree = ShopFunctions::categoryListTree();
             }
             //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility
             if (isset($product->shoppergroups)) {
                 $this->shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups);
             } else {
                 $this->shoppergroupList = '';
             }
             // Load the product price
             $this->loadHelper('calculationh');
             $product_childIds = $model->getProductChildIds($virtuemart_product_id);
             $product_childs = array();
             foreach ($product_childIds as $id) {
                 $product_childs[] = $model->getProductSingle($id, false);
             }
             $this->assignRef('product_childs', $product_childs);
             JLoader::register('VirtueMartModelConfig', JPATH_VM_ADMINISTRATOR . '/models/config.php');
             $this->productLayouts = VirtueMartModelConfig::getLayoutList('productdetails', $product->layout);
             // Load Images
             $model->addImages($product);
             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;
             // Load the vendors
             $vendor_model = VmModel::getModel('vendor');
             if (Vmconfig::get('multix', 'none') !== 'none') {
                 if ($task == 'add') {
                     $vendor_id = $this->adminVendor;
                 } else {
                     $vendor_id = $product->virtuemart_vendor_id;
                 }
                 $lists['vendors'] = Shopfunctions::renderVendorList($vendor_id);
             }
             // Load the currencies
             $currency_model = VmModel::getModel('currency');
             $this->loadHelper('permissions');
             $vendor_model->setId(Permissions::getInstance()->isSuperVendor());
             $vendor = $vendor_model->getVendor();
             if (empty($product->product_currency)) {
                 $product->product_currency = $vendor->vendor_currency;
             }
             //STUDIO42  fix for currency, old method set 2 time same currency symbol
             // TODO verify all others
             $currencyModel = VmModel::getModel('currency');
             $currencyModel->setId($vendor->vendor_currency);
             $currency = $currencyModel->getData();
             $this->vendor_currency = $currency->currency_symbol;
             $currencyModel->setId($product->product_currency);
             $currency = $currencyModel->getData();
             $this->product_currency = $currency->currency_symbol;
             if (count($manufacturers) > 0) {
                 $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox"', 'value', 'text', $product->virtuemart_manufacturer_id);
             }
             $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', $task == 'add' ? VmConfig::get('weight_unit_default') : $product->product_weight_uom);
             $lists['product_iso_uom'] = ShopFunctions::renderUnitIsoList('product_unit', $task == 'add' ? VmConfig::get('weight_unit_default') : $product->product_unit);
             $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', $task == 'add' ? VmConfig::get('lwh_unit_default') : $product->product_lwh_uom);
             if (empty($product->product_available_date)) {
                 $product->product_available_date = date("Y-m-d");
             }
             $waitinglistmodel = VmModel::getModel('waitinglist');
             /* Load waiting list */
             if ($product->virtuemart_product_id) {
                 //$waitinglist = $this->get('waitingusers', 'waitinglist');
                 $waitinglist = $waitinglistmodel->getWaitingusers($product->virtuemart_product_id);
                 $this->assignRef('waitinglist', $waitinglist);
             }
             $productShoppers = $model->getProductShoppersByStatus($product->virtuemart_product_id, array('S'));
             $this->assignRef('productShoppers', $productShoppers);
             $orderstatusModel = VmModel::getModel('orderstatus');
             $lists['OrderStatus'] = $orderstatusModel->renderOSList(array(), 'order_status', TRUE);
             $field_model = VmModel::getModel('customfields');
             $fieldTypes = $field_model->getField_types();
             $this->assignRef('fieldTypes', $fieldTypes);
             /* Load product types lists */
             if ($customsList = $field_model->getCustomsList()) {
                 $emptyOption = JHTML::_('select.option', '', '- ' . JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION') . ' :', 'value', 'text');
                 array_unshift($customsList, $emptyOption);
                 $customlist = JHTML::_('select.genericlist', $customsList, 'customlist');
                 if ($task == "add") {
                     if ($customfieldsDefault = $this->getBLankCustomfields()) {
                         $product->customfields = $customfieldsDefault;
                         // var_dump( $customfieldsDefault);jexit();
                     }
                 }
             }
             $this->assignRef('customsList', $customlist);
             $ChildCustomRelation = $field_model->getProductChildCustomRelation();
             $this->assignRef('ChildCustomRelation', $ChildCustomRelation);
             if ($product->product_parent_id > 0) {
                 $parentRelation = $field_model->getProductParentRelation($product->virtuemart_product_id);
                 $this->assignRef('parentRelation', $parentRelation);
                 // Set up labels
                 $info_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_INFO_LBL');
                 $status_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_STATUS_LBL');
                 $dim_weight_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_DIM_WEIGHT_LBL');
                 $images_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_IMAGES_LBL');
                 $delete_message = JText::_('COM_VIRTUEMART_PRODUCT_FORM_DELETE_ITEM_MSG');
             } else {
                 if ($task == 'add') {
                     $action = JText::_('COM_VIRTUEMART_PRODUCT_FORM_NEW_PRODUCT_LBL');
                 } else {
                     $action = JText::_('COM_VIRTUEMART_PRODUCT_FORM_UPDATE_ITEM_LBL');
                 }
                 $info_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_INFO_LBL');
                 $status_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_STATUS_LBL');
                 $dim_weight_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL');
                 $images_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_IMAGES_LBL');
                 $delete_message = JText::_('COM_VIRTUEMART_PRODUCT_FORM_DELETE_PRODUCT_MSG');
             }
             $this->assignRef('product', $product);
             $product_empty_price = array('virtuemart_product_price_id' => 0, 'virtuemart_product_id' => $virtuemart_product_id, 'virtuemart_shoppergroup_id' => NULL, 'product_price' => NULL, 'override' => NULL, 'product_override_price' => NULL, 'product_tax_id' => NULL, 'product_discount_id' => NULL, 'product_currency' => $vendor->vendor_currency, 'product_price_publish_up' => NULL, 'product_price_publish_down' => NULL, 'price_quantity_start' => NULL, 'price_quantity_end' => NULL);
             $this->assignRef('product_empty_price', $product_empty_price);
             $this->assignRef('product_parent', $product_parent);
             /* Assign label values */
             $this->assignRef('action', $action);
             $this->assignRef('info_label', $info_label);
             $this->assignRef('status_label', $status_label);
             $this->assignRef('dim_weight_label', $dim_weight_label);
             $this->assignRef('images_label', $images_label);
             $this->assignRef('delete_message', $delete_message);
             $this->assignRef('lists', $lists);
             // Toolbar
             if ($product->product_sku) {
                 $sku = ' (' . $product->product_sku . ')';
             } else {
                 $sku = "";
             }
             if (!empty($product->canonCatLink)) {
                 $canonLink = '&virtuemart_category_id=' . $product->canonCatLink;
             } else {
                 $canonLink = '';
             }
             if (!empty($product->virtuemart_product_id)) {
                 $text = '<a href="' . juri::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . $canonLink . '" target="_blank" >' . $product->product_name . $sku . '<span class="vm2-modallink"></span></a>';
             } else {
                 $text = $product->product_name . $sku;
             }
             $this->SetViewTitle('PRODUCT', $text);
             //JToolBarHelper::custom('sentproductemailtocustomer', 'email_32', 'email_32',  'COM_VIRTUEMART_PRODUCT_EMAILTOSHOPPER' ,false);
             $this->addStandardEditViewCommands($product->virtuemart_product_id);
             break;
         case 'massxref_cats':
         case 'massxref_cats_exe':
             //TODO test if path is ok addpath is now in the constructor
             $this->addTemplatePath(JPATH_VM_ADMINISTRATOR . '/views' . DS . 'category' . DS . 'tmpl');
             $this->SetViewTitle('PRODUCT_MASSXREF');
             // $this->setLayout('massxref');
             $this->loadHelper('permissions');
             $this->perms = Permissions::getInstance();
             $this->showVendors = $this->perms->check('admin');
             $keyWord = '';
             $catmodel = VmModel::getModel('category');
             $this->catmodel = $catmodel;
             //$this->addStandardDefaultViewCommands();
             $this->addStandardDefaultViewLists($catmodel, 'category_name');
             $this->categories = $catmodel->getCategoryTree(0, 0, false, $this->lists['search']);
             $this->pagination = $catmodel->getPagination();
             // restore icon is good but not the word
             JToolBarHelper::custom('display', 'restore', 'restore', JText::_('JTOOLBAR_BACK'), false);
             JToolBarHelper::custom('massxref_cats_exe', 'assign', 'assign', JText::_('COM_VIRTUEMART_MASS_REPLACE'), false);
             JToolBarHelper::custom('massxref_cats_add', 'new', 'new', JText::_('COM_VIRTUEMART_MASS_ADD'), true);
             break;
         case 'massxref_sgrps':
         case 'massxref_sgrps_exe':
             $this->SetViewTitle('PRODUCT_MASSXREF');
             //TODO test if path is ok addpath is now in the constructor
             $this->addTemplatePath(JPATH_VM_ADMINISTRATOR . '/views' . DS . 'shoppergroup' . DS . 'tmpl');
             $this->loadHelper('permissions');
             $this->perms = Permissions::getInstance();
             $this->showVendors = $this->perms->check('admin');
             $sgrpmodel = VmModel::getModel('shoppergroup');
             $this->addStandardDefaultViewLists($sgrpmodel);
             $this->shoppergroups = $sgrpmodel->getShopperGroups(false, true);
             $this->pagination = $sgrpmodel->getPagination();
             JToolBarHelper::custom('massxref_sgrps_exe', 'groups-add', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_SGRPS_EXE'), false);
             break;
         default:
             if ($product_parent_id = JRequest::getInt('product_parent_id', false)) {
                 $product_parent = $model->getProductSingle($product_parent_id, false);
                 if ($product_parent) {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $link_to_parent = JHTML::_('link', JRoute::_('index.php?view=product&task=edit&virtuemart_product_id=' . $product_parent->virtuemart_product_id . '&option=com_virtuemart'), $product_parent->product_name, array('class' => 'hasTooltip', 'title' => JText::_('COM_VIRTUEMART_EDIT_PARENT') . ' ' . $product_parent->product_name));
                     $msg = JText::_('COM_VIRTUEMART_PRODUCT_OF') . " " . $link_to_parent;
                 } else {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $msg = 'Parent with product_parent_id ' . $product_parent_id . ' not found';
                 }
             } else {
                 $title = 'PRODUCT';
                 $msg = "";
             }
             $this->db = JFactory::getDBO();
             $this->loadHelper('permissions');
             $this->SetViewTitle($title, $msg);
             $this->addStandardDefaultViewLists($model, 'created_on', 'DESC', 'filter_product');
             $vendor_id = $this->adminVendor;
             if ($vendor_id == 1) {
                 $vendor_id = null;
             }
             // fix ???
             $catid = JRequest::getInt('uctlist = ', 0);
             /* Get the list of products */
             $productlist = $model->getProductListing(false, false, false, false, true, true, $catid, $vendor_id);
             //The pagination must now always set AFTER the model load the listing
             $this->pagination = $model->getPagination();
             /* Get the category tree */
             $categoryId = $model->virtuemart_category_id;
             //OSP switched to filter in model, was JRequest::getInt('virtuemart_category_id');
             $this->category_tree = ShopFunctions::categoryListTree(array($categoryId));
             /* Load the product price */
             $this->loadHelper('calculationh');
             $vendor_model = VmModel::getModel('vendor');
             $productreviews = VmModel::getModel('ratings');
             foreach ($productlist as $virtuemart_product_id => $product) {
                 if (isset($product->virtuemart_media_id)) {
                     $product->mediaitems = count($product->virtuemart_media_id);
                 } else {
                     $product->mediaitems = 'none';
                 }
                 $product->reviews = $productreviews->countReviewsForProduct($product->virtuemart_product_id);
                 $vendor_model->setId($product->virtuemart_vendor_id);
                 $vendor = $vendor_model->getVendor();
                 $currencyDisplay = CurrencyDisplay::getInstance($vendor->vendor_currency, $vendor->virtuemart_vendor_id);
                 if (!empty($product->product_price) && !empty($product->product_currency)) {
                     $product->product_price_display = $currencyDisplay->priceDisplay($product->product_price, (int) $product->product_currency, 1, true);
                 }
                 /* Write the first 5 categories in the list */
                 $product->categoriesList = shopfunctions::renderGuiList('virtuemart_category_id', '#__virtuemart_product_categories', 'virtuemart_product_id', $product->virtuemart_product_id, 'category_name', '#__virtuemart_categories', 'virtuemart_category_id', 'category');
             }
             $mf_model = VmModel::getModel('manufacturer');
             $this->manufacturers = $mf_model->getManufacturerDropdown();
             /* add Search filter in lists*/
             /* Search type */
             $options = array('' => JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), 'parent' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_PARENT_PRODUCT'), 'product' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRODUCT'), 'price' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRICE'), 'withoutprice' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_WITHOUTPRICE'));
             $this->lists['search_type'] = VmHTML::selectList('search_type', JRequest::getVar('search_type'), $options, 1, '', 'onchange="Joomla.ajaxSearch(this); return false;"', 'input-medium');
             /* Search order */
             $options = array('bf' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_BEFORE'), 'af' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_AFTER'));
             $this->lists['search_order'] = VmHTML::selectList('search_order', JRequest::getVar('search_order'), $options, 1, '', '', 'input-small');
             // Toolbar
             //JToolBarHelper::save('sentproductemailtoshoppers', JText::_('COM_VIRTUEMART_PRODUCT_EMAILTOSHOPPERS'));
             JToolBarHelper::custom('massxref_cats', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_CAT'), true);
             JToolBarHelper::custom('massxref_sgrps', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_SGRPS'), true);
             JToolBarHelper::custom('createchild', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_CHILD'), true);
             JToolBarHelper::custom('cloneproduct', 'copy', 'copy', JText::_('COM_VIRTUEMART_PRODUCT_CLONE'), true);
             JToolBarHelper::custom('addrating', 'star-2', '', JText::_('COM_VIRTUEMART_ADD_RATING'), true);
             $this->addStandardDefaultViewCommands();
             $this->productlist = $productlist;
             $this->virtuemart_category_id = $categoryId;
             $this->model = $model;
             break;
     }
     parent::display($tpl);
 }
Example #6
0
 function display($tpl = null)
 {
     // Get the task
     $task = vRequest::getCmd('task', $this->getLayout());
     $this->assignRef('task', $task);
     // Load helpers
     if (!class_exists('CurrencyDisplay')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     if (!class_exists('VmImage')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
     }
     $model = tmsModel::getModel();
     // Handle any publish/unpublish
     switch ($task) {
         case 'add':
         case 'edit':
             //this was in the controller for the edit tasks, we need this for the access by FE
             //$this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'product'.DS.'tmpl');
             tsmConfig::loadJLang('com_tsmart_orders', TRUE);
             tsmConfig::loadJLang('com_tsmart_shoppers', TRUE);
             $model_country = tmsModel::getModel('country');
             $this->countries = $model_country->getItemList();
             $tsmart_product_id = vRequest::getInt('tsmart_product_id');
             if (is_array($tsmart_product_id) && count($tsmart_product_id) > 0) {
                 $tsmart_product_id = (int) $tsmart_product_id[0];
             } else {
                 $tsmart_product_id = (int) $tsmart_product_id;
             }
             $product = $model->getItem($tsmart_product_id);
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
             $product->tsmart_service_class_ids = tsmserviceclass::get_list_service_class_ids_by_tour_id($tsmart_product_id);
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php';
             $product->tsmart_group_size_ids = tsmGroupSize::get_list_group_size_ids_by_tour_id($tsmart_product_id);
             //$user = JFactory::getUser();
             $superVendor = vmAccess::isSuperVendor();
             if ($superVendor != 1 and $superVendor != $product->tsmart_vendor_id) {
                 vmdebug('Product view.html.php ' . $superVendor, $product->tsmart_vendor_id);
                 JFactory::getApplication()->redirect('index.php?option=com_tsmart&view=tsmart', tsmText::_('com_tsmart_ALERTNOTAUTHOR'), 'error');
             }
             if (!empty($product->product_parent_id)) {
                 $product_parent = $model->getProductSingle($product->product_parent_id, false);
             }
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
             $this->tour_service_class = tsmserviceclass::get_list_tour_service_class();
             $customfields = tmsModel::getModel('Customfields');
             $product->allIds[] = $product->tsmart_product_id;
             if (!empty($product->product_parent_id)) {
                 $product->allIds[] = $product->product_parent_id;
             }
             $product->customfields = $customfields->getCustomEmbeddedProductCustomFields($product->allIds);
             // Get the category tree
             if (isset($product->categories)) {
                 $this->category_tree = ShopFunctions::categoryListTree($product->categories);
             } else {
                 $this->category_tree = ShopFunctions::categoryListTree();
             }
             //Fallback for categories inherited by parent to correctly calculate the prices
             if (empty($product->categories) and !empty($product_parent->categories)) {
                 $product->categories = $product_parent->categories;
             }
             //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility
             if (!isset($product->shoppergroups)) {
                 $product->shoppergroups = 0;
             }
             $this->shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups);
             // Load the product price
             if (!class_exists('calculationHelper')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
             }
             //Do we need the children? If there is a C customfield, we dont want them
             $isCustomVariant = false;
             foreach ($product->customfields as $custom) {
                 if ($custom->field_type == 'C' and $custom->tsmart_product_id == $tsmart_product_id) {
                     $isCustomVariant = true;
                     break;
                 }
             }
             if (!class_exists('tsmartModelConfig')) {
                 require VMPATH_ADMIN . '/models/config.php';
             }
             $productLayouts = tsmartModelConfig::getLayoutList('productdetails');
             $this->productLayouts = $productLayouts;
             // Load Images
             $model->addImages($product);
             if (!class_exists('VmTemplate')) {
                 require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
             }
             $vmtemplate = VmTemplate::loadVmTemplateStyle();
             $this->imagePath = shopFunctions::getAvailabilityIconUrl($vmtemplate);
             // Load the vendors
             $vendor_model = tmsModel::getModel('vendor');
             $lists['vendors'] = '';
             if ($this->showVendors()) {
                 $lists['vendors'] = Shopfunctions::renderVendorList($product->tsmart_vendor_id);
             }
             // Load the currencies
             $currency_model = tmsModel::getModel('currency');
             $vendor_model->setId(vmAccess::isSuperVendor());
             $this->vendor = $vendor_model->getVendor();
             $currency = $currency_model->getItemList();
             $this->vendor_currency_symb = $currency->currency_symbol;
             $lists['manufacturers'] = shopFunctions::renderManufacturerList($product->tsmart_manufacturer_id, true);
             if (!empty($product->product_weight_uom)) {
                 $product_weight_uom = $product->product_weight_uom;
             } else {
                 if (!empty($product_parent)) {
                     $product_weight_uom = $product_parent->product_weight_uom;
                 } else {
                     $product_weight_uom = tsmConfig::get('weight_unit_default');
                 }
             }
             if (!empty($product->product_lwh_uom)) {
                 $product_lwh_uom = $product->product_lwh_uom;
             } else {
                 if (!empty($product_parent)) {
                     $product_lwh_uom = $product_parent->product_lwh_uom;
                 } else {
                     $product_lwh_uom = tsmConfig::get('lwh_unit_default');
                 }
             }
             if (!empty($product->product_unit)) {
                 $product_unit = $product->product_unit;
             } else {
                 if (!empty($product_parent)) {
                     $product_unit = $product_parent->product_unit;
                 } else {
                     $product_unit = tsmConfig::get('product_unit_default', 'KG');
                 }
             }
             $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', $product_weight_uom);
             $lists['product_iso_uom'] = ShopFunctions::renderUnitIsoList('product_unit', $product_unit);
             $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', $product_lwh_uom);
             if (empty($product->product_available_date)) {
                 $product->product_available_date = date("Y-m-d");
             }
             $waitinglistmodel = tmsModel::getModel('waitinglist');
             /* Load waiting list */
             if ($product->tsmart_product_id) {
                 //$waitinglist = $this->get('waitingusers', 'waitinglist');
                 $waitinglist = $waitinglistmodel->getWaitingusers($product->tsmart_product_id);
                 $this->assignRef('waitinglist', $waitinglist);
             }
             $orderstatusModel = tmsModel::getModel('orderstatus');
             $lists['OrderStatus'] = $orderstatusModel->renderOSList(array(), 'order_status', TRUE);
             // Add the tsmart_shoppergroup_ids
             $cid = JFactory::getUser()->id;
             $this->activeShoppergroups = shopfunctions::renderGuiList($cid, 'shoppergroups', 'shopper_group_name', 'category', 'vmuser_shoppergroups', 'tsmart_user_id');
             if (!empty($this->activeShoppergroups)) {
                 $shoppergroupModel = tmsModel::getModel('shoppergroup');
                 $this->activeShoppergroups = tsmText::_($shoppergroupModel->getDefault(0)->shopper_group_name);
             }
             // Load protocustom lists
             $customModel = tmsModel::getModel('custom');
             $this->fieldTypes = tsmartModelCustom::getCustomTypes();
             $customsList = $customModel->getCustomsList();
             $attribs = 'style= "width: 300px;"';
             $customlist = JHtml::_('select.genericlist', $customsList, 'customlist', $attribs, 'value', 'text', null, false, true);
             $this->assignRef('customsList', $customlist);
             if ($product->product_parent_id > 0) {
                 // Set up labels
                 $info_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_INFO_LBL');
                 $status_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_STATUS_LBL');
                 $dim_weight_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_DIM_WEIGHT_LBL');
                 $images_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_IMAGES_LBL');
                 $delete_message = tsmText::_('com_tsmart_PRODUCT_FORM_DELETE_ITEM_MSG');
             } else {
                 if ($task == 'add') {
                     $action = tsmText::_('com_tsmart_PRODUCT_FORM_NEW_PRODUCT_LBL');
                 } else {
                     $action = tsmText::_('com_tsmart_PRODUCT_FORM_UPDATE_ITEM_LBL');
                 }
                 $info_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_INFO_LBL');
                 $status_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_STATUS_LBL');
                 $dim_weight_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL');
                 $images_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_IMAGES_LBL');
                 $delete_message = tsmText::_('com_tsmart_PRODUCT_FORM_DELETE_PRODUCT_MSG');
             }
             //get countries
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmcountries.php';
             $countries = tsmcountries::get_countries();
             $this->assignRef('countries', $countries);
             //end get countries
             //get cities
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmcities.php';
             $cities = tsmcities::get_cities();
             $this->assignRef('cities', $cities);
             //end get cities
             //get tour style
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmtourstyle.php';
             $list_tour_style = tsmtourstyle::get_list_tour_style();
             $this->assignRef('list_tour_style', $list_tour_style);
             //end get toursyle
             //get tour section
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmtoursection.php';
             $list_tour_section = tsmtoursection::get_list_tour_section();
             $this->assignRef('list_tour_section', $list_tour_section);
             //end get toursyle
             //get tour physicalgrade
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmphysicalgrade.php';
             $list_physical_grade = vmphysicalgrade::get_physical_grade();
             $this->assignRef('list_physical_grade', $list_physical_grade);
             //end get physicalgrade
             //get tour_type
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmtourtype.php';
             $list_tour_type = tsmtourtype::get_list_tour_type();
             $this->assignRef('list_tour_type', $list_tour_type);
             //end get tour_type
             //get tour_type
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
             $list_tour_service_class = tsmserviceclass::get_list_tour_service_class();
             $product->list_tour_service_class_id = tsmserviceclass::get_list_service_class_ids_by_tour_id($product->tsmart_product_id);
             $this->assignRef('list_tour_service_class', $list_tour_service_class);
             //end get tour_type
             //get activities
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmactivities.php';
             $product->list_activity_id = tsmactivities::get_list_activity_id_by_tour_id($product->tsmart_product_id);
             $activities = tsmactivities::get_activities();
             $this->assignRef('activities', $activities);
             //end get activities
             //get list group size
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php';
             $list_group_size = tsmGroupSize::get_list_group_size();
             $product->list_group_size_id = tsmGroupSize::get_list_group_size_ids_by_tour_id($product->tsmart_product_id);
             $this->assignRef('list_group_size', $list_group_size);
             //end get list group size
             //get list country
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmcountries.php';
             $product->list_tsmart_country_id = tsmcountries::get_list_tsmart_country_id_by_tour_id($product->tsmart_product_id);
             //end get list group size
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php';
             $this->list_price_type = vmprice::get_list_price_type();
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php';
             $this->list_tour_method = vmproduct::get_list_tour_method();
             $this->assignRef('product', $product);
             $this->assignRef('product_parent', $product_parent);
             /* Assign label values */
             $this->assignRef('action', $action);
             $this->assignRef('info_label', $info_label);
             $this->assignRef('status_label', $status_label);
             $this->assignRef('dim_weight_label', $dim_weight_label);
             $this->assignRef('images_label', $images_label);
             $this->assignRef('delete_message', $delete_message);
             $this->assignRef('lists', $lists);
             // Toolbar
             if ($product->product_sku) {
                 $sku = ' (' . $product->product_sku . ')';
             } else {
                 $sku = "";
             }
             //if (!empty($product->canonCatLink)) $canonLink = '&tsmart_category_id=' . $product->canonCatLink; else $canonLink = '';
             if (!empty($product->tsmart_product_id)) {
                 if (!class_exists('shopFunctionsF')) {
                     require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
                 }
                 $menuItemID = shopFunctionsF::getMenuItemId(JFactory::getLanguage()->getTag());
                 $canonLink = '';
                 if ($product->canonCatId) {
                     $canonLink = '&tsmart_category_id=' . $product->canonCatId;
                 }
                 $text = '<a href="' . juri::root() . 'index.php?option=com_tsmart&view=productdetails&tsmart_product_id=' . $product->tsmart_product_id . $canonLink . '&Itemid=' . $menuItemID . '" target="_blank" >' . $product->product_name . $sku . '<span class="vm2-modallink"></span></a>';
                 if (JFactory::getApplication()->isSite()) {
                     $bar = JToolBar::getInstance('toolbar');
                     $bar->appendButton('Link', 'back', 'com_tsmart_LEAVE_TO_PRODUCT', juri::root() . 'index.php?option=com_tsmart&view=productdetails&tsmart_product_id=' . $product->tsmart_product_id . $canonLink . '&Itemid=' . $menuItemID);
                 }
             } else {
                 $text = $product->product_name . $sku;
             }
             $this->SetViewTitle('PRODUCT', $text);
             $this->addStandardEditViewCommandsNoValidate($product->tsmart_product_id);
             break;
         case 'massxref_cats':
         case 'massxref_cats_exe':
             $this->SetViewTitle('PRODUCT_MASSXREF');
             $showVendors = $this->showVendors();
             $this->assignRef('showVendors', $showVendors);
             $keyWord = '';
             $catmodel = tmsModel::getModel('category');
             $this->assignRef('catmodel', $catmodel);
             $this->addStandardDefaultViewCommandsNoValidate();
             $this->addStandardDefaultViewLists($catmodel, 'category_name');
             $session = JFactory::getSession();
             $reset = $session->get('reset_pag', false, 'vm');
             $limit = '';
             if ($reset) {
                 $limit = 0;
                 $session->set('reset_pag', false, 'vm');
             }
             $this->categories = $catmodel->getCategoryTree(0, 0, false, $this->lists['search'], $limit);
             $catpagination = $catmodel->getPagination();
             $this->assignRef('catpagination', $catpagination);
             $this->setLayout('massxref');
             JToolBarHelper::custom('massxref_cats_exe', 'new', 'new', tsmText::_('com_tsmart_PRODUCT_XREF_CAT_EXE'), false);
             break;
         case 'massxref_sgrps':
         case 'massxref_sgrps_exe':
             $sgrpmodel = tmsModel::getModel('shoppergroup');
             $this->addStandardDefaultViewLists($sgrpmodel);
             $shoppergroups = $sgrpmodel->getShopperGroups(false, true);
             $this->assignRef('shoppergroups', $shoppergroups);
             $sgrppagination = $sgrpmodel->getPagination();
             $this->assignRef('sgrppagination', $sgrppagination);
             $this->setLayout('massxref');
             JToolBarHelper::custom('massxref_sgrps_exe', 'new', 'new', tsmText::_('com_tsmart_PRODUCT_XREF_SGRPS_EXE'), false);
             break;
         default:
             if ($product_parent_id = vRequest::getInt('product_parent_id', false)) {
                 $product_parent = $model->getProductSingle($product_parent_id, false);
                 if ($product_parent) {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $link_to_parent = JHtml::_('link', JRoute::_('index.php?view=product&task=edit&tsmart_product_id=' . $product_parent->tsmart_product_id . '&option=com_tsmart'), $product_parent->product_name, array('title' => tsmText::_('com_tsmart_EDIT_PARENT') . ' ' . $product_parent->product_name));
                     $msg = tsmText::_('com_tsmart_PRODUCT_OF') . " " . $link_to_parent;
                 } else {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $msg = 'Parent with product_parent_id ' . $product_parent_id . ' not found';
                 }
             } else {
                 $title = 'PRODUCT';
                 $msg = "";
             }
             $this->SetViewTitle($title, $msg);
             $this->addStandardDefaultViewLists($model, 'created_on');
             if ($cI = vRequest::getInt('tsmart_category_id', false)) {
                 $app = JFactory::getApplication();
                 //$old_state = $app->getUserState('tsmart_category_id');
                 $old_state = $app->getUserState('tsmart_category_id');
                 if (empty($old_state) or $old_state != $cI) {
                     vRequest::setVar('com_tsmart.product.filter_order', 'pc.ordering');
                     $model->filter_order = 'pc.ordering';
                     $old_state = $app->setUserState('tsmart_category_id', $cI);
                 }
             }
             //Get the list of products
             $productlist = $model->getItemList();
             //The pagination must now always set AFTER the model load the listing
             $this->pagination = $model->getPagination();
             //Get the category tree
             $categoryId = $model->tsmart_category_id;
             //OSP switched to filter in model, was vRequest::getInt('tsmart_category_id');
             $category_tree = ShopFunctions::categoryListTree(array($categoryId));
             $this->assignRef('category_tree', $category_tree);
             //load service class
             //Load the product price
             if (!class_exists('calculationHelper')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
             }
             $vendor_model = tmsModel::getModel('vendor');
             $productreviews = tmsModel::getModel('ratings');
             $this->mfTable = $model->getTable('manufacturers');
             $this->catTable = $model->getTable('categories');
             $this->lists['vendors'] = '';
             if ($this->showVendors()) {
                 $this->lists['vendors'] = Shopfunctions::renderVendorList(vmAccess::getVendorId());
             }
             foreach ($productlist as $tsmart_product_id => $product) {
                 $product->mediaitems = count($product->tsmart_media_id);
                 $product->reviews = $productreviews->countReviewsForProduct($product->tsmart_product_id);
                 $vendor_model->setId($product->tsmart_vendor_id);
                 $vendor = $vendor_model->getVendor();
                 $currencyDisplay = CurrencyDisplay::getInstance($vendor->vendor_currency, $vendor->tsmart_vendor_id);
                 if (!empty($product->allPrices[$product->selectedPrice]['product_price']) && !empty($product->allPrices[$product->selectedPrice]['product_currency'])) {
                     $product->product_price_display = $currencyDisplay->priceDisplay($product->allPrices[$product->selectedPrice]['product_price'], (int) $product->allPrices[$product->selectedPrice]['product_currency'], 1, true);
                 } else {
                     if (!empty($product->allPrices) and count($product->allPrices) > 1) {
                         $product->product_price_display = tsmText::_('com_tsmart_MULTIPLE_PRICES');
                     } else {
                         $product->product_price_display = tsmText::_('com_tsmart_NO_PRICE_SET');
                     }
                 }
                 // Write the first 5 categories in the list
                 $product->categoriesList = '';
                 if (!empty($product->categories[0])) {
                     $product->categoriesList = shopfunctions::renderGuiList($product->categories, 'categories', 'category_name', 'category');
                 }
                 // Write the first 5 manufacturers in the list
                 $product->manuList = '';
                 if (!empty($product->tsmart_manufacturer_id[0])) {
                     $product->manuList = shopfunctions::renderGuiList($product->tsmart_manufacturer_id, 'manufacturers', 'mf_name', 'manufacturer');
                 }
             }
             $mf_model = tmsModel::getModel('manufacturer');
             $manufacturers = $mf_model->getManufacturerDropdown();
             $this->assignRef('manufacturers', $manufacturers);
             /* add Search filter in lists*/
             /* Search type */
             $options = array('' => tsmText::_('com_tsmart_LIST_EMPTY_OPTION'), 'parent' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_PARENT_PRODUCT'), 'product' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRODUCT'), 'price' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRICE'), 'withoutprice' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_WITHOUTPRICE'));
             $this->lists['search_type'] = VmHTML::selectList('search_type', vRequest::getVar('search_type'), $options);
             /* Search order */
             $options = array('bf' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_BEFORE'), 'af' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_AFTER'));
             $this->lists['search_order'] = VmHTML::selectList('search_order', vRequest::getVar('search_order'), $options);
             // Toolbar
             /*if (vmAccess::manager('product.edit')) {
                   JToolBarHelper::custom('massxref_cats', 'new', 'new', vmText::_('com_tsmart_PRODUCT_XREF_CAT'), true);
                   JToolBarHelper::custom('massxref_sgrps', 'new', 'new', vmText::_('com_tsmart_PRODUCT_XREF_SGRPS'), true);
               }
               if (vmAccess::manager('product.create')) {
                   JToolBarHelper::custom('createchild', 'new', 'new', vmText::_('com_tsmart_PRODUCT_CHILD'), true);
                   JToolBarHelper::custom('cloneproduct', 'copy', 'copy', vmText::_('com_tsmart_PRODUCT_CLONE'), true);
               }*/
             // JToolBarHelper::custom('addrating', 'default', '', vmText::_('com_tsmart_ADD_RATING'), true);
             $view = vRequest::getCmd('view', vRequest::getCmd('controller', 'tsmart'));
             JToolBarHelper::divider();
             if (vmAccess::manager($view . '.edit.state')) {
                 JToolBarHelper::publishList();
                 JToolBarHelper::unpublishList();
             }
             if (vmAccess::manager($view . '.delete')) {
                 JToolBarHelper::spacer('10');
                 JToolBarHelper::deleteList();
             }
             $this->assignRef('productlist', $productlist);
             $this->assignRef('tsmart_category_id', $categoryId);
             $this->assignRef('model', $model);
             break;
     }
     parent::display($tpl);
 }
Example #7
0
 function display($tpl = null)
 {
     // Get the task
     $task = JRequest::getWord('task');
     // Load helpers
     $this->loadHelper('currencydisplay');
     $this->loadHelper('html');
     $this->loadHelper('image');
     //$category_model = VmModel::getModel('category');
     $model = VmModel::getModel();
     // Handle any publish/unpublish
     switch ($task) {
         case 'add':
         case 'edit':
             //this was in the controller for the edit tasks, I dont know if it is still needed,
             $this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'product' . DS . 'tmpl');
             $virtuemart_product_id = JRequest::getVar('virtuemart_product_id', array());
             if (is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0) {
                 $virtuemart_product_id = (int) $virtuemart_product_id[0];
             } else {
                 $virtuemart_product_id = (int) $virtuemart_product_id;
             }
             $product = $model->getProductSingle($virtuemart_product_id, false);
             $product_parent = $model->getProductParent($product->product_parent_id);
             $mf_model = VmModel::getModel('manufacturer');
             $manufacturers = $mf_model->getManufacturerDropdown($product->virtuemart_manufacturer_id);
             $this->assignRef('manufacturers', $manufacturers);
             // Get the category tree
             if (isset($product->categories)) {
                 $category_tree = ShopFunctions::categoryListTree($product->categories);
             } else {
                 $category_tree = ShopFunctions::categoryListTree();
             }
             $this->assignRef('category_tree', $category_tree);
             //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility
             if (isset($product->shoppergroups)) {
                 $shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups, true);
             }
             $this->assignRef('shoppergroupList', $shoppergroupList);
             // Load the product price
             if (!class_exists('calculationHelper')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
             }
             $calculator = calculationHelper::getInstance();
             $product->prices = $calculator->getProductPrices($product);
             $product_childIds = $model->getProductChildIds($virtuemart_product_id);
             $product_childs = array();
             foreach ($product_childIds as $id) {
                 $product_childs[] = $model->getProductSingle($id, false);
             }
             $this->assignRef('product_childs', $product_childs);
             $DBTax = '';
             //JText::_('COM_VIRTUEMART_RULES_EFFECTING') ;
             foreach ($calculator->rules['DBTax'] as $rule) {
                 $DBTax .= $rule['calc_name'] . '<br />';
             }
             $this->assignRef('DBTaxRules', $DBTax);
             $tax = '';
             //JText::_('COM_VIRTUEMART_TAX_EFFECTING').'<br />';
             foreach ($calculator->rules['Tax'] as $rule) {
                 $tax .= $rule['calc_name'] . '<br />';
             }
             foreach ($calculator->rules['VatTax'] as $rule) {
                 $tax .= $rule['calc_name'] . '<br />';
             }
             $this->assignRef('taxRules', $tax);
             $DATax = '';
             //JText::_('COM_VIRTUEMART_RULES_EFFECTING');
             foreach ($calculator->rules['DATax'] as $rule) {
                 $DATax .= $rule['calc_name'] . '<br />';
             }
             $this->assignRef('DATaxRules', $DATax);
             // 				$this->assignRef('override', $calculator->override);
             // 				$this->assignRef('product_override_price', $calculator->product_override_price);
             if (!isset($product->product_tax_id)) {
                 $product->product_tax_id = 0;
             }
             $lists['taxrates'] = ShopFunctions::renderTaxList($product->product_tax_id, 'product_tax_id');
             if (!isset($product->product_discount_id)) {
                 $product->product_discount_id = 0;
             }
             $lists['discounts'] = $this->renderDiscountList($product->product_discount_id);
             if (!class_exists('VirtueMartModelConfig')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'config.php';
             }
             $productLayouts = VirtueMartModelConfig::getLayoutList('productdetails');
             $this->assignRef('productLayouts', $productLayouts);
             // Load Images
             $model->addImages($product);
             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->assignRef('imagePath', $imagePath);
             // Load the vendors
             $vendor_model = VmModel::getModel('vendor');
             // 				$vendors = $vendor_model->getVendors();
             // 				$lists['vendors'] = JHTML::_('select.genericlist', $vendors, 'virtuemart_vendor_id', '', 'virtuemart_vendor_id', 'vendor_name', $product->virtuemart_vendor_id);
             if (Vmconfig::get('multix', 'none') !== 'none') {
                 $lists['vendors'] = Shopfunctions::renderVendorList($product->virtuemart_vendor_id);
             }
             // Load the currencies
             $currency_model = VmModel::getModel('currency');
             $vendor_model->setId(1);
             $vendor = $vendor_model->getVendor();
             if (empty($product->product_currency)) {
                 $product->product_currency = $vendor->vendor_currency;
             }
             $currencies = JHTML::_('select.genericlist', $currency_model->getCurrencies(), 'product_currency', '', 'virtuemart_currency_id', 'currency_name', $product->product_currency);
             $currency = $currency_model->getCurrency($product->product_currency);
             $this->assignRef('product_currency', $currency->currency_symbol);
             $currency = $currency_model->getCurrency($vendor->vendor_currency);
             $this->assignRef('vendor_currency', $currency->currency_symbol);
             if (count($manufacturers) > 0) {
                 $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox"', 'value', 'text', $product->virtuemart_manufacturer_id);
             }
             $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', $task == 'add' ? VmConfig::get('weight_unit_default') : $product->product_weight_uom);
             $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', $task == 'add' ? VmConfig::get('lwh_unit_default') : $product->product_lwh_uom);
             if (empty($product->product_available_date)) {
                 $product->product_available_date = date("Y-m-d");
             }
             $waitinglistmodel = VmModel::getModel('waitinglist');
             /* Load waiting list */
             if ($product->virtuemart_product_id) {
                 //$waitinglist = $this->get('waitingusers', 'waitinglist');
                 $waitinglist = $waitinglistmodel->getWaitingusers($product->virtuemart_product_id);
                 $this->assignRef('waitinglist', $waitinglist);
             }
             $bookedUsers = $waitinglistmodel->getProductShoppersByStatus($product->virtuemart_product_id, array('S'));
             $this->assignRef('customers', $bookedUsers);
             $orderstatusModel = VmModel::getModel('orderstatus');
             $lists['OrderStatus'] = $orderstatusModel->renderOrderStatusList(true, array('S'));
             $field_model = VmModel::getModel('customfields');
             $fieldTypes = $field_model->getField_types();
             $this->assignRef('fieldTypes', $fieldTypes);
             /* Load product types lists */
             $customsList = $field_model->getCustomsList();
             $this->assignRef('customsList', JHTML::_('select.genericlist', $customsList, 'customlist'));
             $ChildCustomRelation = $field_model->getProductChildCustomRelation();
             $this->assignRef('ChildCustomRelation', $ChildCustomRelation);
             /* Set up labels */
             if ($product->product_parent_id > 0) {
                 $info_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_INFO_LBL');
                 $status_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_STATUS_LBL');
                 $dim_weight_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_DIM_WEIGHT_LBL');
                 $images_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_IMAGES_LBL');
                 $delete_message = JText::_('COM_VIRTUEMART_PRODUCT_FORM_DELETE_ITEM_MSG');
             } else {
                 if ($task == 'add') {
                     $action = JText::_('COM_VIRTUEMART_PRODUCT_FORM_NEW_PRODUCT_LBL');
                 } else {
                     $action = JText::_('COM_VIRTUEMART_PRODUCT_FORM_UPDATE_ITEM_LBL');
                 }
                 $info_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_INFO_LBL');
                 $status_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_STATUS_LBL');
                 $dim_weight_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL');
                 $images_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_IMAGES_LBL');
                 $delete_message = JText::_('COM_VIRTUEMART_PRODUCT_FORM_DELETE_PRODUCT_MSG');
             }
             $config = JFactory::getConfig();
             $tzoffset = $config->getValue('config.offset');
             $this->assignRef('tzoffset', $tzoffset);
             // Assign the values
             $this->assignRef('pane', $pane);
             $this->assignRef('editor', $editor);
             $this->assignRef('product', $product);
             $this->assignRef('currencies', $currencies);
             //no need moved to top $this->assignRef('manufacturers', $manufacturers);
             $this->assignRef('related_products', $related_products);
             $this->assignRef('product_parent', $product_parent);
             /* Assign label values */
             $this->assignRef('action', $action);
             $this->assignRef('info_label', $info_label);
             $this->assignRef('status_label', $status_label);
             $this->assignRef('dim_weight_label', $dim_weight_label);
             $this->assignRef('images_label', $images_label);
             $this->assignRef('delete_message', $delete_message);
             $this->assignRef('lists', $lists);
             // Toolbar
             $text = "";
             if ($task == 'edit') {
                 if ($product->product_sku) {
                     $sku = ' (' . $product->product_sku . ')';
                 } else {
                     $sku = "";
                 }
                 if (!empty($product->virtuemart_product_id)) {
                     $text = '<a href="' . juri::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '" target="_blank" >' . $product->product_name . $sku . '<span class="vm2-modallink"></span></a>';
                 } else {
                     $text = $product->product_name . $sku;
                 }
             }
             $this->SetViewTitle('PRODUCT', $text);
             //JToolBarHelper::custom('sentproductemailtocustomer', 'email_32', 'email_32',  'COM_VIRTUEMART_PRODUCT_EMAILTOSHOPPER' ,false);
             $this->addStandardEditViewCommands($product->virtuemart_product_id);
             break;
         default:
             if ($product_parent_id = JRequest::getInt('product_parent_id', false)) {
                 $product_parent = $model->getProduct($product_parent_id);
                 $title = 'PRODUCT_CHILDREN_LIST';
                 $link_to_parent = JHTML::_('link', JRoute::_('index.php?view=product&task=edit&virtuemart_product_id=' . $product_parent->virtuemart_product_id . '&option=com_virtuemart'), $product_parent->product_name, array('title' => JText::_('COM_VIRTUEMART_EDIT_PARENT') . ' ' . $product_parent->product_name));
                 $msg = JText::_('COM_VIRTUEMART_PRODUCT_OF') . " " . $link_to_parent;
             } else {
                 $title = 'PRODUCT';
                 $msg = "";
             }
             $this->db = JFactory::getDBO();
             $this->SetViewTitle($title, $msg);
             $this->addStandardDefaultViewLists($model, 'created_on');
             /* Get the list of products */
             $productlist = $model->getProductListing(false, false, false, false, true);
             //The pagination must now always set AFTER the model load the listing
             $pagination = $model->getPagination();
             $this->assignRef('pagination', $pagination);
             /* Get the category tree */
             $categoryId = $model->virtuemart_category_id;
             //OSP switched to filter in model, was JRequest::getInt('virtuemart_category_id');
             $category_tree = ShopFunctions::categoryListTree(array($categoryId));
             $this->assignRef('category_tree', $category_tree);
             // Check for Media Items and Reviews, set the price
             $media = VmModel::getModel('media');
             $productreviews = VmModel::getModel('ratings');
             /* Load the product price */
             if (!class_exists('calculationHelper')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
             }
             $vendor_model = VmModel::getModel('vendor');
             foreach ($productlist as $virtuemart_product_id => $product) {
                 $product->mediaitems = count($product->virtuemart_media_id);
                 $product->reviews = $productreviews->countReviewsForProduct($product->virtuemart_product_id);
                 $vendor_model->setId($product->virtuemart_vendor_id);
                 $vendor = $vendor_model->getVendor();
                 $currencyDisplay = CurrencyDisplay::getInstance($vendor->vendor_currency, $vendor->virtuemart_vendor_id);
                 if (!empty($product->product_price) && !empty($product->product_currency)) {
                     $product->product_price_display = $currencyDisplay->priceDisplay($product->product_price, (int) $product->product_currency, 1, true);
                 }
                 /* Write the first 5 categories in the list */
                 $product->categoriesList = shopfunctions::renderGuiList('virtuemart_category_id', '#__virtuemart_product_categories', 'virtuemart_product_id', $product->virtuemart_product_id, 'category_name', '#__virtuemart_categories', 'virtuemart_category_id', 'category');
             }
             $mf_model = VmModel::getModel('manufacturer');
             $manufacturers = $mf_model->getManufacturerDropdown();
             $this->assignRef('manufacturers', $manufacturers);
             /* add Search filter in lists*/
             /* Search type */
             $options = array('' => JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), 'parent' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_PARENT_PRODUCT'), 'product' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRODUCT'), 'price' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRICE'), 'withoutprice' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_WITHOUTPRICE'));
             $this->lists['search_type'] = VmHTML::selectList('search_type', JRequest::getVar('search_type'), $options);
             /* Search order */
             $options = array('bf' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_BEFORE'), 'af' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_AFTER'));
             $this->lists['search_order'] = VmHTML::selectList('search_order', JRequest::getVar('search_order'), $options);
             // Toolbar
             JToolBarHelper::save('sentproductemailtoshoppers', JText::_('COM_VIRTUEMART_PRODUCT_EMAILTOSHOPPERS'));
             JToolBarHelper::custom('createchild', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_CHILD'), true);
             JToolBarHelper::custom('cloneproduct', 'copy', 'copy', JText::_('COM_VIRTUEMART_PRODUCT_CLONE'), true);
             JToolBarHelper::custom('addrating', 'default', '', JText::_('COM_VIRTUEMART_ADD_RATING'), true);
             $this->addStandardDefaultViewCommands();
             $this->assignRef('productlist', $productlist);
             $this->assignRef('virtuemart_category_id', $categoryId);
             $this->assignRef('model', $model);
             break;
     }
     parent::display($tpl);
 }
Example #8
0
 public function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $pathway = $mainframe->getPathway();
     $task = JRequest::getWord('task', 'list');
     $layoutName = JRequest::getWord('layout', 'list');
     $this->setLayout($layoutName);
     $_currentUser = JFactory::getUser();
     $document = JFactory::getDocument();
     if (!empty($tpl)) {
         $format = $tpl;
     } else {
         $format = JRequest::getWord('format', 'html');
     }
     $this->assignRef('format', $format);
     if ($format == 'pdf') {
         $document->setTitle(JText::_('COM_VIRTUEMART_INVOICE'));
         //PDF needs more RAM than usual
         VmConfig::ensureMemoryLimit(96);
     } else {
         if ($layoutName == 'details') {
             $document->setTitle(JText::_('COM_VIRTUEMART_ACC_ORDER_INFO'));
             $pathway->additem(JText::_('COM_VIRTUEMART_ACC_ORDER_INFO'));
         } else {
             $document->setTitle(JText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'));
             $pathway->additem(JText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'));
         }
     }
     $orderModel = VmModel::getModel('orders');
     if ($layoutName == 'details') {
         $order_list_link = FALSE;
         $order_list_link = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=list', FALSE);
         $this->assignRef('order_list_link', $order_list_link);
         $orderDetails = $orderModel->getMyOrderDetails();
         if (!$orderDetails or empty($orderDetails['details'])) {
             echo JText::_('COM_VIRTUEMART_ORDER_NOTFOUND');
             return;
         }
         $userFieldsModel = VmModel::getModel('userfields');
         $_userFields = $userFieldsModel->getUserFields('account', array('captcha' => true, 'delimiters' => true), array('delimiter_userinfo', 'user_is_vendor', 'username', 'password', 'password2', 'agreed', 'address_type'));
         $orderbt = $orderDetails['details']['BT'];
         $orderst = array_key_exists('ST', $orderDetails['details']) ? $orderDetails['details']['ST'] : $orderbt;
         $userfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderbt);
         $_userFields = $userFieldsModel->getUserFields('shipment', array(), array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type'));
         $shipmentfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderst);
         $shipment_name = '';
         if (!class_exists('vmPSPlugin')) {
             require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
         }
         JPluginHelper::importPlugin('vmshipment');
         $dispatcher = JDispatcher::getInstance();
         $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_shipmentmethod_id, &$shipment_name));
         $payment_name = '';
         if (!class_exists('vmPSPlugin')) {
             require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
         }
         JPluginHelper::importPlugin('vmpayment');
         $dispatcher = JDispatcher::getInstance();
         $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_paymentmethod_id, &$payment_name));
         if ($format == 'pdf') {
             $invoiceNumberDate = array();
             $return = $orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate);
             if (empty($invoiceNumberDate)) {
                 $invoiceNumberDate[0] = 'no invoice number accessible';
                 $invoiceNumberDate[1] = 'no invoice date accessible';
             }
             $this->assignRef('invoiceNumber', $invoiceNumberDate[0]);
             $this->assignRef('invoiceDate', $invoiceNumberDate[1]);
         }
         $this->assignRef('userfields', $userfields);
         $this->assignRef('shipmentfields', $shipmentfields);
         $this->assignRef('shipment_name', $shipment_name);
         $this->assignRef('payment_name', $payment_name);
         $this->assignRef('orderdetails', $orderDetails);
         if ($_currentUser->guest) {
             $details_url = juri::root() . 'index.php?option=com_virtuemart&view=orders&layout=details&tmpl=component&order_pass='******'order_pass', false) . '&order_number=' . JRequest::getString('order_number', false);
         } else {
             $details_url = juri::root() . 'index.php?option=com_virtuemart&view=orders&layout=details&tmpl=component&virtuemart_order_id=' . $this->orderdetails['details']['BT']->virtuemart_order_id;
         }
         $this->assignRef('details_url', $details_url);
         $tmpl = JRequest::getWord('tmpl');
         $print = false;
         if ($tmpl) {
             $print = true;
         }
         $this->prepareVendor();
         $this->assignRef('print', $print);
         $vendorId = 1;
         $emailCurrencyId = $orderDetails['details']['BT']->user_currency_id;
         $exchangeRate = FALSE;
         if (!class_exists('vmPSPlugin')) {
             require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
         }
         JPluginHelper::importPlugin('vmpayment');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('plgVmgetEmailCurrency', array($orderDetails['details']['BT']->virtuemart_paymentmethod_id, $orderDetails['details']['BT']->virtuemart_order_id, &$emailCurrencyId));
         if (!class_exists('CurrencyDisplay')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
         }
         $currency = CurrencyDisplay::getInstance($emailCurrencyId, $vendorId);
         if ($emailCurrencyId) {
             vmdebug('exchangerate', $orderDetails['details']['BT']->user_currency_rate);
             $currency->exchangeRateShopper = $orderDetails['details']['BT']->user_currency_rate;
         }
         $this->assignRef('currency', $currency);
         // Implement the Joomla panels. If we need a ShipTo tab, make it the active one.
         // In tmpl/edit.php, this is the 4th tab (0-based, so set to 3 above)
         // jimport('joomla.html.pane');
         // $pane = JPane::getInstance((__VM_ORDER_USE_SLIDERS?'Sliders':'Tabs'));
         // $this->assignRef('pane', $pane);
     } else {
         // 'list' -. default
         $useSSL = VmConfig::get('useSSL', 0);
         $useXHTML = true;
         $this->assignRef('useSSL', $useSSL);
         $this->assignRef('useXHTML', $useXHTML);
         if ($_currentUser->get('id') == 0) {
             // getOrdersList() returns all orders when no userID is set (admin function),
             // so explicetly define an empty array when not logged in.
             $orderList = array();
         } else {
             $orderList = $orderModel->getOrdersList($_currentUser->get('id'), TRUE);
             foreach ($orderList as $order) {
                 $vendorId = 1;
                 $emailCurrencyId = $order->user_currency_id;
                 $exchangeRate = FALSE;
                 if (!class_exists('vmPSPlugin')) {
                     require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
                 }
                 JPluginHelper::importPlugin('vmpayment');
                 $dispatcher = JDispatcher::getInstance();
                 $dispatcher->trigger('plgVmgetEmailCurrency', array($order->virtuemart_paymentmethod_id, $order->virtuemart_order_id, &$emailCurrencyId));
                 if (!class_exists('CurrencyDisplay')) {
                     require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
                 }
                 $currency = CurrencyDisplay::getInstance($emailCurrencyId, $vendorId);
                 $this->assignRef('currency', $currency);
                 if ($emailCurrencyId) {
                     vmdebug('exchangerate', $order->user_currency_rate);
                     $currency->exchangeRateShopper = $order->user_currency_rate;
                 }
                 $order->currency = $currency;
             }
         }
         $this->assignRef('orderlist', $orderList);
     }
     /*
     		if (!class_exists('CurrencyDisplay')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'currencydisplay.php');
     
     		$currency = CurrencyDisplay::getInstance();
     		$this->assignRef('currency', $currency);
     */
     $orderStatusModel = VmModel::getModel('orderstatus');
     $_orderstatuses = $orderStatusModel->getOrderStatusList();
     $orderstatuses = array();
     foreach ($_orderstatuses as $_ordstat) {
         $orderstatuses[$_ordstat->order_status_code] = JText::_($_ordstat->order_status_name);
     }
     $this->assignRef('orderstatuses', $orderstatuses);
     if (!class_exists('ShopFunctions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
     }
     $document = JFactory::getDocument();
     $document->setMetaData('robots', 'NOINDEX, NOFOLLOW, NOARCHIVE, NOSNIPPET');
     // this is no setting in BE to change the layout !
     //shopFunctionsF::setVmTemplate($this,0,0,$layoutName);
     parent::display($tpl);
 }
Example #9
0
* @license 			GNU General Public License version 2 or later; see _LICENSE.php
**/
// No Direct Access
defined('_JEXEC') or die;
// -- Initialize
require_once dirname(__FILE__) . DS . 'config.php';
$cck = CCK_Rendering::getInstance($this->template);
if ($cck->initialize() === false) {
    return;
}
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$doc->addStyleSheet(juri::base(TRUE) . "/templates/seblod_slider_nivo/css/default.css");
$doc->addStyleSheet(juri::base(TRUE) . "/templates/seblod_slider_nivo/css/nivo-slider.css");
$doc->addScript(juri::base(TRUE) . "/templates/seblod_slider_nivo/js/jquery-1.7.1.min.js");
$doc->addScript(juri::base(TRUE) . "/templates/seblod_slider_nivo/js/jquery.nivo.slider.pack.js");
// -- Render
?>

	<div class="slider-wrapper theme-default">
      <div class="ribbon"></div>
      <div id="slider" class="nivoSlider">
			<?php 
$items = $cck->getItems();
$captionCount = 1;
foreach ($items as $item) {
    $img = $item->getThumb1('art_image_fulltext');
    $imgAlt = $item->getValue('art_title');
    $captionId = "#caption" . $captionCount;
    echo '<img src="' . $img . '" alt="' . $imgAlt . '" title="' . $captionId . '"/>';
    $captionCount++;
* @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: product_edit.php 6347 2012-08-14 15:49:02Z Milbo $
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
AdminUIHelper::startAdminArea();
$document = JFactory::getDocument();
vmJsApi::JvalideForm();
$this->editor = JFactory::getEditor();
?>
<form method="post" name="adminForm" action="<?php 
echo juri::current();
?>
" enctype="multipart/form-data" id="adminForm">

<?php 
// Loading Templates in Tabs
$tabarray = array();
$tabarray['information'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_INFO_LBL';
$tabarray['description'] = 'COM_VIRTUEMART_PRODUCT_FORM_DESCRIPTION';
if (VmConfig::get('show_product_statut_tab', 1)) {
    $tabarray['status'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_STATUS_LBL';
}
if (VmConfig::get('show_product_dim_weight_tab', 1)) {
    $tabarray['dimensions'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL';
}
$tabarray['images'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_IMAGES_LBL';
Example #11
0
        $print_link .= '<span class="hasTip print_32" title="' . tsmText::_('com_tsmart_PRINT') . '">&nbsp;</span></a>';
        $invoice_link = '';
        $deliverynote_link = '';
        $pdfDummi = '&d=' . rand(0, 100);
        if (!$order->invoiceNumber) {
            $invoice_url = juri::root() . 'index.php?option=com_tsmart&view=invoice&layout=invoice&format=pdf&tsmart_order_id=' . $order->tsmart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'&create_invoice=' . $order->order_create_invoice_pass . $pdfDummi;
            $invoice_link .= "<a href=\"{$invoice_url}\"  >" . '<span class="hasTip invoicenew_32" title="' . tsmText::_('com_tsmart_INVOICE_CREATE') . '"></span></a>';
        } elseif (!shopFunctions::InvoiceNumberReserved($order->invoiceNumber)) {
            $invoice_url = juri::root() . 'index.php?option=com_tsmart&view=invoice&layout=invoice&format=pdf&tsmart_order_id=' . $order->tsmart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'<span class="hasTip invoice_32" title="' . tsmText::_('com_tsmart_INVOICE') . '"></span></a>';
        }
        if (!$order->invoiceNumber) {
            $deliverynote_url = juri::root() . 'index.php?option=com_tsmart&view=invoice&layout=deliverynote&format=pdf&tsmart_order_id=' . $order->tsmart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'&create_invoice=' . $order->order_create_invoice_pass . $pdfDummi;
            $deliverynote_link = "<a href=\"{$deliverynote_url}\"  >" . '<span class="hasTip deliverynotenew_32" title="' . tsmText::_('com_tsmart_DELIVERYNOTE_CREATE') . '"></span></a>';
        } elseif (!shopFunctions::InvoiceNumberReserved($order->invoiceNumber)) {
            $deliverynote_url = juri::root() . 'index.php?option=com_tsmart&view=invoice&layout=deliverynote&format=pdf&tsmart_order_id=' . $order->tsmart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'<span class="hasTip deliverynote_32" title="' . tsmText::_('com_tsmart_DELIVERYNOTE') . '"></span></a>';
        }
        ?>
				<td><?php 
        echo $print_link;
        echo $deliverynote_link;
        echo $invoice_link;
        ?>
</td>
				<!-- Order date -->
				<td><?php 
        echo vmJsApi::date($order->created_on, 'LC2', TRUE);
        ?>
</td>
				<!-- Last modified -->
Example #12
0
 function createPrintLinks($order, &$print_link, &$deliverynote_link, &$invoice_link)
 {
     /* Print view URL */
     $print_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'{$print_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\"  >";
     $print_link .= '<span class="hasTip print_32" title="' . vmText::_('COM_VIRTUEMART_PRINT') . '">&nbsp;</span></a>';
     $invoice_link = '';
     $deliverynote_link = '';
     $pdfDummi = '&d=' . rand(0, 100);
     if (!$order->invoiceNumber) {
         $invoice_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'&create_invoice=' . $order->order_create_invoice_pass . $pdfDummi;
         $invoice_link .= "<a href=\"{$invoice_url}\"  >" . '<span class="hasTip invoicenew_32" title="' . vmText::_('COM_VIRTUEMART_INVOICE_CREATE') . '"></span></a>';
     } elseif (!shopFunctions::InvoiceNumberReserved($order->invoiceNumber)) {
         $invoice_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'<span class="hasTip invoice_32" title="' . vmText::_('COM_VIRTUEMART_INVOICE') . '"></span></a>';
     }
     if (!$order->invoiceNumber) {
         $deliverynote_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=deliverynote&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'&create_invoice=' . $order->order_create_invoice_pass . $pdfDummi;
         $deliverynote_link = "<a href=\"{$deliverynote_url}\"  >" . '<span class="hasTip deliverynotenew_32" title="' . vmText::_('COM_VIRTUEMART_DELIVERYNOTE_CREATE') . '"></span></a>';
     } elseif (!shopFunctions::InvoiceNumberReserved($order->invoiceNumber)) {
         $deliverynote_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=deliverynote&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'<span class="hasTip deliverynote_32" title="' . vmText::_('COM_VIRTUEMART_DELIVERYNOTE') . '"></span></a>';
     }
 }
Example #13
0
    ?>
		</div>
		<?php 
    echo $this->vendor->vendor_legal_info;
    ?>
		</body>
		<?php 
} else {
    ?>
	<h1><?php 
    echo JText::_('COM_VIRTUEMART_ACC_ORDER_INFO');
    ?>

	<?php 
    /* Print view URL */
    $details_url = juri::root() . 'index.php?option=com_virtuemart&view=orders&layout=details&tmpl=component&virtuemart_order_id=' . $this->orderdetails['details']['BT']->virtuemart_order_id;
    $details_link = "<a href=\"javascript:void window.open('{$details_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\"  >";
    //$details_link .= '<span class="hasTip print_32" title="' . JText::_('COM_VIRTUEMART_PRINT') . '">&nbsp;</span></a>';
    $button = JVM_VERSION == 1 ? '/images/M_images/printButton.png' : 'system/printButton.png';
    $details_link .= JHtml::_('image', $button, JText::_('COM_VIRTUEMART_PRINT'), NULL, true);
    $details_link .= '</a>';
    echo $details_link;
    ?>
</h1>
<?php 
    if ($this->order_list_link) {
        ?>
	<div class='spaceStyle'>
	    <div class="floatright">
		<a href="<?php 
        echo $this->order_list_link;
Example #14
0
 /**
  * 
  * get component url - site side
  * 
  */
 public static function getUrlComponent($args, $component = "")
 {
     if (empty($component)) {
         $component = self::$componentName;
     }
     $url = juri::root() . "index.php?option=" . $component . "&" . $args;
     return $url;
 }
Example #15
0
    ?>
		</div>
		<?php 
    echo $this->vendor->vendor_legal_info;
    ?>
		</body>
		<?php 
} else {
    ?>
	<h1><?php 
    echo JText::_('COM_VIRTUEMART_ACC_ORDER_INFO');
    ?>

	<?php 
    /* Print view URL */
    $details_url = juri::root() . 'index.php?option=com_virtuemart&view=orders&layout=details&tmpl=component&virtuemart_order_id=' . $this->orderdetails['details']['BT']->virtuemart_order_id . '&order_pass='******'order_pass', false) . '&order_number=' . JRequest::getString('order_number', false);
    $details_link = "<a href=\"javascript:void window.open('{$details_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\"  >";
    //$details_link .= '<span class="hasTip print_32" title="' . JText::_('COM_VIRTUEMART_PRINT') . '">&nbsp;</span></a>';
    $button = JVM_VERSION == 1 ? '/images/M_images/printButton.png' : 'system/printButton.png';
    $details_link .= JHtml::_('image', $button, JText::_('COM_VIRTUEMART_PRINT'), NULL, true);
    $details_link .= '</a>';
    echo $details_link;
    ?>
</h1>
<?php 
    if ($this->order_list_link) {
        ?>
	<div class='spaceStyle'>
	    <div class="floatright">
		<a href="<?php 
        echo $this->order_list_link;
    private function fullPaths($data)
    {
        $this->Creator .= ' ' . $this->jdoc->engineName;
        $header = $footer = '';
        if (!strpos($data, 'html>')) {
            $full = juri::root();
            $short = juri::root(true) . '/';
            $langTag = JFactory::getLanguage()->getTag();
            // missing header create it
            $header = '
			<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $langTag . '" lang="' . $langTag . '" dir="' . $this->directionality . '">
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
				<title>' . $this->Title . '</title>
				<meta name="title" content="' . $this->Title . '" />
				<meta name="generator" content="' . $this->Creator . '" />
				<meta name="description" content="' . $this->Subject . '" />
				<meta name="keywords" content="' . $this->Keywords . '" />';
            // add scripts
            foreach ($this->jdoc->_scripts as $src => $script) {
                if ($src[1] === "/") {
                    $src = str_replace($short, $full, $src);
                }
                $header . '<script src="' . $src . '" type="' . $script['mime'] . '"></script>';
            }
            // add css
            foreach ($this->jdoc->_styleSheets as $src => $css) {
                if ($src[1] === "/") {
                    $src = str_replace($short, $full, $src);
                }
                $header . '<link rel="stylesheet"  href="' . $src . '" type="' . $css['mime'] . '">';
            }
            $header .= '</head>';
            $footer = '</html>';
            //public 'HTMLHeader' => string '<h1>Amazon Kindle Fire HD 8,9</h1>' (length=34)
            if (!strpos($data, 'body>')) {
                // add renderengine class to body
                $header .= '<body class="' . $this->jdoc->engineName . '">';
                $footer = '</body>' . $footer;
            }
        }
        // var_dump($this);jexit();
        if (!empty($this->HTMLHeader)) {
            $logo_height = $this->jdoc->params->get('logo_height', 48);
            $header .= '
		  <style>
			#HTMLHeader { position: fixed; padding-left:' . $this->jdoc->_margin_left . 'mm; padding-right:' . $this->jdoc->_margin_right . 'mm; padding-top:' . $this->jdoc->_margin_header . 'mm; left: 0px; top: 0px; right: 0px; height: 30px; text-align: right;}
			#HTMLHeader h1{margin:0px}
			#HTMLHeader img{ position: fixed; padding-left:' . $this->jdoc->_margin_left . 'mm; padding-right:' . $this->jdoc->_margin_right . 'mm; padding-top:' . $this->jdoc->_margin_header . 'mm; left: 0px; top: 0px; right: 0px; height: ' . $logo_height . 'px;}
		  </style>
		  ';
            $header .= '<div id="HTMLHeader">' . $this->HTMLHeader . '</div>';
        }
        if (!empty($this->HTMLfooter)) {
            //@page { margin: 180px 50px; }
            $header .= '<div id="HTMLfooter">' . $this->HTMLfooter . '</div>';
        } else {
            $siteUrl = JURI::getInstance()->toString();
            $siteUrl = str_replace("format=pdf", "", $siteUrl);
            $app = JFactory::getApplication();
            $title = $app->getCfg('sitename') . ' - ' . $this->Title;
            $date =& JFactory::getDate();
            $jDate = JHTML::_('date', $date, JText::_('DATE_FORMAT_LC3'));
            $header .= '
			  <style>
				#HTMLfooter,#HTMLDate { position: fixed; padding-left:' . $this->jdoc->_margin_left . 'mm; padding-right:' . $this->jdoc->_margin_right . 'mm; padding-top:' . $this->jdoc->_margin_footer . 'mm;  bottom: -10px; height: 40px; text-align: left;}
			  </style>
			  ';
            $header .= '<div id="HTMLfooter" style="left:' . $this->jdoc->_margin_left . 'mm"><p class="wkhtmltopdf" ><a href="' . $siteUrl . '">' . $title . '</a></p></div><div id="HTMLDate" style="right:' . $this->jdoc->_margin_right . 'mm">' . $jDate . '</div>';
        }
        // $options= array();
        // $option['header-right']= '""Page [page] of [toPage]""';
        // $option['footer-right']= '""[date]""';
        // $option[1]= 'grayscale';
        // $this->setOptions($option);
        // $break = '<div class="page-breaker"></div>';
        $data = $header . $data . $footer;
        // make absolute links
        $full = '"' . juri::root();
        $short = '"' . juri::root(true) . '/';
        // echo $full.' '.$short; jexit();
        $data = str_replace($short, $full, $data);
        $full = "'" . juri::root();
        $short = "'" . juri::root(true) . '/';
        $data = str_replace($short, $full, $data);
        return $data;
    }
Example #17
0
					<a class="ask-a-question modal" rel="{handler: 'iframe', size: {x: 700, y: 550}}" href="<?php 
echo $url;
?>
"><?php 
echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL');
?>
</a>
				</div>

				<?php 
// Manufacturer of the Product
if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
    ?>
				<div class="manufacturer">
				<?php 
    $link = JRoute::_(juri::root() . 'index.php?option=com_virtuemart&view=manufacturer&virtuemart_manufacturer_id=' . $this->product->virtuemart_manufacturer_id . '&tmpl=component');
    $text = $this->product->mf_name;
    /* Avoid JavaScript on PDF Output */
    if (strtolower(JRequest::getWord('output')) == "pdf") {
        echo JHTML::_('link', $link, $text);
    } else {
        ?>
						<span class="bold"><?php 
        echo JText::_('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL');
        ?>
</span><a class="modal" href="<?php 
        echo $link;
        ?>
"><?php 
        echo $text;
        ?>
    function addStandardEditViewCommands($id = 0, $save2new = true)
    {
        // if (JRequest::getCmd('tmpl') =='component' ) {
        // if (!class_exists('JToolBarHelper')) require(JPATH_ADMINISTRATOR.DS.'includes'.DS.'toolbarhelper.php');
        // } else {
        // 		JRequest::setVar('hidemainmenu', true);
        $view = $this->getName();
        JToolBarHelper::divider();
        if (ShopFunctions::can('add', $view)) {
            if ($id) {
                JToolBarHelper::save2copy('save2copy', 'JTOOLBAR_SAVE_AS_COPY');
            }
            if ($save2new) {
                JToolbarHelper::save2new('save2new', 'JTOOLBAR_SAVE_AND_NEW');
            }
        }
        JToolBarHelper::save();
        JToolBarHelper::apply();
        JToolBarHelper::cancel();
        // todo add filter by view
        if ($id) {
            JToolBarHelper::custom('preview', 'eye', null, 'COM_VIRTUEMART_PREVIEW', false);
        }
        // }
        // javascript for cookies setting in case of press "APPLY"
        $document = JFactory::getDocument();
        if ($view == 'product') {
            $view = 'productdetails';
        }
        $j = "\n\t\t\tJoomla.submitbutton=function(a){\n\t\t\t\tvar options = { path: '/', expires: 2},\n\t\t\t\t\tlink = '';\n\t\t\t\tif (a == 'preview') {\n\t\t\t\t\tlink='" . juri::root() . "index.php?option=com_virtuemart&view=" . $view . "&" . $this->_cidName . "=" . $id . "';\n\t\t\t\t\twindow.location = link;\n\t\t\t\t\t// console.log(link);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (a == 'apply') {\n\t\t\t\t\tjQuery('#searchMedia-div ul').remove();\n\t\t\t\t\tvar idx = jQuery('#adminForm ul li.active').index();\n\t\t\t\t\tjQuery.cookie('vmapply', idx, options);\n\t\t\t\t} else {\n\t\t\t\t\tjQuery.cookie('vmapply', '0', options);\n\t\t\t\t}\n\t\t\t\tjQuery( '#media-dialog' ).remove();\n\t\t\t\tJoomla.submitform(a);\n\t\t\t};\n\t\t";
        $document->addScriptDeclaration($j);
        // LANGUAGE setting
        $editView = JRequest::getWord('view', '');
        $params = JComponentHelper::getParams('com_languages');
        //$config =JFactory::getConfig();$config->get('language');
        $selectedLangue = $params->get('site', 'en-GB');
        $lang = JFactory::getLanguage();
        if ($this->frontEdit) {
            $selectedLangue = $lang->getTag();
        }
        $lang = strtolower(strtr($selectedLangue, '-', '_'));
        // only add if ID and view not null
        if ($id && count(vmconfig::get('active_languages')) > 1) {
            if ($view == 'user') {
                $view = 'vendor';
            }
            //$params = JComponentHelper::getParams('com_languages');
            jimport('joomla.language.helper');
            $this->lang = JRequest::getVar('vmlang', $lang);
            $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('JPATH_SITE'), true);
            $activeVmLangs = vmconfig::get('active_languages');
            foreach ($languages as $k => &$joomlaLang) {
                if (!in_array($joomlaLang['value'], $activeVmLangs)) {
                    unset($languages[$k]);
                }
            }
            $this->langList = JHTML::_('select.genericlist', $languages, 'vmlang', 'class="inputbox"', 'value', 'text', $selectedLangue, 'vmlang');
            $token = JSession::getFormToken();
            $j = '
			jQuery(function($) {
				var oldflag = "";
				$("select#vmlang").chosen().change(function() {
					langCode = $(this).val();
					flagClass = "flag-"+langCode.substr(0,2) ;
					$.getJSON( "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $id . '&editView=' . $editView . '&' . $token . '=1' . $this->tmpl . '" ,
						function(data) {
							var items = [];

							if (data.fields !== "error" ) {
								if (data.structure == "empty") alert(data.msg);
								$.each(data.fields , function(key, val) {
									cible = jQuery("#"+key);
									if (oldflag !== "") cible.parent().removeClass(oldflag)
									if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) {
										if (tinyMCE.execInstanceCommand) tinyMCE.execInstanceCommand(key,"mceSetContent",false,val);
										else tinymce.editors[key].setContent(val);
									}
									else if (data.structure !== "empty") cible.val(val);
									});
								oldflag = flagClass ;
							} else alert(data.msg);
						}
					)
				});
			})';
            $document->addScriptDeclaration($j);
        } else {
            // $params = JComponentHelper::getParams('com_languages');
            // $lang = $params->get('site', 'en-GB');
            $jlang = JFactory::getLanguage();
            $langs = $jlang->getKnownLanguages();
            $defautName = $langs[$selectedLangue]['name'];
            $flagImg = JURI::root(true) . '/administrator/components/com_virtuemart/assets/images/flag/' . substr($lang, 0, 2) . '.png';
            $this->langList = '<input name ="vmlang" type="hidden" value="' . $selectedLangue . '" ><img style="vertical-align: middle;" alt="' . $defautName . '" src="' . $flagImg . '"> <b> ' . $defautName . '</b>';
            $this->lang = $lang;
        }
        //I absolutly do not understand for that should be for, note by Max
        /*		if ($object) {
        		   if(Vmconfig::get('multix','none')!=='none'){
        				$this->loadHelper('permissions');
        				if(!Permissions::getInstance()->check('admin')) {
        					if (!$object->virtuemart_vendor_id) {
        						if(!class_exists('VirtueMartModelVendor')) require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'vendor.php');
        						$object->virtuemart_vendor_id = VirtueMartModelVendor::getLoggedVendor();
        					}
        					$vendorList = '<input type="hidden" name="virtuemart_vendor_id" value="'.$object->virtuemart_vendor_id.'" />';
        				} else 	$vendorList= ShopFunctions::renderVendorList($object->virtuemart_vendor_id,false);
        		   } else {
        				$vendorList = '<input type="hidden" name="virtuemart_vendor_id" value="1" />';
        		   }
        		   $this->assignRef('vendorList', $vendorList);
        		}*/
    }
    /**
     * parse relative images a hrefs and style sheets to full paths
     * add stylesheet if not set
     * add missing header,body ... tags, if needed
     * @param       string  &$data
     */
    private function fullPaths($data)
    {
        $header = $footer = $style = '';
        $full = juri::root();
        $short = juri::root(true) . '/';
        $this->add_info('Title', $this->Title);
        $this->add_info('Creator', $this->Creator);
        $this->add_info('Author', $this->Author);
        $this->add_info('Subject', $this->Subject);
        $this->add_info('Keywords', $this->Keywords);
        // add css
        if (empty($this->jdoc->_styleSheets)) {
            // default styling, if not set
            if (isset($this->jdoc->header_logo)) {
                $file = $this->jdoc->header_logo;
                if (file_exists($file)) {
                    $finfo = finfo_open(FILEINFO_MIME_TYPE);
                    $mime = finfo_file($finfo, $file);
                    if ($mime === "image/gif" || $mime === "image/jpeg") {
                        $this->header_logo = $file;
                    }
                } else {
                    $this->header_logo = '';
                }
            }
            $logo_height = $this->jdoc->params->get('logo_height', 48);
            $style .= '
			 <style>
				@page { margin: 0px 0px; padding: 0px 0px; }
				.pdf-header { position: fixed; padding-left:' . $this->jdoc->_margin_left . 'mm; padding-right:' . $this->jdoc->_margin_right . 'mm; padding-top:' . $this->jdoc->_margin_header . 'mm; left: 0px; top: 0px; right: 0px; height: 30px; text-align: right;}
				.pdf-header h1{margin:0px}
				.pdf-headerr img{ position: fixed; padding-left:' . $this->jdoc->_margin_left . 'mm; padding-right:' . $this->jdoc->_margin_right . 'mm; padding-top:' . $this->jdoc->_margin_header . 'mm; left: 0px; top: 0px; right: 0px; height: ' . $logo_height . 'px;}
				.pdf-footer { position: fixed; padding-left:' . $this->jdoc->_margin_left . 'mm; padding-right:' . $this->jdoc->_margin_right . 'mm; padding-top:' . $this->jdoc->_margin_footer . 'mm;  bottom: -10px; height: 40px; text-align: left;}
				#pageCounter{  position: fixed; padding-right:25px; bottom: -10px; height: 40px;  text-align: right; }
				#pageCounter span:after { content: counter(page); }
			</style>
			';
        } else {
            foreach ($this->jdoc->_styleSheets as $src => $css) {
                if ($src[1] === "/") {
                    $src = str_replace($short, $full, $src);
                }
                $this->_css->load_css_file($src);
                // $header.'<link rel="stylesheet"  href="'.$src.'" type="'.$css['mime'].'">';
            }
        }
        if (!strpos($data, 'html>')) {
            // var_dump($this); jexit();
            $langTag = JFactory::getLanguage()->getTag();
            // missing header create it
            $header = '
			<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $langTag . '" lang="' . $langTag . '" dir="' . $this->directionality . '">
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
				<title>' . $this->Title . '</title>
				<meta name="title" content="' . $this->Title . '" />
				<meta name="generator" content="' . $this->Creator . '" />
				<meta name="author" content="' . $this->Author . '" />
				<meta name="description" content="' . $this->Subject . '" />
				<meta name="keywords" content="' . $this->Keywords . '" />';
            // add scripts
            foreach ($this->jdoc->_scripts as $src => $script) {
                if ($src[1] === "/") {
                    $src = str_replace($short, $full, $src);
                }
                $header . '<script src="' . $src . '" type="' . $script['mime'] . '"></script>';
            }
            $header .= '</head>';
            $footer = '</html>';
            if (!strpos($data, 'body>')) {
                $header .= '<body class="' . $this->jdoc->engineName . '">';
                $footer = '</body>' . $footer;
            }
        }
        // var_dump($this);jexit();
        if (!empty($this->HTMLHeader)) {
            $logo_height = $this->jdoc->params->get('logo_height', 48);
            if (empty($this->jdoc->_styleSheets)) {
            }
            $header .= '<div class="pdf-header">' . $this->HTMLHeader . '</div>';
        }
        // echo($data) ;jexit();
        if (!empty($this->HTMLfooter)) {
            //@page { margin: 180px 50px; }
            $header .= '<div class="pdf-footer">' . $this->HTMLfooter . '</div>';
        } else {
            $siteUrl = JURI::getInstance()->toString();
            $siteUrl = str_replace("&format=pdf", "", $siteUrl);
            $siteUrl = str_replace("?format=pdf", "", $siteUrl);
            $app = JFactory::getApplication();
            $title = $app->getCfg('sitename') . ' - ' . $this->Title;
            $header .= '<div class="pdf-footer"><div class="page"><a href="' . $siteUrl . '">' . $title . '</div></div><div id="pageCounter"><span class="number">Page </span></div>';
        }
        $data = $header . $style . $data . $footer;
        // make absolute links
        $full = '"' . juri::root();
        $short = '"' . juri::root(true) . '/';
        $data = str_replace($short, $full, $data);
        $full = "'" . juri::root();
        $short = "'" . juri::root(true) . '/';
        $data = str_replace($short, $full, $data);
        return $data;
    }
Example #20
0
 function display($tpl = null)
 {
     // Get the task
     $task = JRequest::getWord('task', $this->getLayout());
     $this->assignRef('task', $task);
     // Load helpers
     if (!class_exists('CurrencyDisplay')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     if (!class_exists('VmImage')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
     }
     $model = VmModel::getModel();
     // Handle any publish/unpublish
     switch ($task) {
         case 'add':
         case 'edit':
             //this was in the controller for the edit tasks, we need this for the access by FE
             $this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'product' . DS . 'tmpl');
             VmConfig::loadJLang('com_virtuemart_orders', TRUE);
             VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
             $virtuemart_product_id = JRequest::getVar('virtuemart_product_id', array());
             if (is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0) {
                 $virtuemart_product_id = (int) $virtuemart_product_id[0];
             } else {
                 $virtuemart_product_id = (int) $virtuemart_product_id;
             }
             $product = $model->getProductSingle($virtuemart_product_id, false);
             //$product_parent= $model->getProductParent($product->product_parent_id);
             $product_parent = false;
             if (!empty($product->product_parent_id)) {
                 $product_parent = $model->getProductSingle($product->product_parent_id, false);
             }
             $mf_model = VmModel::getModel('manufacturer');
             $manufacturers = $mf_model->getManufacturerDropdown($product->virtuemart_manufacturer_id);
             $this->assignRef('manufacturers', $manufacturers);
             // Get the category tree
             if (isset($product->categories)) {
                 $category_tree = ShopFunctions::categoryListTree($product->categories);
             } else {
                 $category_tree = ShopFunctions::categoryListTree();
             }
             $this->assignRef('category_tree', $category_tree);
             //Fallback for categories inherited by parent to correctly calculate the prices
             if (empty($product->categories) and !empty($product_parent->categories)) {
                 $product->categories = $product_parent->categories;
             }
             //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility
             if (isset($product->shoppergroups)) {
                 $shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups);
             }
             $this->assignRef('shoppergroupList', $shoppergroupList);
             // Load the product price
             if (!class_exists('calculationHelper')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
             }
             $product_childIds = $model->getProductChildIds($virtuemart_product_id);
             $product_childs = array();
             $childs = 0;
             $maxChilds = 30;
             foreach ($product_childIds as $id) {
                 if ($childs++ > $maxChilds) {
                     break;
                 }
                 $product_childs[] = $model->getProductSingle($id, false);
             }
             $this->assignRef('product_childs', $product_childs);
             if (!class_exists('VirtueMartModelConfig')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'config.php';
             }
             $productLayouts = VirtueMartModelConfig::getLayoutList('productdetails');
             $this->assignRef('productLayouts', $productLayouts);
             // Load Images
             $model->addImages($product);
             if (!class_exists('shopFunctionsF')) {
                 require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
             }
             $vmtemplate = shopFunctionsF::loadVmTemplateStyle();
             if (is_Dir(JPATH_ROOT . DS . 'templates' . DS . $vmtemplate . DS . 'images' . DS . 'availability' . DS)) {
                 $imagePath = '/templates/' . $vmtemplate . '/images/availability/';
             } else {
                 $imagePath = '/components/com_virtuemart/assets/images/availability/';
             }
             $this->assignRef('imagePath', $imagePath);
             // Load the vendors
             $vendor_model = VmModel::getModel('vendor');
             if (Vmconfig::get('multix', 'none') !== 'none') {
                 $lists['vendors'] = Shopfunctions::renderVendorList($product->virtuemart_vendor_id);
             }
             // Load the currencies
             $currency_model = VmModel::getModel('currency');
             if (!class_exists('Permissions')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
             }
             $vendor_model->setId(Permissions::getInstance()->isSuperVendor());
             $vendor = $vendor_model->getVendor();
             if (empty($product->product_currency)) {
                 $product->product_currency = $vendor->vendor_currency;
             }
             //$currencies = JHTML::_('select.genericlist', $currency_model->getCurrencies(), 'product_currency', '', 'virtuemart_currency_id', 'currency_name', $product->product_currency);
             $currency = $currency_model->getCurrency($product->product_currency);
             $this->assignRef('product_currency', $currency->currency_symbol);
             $currency = $currency_model->getCurrency($vendor->vendor_currency);
             $this->assignRef('vendor_currency', $currency->currency_symbol);
             if (count($manufacturers) > 0) {
                 $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox"', 'value', 'text', $product->virtuemart_manufacturer_id);
             }
             if (!empty($product->product_weight_uom)) {
                 $product_weight_uom = $product->product_weight_uom;
             } else {
                 if (!empty($product_parent)) {
                     $product_weight_uom = $product_parent->product_weight_uom;
                 } else {
                     $product_weight_uom = VmConfig::get('weight_unit_default');
                 }
             }
             if (!empty($product->product_lwh_uom)) {
                 $product_lwh_uom = $product->product_lwh_uom;
             } else {
                 if (!empty($product_parent)) {
                     $product_lwh_uom = $product_parent->product_lwh_uom;
                 } else {
                     $product_lwh_uom = VmConfig::get('lwh_unit_default');
                 }
             }
             if (!empty($product->product_unit)) {
                 $product_unit = $product->product_unit;
             } else {
                 if (!empty($product_parent)) {
                     $product_unit = $product_parent->product_unit;
                 } else {
                     $product_unit = VmConfig::get('product_unit_default', 'KG');
                 }
             }
             $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', $product_weight_uom);
             $lists['product_iso_uom'] = ShopFunctions::renderUnitIsoList('product_unit', $product_unit);
             $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', $product_lwh_uom);
             if (empty($product->product_available_date)) {
                 $product->product_available_date = date("Y-m-d");
             }
             $waitinglistmodel = VmModel::getModel('waitinglist');
             /* Load waiting list */
             if ($product->virtuemart_product_id) {
                 //$waitinglist = $this->get('waitingusers', 'waitinglist');
                 $waitinglist = $waitinglistmodel->getWaitingusers($product->virtuemart_product_id);
                 $this->assignRef('waitinglist', $waitinglist);
             }
             $productShoppers = $model->getProductShoppersByStatus($product->virtuemart_product_id, array('S'));
             $this->assignRef('productShoppers', $productShoppers);
             $orderstatusModel = VmModel::getModel('orderstatus');
             $lists['OrderStatus'] = $orderstatusModel->renderOSList(array(), 'order_status', TRUE);
             $field_model = VmModel::getModel('customfields');
             $fieldTypes = $field_model->getField_types();
             $this->assignRef('fieldTypes', $fieldTypes);
             // Add the virtuemart_shoppergroup_ids
             $cid = JFactory::getUser()->id;
             $this->activeShoppergroups = shopfunctions::renderGuiList('virtuemart_shoppergroup_id', '#__virtuemart_vmuser_shoppergroups', 'virtuemart_user_id', $cid, 'shopper_group_name', '#__virtuemart_shoppergroups', 'virtuemart_shoppergroup_id', 'category', 4, 0);
             if (!$this->activeShoppergroups or is_array($this->activeShoppergroups) and count($this->activeShoppergroups) == 0) {
                 //vmdebug('$this->activeShoppergroups',$this->activeShoppergroups);
                 $shoppergroupModel = VmModel::getModel('shoppergroup');
                 $this->activeShoppergroups = vmText::_($shoppergroupModel->getDefault(0)->shopper_group_name);
             }
             /* Load protocustom lists */
             $customsList = $field_model->getCustomsList();
             $attribs = 'style= "width: 300px;"';
             $customlist = JHTML::_('select.genericlist', $customsList, 'customlist', $attribs);
             $this->assignRef('customsList', $customlist);
             $ChildCustomRelation = $field_model->getProductChildCustomRelation();
             $this->assignRef('ChildCustomRelation', $ChildCustomRelation);
             if ($product->product_parent_id > 0) {
                 $parentRelation = $field_model->getProductParentRelation($product->virtuemart_product_id);
                 $this->assignRef('parentRelation', $parentRelation);
                 // Set up labels
                 $info_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_INFO_LBL');
                 $status_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_STATUS_LBL');
                 $dim_weight_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_DIM_WEIGHT_LBL');
                 $images_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_IMAGES_LBL');
                 $delete_message = JText::_('COM_VIRTUEMART_PRODUCT_FORM_DELETE_ITEM_MSG');
             } else {
                 if ($task == 'add') {
                     $action = JText::_('COM_VIRTUEMART_PRODUCT_FORM_NEW_PRODUCT_LBL');
                 } else {
                     $action = JText::_('COM_VIRTUEMART_PRODUCT_FORM_UPDATE_ITEM_LBL');
                 }
                 $info_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_INFO_LBL');
                 $status_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_STATUS_LBL');
                 $dim_weight_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL');
                 $images_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_IMAGES_LBL');
                 $delete_message = JText::_('COM_VIRTUEMART_PRODUCT_FORM_DELETE_PRODUCT_MSG');
             }
             $this->assignRef('product', $product);
             $product_empty_price = array('virtuemart_product_price_id' => 0, 'virtuemart_product_id' => $virtuemart_product_id, 'virtuemart_shoppergroup_id' => NULL, 'product_price' => NULL, 'override' => NULL, 'product_override_price' => NULL, 'product_tax_id' => NULL, 'product_discount_id' => NULL, 'product_currency' => $vendor->vendor_currency, 'product_price_publish_up' => NULL, 'product_price_publish_down' => NULL, 'price_quantity_start' => NULL, 'price_quantity_end' => NULL);
             $this->assignRef('product_empty_price', $product_empty_price);
             $this->assignRef('product_parent', $product_parent);
             /* Assign label values */
             $this->assignRef('action', $action);
             $this->assignRef('info_label', $info_label);
             $this->assignRef('status_label', $status_label);
             $this->assignRef('dim_weight_label', $dim_weight_label);
             $this->assignRef('images_label', $images_label);
             $this->assignRef('delete_message', $delete_message);
             $this->assignRef('lists', $lists);
             // Toolbar
             if ($product->product_sku) {
                 $sku = ' (' . $product->product_sku . ')';
             } else {
                 $sku = "";
             }
             if (!empty($product->canonCatLink)) {
                 $canonLink = '&virtuemart_category_id=' . $product->canonCatLink;
             } else {
                 $canonLink = '';
             }
             if (!empty($product->virtuemart_product_id)) {
                 if (!class_exists('shopFunctionsF')) {
                     require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
                 }
                 $menuItemID = shopFunctionsF::getMenuItemId(JFactory::getLanguage()->getTag());
                 $text = '<a href="' . juri::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . $canonLink . '&Itemid=' . $menuItemID . '" target="_blank" >' . $product->product_name . $sku . '<span class="vm2-modallink"></span></a>';
             } else {
                 $text = $product->product_name . $sku;
             }
             $this->SetViewTitle('PRODUCT', $text);
             $this->addStandardEditViewCommands($product->virtuemart_product_id);
             break;
         case 'massxref_cats':
         case 'massxref_cats_exe':
             $this->SetViewTitle('PRODUCT_MASSXREF');
             if (!class_exists('Permissions')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
             }
             $showVendors = Permissions::getInstance()->check('admin');
             $this->assignRef('showVendors', $showVendors);
             $keyWord = '';
             $catmodel = VmModel::getModel('category');
             $this->assignRef('catmodel', $catmodel);
             //$this->addStandardDefaultViewCommands();
             $this->addStandardDefaultViewLists($catmodel, 'category_name');
             $categories = $catmodel->getCategoryTree(0, 0, false, $this->lists['search']);
             $this->assignRef('categories', $categories);
             $catpagination = $catmodel->getPagination();
             $this->assignRef('catpagination', $catpagination);
             //$this->addStandardDefaultViewCommands();
             $this->setLayout('massxref');
             JToolBarHelper::custom('massxref_cats_exe', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_CAT_EXE'), false);
             break;
         case 'massxref_sgrps':
         case 'massxref_sgrps_exe':
             $sgrpmodel = VmModel::getModel('shoppergroup');
             $this->addStandardDefaultViewLists($sgrpmodel);
             $shoppergroups = $sgrpmodel->getShopperGroups(false, true);
             $this->assignRef('shoppergroups', $shoppergroups);
             $sgrppagination = $sgrpmodel->getPagination();
             $this->assignRef('sgrppagination', $sgrppagination);
             $this->setLayout('massxref');
             JToolBarHelper::custom('massxref_sgrps_exe', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_SGRPS_EXE'), false);
             break;
         default:
             if ($product_parent_id = JRequest::getInt('product_parent_id', false)) {
                 $product_parent = $model->getProductSingle($product_parent_id, false);
                 if ($product_parent) {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $link_to_parent = JHTML::_('link', JRoute::_('index.php?view=product&task=edit&virtuemart_product_id=' . $product_parent->virtuemart_product_id . '&option=com_virtuemart'), $product_parent->product_name, array('title' => JText::_('COM_VIRTUEMART_EDIT_PARENT') . ' ' . $product_parent->product_name));
                     $msg = JText::_('COM_VIRTUEMART_PRODUCT_OF') . " " . $link_to_parent;
                 } else {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $msg = 'Parent with product_parent_id ' . $product_parent_id . ' not found';
                 }
             } else {
                 $title = 'PRODUCT';
                 $msg = "";
             }
             $this->db = JFactory::getDBO();
             $this->SetViewTitle($title, $msg);
             $this->addStandardDefaultViewLists($model, 'created_on');
             /* Get the list of products */
             $productlist = $model->getProductListing(false, false, false, false, true);
             //The pagination must now always set AFTER the model load the listing
             $pagination = $model->getPagination();
             $this->assignRef('pagination', $pagination);
             /* Get the category tree */
             $categoryId = $model->virtuemart_category_id;
             //OSP switched to filter in model, was JRequest::getInt('virtuemart_category_id');
             $category_tree = ShopFunctions::categoryListTree(array($categoryId));
             $this->assignRef('category_tree', $category_tree);
             /* Load the product price */
             if (!class_exists('calculationHelper')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
             }
             $vendor_model = VmModel::getModel('vendor');
             $productreviews = VmModel::getModel('ratings');
             foreach ($productlist as $virtuemart_product_id => $product) {
                 $product->mediaitems = count($product->virtuemart_media_id);
                 $product->reviews = $productreviews->countReviewsForProduct($product->virtuemart_product_id);
                 $vendor_model->setId($product->virtuemart_vendor_id);
                 $vendor = $vendor_model->getVendor();
                 $currencyDisplay = CurrencyDisplay::getInstance($vendor->vendor_currency, $vendor->virtuemart_vendor_id);
                 if (!empty($product->product_price) && !empty($product->product_currency)) {
                     $product->product_price_display = $currencyDisplay->priceDisplay($product->product_price, (int) $product->product_currency, 1, true);
                 }
                 /* Write the first 5 categories in the list */
                 $product->categoriesList = shopfunctions::renderGuiList('virtuemart_category_id', '#__virtuemart_product_categories', 'virtuemart_product_id', $product->virtuemart_product_id, 'category_name', '#__virtuemart_categories', 'virtuemart_category_id', 'category');
             }
             $mf_model = VmModel::getModel('manufacturer');
             $manufacturers = $mf_model->getManufacturerDropdown();
             $this->assignRef('manufacturers', $manufacturers);
             /* add Search filter in lists*/
             /* Search type */
             $options = array('' => JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), 'parent' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_PARENT_PRODUCT'), 'product' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRODUCT'), 'price' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRICE'), 'withoutprice' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_WITHOUTPRICE'));
             $this->lists['search_type'] = VmHTML::selectList('search_type', JRequest::getVar('search_type'), $options);
             /* Search order */
             $options = array('bf' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_BEFORE'), 'af' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_AFTER'));
             $this->lists['search_order'] = VmHTML::selectList('search_order', JRequest::getVar('search_order'), $options);
             // Toolbar
             JToolBarHelper::custom('massxref_cats', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_CAT'), true);
             JToolBarHelper::custom('massxref_sgrps', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_SGRPS'), true);
             JToolBarHelper::custom('createchild', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_CHILD'), true);
             JToolBarHelper::custom('cloneproduct', 'copy', 'copy', JText::_('COM_VIRTUEMART_PRODUCT_CLONE'), true);
             JToolBarHelper::custom('addrating', 'default', '', JText::_('COM_VIRTUEMART_ADD_RATING'), true);
             $this->addStandardDefaultViewCommands();
             $this->assignRef('productlist', $productlist);
             $this->assignRef('virtuemart_category_id', $categoryId);
             $this->assignRef('model', $model);
             break;
     }
     parent::display($tpl);
 }
Example #21
0
 /**
  * Something went wrong, Send notification to all administrators
  *
  * @param string subject of the mail
  * @param string message
  */
 protected function sendEmailToVendorAndAdmins($subject = NULL, $message = NULL)
 {
     // recipient is vendor and admin
     $vendorId = 1;
     $vendorModel = VmModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($vendorId);
     $vendorEmail = $vendorModel->getVendorEmail($vendorId);
     $vendorName = $vendorModel->getVendorName($vendorId);
     VmConfig::loadJLang('com_virtuemart');
     if ($subject == NULL) {
         $subject = JText::sprintf('COM_VIRTUEMART_ERROR_SUBJECT', $this->_name, $vendor->vendor_store_name);
     }
     if ($message == NULL) {
         $link = juri::root() . 'administrator/index.php?option=com_virtuemart&view=log&task=edit&logfile=' . $this->getLogFilename() . VmConfig::LOGFILEEXT;
         //$logFileLink='<a href="'.$link.'">'.$this->getLogFilename().VmConfig::LOGFILEEXT.'</a>';
         $message = JText::sprintf('COM_VIRTUEMART_ERROR_BODY', $subject, $link);
     }
     JUtility::sendMail($vendorEmail, $vendorName, $vendorEmail, $subject, $message);
     if (JVM_VERSION === 1) {
         //get all super administrator
         $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE LOWER( usertype ) = "super administrator"';
     } else {
         $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE sendEmail=1';
     }
     $db = JFactory::getDBO();
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $subject = html_entity_decode($subject, ENT_QUOTES);
     // get superadministrators id
     foreach ($rows as $row) {
         if ($row->sendEmail) {
             $message = html_entity_decode($message, ENT_QUOTES);
             JUtility::sendMail($vendorEmail, $vendorName, $row->email, $subject, $message);
         }
     }
 }
Example #22
0
    function loadScriptAndCss()
    {
        $assetsPath = VMKLARNAPLUGINWEBROOT . '/klarna/assets/';
        JHTML::stylesheet('style.css', $assetsPath . 'css/', false);
        JHTML::stylesheet('klarna.css', $assetsPath . 'css/', false);
        JHTML::script('klarna_general.js', $assetsPath . 'js/', false);
        JHTML::script('klarnaConsentNew.js', 'http://static.klarna.com/external/js/', false);
        $document = JFactory::getDocument();
        $document->addScriptDeclaration('
		 klarna.ajaxPath = "' . juri::root() . '/index.php?option=com_virtuemart&view=plugin&vmtype=vmpayment&name=klarna";
	');
    }
 private function fullPaths($src)
 {
     $full = juri::root();
     $short = juri::root(true) . '/';
     $src = str_replace('"' . $short, '"' . $full, $src);
     return str_replace("'" . $short, "'" . $full, $src);
 }
Example #24
0
			<tr>
				<td class="key"><strong><?php 
    echo vmText::_('COM_VIRTUEMART_COUPON_CODE');
    ?>
</strong></td>
				<td><?php 
    echo $this->orderbt->coupon_code;
    ?>
</td>
			</tr>
			<?php 
}
?>
			<?php 
if ($this->orderbt->invoiceNumber and !shopFunctionsF::InvoiceNumberReserved($this->orderbt->invoiceNumber)) {
    $invoice_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=' . $this->orderbt->virtuemart_order_id . '&order_number=' . $this->orderbt->order_number . '&order_pass='******'COM_VIRTUEMART_INVOICE_PRINT') . "\"  href=\"javascript:void window.open('{$invoice_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\"  >";
    $invoice_link .= $this->orderbt->invoiceNumber . '</a>';
    ?>
			<tr>
				<td class="key"><strong><?php 
    echo vmText::_('COM_VIRTUEMART_INVOICE');
    ?>
</strong></td>
				<td><?php 
    echo $invoice_link;
    ?>
</td>
			</tr>
			<?php 
}
 function content_url()
 {
     $urlContent = juri::root() . "images/";
     return $urlContent;
 }
 /**
  * Render the pdf.
  *
  * @param   string  $name     The file name of the pdf to render
  * @param   array   $params   Array of values
  * @param   string  $content  Override the output of the renderer
  *
  * @return  string  The output of the script
  *
  * @see JDocumentRenderer::render()
  * @since   11.1
  */
 public function render($name = '', $destination = 'I', $content = null)
 {
     // $app = JFactory::getApplication();
     // html debug output
     if (JRequest::getInt('print', null) == 2) {
         return $content;
     }
     $content = str_replace('<hr class="page-break">', '', $content);
     $full = '"' . juri::root();
     $short = '"' . juri::root(true) . '/';
     foreach ($this->jdoc->_styleSheets as $src => $css) {
         if ($src[1] === "/") {
             $src = str_replace($short, $full, $src);
         }
         $stylesheet = file_get_contents($src);
         $this->WriteHTML($stylesheet, 1);
         // The parameter 1 tells that this is css/style only and no body/html/text
     }
     $footer = '';
     if (empty($this->HTMLHeader['html'])) {
         if (!empty($this->jdoc->header_title)) {
             $title = $this->jdoc->header_title;
         } else {
             $title = $this->jdoc->title;
         }
         $this->SetHTMLHeader('<div class="pdf-header"><span class="right"><h3>' . $title . '</h3></span></div>');
     }
     if (!empty($this->HTMLfooter)) {
         //@page { margin: 180px 50px; }
         $htmlFooter .= $this->HTMLfooter;
     } else {
         $siteUrl = JURI::getInstance()->toString();
         $siteUrl = str_replace("&format=pdf", "", $siteUrl);
         $siteUrl = str_replace("?format=pdf", "", $siteUrl);
         $app = JFactory::getApplication();
         $title = $app->getCfg('sitename') . ' - ' . $this->title;
         $htmlFooter .= '<p class="page"><a href="' . $siteUrl . '">' . $title . '</a></p>';
         //.'<div>'{PAGENO}/{nb}.'</div>'
         // jexit($htmlFooter);
     }
     $footer .= '<table width="100%" style="background:none"><tr><td width="66%">';
     $footer .= $htmlFooter;
     $PAGE_CURRENT_OF_TOTAL = JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', '{PAGENO}', '{nbpg}');
     $footer .= '</td><td width="33%" style="text-align: right;">' . $PAGE_CURRENT_OF_TOTAL . '</td></tr></table>';
     $this->setHTMLFooter($footer);
     $content = '<div class="pdf-body">' . $content . '</div>';
     // echo '<div class="pdf-body">'.$content.'</div >'; jexit();
     $this->WriteHTML($content);
     if ($destination === "F") {
         $this->Output($name, $destination);
         return $name;
     } else {
         return $this->Output($name, $destination);
     }
     // render base 64
     // $content = $this->Output('', 'S');
     // $content = chunk_split(base64_encode($content));
 }
Example #27
0
    $listObj->newRow();
    // The row number
    $listObj->addCell($pageNav->getRowOffset($i));
    // The Checkbox
    $html_o = '<input type="checkbox" id="cb' . $i . '" name="order_id[]" value="' . $item->order_id . '" onclick="isChecked(this.checked);">';
    $listObj->addCell($html_o);
    //$url = $_SERVER['PHP_SELF']."?option=com_onepage&amp;view=order_detailspage=$modulename.order_print&amp;limitstart=$limitstart&amp;keyword=".urlencode($keyword)."&amp;order_id=". $db->f("order_id");
    $order_id = $item->order_id;
    $url = 'index.php?option=com_onepage&amp;view=order_details&amp;order_id=' . $order_id;
    $tmp_cell = '<a href="' . $url . '">' . sprintf("%08d", $order_id) . '<br />' . $item->order_number . "</a><br />";
    $listObj->addCell($tmp_cell);
    $tmp_cell = $item->first_name . ' ' . $item->last_name;
    $url = $_SERVER['PHP_SELF'] . "?page=admin.user_form&amp;user_id=" . $item->user_id;
    $tmp_cell = '<a href="' . $url . '">' . $tmp_cell . '</a>';
    $listObj->addCell($tmp_cell);
    $print_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&tmpl=component&virtuemart_order_id=' . $item->order_id . '&order_number=' . $item->order_number . '&order_pass='******'{$print_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\"  >";
    $print_link .= '<span  class="hasTip print_32" title="' . JText::_('COM_VIRTUEMART_PRINT') . '">&nbsp;</span>';
    $print_link .= '</a>';
    $listObj->addCell($print_link);
    // Creation Date
    $listObj->addCell($item->created_on);
    // Last Modified Date
    $listObj->addCell($item->modified_on);
    $order_id = $item->order_id;
    // Order Status Drop Down List
    $html = '
	 <select name="order_status_' . $order_id . '"  style="width: 150px;" class="vm-chzn-select" onchange="document.adminForm.changed_' . $order_id . '.value=\'1\';" >';
    foreach ($this->statuses as $k => $s) {
        $html .= '<option ';
        if ($s['order_status_code'] == $item->order_status) {