Esempio n. 1
0
 /**
  * This function does not allow unicode, replacement for JPath::clean
  * and makesafe
  * @param      $string
  * @param bool $forceNoUni
  * @return mixed|string
  */
 static function filterPath($str)
 {
     if (empty($str)) {
         vmError('filterPath empty string check your paths ');
         vmTrace('Critical error, empty string in filterPath');
         return VMPATH_ROOT;
     }
     $str = trim($str);
     // Delete all '?'
     $str = str_replace('?', '', $str);
     // Replace double byte whitespaces by single byte (East Asian languages)
     $str = preg_replace('/\\xE3\\x80\\x80/', ' ', $str);
     $unicodeslugs = tsmConfig::get('transliterateSlugs', false);
     if ($unicodeslugs) {
         $lang = JFactory::getLanguage();
         $str = $lang->transliterate($str);
     }
     //This is a path, so remove all strange slashes
     $str = str_replace('/', DS, $str);
     //Clean from possible injection
     while (strpos($str, '..') !== false) {
         $str = str_replace('..', '', $str);
     }
     $str = preg_replace('#[/\\\\]+#', DS, $str);
     $str = filter_var($str, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
     return $str;
 }
Esempio n. 2
0
 function __construct()
 {
     parent::__construct();
     if (tsmConfig::get('shop_is_offline') == '1') {
         vRequest::setVar('layout', 'off_line');
     } else {
         vRequest::setVar('layout', 'default');
     }
 }
Esempio n. 3
0
 /**
  * Send the ask question email.
  * @author Kohl Patrick, Christopher Roussel
  */
 public function mailAskquestion()
 {
     vRequest::vmCheckToken();
     if (!class_exists('shopFunctionsF')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $model = tmsModel::getModel('vendor');
     $mainframe = JFactory::getApplication();
     $vars = array();
     $min = tsmConfig::get('asks_minimum_comment_length', 50) + 1;
     $max = tsmConfig::get('asks_maximum_comment_length', 2000) - 1;
     $commentSize = vRequest::getString('comment');
     if (function_exists('mb_strlen')) {
         $commentSize = mb_strlen($commentSize);
     } else {
         $commentSize = strlen($commentSize);
     }
     $validMail = filter_var(vRequest::getVar('email'), FILTER_VALIDATE_EMAIL);
     $virtuemart_vendor_id = vRequest::getInt('virtuemart_vendor_id', 1);
     if (!class_exists('VirtueMartModelVendor')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
     }
     $userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id);
     //$vendorUser = JFactory::getUser($userId);
     if ($commentSize < $min || $commentSize > $max || !$validMail) {
         $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&view=vendor&task=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE), tsmText::_('COM_VIRTUEMART_COMMENT_NOT_VALID_JS'));
         return;
     }
     $user = JFactory::getUser();
     $fromMail = vRequest::getVar('email');
     //is sanitized then
     $fromName = vRequest::getVar('name', '');
     //is sanitized then
     $fromMail = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromMail);
     $fromName = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromName);
     if (!empty($user->id)) {
         if (empty($fromMail)) {
             $fromMail = $user->email;
         }
         if (empty($fromName)) {
             $fromName = $user->name;
         }
     }
     $vars['user'] = array('name' => $fromName, 'email' => $fromMail);
     $VendorEmail = $model->getVendorEmail($virtuemart_vendor_id);
     $vars['vendor'] = array('vendor_store_name' => $fromName);
     if (shopFunctionsF::renderMail('vendor', $VendorEmail, $vars, 'vendor')) {
         $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
     } else {
         $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
     }
     $mainframe->enqueueMessage(tsmText::_($string));
     // Display it all
     $view = $this->getView('vendor', 'html');
     $view->setLayout('mail_confirmed');
     $view->display();
 }
Esempio n. 4
0
 /**
  * constructs a VmModel
  * setMainTable defines the maintable of the model
  *
  * @author Max Milbers
  */
 function __construct()
 {
     parent::__construct();
     //Todo multivendor nasty hack, to get vendor with id 1
     if (tsmConfig::get('multix', 'none') == 'none') {
         $this->setId(1);
     }
     $this->setMainTable('vendors');
 }
Esempio n. 5
0
 function renderMailLayout($doVendor, $recipient)
 {
     $tpl = tsmConfig::get('order_mail_html') ? 'mail_html_notify' : 'mail_raw_notify';
     $this->doVendor = $doVendor;
     $this->fromPdf = false;
     $this->uselayout = $tpl;
     $this->subject = !empty($this->subject) ? $this->subject : tsmText::_('COM_VIRTUEMART_CART_NOTIFY_MAIL_SUBJECT');
     $this->layoutName = $tpl;
     $this->setLayout($tpl);
     $this->isMail = true;
     $this->user = new stdClass();
     $this->user->name = $this->vendor->vendor_store_name;
     $this->user->email = $this->vendorEmail;
     parent::display();
 }
Esempio n. 6
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $mainframe = JFactory::getApplication();
     $pathway = $mainframe->getPathway();
     if (!class_exists('VmImage')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
     }
     $virtuemart_manufacturer_id = vRequest::getInt('virtuemart_manufacturer_id', 0);
     $mf_category_id = vRequest::getInt('mf_category_id', 0);
     // get necessary models
     $model = tmsModel::getModel('manufacturer');
     if ($virtuemart_manufacturer_id != 0) {
         $manufacturer = $model->getManufacturer();
         $model->addImages($manufacturer, 1);
         $manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"', false);
         if (tsmConfig::get('enable_content_plugin', 0)) {
             if (!class_exists('shopFunctionsF')) {
                 require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
             }
             shopFunctionsF::triggerContentPlugin($manufacturer, 'manufacturer', 'mf_desc');
         }
         $document->setTitle(tsmText::_('COM_VIRTUEMART_MANUFACTURER_DETAILS') . ' ' . strip_tags($manufacturer->mf_name));
         //added so that the canonical points to page with visible products thx to P2Peter
         // remove joomla canonical before adding it
         foreach ($document->_links as $k => $array) {
             if ($array['relation'] == 'canonical') {
                 unset($document->_links[$k]);
                 break;
             }
         }
         $document->addHeadLink(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' . $virtuemart_manufacturer_id, FALSE), 'canonical', 'rel', '');
         $this->assignRef('manufacturerImage', $manufacturerImage);
         $this->assignRef('manufacturer', $manufacturer);
         $pathway->addItem(strip_tags($manufacturer->mf_name));
         $this->setLayout('details');
     } else {
         $document->setTitle(tsmText::_('COM_VIRTUEMART_MANUFACTURER_PAGE'));
         $manufacturers = $model->getManufacturers(true, true, true);
         $model->addImages($manufacturers, 1);
         $this->assignRef('manufacturers', $manufacturers);
         $this->setLayout('default');
     }
     parent::display($tpl);
 }
Esempio n. 7
0
 function synchronizeMedia()
 {
     if (vmAccess::manager('media')) {
         $configPaths = array('assets_general_path', 'media_category_path', 'media_product_path', 'media_manufacturer_path', 'media_vendor_path');
         foreach ($configPaths as $path) {
             $this->renameFileExtension(VMPATH_ROOT . DS . tsmConfig::get($path));
         }
         if (!class_exists('Migrator')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'migrator.php';
         }
         $migrator = new Migrator();
         $result = $migrator->portMedia();
         $this->setRedirect($this->redirectPath, $result);
     } else {
         $msg = 'Forget IT';
         $this->setRedirect('index.php?option=com_tsmart', $msg);
     }
 }
Esempio n. 8
0
    function sendPostRequest()
    {
        $post_variables = $this->getPostVariables();
        $jump_url = $this->getJumpUrl();
        $html = '';
        if ($this->_method->debug) {
            $html .= '<form action="' . $jump_url . '" method="post" name="vm_realex_form" target="realex">';
        } else {
            if (tsmConfig::get('css')) {
                $msg = tsmText::_('VMPAYMENT_REALEX_HPP_API_REDIRECT_MESSAGE', true);
            } else {
                $msg = '';
            }
            vmJsApi::addJScript('vm.paymentFormAutoSubmit', '
  			jQuery(document).ready(function($){
   				jQuery("body").addClass("vmLoading");
  				var msg="' . $msg . '";
   				jQuery("body").append("<div class=\\"vmLoadingDiv\\"><div class=\\"vmLoadingDivMsg\\">"+msg+"</div></div>");
    			jQuery("#vmPaymentForm").submit();
			})
		');
            $html .= '<form action="' . $jump_url . '" method="post" name="vm_realex_form" id="vmPaymentForm" accept-charset="UTF-8">';
        }
        $html .= '<input type="hidden" name="charset" value="utf-8">';
        foreach ($post_variables as $name => $value) {
            $html .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
        }
        if ($this->_method->debug) {
            $html .= '<div style="background-color:red;color:white;padding:10px;">
						<input type="submit"  value="The method is in debug mode. Click here to be redirected to Realex" />
						</div>';
            $this->debugLog($post_variables, 'sendPostRequest:', 'debug');
        }
        $html .= '</form>';
        return $html;
    }
Esempio n. 9
0
	    <td class="key">
		<span class="hasTip" title="<?php echo vmText::_('com_tsmart_ADMIN_CFG_MAIL_FROM_RECIPIENT_EXPLAIN'); ?>">
		<label for="mail_from_recipient"><?php echo vmText::_('com_tsmart_ADMIN_CFG_MAIL_FROM_RECIPIENT') ?></span>
		    </span>
	    </td>
	    <td>
		    <?php echo VmHTML::checkbox('mail_from_recipient', VmConfig::get('mail_from_recipient',0)); ?>
	    </td>
    </tr>
    <tr>
	    <td class="key">
		<span class="hasTip" title="<?php echo vmText::_('com_tsmart_ADMIN_CFG_MAIL_FROM_SETSENDER_EXPLAIN'); ?>">
		<label for="mail_from_setsender"><?php echo vmText::_('com_tsmart_ADMIN_CFG_MAIL_FROM_SETSENDER') ?></span>
		    </span>
	    </td>
	    <td>
		    <?php echo VmHTML::checkbox('mail_from_setsender', VmConfig::get('mail_from_setsender',0)); ?>
	    </td>
    </tr --><?php */
$attrlist = 'class="inputbox" multiple="multiple" ';
echo VmHTML::row('genericlist', 'com_tsmart_ADMIN_CFG_STATUS_PDF_INVOICES', $this->osWoP_Options, 'inv_os[]', $attrlist, 'order_status_code', 'order_status_name', tsmConfig::get('inv_os', array('C')), 'inv_os', true);
echo VmHTML::row('genericlist', 'com_tsmart_CFG_OSTATUS_EMAILS_SHOPPER', $this->osWoP_Options, 'email_os_s[]', $attrlist, 'order_status_code', 'order_status_name', tsmConfig::get('email_os_s', array('U', 'C', 'S', 'R', 'X')), 'email_os_s', true);
echo VmHTML::row('genericlist', 'com_tsmart_CFG_OSTATUS_EMAILS_VENDOR', $this->os_Options, 'email_os_v[]', $attrlist, 'order_status_code', 'order_status_name', tsmConfig::get('email_os_v', array('U', 'C', 'R', 'X')), 'email_os_v', true);
echo VmHTML::row('input', 'com_tsmart_CFG_ATTACH', 'attach', tsmConfig::get('attach', ''));
echo VmHTML::row('genericlist', 'com_tsmart_CFG_ATTACH_OS', $this->osWoP_Options, 'attach_os[]', $attrlist, 'order_status_code', 'order_status_name', tsmConfig::get('attach_os', array('U', 'C', 'R', 'X')), 'attach_os', true);
?>
	</table>
</fieldset>


Esempio n. 10
0
 public static function loadJLang($fname, $type, $name)
 {
     $jlang = JFactory::getLanguage();
     $tag = $jlang->getTag();
     $path = $basePath = VMPATH_ROOT . DS . 'plugins' . DS . $type . DS . $name;
     if (tsmConfig::get('enableEnglish', true) and $tag != 'en-GB') {
         $testpath = $basePath . DS . 'language' . DS . 'en-GB' . DS . 'en-GB.' . $fname . '.ini';
         if (!file_exists($testpath)) {
             $epath = JPATH_ADMINISTRATOR;
         } else {
             $epath = $path;
         }
         $jlang->load($fname, $epath, 'en-GB');
     }
     $testpath = $basePath . DS . 'language' . DS . $tag . DS . $tag . '.' . $fname . '.ini';
     if (!file_exists($testpath)) {
         $path = JPATH_ADMINISTRATOR;
     }
     $jlang->load($fname, $path, $tag, true);
 }
Esempio n. 11
0
    ?>
			</td>
			<td align="center">
				<?php 
    if ($row->default != 0) {
        echo JHtml::_('image', 'menu/icon-16-default.png', tsmText::_('com_tsmart_SHOPPERGROUP_DEFAULT'), NULL, true);
    }
    ?>
			</td>
			<td align="center">
				<?php 
    echo $published;
    ?>
			</td>
			<?php 
    if (tsmConfig::get('multix', 'none') != 'none' && $this->showVendors) {
        ?>
			<td align="left">
				<?php 
        echo $row->tsmart_vendor_id;
        ?>
			</td>
			<?php 
    }
    ?>
			<td align="center">
				<?php 
    if ($row->sgrp_additional == 1) {
        echo JHtml::_('image', 'menu/icon-16-apply.png', tsmText::_('com_tsmart_SHOPPERGROUP_ADDITIONAL'), NULL, true);
    }
    ?>
Esempio n. 12
0
 /**
  * This is a general function to safely open a connection to a server,
  * post data when needed and read the result.
  * Tries using cURL and switches to fopen/fsockopen if cURL is not available
  * @since tsmart 1.1.0
  * @static
  * @param string $url
  * @param string $postData
  * @param array $headers
  * @param resource $fileToSaveData
  * @return mixed
  */
 static function handleCommunication($url, $postData = '', $headers = array(), $fileToSaveData = null)
 {
     $urlParts = parse_url($url);
     if (!isset($urlParts['port'])) {
         $urlParts['port'] = 80;
     }
     if (!isset($urlParts['scheme'])) {
         $urlParts['scheme'] = 'http';
     }
     if (isset($urlParts['query'])) {
         $urlParts['query'] = '?' . $urlParts['query'];
         if (isset($urlParts['path'])) {
             $urlParts['path'] = $urlParts['path'] . $urlParts['query'];
         }
     }
     $vm_proxy_url = tsmConfig::get('conf_VM_PROXY_URL', '');
     // Check proxy
     if (trim($vm_proxy_url) != '') {
         if (!stristr($vm_proxy_url, 'http')) {
             $proxyURL['host'] = $vm_proxy_url;
             $proxyURL['scheme'] = 'http';
         } else {
             $proxyURL = parse_url($vm_proxy_url);
         }
     } else {
         $proxyURL = '';
     }
     if (function_exists("curl_init") && function_exists('curl_exec')) {
         $CR = curl_init();
         curl_setopt($CR, CURLOPT_URL, $url);
         // just to get sure the script doesn't die
         curl_setopt($CR, CURLOPT_TIMEOUT, 30);
         if (!empty($headers)) {
             // Add additional headers if provided
             curl_setopt($CR, CURLOPT_HTTPHEADER, $headers);
         }
         curl_setopt($CR, CURLOPT_FAILONERROR, true);
         if ($postData) {
             curl_setopt($CR, CURLOPT_POSTFIELDS, $postData);
             curl_setopt($CR, CURLOPT_POST, 1);
         }
         if (is_resource($fileToSaveData)) {
             curl_setopt($CR, CURLOPT_FILE, $fileToSaveData);
         } else {
             curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1);
         }
         // Do we need to set up the proxy?
         if (!empty($proxyURL)) {
             //		$vmLogger->debug( 'Setting up proxy: '.$proxyURL['host'].':'.VM_PROXY_PORT );
             //curl_setopt($CR, CURLOPT_HTTPPROXYTUNNEL, true);
             curl_setopt($CR, CURLOPT_PROXY, $proxyURL['host']);
             curl_setopt($CR, CURLOPT_PROXYPORT, VM_PROXY_PORT);
             // Check if the proxy needs authentication
             if (trim(@VM_PROXY_USER) != '') {
                 //		    $vmLogger->debug( 'Using proxy authentication!' );
                 curl_setopt($CR, CURLOPT_PROXYUSERPWD, VM_PROXY_USER . ':' . VM_PROXY_PASS);
             }
         }
         if ($urlParts['scheme'] == 'https') {
             // No PEER certificate validation...as we don't have
             // a certificate file for it to authenticate the host www.ups.com against!
             curl_setopt($CR, CURLOPT_SSL_VERIFYPEER, 0);
         }
         $result = curl_exec($CR);
         $error = curl_error($CR);
         if (!empty($error) && stristr($error, '502') && !empty($proxyURL)) {
             //		$vmLogger->debug( 'Switching to NTLM authenticaton.');
             curl_setopt($CR, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
             $result = curl_exec($CR);
             $error = curl_error($CR);
         }
         curl_close($CR);
         if (!empty($error)) {
             //JError::raiseError(1, $error );
             return false;
         } else {
             return $result;
         }
     } else {
         if ($postData) {
             if (!empty($proxyURL)) {
                 // If we have something to post we need to write into a socket
                 if ($proxyURL['scheme'] == 'https') {
                     $protocol = 'ssl';
                 } else {
                     $protocol = 'http';
                 }
                 $fp = fsockopen("{$protocol}://" . $proxyURL['host'], VM_PROXY_PORT, $errno, $errstr, $timeout = 30);
             } else {
                 // If we have something to post we need to write into a socket
                 if ($urlParts['scheme'] == 'https') {
                     $protocol = 'ssl';
                 } else {
                     $protocol = $urlParts['scheme'];
                 }
                 $fp = fsockopen("{$protocol}://" . $urlParts['host'], $urlParts['port'], $errno, $errstr, $timeout = 30);
             }
         } else {
             if (!empty($proxyURL)) {
                 // Do a read-only fopen transaction
                 $fp = fopen($proxyURL['scheme'] . '://' . $proxyURL['host'] . ':' . VM_PROXY_PORT, 'rb');
             } else {
                 // Do a read-only fopen transaction
                 $fp = fopen($urlParts['scheme'] . '://' . $urlParts['host'] . ':' . $urlParts['port'] . $urlParts['path'], 'rb');
             }
         }
         if (!$fp) {
             //error tell us
             vmWarn('Possible server error! - ' . $errstr . '(' . $errno . ')\\n');
             return false;
         } else {
             vmdebug('Connection opened to ' . $urlParts['host']);
         }
         if ($postData) {
             //send the server request
             if (!empty($proxyURL)) {
                 fputs($fp, "POST " . $urlParts['host'] . ':' . $urlParts['port'] . $urlParts['path'] . " HTTP/1.0\r\n");
                 fputs($fp, "Host: " . $proxyURL['host'] . "\r\n");
                 if (trim(@VM_PROXY_USER) != '') {
                     fputs($fp, "Proxy-Authorization: Basic " . base64_encode(VM_PROXY_USER . ':' . VM_PROXY_PASS) . "\r\n\r\n");
                 }
             } else {
                 fputs($fp, 'POST ' . $urlParts['path'] . " HTTP/1.0\r\n");
                 fputs($fp, 'Host:' . $urlParts['host'] . "\r\n");
             }
             fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
             fputs($fp, "Content-length: " . strlen($postData) . "\r\n");
             fputs($fp, "Connection: close\r\n\r\n");
             fputs($fp, $postData . "\r\n\r\n");
         } else {
             if (!empty($proxyURL)) {
                 fputs($fp, "GET " . $urlParts['host'] . ':' . $urlParts['port'] . $urlParts['path'] . " HTTP/1.0\r\n");
                 fputs($fp, "Host: " . $proxyURL['host'] . "\r\n");
                 if (trim(@VM_PROXY_USER) != '') {
                     fputs($fp, "Proxy-Authorization: Basic " . base64_encode(VM_PROXY_USER . ':' . VM_PROXY_PASS) . "\r\n\r\n");
                 }
             } else {
                 //				JError::raiseNotice(1, 'Host:'. $urlParts['host'].' path: '. $urlParts['path'] );
                 fputs($fp, 'GET ' . $urlParts['path'] . " HTTP/1.0\r\n");
                 fputs($fp, 'Host:' . $urlParts['host'] . "\r\n");
             }
         }
         // Add additional headers if provided
         foreach ($headers as $header) {
             fputs($fp, $header . "\r\n");
         }
         $data = "";
         while (!feof($fp)) {
             $data .= @fgets($fp, 4096);
         }
         fclose($fp);
         // If didnt get content-length, something is wrong, return false.
         if (trim($data) == '') {
             vmWarn('An error occured while communicating with the server ' . $urlParts['host'] . '. It didn\'t reply (correctly). Please try again later, thank you.');
             return false;
         }
         $result = trim($data);
         if (is_resource($fileToSaveData)) {
             fwrite($fileToSaveData, $result);
             return true;
         } else {
             return $result;
         }
     }
 }
Esempio n. 13
0
    /**
     * @param $post_variables
     * @return string
     */
    function getConfirmedHtml($post_variables)
    {
        $pbxServer = $this->getPayboxServerUrl();
        // add spin image
        $html = '';
        if ($this->_method->debug) {
            $html .= '<form action="' . $pbxServer . '" method="post" name="vm_paybox_form" target="paybox">';
        } else {
            if (tsmConfig::get('css')) {
                $msg = tsmText::_('VMPAYMENT_PAYBOX_REDIRECT_MESSAGE', true);
            } else {
                $msg = '';
            }
            vmJsApi::addJScript('vm.paymentFormAutoSubmit', '
  			jQuery(document).ready(function($){
   				jQuery("body").addClass("vmLoading");
  				var msg="' . $msg . '";
   				jQuery("body").append("<div class=\\"vmLoadingDiv\\"><div class=\\"vmLoadingDivMsg\\">"+msg+"</div></div>");
    			jQuery("#vmPaymentForm").submit();
			})
		');
            $html .= '<form action="' . $pbxServer . '" method="post" name="vm_paybox_form" id="vmPaymentForm">';
        }
        foreach ($post_variables as $name => $value) {
            $html .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
        }
        if ($this->_method->debug) {
            $this->plugin->debugLog($this->_method->virtuemart_paymentmethod_id, 'sendPostRequest: payment method', 'debug');
            $this->plugin->debugLog($pbxServer, 'sendPostRequest: Server', 'debug');
            $html .= '<div style="background-color:red;color:white;padding:10px;">
						<input type="submit"  value="The method is in debug mode. Click here to be redirected to Paybox" />
						</div>';
            $this->plugin->debugLog($post_variables, 'sendPostRequest:', 'debug');
        } else {
            $html .= '<input type="submit"  value="' . tsmText::_('VMPAYMENT_PAYBOX_REDIRECT_MESSAGE') . '" />';
        }
        $html .= '</form>';
        return $html;
    }
Esempio n. 14
0
?>
		<?php 
echo $this->lists['readonly'];
?>
		<?php 
echo $this->lists['published'];
?>
		<?php 
echo VmHTML::row('input', 'com_tsmart_USERFIELDS_SIZE', 'size', $this->userField->size, 'class="inputbox"', '', 5);
?>
		<?php 
echo VmHTML::row('raw', 'com_tsmart_ORDERING', $this->ordering);
// VmHTML::row('input','com_tsmart_ORDERING','ordering',$this->userField->ordering,'class="inputbox"','',5);
?>
		<?php 
if (tsmConfig::get('multix', 'none') !== 'none') {
    echo VmHTML::row('raw', 'com_tsmart_VENDOR', $this->lists['vendors']);
}
?>
	</table>
	</fieldset>
</div>

<input type="hidden" name="tsmart_userfield_id" value="<?php 
echo $this->userField->tsmart_userfield_id;
?>
" />
<input type="hidden" name="valueCount" value="<?php 
echo $this->valueCount;
?>
" />
Esempio n. 15
0
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
echo '<a class="continue_link" href="' . $this->continue_link . '" >' . tsmText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
echo '<a class="showcart floatright" href="' . $this->cart_link . '">' . tsmText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';
if ($this->products) {
    foreach ($this->products as $product) {
        if ($product->quantity > 0) {
            echo '<h4>' . tsmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED', $product->product_name, $product->quantity) . '</h4>';
        } else {
            if (!empty($product->errorMsg)) {
                echo '<div>' . $product->errorMsg . '</div>';
            }
        }
    }
}
if (tsmConfig::get('popup_rel', 1)) {
    //VmConfig::$echoDebug=true;
    if ($this->products and is_array($this->products) and count($this->products) > 0) {
        $product = reset($this->products);
        $customFieldsModel = tmsModel::getModel('customfields');
        $product->customfields = $customFieldsModel->getCustomEmbeddedProductCustomFields($product->allIds, 'R');
        $customFieldsModel->displayProductCustomfieldFE($product, $product->customfields);
        if (!empty($product->customfields)) {
            ?>
			<div class="product-related-products">
			<h4><?php 
            echo tsmText::_('COM_VIRTUEMART_RELATED_PRODUCTS');
            ?>
</h4>
			<?php 
        }
Esempio n. 16
0
}
//Show VAT tax seperated
if (!empty($this->cart->cartData)) {
    if (!empty($this->cart->cartData['VatTax'])) {
        $c = count($this->cart->cartData['VatTax']);
        if (!tsmConfig::get('show_tax') or $c > 1) {
            if ($c > 0) {
                ?>
<tr class="sectiontableentry2">
				<td colspan="5" align="right"><?php 
                echo tsmText::_('COM_VIRTUEMART_TOTAL_INCL_TAX');
                ?>
</td>

				<?php 
                if (tsmConfig::get('show_tax')) {
                    ?>
					<td ></td>
				<?php 
                }
                ?>
				<td></td>
				</tr><?php 
            }
            foreach ($this->cart->cartData['VatTax'] as $vatTax) {
                if (!empty($vatTax['result'])) {
                    echo '<tr class="sectiontableentry' . $i . '">';
                    echo '<td colspan="4" align="right">' . shopFunctionsF::getTaxNameWithValue($vatTax['calc_name'], $vatTax['calc_value']) . '</td>';
                    echo '<td align="right"><span class="priceColor2">' . $this->currencyDisplay->createPriceDiv('taxAmount', '', $vatTax['result'], FALSE, false, 1.0, false, true) . '</span></td>';
                    echo '<td></td><td></td>';
                    echo '</tr>';
Esempio n. 17
0
    if (!class_exists($_class)) {
        require $basePath . DS . 'controllers' . DS . $_controller . '.php';
    }
} else {
    // try plugins
    JPluginHelper::importPlugin('vmextended');
    $dispatcher = JDispatcher::getInstance();
    $rets = $dispatcher->trigger($trigger, array($_controller));
    foreach ($rets as $ret) {
        if ($ret) {
            return true;
        }
    }
}
if (class_exists($_class)) {
    $controller = new $_class();
    $controller->execute($task);
    //vmTime($_class.' Finished task '.$task,'Start');
    vmRam('End');
    vmRamPeak('Peak');
    /* Redirect if set by the controller */
    $controller->redirect();
} else {
    vmDebug('VirtueMart controller not found: ' . $_class);
    if (tsmConfig::get('handle_404', 1)) {
        $mainframe = Jfactory::getApplication();
        $mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=tsmart', FALSE));
    } else {
        JError::raise(E_ERROR, '404', 'Not found');
    }
}
Esempio n. 18
0
    public function preparePost()
    {
        $post_variables = $this->initPostVariables($this->_method->payment_type);
        $paymentCurrency = CurrencyDisplay::getInstance($this->_method->payment_currency);
        $order_number_text = $this->getItemName(tsmText::_('COM_VIRTUEMART_ORDER_NUMBER'));
        switch ($this->_method->payment_type) {
            case '_xclick':
            case '_donations':
                $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number;
                $post_variables['amount'] = $this->total;
                break;
            case '_oe-gift-certificate':
                $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number;
                //$post_variables['amount'] = round ($paymentCurrency->convertCurrencyTo ($this->_method->payment_currency, $this->order['details']['BT']->order_total, FALSE), 2);;
                $post_variables['fixed_denom'] = vmPSPlugin::getAmountValueInCurrency($this->order['details']['BT']->order_salesPrice, $this->_method->payment_currency);
                //$post_variables['min_denom'] = $this->total;
                //$post_variables['max_denom'] = $this->total;
                $post_variables['shopping_url'] = JURI::root();
                $post_variables['buyer_name'] = $this->order['details']['BT']->first_name . ' ' . $this->order['details']['BT']->last_name;
                if (array_key_exists('ST', $this->order['details'])) {
                    $post_variables['recipient_name'] = $this->order['details']['ST']->first_name . ' ' . $this->order['details']['ST']->last_name;
                }
                break;
            case '_cart':
                $this->addPrices($post_variables);
                break;
            case '_xclick-subscriptions':
                $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number;
                if ($this->_method->subcription_trials) {
                    $post_variables['a1'] = $this->_method->trial1_price ? $this->_method->trial1_price : 0;
                    //Trial1 price.
                    $post_variables['p1'] = $this->getDurationValue($this->_method->trial1_duration);
                    $post_variables['t1'] = $this->getDurationUnit($this->_method->trial1_duration);
                }
                /*if ($this->_method->subcription_trials == 2) {
                			$post_variables['a2']		= ($this->_method->trial2_price) ? $this->_method->trial2_price : 0; //Trial2 price.
                			$post_variables['p2']       = $this->getDurationValue($this->_method->trial2_duration);
                			$post_variables['t2']       = $this->getDurationUnit($this->_method->trial2_duration);
                		}*/
                $post_variables['a3'] = $this->total;
                //Regular subscription price.
                $post_variables['p3'] = $this->getDurationValue($this->_method->subscription_duration);
                $post_variables['t3'] = $this->getDurationUnit($this->_method->subscription_duration);
                $post_variables['src'] = 1;
                //Recurring payments. Subscription payments recur unless subscribers cancel their subscriptions before the end of the current billing cycle or you limit the number of times that payments recur with the value that you specify for srt
                $post_variables['srt'] = $this->_method->subscription_term;
                //Recurring times. Number of times that subscription payments recur. Specify an integer with a minimum value of 1 and a maximum value of 52. Valid only if you specify src="1"
                $post_variables['sra'] = 1;
                //Reattempt on failure. If a recurring payment fails, PayPal attempts to collect the payment two more times before canceling the subscription.
                $post_variables['modify'] = 0;
                //Modification behavior. Allowable values are:
                //0 – allows subscribers only to sign up for new subscriptions,
                //1 – allows subscribers to sign up for new subscriptions and modify their current subscriptions
                //2 – allows subscribers to modify only their current subscriptions
                break;
            case '_xclick-auto-billing':
                $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number;
                //A description of the automatic billing plan.
                $post_variables['max_text'] = $this->_method->payment_desc;
                //Specify whether to let buyers enter maximum billing limits in a text box or choose from a list of maximum billing limits that you specify.
                //Allowable values are:
                //max_limit_own – your button displays a text box for buyers to enter their own maximums above a minimum billing limit that you set with the min_amount variable.
                //max_limit_defined – your button displays a dropdown menu of product options with prices to let buyers choose their maximum billing limits.
                $post_variables['set_customer_limit'] = 'max_limit_defined';
                //The minimum monthly billing limit, if you have one. Valid only if set_customer_limit = max_limit_own.
                //$post_variables['min_amount'] 	= 0;
                $post_variables['min_amount'] = $this->total;
                switch ($this->_method->billing_max_amount_type) {
                    case 'cust':
                        $post_variables["max_amount"] = vmPSPlugin::getAmountValueInCurrency($this->customerData->getVar('autobilling_max_amount'), $this->_method->payment_currency);
                        break;
                    case 'value':
                        $post_variables["max_amount"] = vmPSPlugin::getAmountValueInCurrency($this->_method->billing_max_amount, $this->_method->payment_currency);
                        break;
                    case 'perc':
                        $percentage = $this->_method->billing_max_amount;
                        $max_amount = $this->total * floatval($percentage) / 100 + $this->total;
                        $post_variables['max_amount'] = round($max_amount, 2);
                        break;
                    case 'cart':
                    default:
                        $post_variables['max_amount'] = $this->total;
                        break;
                }
                break;
            case '_xclick-payment-plan':
                $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number;
                $post_variables['disp_tot'] = 'Y';
                //Display the total payment amount to buyers during checkout
                $post_variables['option_index'] = 0;
                $post_variables['option_select0_type'] = 'E';
                //F – pay in full, at checkout, E – pay in equal periods, beginning at checkout or sometime later, V – pay in variable periods, beginning at checkout
                if ($this->_method->payment_plan_defer) {
                    $post_variables['option_select0_a0'] = '0.00';
                    $post_variables['option_select0_p0'] = $this->getDurationValue($this->_method->payment_plan_defer_duration);
                    $post_variables['option_select0_t0'] = $this->getDurationUnit($this->_method->payment_plan_defer_duration);
                    $post_variables['option_select0_n0'] = 1;
                    $post_variables['option_select0_a1'] = round($this->total / $this->_method->payment_plan_term, 2);
                    $post_variables['option_select0_p1'] = $this->getDurationValue($this->_method->payment_plan_duration);
                    $post_variables['option_select0_t1'] = $this->getDurationUnit($this->_method->payment_plan_duration);
                    $post_variables['option_select0_n1'] = $this->_method->payment_plan_term;
                } else {
                    $post_variables['option_select0_a0'] = round($this->total / $this->_method->payment_plan_term, 2);
                    $post_variables['option_select0_p0'] = $this->getDurationValue($this->_method->payment_plan_duration);
                    $post_variables['option_select0_t0'] = $this->getDurationUnit($this->_method->payment_plan_duration);
                    $post_variables['option_select0_n0'] = $this->_method->payment_plan_term;
                }
                $post_variables['os0'] = 'pay-in-' . $this->_method->payment_plan_term;
                $post_variables['option_select0'] = 'pay-in-' . $this->_method->payment_plan_term;
                $post_variables['option_select0_name'] = $this->_method->payment_name;
        }
        $url = $this->_getPayPalUrl();
        if (tsmConfig::get('css')) {
            $msg = tsmText::_('VMPAYMENT_PAYPAL_REDIRECT_MESSAGE', true);
        } else {
            $msg = '';
        }
        vmJsApi::addJScript('vm.paymentFormAutoSubmit', '
  			jQuery(document).ready(function($){
   				jQuery("body").addClass("vmLoading");
  				var msg="' . $msg . '";
   				jQuery("body").append("<div class=\\"vmLoadingDiv\\"><div class=\\"vmLoadingDivMsg\\">"+msg+"</div></div>");
    			jQuery("#vmPaymentForm").submit();
			})
		');
        $html = '';
        if ($this->_method->debug) {
            $html .= '<form action="' . $url . '" method="post" name="vm_paypal_form" target="paypal">';
        } else {
            $html .= '<form action="' . $url . '" method="post" name="vm_paypal_form" id="vmPaymentForm" accept-charset="UTF-8">';
        }
        $html .= '<input type="hidden" name="charset" value="utf-8">';
        foreach ($post_variables as $name => $value) {
            $html .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
        }
        if ($this->_method->debug) {
            $html .= '<div style="background-color:red;color:white;padding:10px;">
						<input type="submit"  value="The method is in debug mode. Click here to be redirected to PayPal" />
						</div>';
            $this->debugLog($post_variables, 'PayPal request:', 'debug');
        } else {
            $html .= '<input type="submit"  value="' . tsmText::_('VMPAYMENT_PAYPAL_REDIRECT_MESSAGE') . '" />';
        }
        $html .= '</form>';
        return $html;
    }
Esempio n. 19
0
 /**
  * Send the Recommend to a friend email.
  *
  * @author Kohl Patrick
  * @author Max Milbers
  */
 public function mailRecommend()
 {
     JSession::checkToken() or jexit('Invalid Token');
     $app = JFactory::getApplication();
     if (!tsmConfig::get('show_emailfriend', false)) {
         $app->redirect(JRoute::_('index.php?option=com_virtuemart&tmpl=component&view=productdetails&task=askquestion&virtuemart_product_id=' . vRequest::getInt('virtuemart_product_id', 0)), 'Function disabled');
     }
     if (JFactory::getUser()->guest == 1 and tsmConfig::get('ask_captcha')) {
         $recaptcha = vRequest::getVar('recaptcha_response_field');
         JPluginHelper::importPlugin('captcha');
         $dispatcher = JDispatcher::getInstance();
         $res = $dispatcher->trigger('onCheckAnswer', $recaptcha);
         $session = JFactory::getSession();
         if (!$res[0]) {
             $mailrecommend = array('email' => vRequest::getVar('email'), 'comment' => vRequest::getString('comment'));
             $session->set('mailrecommend', $mailrecommend, 'vm');
             $errmsg = tsmText::_('PLG_RECAPTCHA_ERROR_INCORRECT_CAPTCHA_SOL');
             $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&tmpl=component&view=productdetails&task=recommend&virtuemart_product_id=' . vRequest::getInt('virtuemart_product_id', 0)), $errmsg);
             return;
         } else {
             $session->set('mailrecommend', 0, 'vm');
         }
     }
     $vars = array();
     $toMail = vRequest::getVar('email');
     //is sanitized then
     $toMail = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $toMail);
     if (shopFunctionsF::renderMail('recommend', $toMail, $vars, 'productdetails', TRUE)) {
         $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
     } else {
         $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
     }
     $app->enqueueMessage(tsmText::_($string));
     $view = $this->getView('recommend', 'html');
     $view->setLayout('mail_confirmed');
     $view->display();
 }
Esempio n. 20
0
 static function displayCustomMedia($media_id, $table = 'product', $width = false, $height = false, $absUrl = false)
 {
     if (!class_exists('TableMedias')) {
         require VMPATH_ADMIN . DS . 'tables' . DS . 'medias.php';
     }
     $db = JFactory::getDBO();
     $data = new TableMedias($db);
     $data->load((int) $media_id);
     if (!empty($data->file_type)) {
         $table = $data->file_type;
     }
     if (!class_exists('VmMediaHandler')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'mediahandler.php';
     }
     $media = VmMediaHandler::createMedia($data, $table);
     if (!$width) {
         $width = tsmConfig::get('img_width', 90);
     }
     if (!$height) {
         $height = tsmConfig::get('img_height', 90);
     }
     return $media->displayMediaThumb('', FALSE, '', TRUE, TRUE, $absUrl, $width, $height);
 }
Esempio n. 21
0
 function getInvoicePDF($orderDetails = 0, $viewName = 'invoice', $layout = 'invoice', $format = 'html', $force = false)
 {
     // 		$force = true;
     $path = tsmConfig::get('forSale_path', 0);
     if (empty($path)) {
         vmError('No path set to store invoices');
         return false;
     } else {
         $path .= shopFunctionsF::getInvoiceFolderName() . DS;
         if (!file_exists($path)) {
             vmError('Path wrong to store invoices, folder invoices does not exist ' . $path);
             return false;
         } else {
             if (!is_writable($path)) {
                 vmError('Cannot store pdf, directory not writeable ' . $path);
                 return false;
             }
         }
     }
     $orderModel = tmsModel::getModel('orders');
     $invoiceNumberDate = array();
     if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
         return false;
     }
     if (!empty($invoiceNumberDate[0])) {
         $invoiceNumber = $invoiceNumberDate[0];
     } else {
         $invoiceNumber = FALSE;
     }
     if (!$invoiceNumber or empty($invoiceNumber)) {
         vmError('Cant create pdf, createInvoiceNumber failed');
         return 0;
     }
     if (shopFunctionsF::InvoiceNumberReserved($invoiceNumber)) {
         return 0;
     }
     //$path .= preg_replace('/[^A-Za-z0-9_\-\.]/', '_', 'vm'.$layout.'_'.$invoiceNumber.'.pdf');
     $path .= shopFunctionsF::getInvoiceName($invoiceNumber, $layout) . '.pdf';
     if (file_exists($path) and !$force) {
         return $path;
     }
     //We come from the be, so we need to load the FE language
     tsmConfig::loadJLang('com_virtuemart', true);
     $this->addViewPath(VMPATH_SITE . DS . 'views');
     $view = $this->getView($viewName, $format);
     $this->writeJs = false;
     $view->addTemplatePath(VMPATH_SITE . DS . 'views' . DS . $viewName . DS . 'tmpl');
     if (!class_exists('VmTemplate')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
     }
     $template = VmTemplate::loadVmTemplateStyle();
     $templateName = VmTemplate::setTemplate($template);
     if (!empty($templateName)) {
         $TemplateOverrideFolder = JPATH_SITE . DS . "templates" . DS . $templateName . DS . "html" . DS . "com_virtuemart" . DS . "invoice";
         if (file_exists($TemplateOverrideFolder)) {
             $view->addTemplatePath($TemplateOverrideFolder);
         }
     }
     $view->invoiceNumber = $invoiceNumberDate[0];
     $view->invoiceDate = $invoiceNumberDate[1];
     $view->orderDetails = $orderDetails;
     $view->uselayout = $layout;
     $view->showHeaderFooter = false;
     $vendorModel = tmsModel::getModel('vendor');
     $virtuemart_vendor_id = 1;
     //We could set this automatically by the vendorId stored in the order.
     $vendor = $vendorModel->getVendor($virtuemart_vendor_id);
     $metadata = array('title' => tsmText::sprintf('COM_VIRTUEMART_INVOICE_TITLE', $vendor->vendor_store_name, $view->invoiceNumber, $orderDetails['details']['BT']->order_number), 'keywords' => tsmText::_('COM_VIRTUEMART_INVOICE_CREATOR'));
     return VmPdf::createVmPdf($view, $path, 'F', $metadata);
 }
Esempio n. 22
0
 /**
  * renderMailLayout
  *
  * @author Max Milbers
  * @author Valerie Isaksen
  */
 public function renderMailLayout($doVendor, $recipient)
 {
     $this->useSSL = tsmConfig::get('useSSL', 0);
     $this->useXHTML = true;
     $userFieldsModel = tmsModel::getModel('UserFields');
     $userFields = $userFieldsModel->getUserFields();
     $this->userFields = $userFieldsModel->getUserFieldsFilled($userFields, $this->user->userInfo);
     if (tsmConfig::get('order_mail_html')) {
         $mailFormat = 'html';
         $lineSeparator = "<br />";
     } else {
         $mailFormat = 'raw';
         $lineSeparator = "\n";
     }
     $virtuemart_vendor_id = 1;
     $vendorModel = tmsModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($virtuemart_vendor_id);
     $vendorModel->addImages($vendor);
     $vendor->vendorFields = $vendorModel->getVendorAddressFields();
     $this->assignRef('vendor', $vendor);
     if (!$doVendor) {
         $this->subject = tsmText::sprintf('COM_VIRTUEMART_NEW_SHOPPER_SUBJECT', $this->user->username, $this->vendor->vendor_store_name);
         $tpl = 'mail_' . $mailFormat . '_reguser';
     } else {
         $this->subject = tsmText::sprintf('COM_VIRTUEMART_VENDOR_NEW_SHOPPER_SUBJECT', $this->user->username, $this->vendor->vendor_store_name);
         $tpl = 'mail_' . $mailFormat . '_regvendor';
     }
     $this->assignRef('recipient', $recipient);
     $this->vendorEmail = $vendorModel->getVendorEmail($this->vendor->virtuemart_vendor_id);
     $this->layoutName = $tpl;
     $this->setLayout($tpl);
     $this->isMail = true;
     parent::display();
 }
Esempio n. 23
0
	<div class="addtocart-area">
		<form method="post" class="product js-recalculate" action="<?php 
echo JRoute::_('index.php?option=com_virtuemart', false);
?>
">
			<div class="vm-customfields-wrap">
				<?php 
if (!empty($rowHeights['customfields'])) {
    foreach ($positions as $pos) {
        echo shopFunctionsF::renderVmSubLayout('customfields', array('product' => $product, 'position' => $pos));
    }
}
?>
			</div>			
				<?php 
if (!tsmConfig::get('use_as_catalog', 0)) {
    echo shopFunctionsF::renderVmSubLayout('addtocartbar', array('product' => $product));
}
?>
			<input type="hidden" name="option" value="com_virtuemart"/>
			<input type="hidden" name="view" value="cart"/>
			<input type="hidden" name="virtuemart_product_id[]" value="<?php 
echo $product->virtuemart_product_id;
?>
"/>
			<input type="hidden" name="pname" value="<?php 
echo $product->product_name;
?>
"/>
			<input type="hidden" name="pid" value="<?php 
echo $product->virtuemart_product_id;
Esempio n. 24
0
 private function checkClientIP()
 {
     $revproxvar = tsmConfig::get('revproxvar', '');
     if (!empty($revproxvar)) {
         vmdebug('My server variable ', $_SERVER);
     }
 }
Esempio n. 25
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);
 }
Esempio n. 26
0
 /**
  * Get ssl parameters for certificate based client authentication
  *
  * @param string $certPath - path to client certificate file (PEM formatted file)
  */
 public function getSSLCertificate(&$certifPath, &$passPhrase)
 {
     $safePath = tsmConfig::get('forSale_path', '');
     if ($safePath) {
         $sslCertifFolder = $safePath . "paypal";
     }
     $certifPath = $sslCertifFolder . DS . $this->api_certificate;
 }
Esempio n. 27
0
    /**
     * Retrieve a list of users from the database.
     *
     * @author Max Milbers
     * @return object List of user objects
     */
    function getUserList()
    {
        //$select = ' * ';
        //$joinedTables = ' FROM #__users AS ju LEFT JOIN #__tsmart_vmusers AS vmu ON ju.id = vmu.tsmart_user_id';
        $search = vRequest::getString('search', false);
        $tableToUse = vRequest::getString('searchTable', 'juser');
        $where = array();
        if ($search) {
            $where = ' WHERE ';
            $db = JFactory::getDbo();
            $searchArray = array('ju.name', 'ju.username', 'ju.email', 'shopper_group_name');
            // removed ,'usertype' should be handled by extra dropdown
            $userFieldsValid = array();
            if ($tableToUse != 'juser') {
                if (!class_exists('TableUserinfos')) {
                    require VMPATH_ADMIN . DS . 'tables' . DS . 'userinfos.php';
                }
                $userfieldTable = new TableUserinfos($db);
                $userfieldFields = get_object_vars($userfieldTable);
                $userFieldSearchArray = array('company', 'first_name', 'last_name', 'address_1', 'zip', 'city', 'phone_1');
                //We must validate if the userfields actually exists, they could be removed
                foreach ($userFieldSearchArray as $ufield) {
                    if (array_key_exists($ufield, $userfieldFields)) {
                        $userFieldsValid[] = $ufield;
                    }
                }
                $searchArray = array_merge($userFieldsValid, $searchArray);
            }
            $search = str_replace(' ', '%', $db->escape($search, true));
            foreach ($searchArray as $field) {
                $whereOr[] = ' ' . $field . ' LIKE "%' . $search . '%" ';
            }
            //$where = substr($where,0,-3);
        }
        $select = ' ju.id AS id
			, ju.name AS name
			, ju.username AS username
			, ju.email AS email
			, IFNULL(vmu.user_is_vendor,"0") AS is_vendor
			, IFNULL(sg.shopper_group_name, "") AS shopper_group_name ';
        if ($search) {
            if ($tableToUse != 'juser') {
                $select .= ' , ui.name as uiname ';
            }
            foreach ($userFieldsValid as $ufield) {
                $select .= ' , ' . $ufield;
            }
        }
        $joinedTables = ' FROM #__users AS ju
			LEFT JOIN #__tsmart_vmusers AS vmu ON ju.id = vmu.tsmart_user_id
			LEFT JOIN #__tsmart_vmuser_shoppergroups AS vx ON ju.id = vx.tsmart_user_id
			LEFT JOIN #__tsmart_shoppergroups AS sg ON vx.tsmart_shoppergroup_id = sg.tsmart_shoppergroup_id ';
        if ($search and $tableToUse != 'juser') {
            $joinedTables .= ' LEFT JOIN #__tsmart_userinfos AS ui ON ui.tsmart_user_id = vmu.tsmart_user_id';
        }
        $whereAnd = array();
        if (tsmConfig::get('multixcart', 0) == 'byvendor') {
            $superVendor = vmAccess::isSuperVendor();
            if ($superVendor > 1) {
                $joinedTables .= ' LEFT JOIN #__tsmart_vendor_users AS vu ON ju.id = vmu.tsmart_user_id';
                $whereAnd[] = ' vu.tsmart_vendor_id = ' . $superVendor . ' ';
            }
        }
        $where = '';
        $whereStr = ' WHERE ';
        if (!empty($whereOr)) {
            $where = $whereStr . implode(' OR ', $whereOr);
            $whereStr = 'AND';
        }
        if (!empty($whereAnd)) {
            $where .= $whereStr . ' (' . implode(' OR ', $whereAnd) . ')';
        }
        return $this->_data = $this->exeSortSearchListQuery(0, $select, $joinedTables, $where, ' GROUP BY ju.id', $this->_getOrdering());
    }
Esempio n. 28
0
				<th width="20">
				<?php 
    echo tsmText::_('com_tsmart_SHARED');
    ?>
				</th><?php 
}
?>
			 <th><?php 
echo $this->sort('tsmart_shipmentmethod_id', 'com_tsmart_ID');
?>
</th>
		</tr>
		</thead>
		<?php 
$k = 0;
$set_automatic_shipment = tsmConfig::get('set_automatic_shipment', false);
for ($i = 0, $n = count($this->shipments); $i < $n; $i++) {
    $row = $this->shipments[$i];
    $published = $this->gridPublished($row, $i);
    //$row->published = 1;
    $checked = JHtml::_('grid.id', $i, $row->tsmart_shipmentmethod_id);
    if ($this->showVendors) {
        $shared = $this->toggle($row->shared, $i, 'toggle.shared');
    }
    $editlink = JROUTE::_('index.php?option=com_tsmart&view=shipmentmethod&task=edit&cid[]=' . $row->tsmart_shipmentmethod_id);
    ?>
			<tr class="row<?php 
    echo $k;
    ?>
">
				<td class="admin-checkbox">
Esempio n. 29
0
 /**
  * Checks if we show multivendor related stuff for admins
  * @return bool|null
  */
 public function showVendors()
 {
     if ($this->showVendors === null) {
         if (tsmConfig::get('multix', 'none') != 'none' and vmAccess::manager('managevendors')) {
             $this->showVendors = true;
         } else {
             $this->showVendors = false;
         }
     }
     return $this->showVendors;
 }
Esempio n. 30
0
?>
</legend>
		<table class="admintable">
			<?php 
echo VmHTML::row('checkbox', 'com_tsmart_REVIEWS_AUTOPUBLISH', 'reviews_autopublish', tsmConfig::get('reviews_autopublish', 0));
echo VmHTML::row('input', 'com_tsmart_ADMIN_CFG_REVIEW_MINIMUM_COMMENT_LENGTH', 'reviews_minimum_comment_length', tsmConfig::get('reviews_minimum_comment_length', 0));
echo VmHTML::row('input', 'com_tsmart_ADMIN_CFG_REVIEW_MAXIMUM_COMMENT_LENGTH', 'reviews_maximum_comment_length', tsmConfig::get('reviews_maximum_comment_length', 0));
$showReviewFor = array('none' => tsmText::_('com_tsmart_ADMIN_CFG_REVIEW_SHOW_NONE'), 'registered' => tsmText::_('com_tsmart_ADMIN_CFG_REVIEW_SHOW_REGISTERED'), 'all' => tsmText::_('com_tsmart_ADMIN_CFG_REVIEW_SHOW_ALL'));
//showReviewFor
echo VmHTML::row('radioList', 'com_tsmart_ADMIN_CFG_REVIEW_SHOW', 'showReviewFor', tsmConfig::get('showReviewFor', 'all'), $showReviewFor);
$reviewMode = array('none' => tsmText::_('com_tsmart_ADMIN_CFG_REVIEW_MODE_NONE'), 'bought' => tsmText::_('com_tsmart_ADMIN_CFG_REVIEW_MODE_BOUGHT_PRODUCT'), 'registered' => tsmText::_('com_tsmart_ADMIN_CFG_REVIEW_MODE_REGISTERED'));
echo VmHTML::row('radioList', 'com_tsmart_ADMIN_CFG_REVIEW', 'reviewMode', tsmConfig::get('reviewMode', 'bought'), $reviewMode);
echo VmHTML::row('radioList', 'com_tsmart_ADMIN_CFG_RATING_SHOW', 'showRatingFor', tsmConfig::get('showRatingFor', 'all'), $showReviewFor);
echo VmHTML::row('radioList', 'com_tsmart_ADMIN_CFG_RATING', 'ratingMode', tsmConfig::get('ratingMode', 'bought'), $reviewMode);
$attrlist = 'class="inputbox" multiple="multiple" ';
echo VmHTML::row('genericlist', 'com_tsmart_REVIEWS_OS', $this->os_Options, 'rr_os[]', $attrlist, 'order_status_code', 'order_status_name', tsmConfig::get('rr_os', array('C')), 'rr_os', true);
?>

		</table>
	</fieldset>
</td>
</tr>
</table>
<?php 
vmJsApi::addJScript('vm.imagechange', '
	jQuery("#image").change(function () {
		var $newimage = jQuery(this).val();
		jQuery("#product_availability").val($newimage);
		jQuery("#imagelib").attr({ src:"' . JURI::root(true) . $this->imagePath . '" + $newimage, alt:$newimage });
	});');
?>