示例#1
0
echo VmHTML::row('radio', 'COM_VIRTUEMART_COUPON_PERCENT_TOTAL', 'percent_or_total', $radioOptions, $this->coupon->percent_or_total);
?>
			<?php 
$listOptions = array();
$listOptions[] = JHtml::_('select.option', 'permanent', vmText::_('COM_VIRTUEMART_COUPON_TYPE_PERMANENT'));
$listOptions[] = JHtml::_('select.option', 'gift', vmText::_('COM_VIRTUEMART_COUPON_TYPE_GIFT'));
echo VmHTML::row('select', 'COM_VIRTUEMART_COUPON_TYPE', 'coupon_type', $listOptions, $this->coupon->coupon_type, '', 'value', 'text', false);
?>
 			<?php 
echo VmHTML::row('input', 'COM_VIRTUEMART_COUPON_VALUE_VALID_AT', 'coupon_value_valid', $this->coupon->coupon_value_valid, 'class="inputbox"', '', 10, 255, ' ' . $this->vendor_currency);
?>
			<?php 
echo VmHTML::row('raw', 'COM_VIRTUEMART_COUPON_START', vmJsApi::jDate($this->coupon->coupon_start_date, 'coupon_start_date'));
?>
			<?php 
echo VmHTML::row('raw', 'COM_VIRTUEMART_COUPON_EXPIRY', vmJsApi::jDate($this->coupon->coupon_expiry_date, 'coupon_expiry_date'));
?>
	    </table>
	</fieldset>
    <input type="hidden" name="virtuemart_coupon_id" value="<?php 
echo $this->coupon->virtuemart_coupon_id;
?>
" />

 	<?php 
echo $this->addStandardHiddenToForm();
?>
</form>


    <?php 
示例#2
0
            <table>
                <tr>
                    <td align="left" width="100%">
						<?php 
echo vmText::_('COM_VIRTUEMART_ORDERSTATUS') . $this->lists['state_list'];
?>

						<?php 
echo vmText::_('COM_VIRTUEMART_REPORT_INTERVAL') . $this->lists['intervals'];
?>

                        <?php 
echo vmText::_('COM_VIRTUEMART_REPORT_SET_PERIOD') . $this->lists['select_date'];
echo vmText::_('COM_VIRTUEMART_REPORT_FROM_PERIOD') . vmJsApi::jDate($this->from_period, 'from_period');
echo vmText::_('COM_VIRTUEMART_REPORT_UNTIL_PERIOD') . vmJsApi::jDate($this->until_period, 'until_period');
if (VmConfig::get('multix', 'none') != 'none') {
    $vendorId = vRequest::getInt('virtuemart_vendor_id', 1);
    echo ShopFunctions::renderVendorList($vendorId, false);
}
?>

                        <button class="btn btn-small" onclick="this.form.period.value='';this.form.submit();"><?php 
echo vmText::_('COM_VIRTUEMART_GO');
?>

                        </button>
                    </td>
                </tr>
            </table>
        </div>
示例#3
0
 /**
  * @author Max Milbers
  * @param $product
  * @param $customfield
  */
 public function displayProductCustomfieldFE(&$product, &$customfields)
 {
     if (!class_exists('calculationHelper')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     $selectList = array();
     $dynChilds = 1;
     //= array();
     $session = JFactory::getSession();
     $virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm');
     foreach ($customfields as $k => &$customfield) {
         if (!isset($customfield->display)) {
             $customfield->display = '';
         }
         $calculator->_product = $product;
         if (!class_exists('vmCustomPlugin')) {
             require VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php';
         }
         if ($customfield->field_type == "E") {
             JPluginHelper::importPlugin('vmcustom');
             $dispatcher = JDispatcher::getInstance();
             $ret = $dispatcher->trigger('plgVmOnDisplayProductFEVM3', array(&$product, &$customfield));
             continue;
         }
         $fieldname = 'field[' . $product->virtuemart_product_id . '][' . $customfield->virtuemart_customfield_id . '][customfield_value]';
         $customProductDataName = 'customProductData[' . $product->virtuemart_product_id . '][' . $customfield->virtuemart_custom_id . ']';
         //This is a kind of fallback, setting default of custom if there is no value of the productcustom
         $customfield->customfield_value = empty($customfield->customfield_value) ? $customfield->custom_value : $customfield->customfield_value;
         $type = $customfield->field_type;
         $idTag = (int) $product->virtuemart_product_id . '-' . $customfield->virtuemart_customfield_id;
         $idTag = $idTag . 'customProductData';
         $idTag = VmHtml::ensureUniqueId($idTag);
         if (!class_exists('CurrencyDisplay')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
         }
         $currency = CurrencyDisplay::getInstance();
         switch ($type) {
             case 'C':
                 $html = '';
                 $dropdowns = array();
                 if (isset($customfield->options->{$product->virtuemart_product_id})) {
                     $productSelection = $customfield->options->{$product->virtuemart_product_id};
                 } else {
                     $productSelection = false;
                 }
                 $ignore = array();
                 foreach ($customfield->options as $product_id => $variants) {
                     foreach ($variants as $k => $variant) {
                         //if(in_array($variant,$ignore)){ vmdebug('Product to ignore, continue',$product_id,$k,$variant);continue;}
                         if (!isset($dropdowns[$k]) or !is_array($dropdowns[$k])) {
                             $dropdowns[$k] = array();
                         }
                         if (!in_array($variant, $dropdowns[$k])) {
                             if ($k == 0 or !$productSelection) {
                                 $dropdowns[$k][] = $variant;
                             } else {
                                 if ($k > 0 and $productSelection[$k - 1] == $variants[$k - 1]) {
                                     $break = false;
                                     for ($h = 1; $h <= $k; $h++) {
                                         if ($productSelection[$h - 1] != $variants[$h - 1]) {
                                             //$ignore[] = $variant;
                                             $break = true;
                                         }
                                     }
                                     if (!$break) {
                                         $dropdowns[$k][] = $variant;
                                     }
                                 } else {
                                     //	break;
                                 }
                             }
                         }
                     }
                 }
                 $tags = array();
                 foreach ($customfield->selectoptions as $k => $soption) {
                     $options = array();
                     $selected = false;
                     foreach ($dropdowns[$k] as $i => $elem) {
                         $elem = trim((string) $elem);
                         $text = $elem;
                         if ($soption->clabel != '' and in_array($soption->voption, self::$dimensions)) {
                             $rd = $soption->clabel;
                             if (is_numeric($rd) and is_numeric($elem)) {
                                 $text = number_format(round((double) $elem, (int) $rd), $rd);
                             }
                             //vmdebug('($dropdowns[$k] in DIMENSION value = '.$elem.' r='.$rd.' '.$text);
                         } else {
                             if ($soption->voption === 'clabels' and $soption->clabel != '') {
                                 $text = vmText::_($elem);
                             }
                         }
                         if ($elem == '0') {
                             $text = vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION');
                         }
                         $options[] = array('value' => $elem, 'text' => $text);
                         if ($productSelection and $productSelection[$k] == $elem) {
                             $selected = $elem;
                         }
                     }
                     if (empty($selected)) {
                         $product->orderable = false;
                     }
                     $idTagK = $idTag . 'cvard' . $k;
                     if ($customfield->showlabels) {
                         if (in_array($soption->voption, self::$dimensions)) {
                             $soption->slabel = vmText::_('COM_VIRTUEMART_' . strtoupper($soption->voption));
                         } else {
                             if (!empty($soption->clabel) and !in_array($soption->voption, self::$dimensions)) {
                                 $soption->slabel = vmText::_($soption->clabel);
                             }
                         }
                         if (isset($soption->slabel)) {
                             $html .= '<span class="vm-cmv-label" >' . $soption->slabel . '</span>';
                         }
                     }
                     $attribs = array('class' => 'vm-chzn-select cvselection no-vm-bind', 'data-dynamic-update' => '1');
                     if ('productdetails' != vRequest::getCmd('view')) {
                         $attribs['reload'] = '1';
                     }
                     $html .= JHtml::_('select.genericlist', $options, $fieldname, $attribs, "value", "text", $selected, $idTagK);
                     $tags[] = $idTagK;
                 }
                 $Itemid = vRequest::getInt('Itemid', '');
                 // '&Itemid=127';
                 if (!empty($Itemid)) {
                     $Itemid = '&Itemid=' . $Itemid;
                 }
                 //create array for js
                 $jsArray = array();
                 $url = '';
                 foreach ($customfield->options as $product_id => $variants) {
                     $url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $product_id . $Itemid);
                     $jsArray[] = '["' . $url . '","' . implode('","', $variants) . '"]';
                 }
                 vmJsApi::addJScript('cvfind', false, false);
                 $jsVariants = implode(',', $jsArray);
                 $j = "\n\t\t\t\t\t\tjQuery('#" . implode(',#', $tags) . "').off('change',Virtuemart.cvFind);\n\t\t\t\t\t\tjQuery('#" . implode(',#', $tags) . "').on('change', { variants:[" . $jsVariants . "] },Virtuemart.cvFind);\n\t\t\t\t\t";
                 $hash = md5(implode('', $tags));
                 vmJsApi::addJScript('cvselvars' . $hash, $j, false);
                 //Now we need just the JS to reload the correct product
                 $customfield->display = $html;
                 break;
             case 'A':
                 $html = '';
                 //if($selectedFound) continue;
                 $options = array();
                 $productModel = VmModel::getModel('product');
                 //Note by Jeremy Magne (Daycounts) 2013-08-31
                 //Previously the the product model is loaded but we need to ensure the correct product id is set because the getUncategorizedChildren does not get the product id as parameter.
                 //In case the product model was previously loaded, by a related product for example, this would generate wrong uncategorized children list
                 $productModel->setId($customfield->virtuemart_product_id);
                 $uncatChildren = $productModel->getUncategorizedChildren($customfield->withParent);
                 if (!$customfield->withParent or $customfield->withParent and $customfield->parentOrderable) {
                     $options[0] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $customfield->virtuemart_product_id, FALSE), 'text' => vmText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT'));
                 }
                 $selected = vRequest::getInt('virtuemart_product_id', 0);
                 $selectedFound = false;
                 if (empty($calculator) and $customfield->wPrice) {
                     if (!class_exists('calculationHelper')) {
                         require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
                     }
                     $calculator = calculationHelper::getInstance();
                 }
                 $parentStock = 0;
                 foreach ($uncatChildren as $k => $child) {
                     if (!isset($child[$customfield->customfield_value])) {
                         vmdebug('The child has no value at index ' . $customfield->customfield_value, $customfield, $child);
                     } else {
                         $productChild = $productModel->getProduct((int) $child['virtuemart_product_id'], false);
                         if (!$productChild) {
                             continue;
                         }
                         $available = $productChild->product_in_stock - $productChild->product_ordered;
                         if (VmConfig::get('stockhandle', 'none') == 'disableit_children' and $available <= 0) {
                             continue;
                         }
                         $parentStock += $available;
                         $priceStr = '';
                         if ($customfield->wPrice) {
                             //$product = $productModel->getProductSingle((int)$child['virtuemart_product_id'],false);
                             $productPrices = $calculator->getProductPrices($productChild);
                             $priceStr = ' (' . $currency->priceDisplay($productPrices['salesPrice']) . ')';
                         }
                         $options[] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id']), 'text' => $child[$customfield->customfield_value] . $priceStr);
                         if ($selected == $child['virtuemart_product_id']) {
                             $selectedFound = true;
                             vmdebug($customfield->virtuemart_product_id . ' $selectedFound by vRequest ' . $selected);
                         }
                         //vmdebug('$child productId ',$child['virtuemart_product_id'],$customfield->customfield_value,$child);
                     }
                 }
                 if (!$selectedFound) {
                     $pos = array_search($customfield->virtuemart_product_id, $product->allIds);
                     if (isset($product->allIds[$pos - 1])) {
                         $selected = $product->allIds[$pos - 1];
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to - 1 allIds['.($pos-1).'] = '.$selected.' and count '.$dynChilds);
                         //break;
                     } elseif (isset($product->allIds[$pos])) {
                         $selected = $product->allIds[$pos];
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to allIds['.$pos.'] = '.$selected.' and count '.$dynChilds);
                     } else {
                         $selected = $customfield->virtuemart_product_id;
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to $customfield->virtuemart_product_id ',$selected,$product->allIds);
                     }
                 }
                 $url = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $selected;
                 $html .= JHtml::_('select.genericlist', $options, $fieldname, 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="vm-chzn-select no-vm-bind" data-dynamic-update="1" ', "value", "text", JRoute::_($url, false), $idTag);
                 vmJsApi::chosenDropDowns();
                 if ($customfield->parentOrderable == 0) {
                     if ($product->product_parent_id == 0) {
                         $product->orderable = FALSE;
                     } else {
                         $product->product_in_stock = $parentStock;
                     }
                 } else {
                 }
                 $dynChilds++;
                 $customfield->display = $html;
                 break;
                 /*Date variant*/
             /*Date variant*/
             case 'D':
                 if (empty($customfield->custom_value)) {
                     $customfield->custom_value = 'LC2';
                 }
                 //Customer selects date
                 if ($customfield->is_input) {
                     $customfield->display = '<span class="product_custom_date">' . vmJsApi::jDate($customfield->customfield_value, $customProductDataName) . '</span>';
                     //vmJsApi::jDate($field->custom_value, 'field['.$row.'][custom_value]','field_'.$row.'_customvalue').$priceInput;
                 } else {
                     $customfield->display = '<span class="product_custom_date">' . vmJsApi::date($customfield->customfield_value, $customfield->custom_value, TRUE) . '</span>';
                 }
                 break;
                 /* text area or editor No vmText, only displayed in BE */
             /* text area or editor No vmText, only displayed in BE */
             case 'X':
             case 'Y':
                 $customfield->display = $customfield->customfield_value;
                 break;
                 /* string or integer */
             /* string or integer */
             case 'B':
             case 'S':
             case 'M':
                 if ($type == 'M') {
                     $selectType = 'select.radiolist';
                     $class = '';
                 } else {
                     $selectType = 'select.genericlist';
                     if (!empty($customfield->is_input)) {
                         vmJsApi::chosenDropDowns();
                         $class = 'class="vm-chzn-select"';
                     }
                 }
                 if ($customfield->is_list and $customfield->is_list != 2) {
                     if (!empty($customfield->is_input)) {
                         $options = array();
                         $values = explode(';', $customfield->custom_value);
                         foreach ($values as $key => $val) {
                             if ($type == 'M') {
                                 $tmp = array('value' => $val, 'text' => $this->displayCustomMedia($val, 'product', $customfield->width, $customfield->height));
                                 $options[] = (object) $tmp;
                             } else {
                                 $options[] = array('value' => $val, 'text' => vmText::_($val));
                             }
                         }
                         $currentValue = $customfield->customfield_value;
                         $customfield->display = JHtml::_($selectType, $options, $customProductDataName . '[' . $customfield->virtuemart_customfield_id . ']', $class, 'value', 'text', $currentValue, $idTag);
                     } else {
                         if ($type == 'M') {
                             $customfield->display = $this->displayCustomMedia($customfield->customfield_value, 'product', $customfield->width, $customfield->height);
                         } else {
                             $customfield->display = vmText::_($customfield->customfield_value);
                         }
                     }
                 } else {
                     if (!empty($customfield->is_input)) {
                         if (!isset($selectList[$customfield->virtuemart_custom_id])) {
                             $tmpField = clone $customfield;
                             $tmpField->options = null;
                             $customfield->options[$customfield->virtuemart_customfield_id] = $tmpField;
                             $selectList[$customfield->virtuemart_custom_id] = $k;
                             $customfield->customProductDataName = $customProductDataName;
                         } else {
                             $customfields[$selectList[$customfield->virtuemart_custom_id]]->options[$customfield->virtuemart_customfield_id] = $customfield;
                             unset($customfields[$k]);
                             //$customfield->options[$customfield->virtuemart_customfield_id] = $customfield;
                         }
                         $default = reset($customfields[$selectList[$customfield->virtuemart_custom_id]]->options);
                         foreach ($customfields[$selectList[$customfield->virtuemart_custom_id]]->options as &$productCustom) {
                             $price = self::_getCustomPrice($productCustom->customfield_price, $currency, $calculator);
                             if ($type == 'M') {
                                 $productCustom->text = $this->displayCustomMedia($productCustom->customfield_value, 'product', $customfield->width, $customfield->height) . ' ' . $price;
                             } else {
                                 $trValue = vmText::_($productCustom->customfield_value);
                                 if ($productCustom->customfield_value != $trValue and strpos($trValue, '%1') !== false) {
                                     $productCustom->text = vmText::sprintf($productCustom->customfield_value, $price);
                                 } else {
                                     $productCustom->text = $trValue . ' ' . $price;
                                 }
                             }
                         }
                         $customfields[$selectList[$customfield->virtuemart_custom_id]]->display = JHtml::_($selectType, $customfields[$selectList[$customfield->virtuemart_custom_id]]->options, $customfields[$selectList[$customfield->virtuemart_custom_id]]->customProductDataName, $class, 'virtuemart_customfield_id', 'text', $default->customfield_value, $idTag);
                         //*/
                     } else {
                         if ($type == 'M') {
                             $customfield->display = $this->displayCustomMedia($customfield->customfield_value, 'product', $customfield->width, $customfield->height);
                         } else {
                             $customfield->display = vmText::_($customfield->customfield_value);
                         }
                     }
                 }
                 break;
             case 'Z':
                 if (empty($customfield->customfield_value)) {
                     break;
                 }
                 $html = '';
                 $q = 'SELECT * FROM `#__virtuemart_categories_' . VmConfig::$vmlang . '` as l INNER JOIN `#__virtuemart_categories` AS c using (`virtuemart_category_id`) WHERE `published`=1 AND l.`virtuemart_category_id`= "' . (int) $customfield->customfield_value . '" ';
                 $db = JFactory::getDBO();
                 $db->setQuery($q);
                 if ($category = $db->loadObject()) {
                     if (empty($category->virtuemart_category_id)) {
                         break;
                     }
                     $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_category_medias`WHERE `virtuemart_category_id`= "' . $category->virtuemart_category_id . '" ';
                     $db->setQuery($q);
                     $thumb = '';
                     if ($media_id = $db->loadResult()) {
                         $thumb = $this->displayCustomMedia($media_id, 'category', $customfield->width, $customfield->height);
                     }
                     $customfield->display = JHtml::link(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id), $thumb . ' ' . $category->category_name, array('title' => $category->category_name, 'target' => '_blank'));
                 }
                 break;
             case 'R':
                 if (empty($customfield->customfield_value)) {
                     $customfield->display = 'customfield related product has no value';
                     break;
                 }
                 $pModel = VmModel::getModel('product');
                 $related = $pModel->getProduct((int) $customfield->customfield_value, TRUE, $customfield->wPrice, TRUE, 1);
                 if (!$related) {
                     break;
                 }
                 $thumb = '';
                 if ($customfield->wImage) {
                     if (!empty($related->virtuemart_media_id[0])) {
                         $thumb = $this->displayCustomMedia($related->virtuemart_media_id[0], 'product', $customfield->width, $customfield->height) . ' ';
                     } else {
                         $thumb = $this->displayCustomMedia(0, 'product', $customfield->width, $customfield->height) . ' ';
                     }
                 }
                 $customfield->display = shopFunctionsF::renderVmSubLayout('related', array('customfield' => $customfield, 'related' => $related, 'thumb' => $thumb));
                 break;
         }
     }
 }
示例#4
0
					 <?php 
echo JHTML::_('select.genericlist', $this->manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox" onchange="document.adminForm.submit(); return false;"', 'value', 'text', $this->model->virtuemart_manufacturer_id);
?>

				<?php 
echo JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE');
?>
&nbsp;
					<input type="text" value="<?php 
echo JRequest::getVar('filter_product');
?>
" name="filter_product" size="25" />
				<?php 
echo $this->lists['search_type'];
echo $this->lists['search_order'];
echo vmJsApi::jDate(JRequest::getVar('search_date', $nowstring), 'search_date', 'class="datepicker" size="9"');
//echo JHTML::calendar( JRequest::getVar('search_date', $nowstring), 'search_date', 'search_date', '%H.%M %d.%m.%Y', 'size="20"');
?>
				<button onclick="this.form.submit();"><?php 
echo JText::_('COM_VIRTUEMART_GO');
?>
</button>
				<button onclick="document.adminForm.filter_product.value=''; document.adminForm.search_type.options[0].selected = true;"><?php 
echo JText::_('COM_VIRTUEMART_RESET');
?>
</button>
			</td>

		</tr>
	</table>
	</div>
示例#5
0
echo JHtml::_('select.genericlist', $this->manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox" onchange="document.adminForm.submit(); return false;"', 'value', 'text', $this->model->virtuemart_manufacturer_id);
?>


				<?php 
echo vmText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE');
?>
&nbsp;
					<input type="text" value="<?php 
echo vRequest::getVar('filter_product');
?>
" name="filter_product" size="25" />
				<?php 
echo $this->lists['search_type'];
echo $this->lists['search_order'];
echo vmJsApi::jDate(vRequest::getVar('search_date', $nowstring), 'search_date');
?>

				<button  class="btn btn-small" onclick="this.form.submit();"><?php 
echo vmText::_('COM_VIRTUEMART_GO');
?>
</button>
				<button  class="btn btn-small" onclick="document.adminForm.filter_product.value=''; document.adminForm.search_type.options[0].selected = true;"><?php 
echo vmText::_('COM_VIRTUEMART_RESET');
?>
</button>
			</td>

		</tr>
	</table>
	</div>
示例#6
0
	/**
	 * Return an array with userFields in several formats.
	 *
	 * @access public
	 * @param $_selection An array, as returned by getuserFields(), with fields that should be returned.
	 * @param $_userData Array with userdata holding the values for the fields
	 * @param $_prefix string Optional prefix for the formtag name attribute
	 * @author Oscar van Eijk
	 * @return array List with all userfield data in the format:
	 * array(
	 *    'fields' => array(   // All fields
	 *                   <fieldname> => array(
	 *                                     'name' =>       // Name of the field
	 *                                     'value' =>      // Existing value for the current user, or the default
	 *                                     'title' =>      // Title used for label and such
	 *                                     'type' =>       // Field type as specified in the userfields table
	 *                                     'hidden' =>     // True/False
	 *                                     'required' =>   // True/False. If True, the formcode also has the class "required" for the Joomla formvalidator
	 *                                     'formcode' =>   // Full HTML tag
	 *                                  )
	 *                   [...]
	 *                )
	 *    'functions' => array() // Optional javascript functions without <script> tags.
	 *                           // Possible usage: if (count($ar('functions')>0) echo '<script ...>'.join("\n", $ar('functions')).'</script>;
	 *    'scripts'   => array(  // Array with scriptsources for use with JHtml::script();
	 *                      <name> => <path>
	 *                      [...]
	 *                   )
	 *    'links'     => array(  // Array with stylesheets for use with JHtml::stylesheet();
	 *                      <name> => <path>
	 *                      [...]
	 *                   )
	 * )
	 * @example This example illustrates the use of this function. For additional examples, see the Order view
	 * and the User view in the administrator section.
	 * <pre>
	 *   // In the controller, make sure this model is loaded.
	 *   // In view.html.php, make the following calls:
	 *   $_usrDetails = getUserDetailsFromSomeModel(); // retrieve an user_info record, eg from the usermodel or ordermodel
	 *   $_usrFieldList = $userFieldsModel->getUserFields(
	 *                    'registration'
	 *                  , array() // Default switches
	 *                  , array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type') // Skips
	 *    );
	 *   $usrFieldValues = $userFieldsModel->getUserFieldsFilled(
	 *                      $_usrFieldList
	 *                     ,$_usrDetails
	 *   );
	 *   $this->assignRef('userfields', $userfields);
	 *   // In the template, use code below to display the data. For an extended example using
	 *   // delimiters, JavaScripts and StyleSheets, see the edit_shopper.php in the user view
	 *   <table class="admintable" width="100%">
	 *     <thead>
	 *       <tr>
	 *         <td class="key" style="text-align: center;"  colspan="2">
	 *            <?php echo vmText::_('COM_VIRTUEMART_TABLE_HEADER') ?>
	 *         </td>
	 *       </tr>
	 *     </thead>
	 *      <?php
	 *        foreach ($this->shipmentfields['fields'] as $_field ) {
	 *          echo '  <tr>'."\n";
	 *          echo '    <td class="key">'."\n";
	 *          echo '      '.$_field['title']."\n";
	 *          echo '    </td>'."\n";
	 *          echo '    <td>'."\n";
	 *
	 *          echo '      '.$_field['value']."\n";    // Display only
	 *       Or:
	 *          echo '      '.$_field['formcode']."\n"; // Input form
	 *
	 *          echo '    </td>'."\n";
	 *          echo '  </tr>'."\n";
	 *        }
	 *      ?>
	 *    </table>
	 * </pre>
	 */
	public function getUserFieldsFilled($_selection, $_userData = null, $_prefix = ''){


		//if(!class_exists('ShopFunctions')) require(VMPATH_ADMIN.DS.'helpers'.DS.'shopfunctions.php');
		$_return = array(
				 'fields' => array()
		,'functions' => array()
		,'scripts' => array()
		,'links' => array()
		);

		$admin = false;
		$user = JFactory::getUser();
		if($user->authorise('core.admin','com_virtuemart') or $user->authorise('core.manage','com_virtuemart')){
			$admin  = true;
		}

		// 		vmdebug('my user data in getUserFieldsFilled',$_selection,$_userData);
		$_userData=(array)($_userData);
		if (is_array($_selection)) {

			foreach ($_selection as $_fld) {

				$_return['fields'][$_fld->name] = array(
					     'name' => $_prefix . $_fld->name
				,'value' => (($_userData == null || !array_key_exists($_fld->name, $_userData))
				? $_fld->default
				: $_userData[$_fld->name])
				,'title' => vmText::_($_fld->title)
				,'type' => $_fld->type
				,'required' => $_fld->required
				,'hidden' => false
				,'formcode' => ''
				,'description' => vmText::_($_fld->description)
				);

				$readonly = '';
				if(!$admin){
					if($_fld->readonly ){
						$readonly = ' readonly="readonly" ';
					}
				}
 				//vmdebug ('getUserFieldsFilled',$_fld->name,$_return['fields'][$_fld->name]['value']);
				// 			if($_fld->name==='email') vmdebug('user data email getuserfieldbyuser',$_userData);
				// First, see if there are predefined fields by checking the name
				switch( $_fld->name ) {

					// 				case 'email':
					// 					$_return['fields'][$_fld->name]['formcode'] = $_userData->email;
					// 					break;
					case 'virtuemart_country_id':

						if(!class_exists('shopFunctionsF'))require(VMPATH_SITE.DS.'helpers'.DS.'shopfunctionsf.php');
						$attrib = array();
						if ($_fld->size) {
							$attrib = array('style'=>"width: ".$_fld->size."px");
						}
						$_return['fields'][$_fld->name]['formcode'] =
							ShopFunctionsF::renderCountryList($_return['fields'][$_fld->name]['value'], false, $attrib , $_prefix, $_fld->required);

						if(!empty($_return['fields'][$_fld->name]['value'])){
							// Translate the value from ID to name
							$_return['fields'][$_fld->name]['virtuemart_country_id'] = (int)$_return['fields'][$_fld->name]['value'];
							$db = JFactory::getDBO ();
							$q = 'SELECT * FROM `#__virtuemart_countries` WHERE virtuemart_country_id = "' . (int)$_return['fields'][$_fld->name]['value'] . '"';
							$db->setQuery ($q);
							$r = $db->loadAssoc();
							if($r){
								$_return['fields'][$_fld->name]['value'] = !empty($r['country_name'])? $r['country_name']:'' ;
								$_return['fields'][$_fld->name]['country_2_code'] = !empty($r['country_2_code'])? $r['country_2_code']:'' ;
								$_return['fields'][$_fld->name]['country_3_code'] = !empty($r['country_3_code'])? $r['country_3_code']:'' ;
							} else {
								vmError('Model Userfields, country with id '.$_return['fields'][$_fld->name]['value'].' not found');
							}
						} else {
							$_return['fields'][$_fld->name]['value'] = '' ;
							$_return['fields'][$_fld->name]['country_2_code'] = '' ;
							$_return['fields'][$_fld->name]['country_3_code'] = '' ;
						}

						//$_return['fields'][$_fld->name]['value'] = vmText::_(shopFunctions::getCountryByID($_return['fields'][$_fld->name]['value']));
						//$_return['fields'][$_fld->name]['state_2_code'] = vmText::_(shopFunctions::getCountryByID($_return['fields'][$_fld->name]['value']));
						break;

					case 'virtuemart_state_id':
						if (!class_exists ('shopFunctionsF'))
							require(VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php');
						$attrib = array();
						if ($_fld->size) {
							$attrib = array('style'=>"width: ".$_fld->size."px");
						}
						$_return['fields'][$_fld->name]['formcode'] =
						shopFunctionsF::renderStateList(	$_return['fields'][$_fld->name]['value'],
						$_prefix,
						false,
						$_fld->required,
							$attrib
						);


						if(!empty($_return['fields'][$_fld->name]['value'])){
							// Translate the value from ID to name
							$_return['fields'][$_fld->name]['virtuemart_state_id'] = (int)$_return['fields'][$_fld->name]['value'];
							$db = JFactory::getDBO ();
							$q = 'SELECT * FROM `#__virtuemart_states` WHERE virtuemart_state_id = "' . (int)$_return['fields'][$_fld->name]['value'] . '"';
							$db->setQuery ($q);
							$r = $db->loadAssoc();
							if($r){
								$_return['fields'][$_fld->name]['value'] = !empty($r['state_name'])? $r['state_name']:'' ;
								$_return['fields'][$_fld->name]['state_2_code'] = !empty($r['state_2_code'])? $r['state_2_code']:'' ;
								$_return['fields'][$_fld->name]['state_3_code'] = !empty($r['state_3_code'])? $r['state_3_code']:'' ;
							} else {
								vmError('Model Userfields, state with id '.$_return['fields'][$_fld->name]['value'].' not found');
							}
						} else {
							$_return['fields'][$_fld->name]['value'] = '' ;
							$_return['fields'][$_fld->name]['state_2_code'] = '' ;
							$_return['fields'][$_fld->name]['state_3_code'] = '' ;
						}

						//$_return['fields'][$_fld->name]['value'] = shopFunctions::getStateByID($_return['fields'][$_fld->name]['value']);
						break;
						//case 'agreed':
						//	$_return['fields'][$_fld->name]['formcode'] = '<input type="checkbox" id="'.$_prefix.'agreed_field" name="'.$_prefix.'agreed" value="1" '
						//		. ($_fld->required ? ' class="required"' : '') . ' />';
						//	break;
					case 'password':
					case 'password2':
						$_return['fields'][$_fld->name]['formcode'] = '<input type="password" id="' . $_prefix.$_fld->name . '_field" name="' . $_prefix.$_fld->name .'" '.($_fld->required ? ' class="required"' : ''). ' size="30" class="inputbox" />'."\n";
					break;
						break;

					//case 'agreed':
					//case 'tos':


						break;
						// It's not a predefined field, so handle it by it's fieldtype
					default:
						if(strpos($_fld->type,'plugin')!==false){

							JPluginHelper::importPlugin('vmuserfield');
							$dispatcher = JDispatcher::getInstance();
							$dispatcher->trigger('plgVmOnUserfieldDisplay',array($_prefix, $_fld,isset($_userData['virtuemart_user_id'])?$_userData['virtuemart_user_id']:0,  &$_return) );
							break;
						}
					switch( $_fld->type ) {
						case 'hidden':
							$_return['fields'][$_fld->name]['formcode'] = '<input type="hidden" id="'
							. $_prefix.$_fld->name . '_field" name="' . $_prefix.$_fld->name.'" size="' . $_fld->size
							. '" value="' . $_return['fields'][$_fld->name]['value'] .'" '
							. ($_fld->required ? ' class="required"' : '')
							. ($_fld->maxlength ? ' maxlength="' . $_fld->maxlength . '"' : '')
							. $readonly . ' /> ';
							$_return['fields'][$_fld->name]['hidden'] = true;
							break;
						case 'date':
						case 'age_verification':
							//echo JHtml::_('behavior.calendar');
							/*
							 * TODO We must add the joomla.javascript here that contains the calendar,
							 * since Joomla does not load it when there's no user logged in.
							 * Gotta find out why... some security issue or a bug???
							 * Note by Oscar
							 */
							// if ($_userData === null) { // Not logged in
							// $_doc = JFactory::getDocument();
							// $_doc->addScript( JURI::root(true).'/includes/js/joomla.javascript.js');
							// }
							$currentYear= date('Y');

						//	$calendar = vmJsApi::jDate($_return['fields'][$_fld->name]['value'],  $_prefix.$_fld->name,  $_prefix.$_fld->name . '_field',false,($currentYear-100).':'.$currentYear);
						//	$_return['fields'][$_fld->name]['formcode'] = $calendar ;

							//if(empty($_return['fields'][$_fld->name]['value'])){
							//	$_return['fields'][$_fld->name]['value'] = "1912-01-01 00:00:00";
							//}                                                     jDate($date='',$name="date",$id=null,$resetBt = true, $yearRange='') {
							// Year range MUST start 100 years ago, for birthday
							$_return['fields'][$_fld->name]['formcode'] = vmJsApi::jDate($_return['fields'][$_fld->name]['value'],  $_prefix.$_fld->name,$_prefix.$_fld->name . '_field',false,($currentYear-100).':'.$currentYear);
							break;
						case 'emailaddress':
							if( JFactory::getApplication()->isSite()) {
								if(empty($_return['fields'][$_fld->name]['value'])) {
									$_return['fields'][$_fld->name]['value'] = JFactory::getUser()->email;
								}
							}							// 							vmdebug('emailaddress',$_fld);
						case 'text':
						case 'webaddress':

							$_return['fields'][$_fld->name]['formcode'] = '<input type="text" id="'
							. $_prefix.$_fld->name . '_field" name="' . $_prefix.$_fld->name.'" size="' . $_fld->size
							. '" value="' . $_return['fields'][$_fld->name]['value'] .'" '
							. ($_fld->required ? ' class="required"' : '')
							. ($_fld->maxlength ? ' maxlength="' . $_fld->maxlength . '"' : '')
							. $readonly . ' /> ';
							break;
						case 'textarea':
							$_return['fields'][$_fld->name]['formcode'] = '<textarea id="'
							. $_prefix.$_fld->name . '_field" name="' . $_prefix.$_fld->name . '" cols="' . $_fld->cols
							. '" rows="'.$_fld->rows . '" class="inputbox" '
							. $readonly.'>'
							. $_return['fields'][$_fld->name]['value'] .'</textarea>';
							break;
						case 'editorta':
							jimport( 'joomla.html.editor' );
							$editor = JFactory::getEditor();
							$_return['fields'][$_fld->name]['formcode'] = $editor->display($_prefix.$_fld->name, $_return['fields'][$_fld->name]['value'], '150', '100', $_fld->cols, $_fld->rows,  array('pagebreak', 'readmore'));
							break;
						case 'checkbox':
							$_return['fields'][$_fld->name]['formcode'] = '<input type="checkbox" name="'
							. $_prefix.$_fld->name . '" id="' . $_prefix.$_fld->name . '_field" value="1" '
							. ($_return['fields'][$_fld->name]['value'] ? 'checked="checked"' : '') .'/>';
							 if($_return['fields'][$_fld->name]['value']) {
								 $_return['fields'][$_fld->name]['value'] = vmText::_($_prefix.$_fld->title);
							 }
							break;
						case 'custom':
							if(!class_exists('shopFunctionsF'))require(VMPATH_SITE.DS.'helpers'.DS.'shopfunctionsf.php');
							$_return['fields'][$_fld->name]['formcode'] =  shopFunctionsF::renderVmSubLayout($_fld->name,array('field'=>$_return['fields'][$_fld->name],'userData' => $_userData,'prefix' => $_prefix));
							break;
							// /*##mygruz20120223193710 { :*/
						// case 'userfieldplugin': //why not just vmuserfieldsplugin ?
							// JPluginHelper::importPlugin('vmuserfield');
							// $dispatcher = JDispatcher::getInstance();
							// //Todo to adjust to new pattern, using &
							// $html = '' ;
							// $dispatcher->trigger('plgVmOnUserFieldDisplay',array($_return['fields'][$_fld->name], &$html) );
							// $_return['fields'][$_fld->name]['formcode'] = $html;
							// break;
							// /*##mygruz20120223193710 } */
						case 'multicheckbox':
						case 'multiselect':
						case 'select':
						case 'radio':
							$_qry = 'SELECT fieldtitle, fieldvalue '
							. 'FROM #__virtuemart_userfield_values '
							. 'WHERE virtuemart_userfield_id = ' . $_fld->virtuemart_userfield_id
							. ' ORDER BY ordering ';
							$_values = $this->_getList($_qry);
							// We need an extra lok here, especially for the Bank info; the values
							// must be translated.
							// Don't check on the field name though, since others might be added in the future :-(

							foreach ($_values as $_v) {
								$_v->fieldtitle = vmText::_($_v->fieldtitle);
							}
							$_attribs = array();
							if ($_fld->readonly and !$admin) {
								$_attribs['readonly'] = 'readonly';
							}
							if ($_fld->required) {
								$_attribs['class'] = 'required';
							}

							if ($_fld->type == 'radio' or $_fld->type == 'select') {
								$_selected = $_return['fields'][$_fld->name]['value'];
							} else {
								$_attribs['size'] = $_fld->size; // Use for all but radioselects
								if (!is_array($_return['fields'][$_fld->name]['value'])){
									$_selected = explode("|*|", $_return['fields'][$_fld->name]['value']);
								} else {
									$_selected = $_return['fields'][$_fld->name]['value'];
								}
							}

							// Nested switch...
							switch($_fld->type) {
								case 'multicheckbox':
									// todo: use those
									$_attribs['rows'] = $_fld->rows;
									$_attribs['cols'] = $_fld->cols;
									$formcode = '';
									$field_values="";
									$_idx = 0;
									$separator_form = '<br />';
									$separator_title = ',';
									foreach ($_values as $_val) {
										 if ( in_array($_val->fieldvalue, $_selected)) {
											 $is_selected='checked="checked"';
											 $field_values.= vmText::_($_val->fieldtitle). $separator_title;
										 }  else {
											 $is_selected='';
										 }
										$formcode .= '<input type="checkbox" name="'
										. $_prefix.$_fld->name . '[]" id="' . $_prefix.$_fld->name . '_field' . $_idx . '" value="'. $_val->fieldvalue . '" '
										. $is_selected .'/> <label for="' . $_prefix.$_fld->name . '_field' . $_idx . '">'.vmText::_($_val->fieldtitle) .'</label>'. $separator_form;
										$_idx++;
									}
									// remove last br
									$_return['fields'][$_fld->name]['formcode'] =substr($formcode ,0,-strlen($separator_form));
									$_return['fields'][$_fld->name]['value'] = substr($field_values,0,-strlen($separator_title));
									break;
								case 'multiselect':
									$_attribs['multiple'] = 'multiple';
									$_attribs['class'] = 'vm-chzn-select';
									$field_values="";
									$_return['fields'][$_fld->name]['formcode'] = JHtml::_('select.genericlist', $_values, $_prefix.$_fld->name.'[]', $_attribs, 'fieldvalue', 'fieldtitle', $_selected);
									$separator_form = '<br />';
									$separator_title = ',';
									foreach ($_values as $_val) {
										 if ( in_array($_val->fieldvalue, $_selected)) {
											 $field_values.= vmText::_($_val->fieldtitle). $separator_title;
										 }
										}
									$_return['fields'][$_fld->name]['value'] = substr($field_values,0,-strlen($separator_title));

									break;
								case 'select':
									$_attribs['class'] = 'vm-chzn-select';
									if ($_fld->size) {
										$_attribs['style']= "width: ".$_fld->size."px";
									}
									if(!$_fld->required){
										$obj = new stdClass();
										$obj->fieldtitle = vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION');
										$obj->fieldvalue = '';
										array_unshift($_values,$obj);
									}

									$_return['fields'][$_fld->name]['formcode'] = JHTML::_('select.genericlist', $_values, $_prefix.$_fld->name, $_attribs, 'fieldvalue', 'fieldtitle', $_selected);
									if ( !empty($_selected)){
										foreach ($_values as $_val) {
											if ( $_val->fieldvalue==$_selected ) {
												// vmdebug('getUserFieldsFilled set empty select to value',$_selected,$_fld,$_return['fields'][$_fld->name]);
												$_return['fields'][$_fld->name]['value'] = vmText::_($_val->fieldtitle);
											}
										}
									}

									break;

								case 'radio':
									$_return['fields'][$_fld->name]['formcode'] =  JHtml::_('select.radiolist', $_values, $_prefix.$_fld->name, $_attribs, 'fieldvalue', 'fieldtitle', $_selected);
									if ( !empty($_selected)){
										foreach ($_values as $_val) {
											if (  $_val->fieldvalue==$_selected) {
												$_return['fields'][$_fld->name]['value'] = vmText::_($_val->fieldtitle);
											}
										}
									}

									break;
							}
							break;
					}
					break;
				}
			}
		} else {
			vmdebug('getUserFieldsFilled $_selection is not an array ',$_selection);
// 			$_return['fields'][$_fld->name]['formcode'] = '';
		}

		return $_return;
	}
    /**
     * 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;*/
            }
        }
    }
示例#8
0
                               id="max_space" name="max_space" class="inputbox number">
                        <label>Sale periol</label>
                        <?php 
echo vmJsApi::jDate($this->departure->sale_period_open, 'sale_period_open');
?>
                        To
                        <?php 
echo vmJsApi::jDate($this->departure->sale_period_close, 'sale_period_close');
?>
                        <label>Vaild period</label>
                        <?php 
echo vmJsApi::jDate($this->departure->vail_period_from, 'vail_period_from');
?>
                        To
                        <?php 
echo vmJsApi::jDate($this->departure->vail_period_to, 'vail_period_to');
?>
                        <label>Departure Note</label>
                        <textarea>
                            <?php 
echo $this->departure->departure_note;
?>
                        </textarea>
                        <br/>
                        <a href="javascript:void(0)" class="btn btn-small btn-success pull-right calculator-price">
                            <span class="icon-refresh icon-white"></span>
                            Calculator price
                        </a>

                    </div>
                </div>
示例#9
0
					 <?php 
echo JHtml::_('select.genericlist', $this->manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox" onchange="document.adminForm.submit(); return false;"', 'value', 'text', $this->model->virtuemart_manufacturer_id);
?>

				<?php 
echo vmText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE');
?>
&nbsp;
					<input type="text" value="<?php 
echo $this->filter_product;
?>
" name="filter_product" size="25" />
				<?php 
echo $this->lists['search_type'];
echo $this->lists['search_order'];
echo vmJsApi::jDate($this->search_date, 'search_date');
echo $this->lists['vendors'];
?>
				<button  class="btn btn-small" onclick="this.form.submit();"><?php 
echo vmText::_('COM_VIRTUEMART_GO');
?>
</button>
				<button  class="btn btn-small" onclick="document.adminForm.filter_product.value=''; document.adminForm.search_type.options[0].selected = true;"><?php 
echo vmText::_('COM_VIRTUEMART_RESET');
?>
</button>

				<?php 
echo $this->pagination->getLimitBox();
?>
	</span>
示例#10
0
		<?php 
echo VmHTML::row('raw', 'com_tsmart_MANUFACTURER', $this->manufacturerList);
/* Mod. <mediaDESIGN> St.Kraft 2013-02-24 Herstellerrabatt */
?>

		<?php 
//echo VmHTML::row('booleanlist','com_tsmart_VISIBLE_FOR_SHOPPER','calc_shopper_published',$this->calc->calc_shopper_published);
?>
		<?php 
//echo VmHTML::row('booleanlist','com_tsmart_VISIBLE_FOR_VENDOR','calc_vendor_published',$this->calc->calc_vendor_published);
?>
		<?php 
echo VmHTML::row('raw', 'com_tsmart_START_DATE', vmJsApi::jDate($this->calc->publish_up, 'publish_up'));
?>
		<?php 
echo VmHTML::row('raw', 'com_tsmart_END_DATE', vmJsApi::jDate($this->calc->publish_down, 'publish_down'));
?>

        </table></fieldset>
		<?php 
if (!class_exists('vmCalculationPlugin')) {
    require VMPATH_PLUGINLIBS . DS . 'vmcalculationplugin.php';
}
JPluginHelper::importPlugin('vmcalculation');
$dispatcher = JDispatcher::getInstance();
$html = '';
$returnValues = $dispatcher->trigger('plgVmOnDisplayEdit', array(&$this->calc, &$html));
echo $html;
if ($this->showVendors()) {
    echo VmHTML::row('raw', 'com_tsmart_VENDOR', $this->vendorList);
}
示例#11
0
	/**
	 * @author Max Milbers
	 * @param $product
	 * @param $customfield
	 */
	public function displayProductCustomfieldFE (&$product, &$customfields) {

		static $idUnique = array();
		if (!class_exists ('calculationHelper')) {
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php');
		}
		$calculator = calculationHelper::getInstance ();

		$selectList = array();

		$dynChilds = 1; //= array();
		$session = JFactory::getSession ();
		$virtuemart_category_id = $session->get ('vmlastvisitedcategoryid', 0, 'vm');

		foreach($customfields as $k => &$customfield){

			if(!isset($customfield->display))$customfield->display = '';

			$calculator ->_product = $product;
			if (!class_exists ('vmCustomPlugin')) {
				require(VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php');
			}

			if ($customfield->field_type == "E") {

				JPluginHelper::importPlugin ('vmcustom');
				$dispatcher = JDispatcher::getInstance ();
				$ret = $dispatcher->trigger ('plgVmOnDisplayProductFEVM3', array(&$product, &$customfield));
				continue;
			}

			$fieldname = 'field['.$product->virtuemart_product_id.'][' . $customfield->virtuemart_customfield_id . '][customfield_value]';
			$customProductDataName = 'customProductData['.$product->virtuemart_product_id.']['.$customfield->virtuemart_custom_id.']';

			//This is a kind of fallback, setting default of custom if there is no value of the productcustom
			$customfield->customfield_value = empty($customfield->customfield_value) ? $customfield->custom_value : $customfield->customfield_value;

			$type = $customfield->field_type;

			$idTag = (int)$product->virtuemart_product_id.'-'.$customfield->virtuemart_customfield_id;

			if(!isset($idUnique[$idTag])){
				$idUnique[$idTag] = 0;
			}  else {
				$counter = $idUnique[$idTag]++;
				$idTag = $idTag.'-'.$counter;
			}
			$idTag = $idTag . 'customProductData';
			if (!class_exists ('CurrencyDisplay'))
				require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php');
			$currency = CurrencyDisplay::getInstance ();

			switch ($type) {

				case 'C':

					$html = '';

					$dropdowns = array();

					if(isset($customfield->options->{$product->virtuemart_product_id})){
						$productSelection = $customfield->options->{$product->virtuemart_product_id};
					} else {
						$productSelection = false;
					}


					$ignore = array();
					foreach($customfield->options as $product_id=>$variants){
						if(in_array($product_id,$ignore)) continue;
						foreach($variants as $k => $variant){
							if(!isset($dropdowns[$k]) or !is_array($dropdowns[$k])) $dropdowns[$k] = array();

							if(!in_array($variant,$dropdowns[$k])  ){
								if($k==0 or !$productSelection){
									$dropdowns[$k][] = $variant;
								} else if($k>0 and $productSelection[$k-1] == $variants[$k-1]){
									$dropdowns[$k][] = $variant;
								} else {
									$ignore[] = $product_id;
								}

							}
						}
					}

					//vmJsApi::chosenDropDowns();
					foreach($customfield->selectoptions as $k => $soption){
						$options = array();
						$selected = 0;
						foreach($dropdowns[$k] as $i=> $elem){

							$elem = trim((string)$elem);
							$options[] = array('value'=>$elem,'text'=>$elem);

							if($productSelection and $productSelection[$k] == $elem){
								$selected = $elem;
							}

						}
						$idTag .= 'cvard'.$k;
						$soption->slabel = empty($soption->clabel)? vmText::_('COM_VIRTUEMART_'.strtoupper($soption->voption)): vmText::_($soption->clabel);

						$html .= JHtml::_ ('select.genericlist', $options, $fieldname, 'class="vm-chzn-select cvselection" data-dynamic-update="1" ', "value", "text", $selected,$idTag);
					}


					$Itemid = vRequest::getInt('Itemid',''); // '&Itemid=127';
					if(!empty($Itemid)){
						$Itemid = '&Itemid='.$Itemid;
					}

					//create array for js
					$jsArray = array();

					$url = '';
					foreach($customfield->options as $product_id=>$variants){
						$url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id='.$product_id.$Itemid);
						$jsArray[] = '["'.$url.'","'.implode('","',$variants).'"]';
					}
					//vmdebug('my urls of child variants',$jsArray);
					$jsVariants = implode(',',$jsArray);
					vmJsApi::addJScript('cvselection',"
var cvselection = function($) {
	jQuery( function($) {
		$('.cvselection').change(function() {
			var variants = [".$jsVariants."];
			var selection = [];
			$('.cvselection').each(function() {
				selection[selection.length] = $(this).val();
				//console.log('My selection '+selection[selection.length-1]);
			});
			var index ;
			var i2 ;
			var hitcount;
			var runs;
			for	(runs = 0; runs < selection.length; index++) {
				for	(index = 0; index < variants.length; index++) {
					hitcount = 0;
					for	(i2 = 0; i2 < selection.length; i2++) {
						if(selection[i2]==variants[index][i2+1]){
							hitcount++;
							console.log('Attribute hit selection '+i2+' '+selection[i2]+' '+variants[index][i2+1] );
							if(hitcount == (selection.length-runs)){
								console.log('redirect to '+variants[index][0])

								//console.log('Set on selected option the attr url = '+variants[index][0]);
								jQuery(this).find(':selected').attr('url',variants[index][0]);
								jQuery(this).attr('url',variants[index][0]);

								i2 = selection.length+1;
								index = variants.length+1;
								runs = variants.length+1;
								break;
							}
						} else {
							break;
						}
					}
				}
				if(index>selection.length){
					break;
				}
				runs++;
				//console.log('Could not find product for selection ');
			}
		});
	})
};
cvselection();
jQuery('body').on('updateVirtueMartProductDetail', cvselection);
");
					//$html .= '<script type="text/javascript">'.$script.'</script>';

					//Now we need just the JS to reload the correct product
					$customfield->display = $html;
					break;

				case 'A':

					$html = '';
					//if($selectedFound) continue;
					$options = array();
					$productModel = VmModel::getModel ('product');

					//Note by Jeremy Magne (Daycounts) 2013-08-31
					//Previously the the product model is loaded but we need to ensure the correct product id is set because the getUncategorizedChildren does not get the product id as parameter.
					//In case the product model was previously loaded, by a related product for example, this would generate wrong uncategorized children list
					$productModel->setId($customfield->virtuemart_product_id);

					$uncatChildren = $productModel->getUncategorizedChildren ($customfield->withParent);

					if(!$customfield->withParent or ($customfield->withParent and $customfield->parentOrderable)){
						$options[0] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $customfield->virtuemart_product_id,FALSE), 'text' => vmText::_ ('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT'));
					}

					$selected = vRequest::getInt ('virtuemart_product_id',0);
					$selectedFound = false;

					if (empty($calculator) and $customfield->wPrice) {
						if (!class_exists ('calculationHelper'))
							require(VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php');
						$calculator = calculationHelper::getInstance ();
					}

					$parentStock = 0;
					foreach ($uncatChildren as $k => $child) {
						if(!isset($child[$customfield->customfield_value])){
							vmdebug('The child has no value at index '.$customfield->customfield_value,$customfield,$child);
						} else {

							$productChild = $productModel->getProduct((int)$child['virtuemart_product_id'],false);
							if(!$productChild) continue;
							$available = $productChild->product_in_stock - $productChild->product_ordered;
							if(VmConfig::get('stockhandle','none')=='disableit_children' and $available <= 0){
								continue;
							}
							$parentStock += $available;
							$priceStr = '';
							if($customfield->wPrice){
								//$product = $productModel->getProductSingle((int)$child['virtuemart_product_id'],false);
								$productPrices = $calculator->getProductPrices ($productChild);
								$priceStr =  ' (' . $currency->priceDisplay ($productPrices['salesPrice']) . ')';
							}
							$options[] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id']), 'text' => $child[$customfield->customfield_value].$priceStr);
							if($selected==$child['virtuemart_product_id']){
								$selectedFound = true;
								vmdebug($customfield->virtuemart_product_id.' $selectedFound by vRequest '.$selected);
							}
							//vmdebug('$child productId ',$child['virtuemart_product_id'],$customfield->customfield_value,$child);
						}
					}
					if(!$selectedFound){
						$pos = array_search($customfield->virtuemart_product_id, $product->allIds);
						if(isset($product->allIds[$pos-1])){
							$selected = $product->allIds[$pos-1];
							//vmdebug($customfield->virtuemart_product_id.' Set selected to - 1 allIds['.($pos-1).'] = '.$selected.' and count '.$dynChilds);
							//break;
						} elseif(isset($product->allIds[$pos])){
							$selected = $product->allIds[$pos];
							//vmdebug($customfield->virtuemart_product_id.' Set selected to allIds['.$pos.'] = '.$selected.' and count '.$dynChilds);
						} else {
							$selected = $customfield->virtuemart_product_id;
							//vmdebug($customfield->virtuemart_product_id.' Set selected to $customfield->virtuemart_product_id ',$selected,$product->allIds);
						}
					}

					$url = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id='.
						$virtuemart_category_id .'&virtuemart_product_id='. $selected;
					$html .= JHtml::_ ('select.genericlist', $options, $fieldname, 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="vm-chzn-select" data-dynamic-update="1" ', "value", "text",
						JRoute::_ ($url,false),$idTag);

					vmJsApi::chosenDropDowns();

					if($customfield->parentOrderable==0){
						if($product->product_parent_id==0){
							$product->orderable = FALSE;
						} else {
							$product->product_in_stock = $parentStock;
						}

					} else {


					}

					$dynChilds++;
					$customfield->display = $html;
					break;

				/*Date variant*/
				case 'D':
					if(empty($customfield->custom_value)) $customfield->custom_value = 'LC2';
					//Customer selects date
					if($customfield->is_input){
						$customfield->display =  '<span class="product_custom_date">' . vmJsApi::jDate ($customfield->customfield_value,$customProductDataName) . '</span>'; //vmJsApi::jDate($field->custom_value, 'field['.$row.'][custom_value]','field_'.$row.'_customvalue').$priceInput;
					}
					//Customer just sees a date
					else {
						$customfield->display =  '<span class="product_custom_date">' . vmJsApi::date ($customfield->customfield_value, $customfield->custom_value, TRUE) . '</span>';
					}

					break;
				/* text area or editor No vmText, only displayed in BE */
				case 'X':
				case 'Y':
					$customfield->display =  $customfield->customfield_value;
					break;
				/* string or integer */
				case 'B':
				case 'S':
				case 'M':

				if($type== 'M'){
					$selectType = 'select.radiolist';
					$class = '';
				} else {
					$selectType = 'select.genericlist';
					if(!empty($customfield->is_input)){
						vmJsApi::chosenDropDowns();
						$class = 'class="vm-chzn-select"';
					}
				}

					if($customfield->is_list){

						if(!empty($customfield->is_input)){

							$options = array();
							$values = explode (';', $customfield->custom_value);

							foreach ($values as $key => $val) {
								if($type == 'M'){
									$options[] = array('value' => $val, 'text' => $this->displayCustomMedia ($val));
								} else {
									$options[] = array('value' => $val, 'text' => vmText::_($val));
								}

							}

							$currentValue = $customfield->customfield_value;

							$customfield->display = JHtml::_ ($selectType, $options, $customProductDataName.'[' . $customfield->virtuemart_customfield_id . ']', $class, 'value', 'text', $currentValue,$idTag);
						} else {
							if($type == 'M'){
								$customfield->display =  $this->displayCustomMedia ($customfield->customfield_value);
							} else {
								$customfield->display =  vmText::_ ($customfield->customfield_value);
							}
						}
					} else {

						if(!empty($customfield->is_input)){

							if(!isset($selectList[$customfield->virtuemart_custom_id])) {
								$tmpField = clone($customfield);
								$tmpField->options = null;
								$customfield->options[$customfield->virtuemart_customfield_id] = $tmpField;
								$selectList[$customfield->virtuemart_custom_id] = $k;
								$customfield->customProductDataName = $customProductDataName;
							} else {
								$customfields[$selectList[$customfield->virtuemart_custom_id]]->options[$customfield->virtuemart_customfield_id] = $customfield;
								unset($customfields[$k]);
								//$customfield->options[$customfield->virtuemart_customfield_id] = $customfield;
							}

							$default = reset($customfields[$selectList[$customfield->virtuemart_custom_id]]->options);
							foreach ($customfields[$selectList[$customfield->virtuemart_custom_id]]->options as &$productCustom) {
								$price = self::_getCustomPrice($productCustom->customfield_price, $currency, $calculator);
								if($type == 'M'){
									$productCustom->text = $this->displayCustomMedia ($productCustom->customfield_value).' '.$price;
								} else {
									$trValue = vmText::_($productCustom->customfield_value);
									if($productCustom->customfield_value!=$trValue and strpos($trValue,'%1')!==false){
										$productCustom->text = vmText::sprintf($productCustom->customfield_value,$price);
									} else {
										$productCustom->text = $trValue.' '.$price;
									}
								}
							}


							$customfields[$selectList[$customfield->virtuemart_custom_id]]->display = JHtml::_ ($selectType, $customfields[$selectList[$customfield->virtuemart_custom_id]]->options,
								$customfields[$selectList[$customfield->virtuemart_custom_id]]->customProductDataName,
								$class, 'virtuemart_customfield_id', 'text', $default->customfield_value,$idTag);	//*/
						} else {
							if($type == 'M'){
								$customfield->display = $this->displayCustomMedia ($customfield->customfield_value);
							} else {
								$customfield->display =  vmText::_ ($customfield->customfield_value);
							}
						}
					}

					break;

				case 'Z':
					if(empty($customfield->customfield_value)) break;
					$html = '';
					$q = 'SELECT * FROM `#__virtuemart_categories_' . VmConfig::$vmlang . '` as l JOIN `#__virtuemart_categories` AS c using (`virtuemart_category_id`) WHERE `published`=1 AND l.`virtuemart_category_id`= "' . (int)$customfield->customfield_value . '" ';
					$db = JFactory::getDBO();
					$db->setQuery ($q);
					if ($category = $db->loadObject ()) {

						if(empty($category->virtuemart_category_id)) break;

						$q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_category_medias`WHERE `virtuemart_category_id`= "' . $category->virtuemart_category_id . '" ';
						$db->setQuery ($q);
						$thumb = '';
						if ($media_id = $db->loadResult ()) {
							$thumb = $this->displayCustomMedia ($media_id,'category');
						}
						$customfield->display = JHtml::link (JRoute::_ ('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id), $thumb . ' ' . $category->category_name, array('title' => $category->category_name,'target'=>'_blank'));
					}
					break;
				case 'R':
					if(empty($customfield->customfield_value)){
						$customfield->display = 'customfield related product has no value';
						break;
					}
					$pModel = VmModel::getModel('product');
					$related = $pModel->getProduct((int)$customfield->customfield_value,TRUE,$customfield->wPrice,TRUE,1);

					if(!$related) break;

					$thumb = '';
					if($customfield->wImage){
						if (!empty($related->virtuemart_media_id[0])) {
							$thumb = $this->displayCustomMedia ($related->virtuemart_media_id[0]).' ';
						} else {
							$thumb = $this->displayCustomMedia (0).' ';
						}
					}

					$customfield->display = shopFunctionsF::renderVmSubLayout('related',array('customfield'=>$customfield,'related'=>$related, 'thumb'=>$thumb));

					break;
			}
		}

	}
				<?php 
    $vendorId = JRequest::getInt('virtuemart_vendor_id', 1);
    echo ShopFunctions::renderVendorList($vendorId, false);
    ?>
			</div>
			<?php 
}
?>
		<div class="btn-group pull-right" style="clear:right;">
		<?php 
echo vmJsApi::jDate($this->until_period, 'until_period', '', true, '', JText::_('COM_VIRTUEMART_REPORT_UNTIL_PERIOD'));
?>
		</div>
		<div class="btn-group pull-right">
		<?php 
echo vmJsApi::jDate($this->from_period, 'from_period', '', true, '', JText::_('COM_VIRTUEMART_REPORT_FROM_PERIOD'));
?>
 
		</div>
		<div class="btn-group pull-right">
		<?php 
echo $this->lists['select_date'];
?>
		</div>

	</div>
	<div class="clearfix"> </div>
	<div id="results">
		<?php 
// split to use ajax search
echo $this->loadTemplate('results');
示例#13
0
 /**
  * @author Max Milbers
  * @param $product
  * @param $customfield
  */
 public function displayProductCustomfieldFE(&$product, &$customfields)
 {
     static $idUnique = array();
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     $selectList = array();
     $dynChilds = 1;
     //= array();
     $session = JFactory::getSession();
     $virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm');
     foreach ($customfields as $k => &$customfield) {
         if (!isset($customfield->display)) {
             $customfield->display = '';
         }
         $calculator->_product = $product;
         if (!class_exists('vmCustomPlugin')) {
             require JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php';
         }
         if ($customfield->field_type == "E") {
             JPluginHelper::importPlugin('vmcustom');
             $dispatcher = JDispatcher::getInstance();
             $ret = $dispatcher->trigger('plgVmOnDisplayProductFEVM3', array(&$product, &$customfield));
             continue;
         }
         $fieldname = 'field[' . $product->virtuemart_product_id . '][' . $customfield->virtuemart_customfield_id . '][customfield_value]';
         $customProductDataName = 'customProductData[' . $product->virtuemart_product_id . '][' . $customfield->virtuemart_custom_id . ']';
         //This is a kind of fallback, setting default of custom if there is no value of the productcustom
         $customfield->customfield_value = empty($customfield->customfield_value) ? $customfield->custom_value : $customfield->customfield_value;
         $type = $customfield->field_type;
         $idTag = (int) $product->virtuemart_product_id . '-' . $customfield->virtuemart_customfield_id;
         if (!isset($idUnique[$idTag])) {
             $idUnique[$idTag] = 0;
         } else {
             $counter = $idUnique[$idTag]++;
             $idTag = $idTag . '-' . $counter;
         }
         $idTag = $idTag . 'customProductData';
         if (!class_exists('CurrencyDisplay')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
         }
         $currency = CurrencyDisplay::getInstance();
         switch ($type) {
             case 'C':
                 $html = '';
                 $dropdowns = array();
                 if (isset($customfield->options->{$product->virtuemart_product_id})) {
                     $productSelection = $customfield->options->{$product->virtuemart_product_id};
                 } else {
                     $productSelection = false;
                 }
                 $ignore = array();
                 foreach ($customfield->options as $product_id => $variants) {
                     if (in_array($product_id, $ignore)) {
                         continue;
                     }
                     foreach ($variants as $k => $variant) {
                         if (!isset($dropdowns[$k]) or !is_array($dropdowns[$k])) {
                             $dropdowns[$k] = array();
                         }
                         if (!in_array($variant, $dropdowns[$k])) {
                             if ($k == 0 or !$productSelection) {
                                 $dropdowns[$k][] = $variant;
                             } else {
                                 if ($k > 0 and $productSelection[$k - 1] == $variants[$k - 1]) {
                                     vmdebug('my ', $variant, $productSelection[$k - 1]);
                                     $dropdowns[$k][] = $variant;
                                 } else {
                                     $ignore[] = $product_id;
                                 }
                             }
                         }
                     }
                 }
                 foreach ($customfield->selectoptions as $k => $soption) {
                     $options = array();
                     $selected = 0;
                     foreach ($dropdowns[$k] as $i => $elem) {
                         $elem = trim((string) $elem);
                         $options[] = array('value' => $elem, 'text' => $elem);
                         if ($productSelection and $productSelection[$k] == $elem) {
                             $selected = $elem;
                         }
                     }
                     $idTag .= 'cvard' . $k;
                     $soption->slabel = empty($soption->clabel) ? vmText::_('COM_VIRTUEMART_' . strtoupper($soption->voption)) : vmText::_($soption->clabel);
                     $html .= JHtml::_('select.genericlist', $options, $fieldname, 'class="vm-chzn-select cvselection" ', "value", "text", $selected, $idTag);
                 }
                 //vmdebug('displayProductCustomfieldFE my C', $customfield->options,$dropdowns);
                 //'http://vm3j2.stuprecht/en/?option=com_virtuemart&view=productdetails&virtuemart_product_id='+variants[index][0]+'&virtuemart_category_id=10&Itemid=127'
                 $Itemid = vRequest::getInt('Itemid', '');
                 // '&Itemid=127';
                 if (!empty($Itemid)) {
                     $Itemid = '&Itemid=' . $Itemid;
                 }
                 $url = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=';
                 //create array for js
                 $jsArray = array();
                 foreach ($customfield->options as $product_id => $variants) {
                     $jsArray[] = '["' . $product_id . '","' . implode('","', $variants) . '"]';
                 }
                 $jsVariants = implode(',', $jsArray);
                 $script = "\n\tjQuery( function(\$) {\n\t\t\$('.cvselection').change(function() {\n\t\t\t\tvar variants = [" . $jsVariants . "];\n\t\t\t\tvar selection = [];\n\t\t\t\t\$('.cvselection').each(function() {\n\t\t\t\t\tselection[selection.length] = \$(this).val();\n\t\t\t\t\tconsole.log('My selection '+selection[selection.length-1]);\n\t\t\t\t});\n\t\t\t\tvar Itemid = '" . $Itemid . "';\n\t\t\t\tvar url = '" . $url . "';\n\t\t\t\tvar index ;\n\t\t\t\tvar i2 ;\n\t\t\t\tvar hitcount;\n\t\t\t\tvar runs;\n\t\t\t\tfor\t(runs = 0; runs < selection.length; index++) {\n\t\t\t\t\tfor\t(index = 0; index < variants.length; index++) {\n\t\t\t\t\t\thitcount = 0;\n\t\t\t\t\t\tfor\t(i2 = 0; i2 < selection.length; i2++) {\n\t\t\t\t\t\t\t//console.log('hmm '+variants[index][i2+1]+' selection '+selection[i2]);\n\t\t\t\t\t\t\tif(selection[i2]==variants[index][i2+1]){\n\t\t\t\t\t\t\t\thitcount++;\n\t\t\t\t\t\t\t\tconsole.log('Attribute hit selection '+i2+' '+selection[i2]+' '+variants[index][i2+1] );\n\t\t\t\t\t\t\t\tif(hitcount == (selection.length-runs)){\n\t\t\t\t\t\t\t\t\tconsole.log('Product found '+variants[index][0]+' '+variants[index][1]+' '+variants[index][2]);\n\t\t\t\t\t\t\t\t\tconsole.log('Would redirect to '+url+variants[index][0])\n\t\t\t\t\t\t\t\t\t//break;\n\t\t\t\t\t\t\t\t\twindow.top.location.href=url+variants[index][0]+Itemid;\n\t\t\t\t\t\t\t\t\ti2 = 200;\n\t\t\t\t\t\t\t\t\tindex = 200;\n\t\t\t\t\t\t\t\t\truns = 200;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\truns++;\n\t\t\t\t\tconsole.log('Could not find product for selection ');\n\t\t\t\t}\n\n\t\t\t});\n\t\t});\n\t";
                 $html .= '<script type="text/javascript">' . $script . '</script>';
                 //Now we need just the JS to reload the correct product
                 $customfield->display = $html;
                 break;
             case 'A':
                 $html = '';
                 //if($selectedFound) continue;
                 $options = array();
                 $productModel = VmModel::getModel('product');
                 //Note by Jeremy Magne (Daycounts) 2013-08-31
                 //Previously the the product model is loaded but we need to ensure the correct product id is set because the getUncategorizedChildren does not get the product id as parameter.
                 //In case the product model was previously loaded, by a related product for example, this would generate wrong uncategorized children list
                 $productModel->setId($customfield->virtuemart_product_id);
                 $uncatChildren = $productModel->getUncategorizedChildren($customfield->withParent);
                 if (!$customfield->withParent or $customfield->withParent and $customfield->parentOrderable) {
                     $options[0] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $customfield->virtuemart_product_id, FALSE), 'text' => vmText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT'));
                 }
                 $selected = vRequest::getInt('virtuemart_product_id', 0);
                 $selectedFound = false;
                 $customfield->withPrices = false;
                 if (empty($calculator) and $customfield->withPrices) {
                     if (!class_exists('calculationHelper')) {
                         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
                     }
                     $calculator = calculationHelper::getInstance();
                 }
                 $parentStock = 0;
                 foreach ($uncatChildren as $k => $child) {
                     if (!isset($child[$customfield->customfield_value])) {
                         vmdebug('The child has no value at index ' . $customfield->customfield_value, $customfield, $child);
                     } else {
                         $productChild = $productModel->getProduct((int) $child['virtuemart_product_id'], false);
                         if (!$productChild) {
                             continue;
                         }
                         $available = $productChild->product_in_stock - $productChild->product_ordered;
                         if (VmConfig::get('stockhandle', 'none') == 'disableit_children' and $available <= 0) {
                             continue;
                         }
                         $parentStock += $available;
                         $priceStr = '';
                         if ($customfield->withPrices) {
                             //$product = $productModel->getProductSingle((int)$child['virtuemart_product_id'],false);
                             $productPrices = $calculator->getProductPrices($productChild);
                             $priceStr = ' (' . $currency->priceDisplay($productPrices['salesPrice']) . ')';
                         }
                         $options[] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id']), 'text' => $child[$customfield->customfield_value] . $priceStr);
                         if ($selected == $child['virtuemart_product_id']) {
                             $selectedFound = true;
                             vmdebug($customfield->virtuemart_product_id . ' $selectedFound by vRequest ' . $selected);
                         }
                         //vmdebug('$child productId ',$child['virtuemart_product_id'],$customfield->customfield_value,$child);
                     }
                 }
                 if (!$selectedFound) {
                     $pos = array_search($customfield->virtuemart_product_id, $product->allIds);
                     if (isset($product->allIds[$pos - 1])) {
                         $selected = $product->allIds[$pos - 1];
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to - 1 allIds['.($pos-1).'] = '.$selected.' and count '.$dynChilds);
                         //break;
                     } elseif (isset($product->allIds[$pos])) {
                         $selected = $product->allIds[$pos];
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to allIds['.$pos.'] = '.$selected.' and count '.$dynChilds);
                     } else {
                         $selected = $customfield->virtuemart_product_id;
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to $customfield->virtuemart_product_id ',$selected,$product->allIds);
                     }
                 }
                 $url = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $selected;
                 $html .= JHtml::_('select.genericlist', $options, $fieldname, 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="vm-chzn-select" data-dynamic-update="1" ', "value", "text", JRoute::_($url, false), $idTag);
                 if ($customfield->parentOrderable == 0) {
                     if ($product->product_parent_id == 0) {
                         $product->orderable = FALSE;
                     } else {
                         $product->product_in_stock = $parentStock;
                     }
                 } else {
                 }
                 $dynChilds++;
                 $customfield->display = $html;
                 break;
                 /*Date variant*/
             /*Date variant*/
             case 'D':
                 if (empty($customfield->custom_value)) {
                     $customfield->custom_value = 'LC2';
                 }
                 //Customer selects date
                 if ($customfield->is_input) {
                     $customfield->display = '<span class="product_custom_date">' . vmJsApi::jDate($customfield->customfield_value, $customProductDataName) . '</span>';
                     //vmJsApi::jDate($field->custom_value, 'field['.$row.'][custom_value]','field_'.$row.'_customvalue').$priceInput;
                 } else {
                     $customfield->display = '<span class="product_custom_date">' . vmJsApi::date($customfield->customfield_value, $customfield->custom_value, TRUE) . '</span>';
                 }
                 break;
                 /* text area or editor No vmText, only displayed in BE */
             /* text area or editor No vmText, only displayed in BE */
             case 'X':
             case 'Y':
                 $customfield->display = $customfield->customfield_value;
                 break;
                 /* string or integer */
             /* string or integer */
             case 'B':
             case 'S':
                 if ($customfield->is_list) {
                     /*if($type=='B'){
                     			if ($customfield->customfield_value == 0){
                     				$customfield->customfield_value =  'JNO';
                     			} else {
                     				$customfield->customfield_value =  'JYES';
                     			}
                     		}*/
                     //vmdebug('case S $customfield->is_list',$customfield->customfield_value);
                     if (!empty($customfield->is_input)) {
                         $options = array();
                         $values = explode(';', $customfield->custom_value);
                         foreach ($values as $key => $val) {
                             $options[] = array('value' => $val, 'text' => $val);
                         }
                         $currentValue = $customfield->customfield_value;
                         $customfield->display = JHtml::_('select.genericlist', $options, $customProductDataName, NULL, 'value', 'text', $currentValue, $idTag);
                         //$customfield->display =  '<input type="text" readonly value="' . vmText::_ ($customfield->customfield_value) . '" name="'.$customProductDataName.'" /> ' . vmText::_ ('COM_VIRTUEMART_CART_PRICE') . $price . ' ';
                     } else {
                         $customfield->display = vmText::_($customfield->customfield_value);
                     }
                 } else {
                     if (!empty($customfield->is_input)) {
                         if (!isset($selectList[$customfield->virtuemart_custom_id])) {
                             $tmpField = clone $customfield;
                             $tmpField->options = null;
                             $customfield->options[$customfield->virtuemart_customfield_id] = $tmpField;
                             $selectList[$customfield->virtuemart_custom_id] = $k;
                             $customfield->customProductDataName = $customProductDataName;
                         } else {
                             $customfields[$selectList[$customfield->virtuemart_custom_id]]->options[$customfield->virtuemart_customfield_id] = $customfield;
                             unset($customfields[$k]);
                             //$customfield->options[$customfield->virtuemart_customfield_id] = $customfield;
                         }
                         /*
                         							$options = $this->getCustomEmbeddedProductCustomFields($product->allIds,$customfield->virtuemart_custom_id);
                         							//vmdebug('getProductCustomsFieldCart options',$options,$product->allIds);
                         							$customfield->options = array();
                         							foreach ($options as $option) {
                         								$customfield->options[$option->virtuemart_customfield_id] = $option;
                         							}
                         */
                         $default = reset($customfields[$selectList[$customfield->virtuemart_custom_id]]->options);
                         foreach ($customfields[$selectList[$customfield->virtuemart_custom_id]]->options as &$productCustom) {
                             $price = self::_getCustomPrice($productCustom->customfield_price, $currency, $calculator);
                             $productCustom->text = $productCustom->customfield_value . ' ' . $price;
                             //$productCustom->formname = '['.$productCustom->virtuemart_customfield_id.'][selected]';
                         }
                         //$customfield->display
                         $customfields[$selectList[$customfield->virtuemart_custom_id]]->display = JHtml::_('select.genericlist', $customfields[$selectList[$customfield->virtuemart_custom_id]]->options, $customfields[$selectList[$customfield->virtuemart_custom_id]]->customProductDataName, 'class="vm-chzn-select"', 'virtuemart_customfield_id', 'text', $default->customfield_value, $idTag);
                         //*/
                     } else {
                         $customfield->display = vmText::_($customfield->customfield_value);
                     }
                 }
                 break;
                 /* parent The parent has a display in the FE?*/
             /* parent The parent has a display in the FE?*/
             case 'G':
                 //$customfield->display =  '<span class="product_custom_parent">' . vmText::_ ($value) . '</span>';
                 break;
                 // image
             // image
             case 'M':
                 $customfield->display = $this->displayCustomMedia($customfield->customfield_value);
                 break;
             case 'Z':
                 $html = '';
                 $q = 'SELECT * FROM `#__virtuemart_categories_' . VmConfig::$vmlang . '` as l JOIN `#__virtuemart_categories` AS c using (`virtuemart_category_id`) WHERE `published`=1 AND l.`virtuemart_category_id`= "' . (int) $customfield->customfield_value . '" ';
                 $db = JFactory::getDBO();
                 $db->setQuery($q);
                 if ($category = $db->loadObject()) {
                     $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_category_medias`WHERE `virtuemart_category_id`= "' . $category->virtuemart_category_id . '" ';
                     $db->setQuery($q);
                     $thumb = '';
                     if ($media_id = $db->loadResult()) {
                         $thumb = $this->displayCustomMedia($media_id, 'category');
                     }
                     $customfield->display = JHtml::link(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id), $thumb . ' ' . $category->category_name, array('title' => $category->category_name));
                 }
                 break;
             case 'R':
                 if (empty($customfield->customfield_value)) {
                     $customfield->display = 'customfield related product has no value';
                     break;
                 }
                 $pModel = VmModel::getModel('product');
                 $related = $pModel->getProduct((int) $customfield->customfield_value, FALSE, FALSE, TRUE, 1);
                 if (!$related) {
                     break;
                 }
                 if (!empty($related->virtuemart_media_id[0])) {
                     $thumb = $this->displayCustomMedia($related->virtuemart_media_id[0]) . ' ';
                 } else {
                     $thumb = $this->displayCustomMedia(0) . ' ';
                 }
                 //juri::root() For whatever reason, we used this here, maybe it was for the mails
                 $customfield->display = JHtml::link(JRoute::_('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'));
                 break;
         }
     }
 }
示例#14
0
                                    </select>

                                </td>
                            </tr>
                            <tr>
                                <td>Sale periol</td>
                                <td>From</td>
                                <td nowrap>
                                    <?php 
    echo vmJsApi::jDate($this->price->sale_period_from, 'sale_period_from');
    ?>
                                </td>
                                <td>To</td>
                                <td nowrap>
                                    <?php 
    echo vmJsApi::jDate($this->price->sale_period_to, 'sale_period_to');
    ?>
                                </td>

                            </tr>
                            <tr>
                                <td colspan="2">
                                    <button class="btn btn-small btn-success" onclick="Joomla.submitbutton('apply')">
                                        <span class="icon-apply icon-white"></span>
                                        add new price</button>
                                </td>
                            </tr>

                        </table>

                    </div>
示例#15
0
if (!empty($this->DATaxRules)) {
    echo vmText::_('COM_VIRTUEMART_RULES_EFFECTING') . '<br />' . $this->DATaxRules;
}
// 						vmdebug('my rules',$this->DBTaxRules,$this->DATaxRules); echo vmText::_('COM_VIRTUEMART_PRODUCT_FORM_DISCOUNT_EFFECTING').$this->DBTaxRules;
?>
						</span>
        </td>
		<td style="background: #d5d5d5;padding:0;width:1px;"></td>
        <td  nowrap>
			<?php 
echo vmJsApi::jDate($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_up'], 'mprices[product_price_publish_up][]');
?>
        </td>
        <td  nowrap>
			<?php 
echo vmJsApi::jDate($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_down'], 'mprices[product_price_publish_down][]');
?>
        </td>
    </tr>

<?php 
$rowColor = 1 - $rowColor;
?>
    <tr class="row<?php 
echo $rowColor;
?>
">

        <td width="60px">
            <div style="text-align: right; font-weight: bold;">
				<span
if (!empty($this->DATaxRules)) {
    echo JText::_('COM_VIRTUEMART_RULES_EFFECTING') . '<br />' . $this->DATaxRules;
}
// 						vmdebug('my rules',$this->DBTaxRules,$this->DATaxRules); echo JText::_('COM_VIRTUEMART_PRODUCT_FORM_DISCOUNT_EFFECTING').$this->DBTaxRules;
?>
						</span>
        </td>
		<td style="background: #d5d5d5;padding:0;width:1px;"></td>
        <td  nowrap>
			<?php 
echo vmJsApi::jDate($this->tempProduct->product_price_publish_up, 'mprices[product_price_publish_up][]');
?>
        </td>
        <td  nowrap>
			<?php 
echo vmJsApi::jDate($this->tempProduct->product_price_publish_down, 'mprices[product_price_publish_down][]');
?>
        </td>
    </tr>

<?php 
$rowColor = 1 - $rowColor;
?>
    <tr class="row<?php 
echo $rowColor;
?>
">

        <td width="60px">
            <div style="text-align: right; font-weight: bold;">
				<span
		<?php 
echo VmHTML::row('raw', 'COM_VIRTUEMART_MANUFACTURER', $this->manufacturerList);
/* Mod. <mediaDESIGN> St.Kraft 2013-02-24 Herstellerrabatt */
?>

		<?php 
//echo VmHTML::row('booleanlist','COM_VIRTUEMART_VISIBLE_FOR_SHOPPER','calc_shopper_published',$this->calc->calc_shopper_published);
?>
		<?php 
//echo VmHTML::row('booleanlist','COM_VIRTUEMART_VISIBLE_FOR_VENDOR','calc_vendor_published',$this->calc->calc_vendor_published);
?>
		<?php 
echo VmHTML::row('raw', 'COM_VIRTUEMART_START_DATE', vmJsApi::jDate($this->calc->publish_up, 'publish_up'));
?>
		<?php 
echo VmHTML::row('raw', 'COM_VIRTUEMART_END_DATE', vmJsApi::jDate($this->calc->publish_down, 'publish_down'));
?>
		<?php 
if (Vmconfig::get('multix', 'none') !== 'none' and $this->perms->check('admin')) {
    echo VmHTML::row('raw', 'COM_VIRTUEMART_VENDOR', $this->vendorList);
}
?>
        </table></fieldset>
		<?php 
if (!class_exists('vmCalculationPlugin')) {
    require JPATH_VM_PLUGINS . DS . 'vmcalculationplugin.php';
}
JPluginHelper::importPlugin('vmcalculation');
$dispatcher = JDispatcher::getInstance();
$html = '';
$returnValues = $dispatcher->trigger('plgVmOnDisplayEdit', array(&$this->calc, &$html));
示例#18
0
    /**
     * Formatting admin display by roles
     * input Types for product only !
     * $field->is_cart_attribute if can have a price
     */
    public function inputType($field, $product_id, $row)
    {
        $field->custom_value = empty($field->custom_value) ? $field->value : $field->custom_value;
        if ($field->is_cart_attribute) {
            $priceInput = '<input type="text" value="' . (isset($field->custom_price) ? $field->custom_price : '0') . '" name="field[' . $row . '][custom_price]" />';
        } else {
            $priceInput = ' ';
        }
        if ($field->is_list) {
            $options = array();
            $values = explode(';', $field->custom_value);
            foreach ($values as $key => $val) {
                $options[] = array('value' => $val, 'text' => $val);
            }
            return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]') . '</td><td>' . $priceInput;
        } else {
            switch ($field->field_type) {
                case 'A':
                    $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_FORM_SKU'));
                    $options[] = array('value' => 'slug', 'text' => JText::_('COM_VIRTUEMART_PRODUCT_FORM_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'));
                    return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', '', 'value', 'text', $field->custom_value) . '</td><td>' . $priceInput;
                    // 					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" 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]" />';
                    if (!class_exists('vmCustomPlugin')) {
                        require JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php';
                    }
                    JPluginHelper::importPlugin('vmcustom', $field->custom_element);
                    $dispatcher = JDispatcher::getInstance();
                    $retValue = '';
                    $dispatcher->trigger('plgVmOnProductEdit', array($field, $product_id, &$row, &$retValue));
                    return $html . $retValue . $priceInput;
                    break;
                case 'D':
                    return vmJsApi::jDate($field->custom_value, 'field[' . $row . '][custom_value]', 'field_' . $row . '_customvalue') . $priceInput;
                    break;
                case 'T':
                    //TODO Patrick
                    return '<input type="text" value="' . $field->custom_value . '" name="field[' . $row . '][custom_value]" /></td><td>' . $priceInput;
                    break;
                    /* string or integer */
                /* string or integer */
                case 'S':
                case 'I':
                    return '<input type="text" value="' . $field->custom_value . '" name="field[' . $row . '][custom_value]" /></td><td>' . $priceInput;
                    break;
                case 'I':
                    return '<input type="text" value="' . $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();
                    $_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);
                        }
                        $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), $thumb . ' ' . $category->category_name, array('title' => $category->category_name)) . $display;
                    } else {
                        return 'no result';
                    }
                    /* related product*/
                /* related product*/
                case 'R':
                    if (!$field->custom_value) {
                        return '';
                    }
                    $q = 'SELECT `product_name`,`product_sku`,`product_s_desc` FROM `#__virtuemart_products_' . VMLANG . '` as l JOIN `#__virtuemart_products` AS p using (`virtuemart_product_id`) WHERE `virtuemart_product_id`=' . (int) $field->custom_value;
                    $this->_db->setQuery($q);
                    $related = $this->_db->loadObject();
                    $display = $related->product_name . '(' . $related->product_sku . ')';
                    $display = '<input type="hidden" value="' . $field->custom_value . '" name="field[' . $row . '][custom_value]" />';
                    $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_product_medias`WHERE `virtuemart_product_id`= "' . (int) $field->custom_value . '" AND (`ordering` = 0 OR `ordering` = 1)';
                    $this->_db->setQuery($q);
                    $thumb = '';
                    if ($media_id = $this->_db->loadResult()) {
                        $thumb = $this->displayCustomMedia($media_id);
                    }
                    return $display . JHTML::link(JRoute::_('index.php?option=com_virtuemart&view=product&task=edit&virtuemart_product_id=' . $field->custom_value), $thumb . '<br /> ' . $related->product_name, array('title' => $related->product_name . '<br/>' . $related->product_s_desc));
                    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;*/
            }
        }
    }
示例#19
0
 /**
  * Return an array with userFields in several formats.
  *
  * @access public
  * @param $_selection An array, as returned by getuserFields(), with fields that should be returned.
  * @param $_userData Array with userdata holding the values for the fields
  * @param $_prefix string Optional prefix for the formtag name attribute
  * @author Oscar van Eijk
  * @return array List with all userfield data in the format:
  * array(
  *    'fields' => array(   // All fields
  *                   <fieldname> => array(
  *                                     'name' =>       // Name of the field
  *                                     'value' =>      // Existing value for the current user, or the default
  *                                     'title' =>      // Title used for label and such
  *                                     'type' =>       // Field type as specified in the userfields table
  *                                     'hidden' =>     // True/False
  *                                     'required' =>   // True/False. If True, the formcode also has the class "required" for the Joomla formvalidator
  *                                     'formcode' =>   // Full HTML tag
  *                                  )
  *                   [...]
  *                )
  *    'functions' => array() // Optional javascript functions without <script> tags.
  *                           // Possible usage: if (count($ar('functions')>0) echo '<script ...>'.join("\n", $ar('functions')).'</script>;
  *    'scripts'   => array(  // Array with scriptsources for use with JHTML::script();
  *                      <name> => <path>
  *                      [...]
  *                   )
  *    'links'     => array(  // Array with stylesheets for use with JHTML::stylesheet();
  *                      <name> => <path>
  *                      [...]
  *                   )
  * )
  * @example This example illustrates the use of this function. For additional examples, see the Order view
  * and the User view in the administrator section.
  * <pre>
  *   // In the controller, make sure this model is loaded.
  *   // In view.html.php, make the following calls:
  *   $_usrDetails = getUserDetailsFromSomeModel(); // retrieve an user_info record, eg from the usermodel or ordermodel
  *   $_usrFieldList = $userFieldsModel->getUserFields(
  *                    'registration'
  *                  , array() // Default switches
  *                  , array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type') // Skips
  *    );
  *   $usrFieldValues = $userFieldsModel->getUserFieldsFilled(
  *                      $_usrFieldList
  *                     ,$_usrDetails
  *   );
  *   $this->assignRef('userfields', $userfields);
  *   // In the template, use code below to display the data. For an extended example using
  *   // delimiters, JavaScripts and StyleSheets, see the edit_shopper.php in the user view
  *   <table class="admintable" width="100%">
  *     <thead>
  *       <tr>
  *         <td class="key" style="text-align: center;"  colspan="2">
  *            <?php echo JText::_('COM_VIRTUEMART_TABLE_HEADER') ?>
  *         </td>
  *       </tr>
  *     </thead>
  *      <?php
  *        foreach ($this->shipmentfields['fields'] as $_field ) {
  *          echo '  <tr>'."\n";
  *          echo '    <td class="key">'."\n";
  *          echo '      '.$_field['title']."\n";
  *          echo '    </td>'."\n";
  *          echo '    <td>'."\n";
  *
  *          echo '      '.$_field['value']."\n";    // Display only
  *       Or:
  *          echo '      '.$_field['formcode']."\n"; // Input form
  *
  *          echo '    </td>'."\n";
  *          echo '  </tr>'."\n";
  *        }
  *      ?>
  *    </table>
  * </pre>
  */
 public function getUserFieldsFilled($_selection, $_userData = null, $_prefix = '')
 {
     if (!class_exists('ShopFunctions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
     }
     $_return = array('fields' => array(), 'functions' => array(), 'scripts' => array(), 'links' => array());
     // 		vmdebug('my user data in getUserFieldsFilled',$_selection,$_userData);
     $_userData = (array) $_userData;
     if (is_array($_selection)) {
         foreach ($_selection as $_fld) {
             $_return['fields'][$_fld->name] = array('name' => $_prefix . $_fld->name, 'value' => $_userData == null || !array_key_exists($_fld->name, $_userData) ? $_fld->default : @$_userData[$_fld->name], 'title' => JText::_($_fld->title), 'type' => $_fld->type, 'required' => $_fld->required, 'hidden' => false, 'formcode' => '');
             // 				vmdebug ('getUserFieldsFilled',$_fld->name);
             // 			if($_fld->name==='email') vmdebug('user data email getuserfieldbyuser',$_userData);
             // First, see if there are predefined fields by checking the name
             switch ($_fld->name) {
                 // 				case 'email':
                 // 					$_return['fields'][$_fld->name]['formcode'] = $_userData->email;
                 // 					break;
                 case 'virtuemart_country_id':
                     $_return['fields'][$_fld->name]['formcode'] = ShopFunctions::renderCountryList($_return['fields'][$_fld->name]['value'], false, array(), $_prefix, $_fld->required);
                     // Translate the value from ID to name
                     $_return['fields'][$_fld->name]['value'] = shopFunctions::getCountryByID($_return['fields'][$_fld->name]['value']);
                     break;
                 case 'virtuemart_state_id':
                     $_return['fields'][$_fld->name]['formcode'] = shopFunctions::renderStateList($_return['fields'][$_fld->name]['value'], $_prefix, false, $_fld->required);
                     $_return['fields'][$_fld->name]['value'] = shopFunctions::getStateByID($_return['fields'][$_fld->name]['value']);
                     break;
                     //case 'agreed':
                     //	$_return['fields'][$_fld->name]['formcode'] = '<input type="checkbox" id="'.$_prefix.'agreed_field" name="'.$_prefix.'agreed" value="1" '
                     //		. ($_fld->required ? ' class="required"' : '') . ' />';
                     //	break;
                 //case 'agreed':
                 //	$_return['fields'][$_fld->name]['formcode'] = '<input type="checkbox" id="'.$_prefix.'agreed_field" name="'.$_prefix.'agreed" value="1" '
                 //		. ($_fld->required ? ' class="required"' : '') . ' />';
                 //	break;
                 case 'password':
                 case 'password2':
                     $_return['fields'][$_fld->name]['formcode'] = '<input type="password" id="' . $_prefix . $_fld->name . '_field" name="' . $_prefix . $_fld->name . '" size="30" class="inputbox" />' . "\n";
                     break;
                 case 'agreed':
                     $_return['fields'][$_fld->name]['formcode'] = '<input type="checkbox" name="' . $_prefix . $_fld->name . '" id="' . $_prefix . $_fld->name . '_field" value="1" ' . ($_return['fields'][$_fld->name]['value'] ? 'checked="checked"' : '') . '/>';
                     break;
                     // It's not a predefined field, so handle it by it's fieldtype
                 // It's not a predefined field, so handle it by it's fieldtype
                 default:
                     if (strpos($_fld->type, 'plugin') !== false) {
                         JPluginHelper::importPlugin('vmuserfield');
                         $dispatcher = JDispatcher::getInstance();
                         $dispatcher->trigger('plgVmOnUserfieldDisplay', array($_prefix, $_fld, &$_return));
                         break;
                     }
                     switch ($_fld->type) {
                         case 'hidden':
                             $_return['fields'][$_fld->name]['formcode'] = '<input type="hidden" id="' . $_prefix . $_fld->name . '_field" name="' . $_prefix . $_fld->name . '" size="' . $_fld->size . '" value="' . $_return['fields'][$_fld->name]['value'] . '" ' . ($_fld->required ? ' class="required"' : '') . ($_fld->maxlength ? ' maxlength="' . $_fld->maxlength . '"' : '') . ($_fld->readonly ? ' readonly="readonly"' : '') . ' /> ';
                             $_return['fields'][$_fld->name]['hidden'] = true;
                             break;
                         case 'date':
                         case 'age_verification':
                             //echo JHTML::_('behavior.calendar');
                             /*
                              * TODO We must add the joomla.javascript here that contains the calendar,
                              * since Joomla does not load it when there's no user logged in.
                              * Gotta find out why... some security issue or a bug???
                              * Note by Oscar
                              */
                             // if ($_userData === null) { // Not logged in
                             // $_doc = JFactory::getDocument();
                             // $_doc->addScript( JURI::root(true).'/includes/js/joomla.javascript.js');
                             // }
                             $currentYear = date('Y');
                             $calendar = vmJsApi::jDate($_return['fields'][$_fld->name]['value'], $_prefix . $_fld->name, $_prefix . $_fld->name . '_field', false, $currentYear - 100 . ':' . $currentYear);
                             $_return['fields'][$_fld->name]['formcode'] = $calendar;
                             break;
                         case 'emailaddress':
                             if (empty($_return['fields'][$_fld->name]['value'])) {
                                 $_return['fields'][$_fld->name]['value'] = JFactory::getUser()->email;
                             }
                             // 							vmdebug('emailaddress',$_fld);
                         // 							vmdebug('emailaddress',$_fld);
                         case 'text':
                         case 'webaddress':
                             $_return['fields'][$_fld->name]['formcode'] = '<input type="text" id="' . $_prefix . $_fld->name . '_field" name="' . $_prefix . $_fld->name . '" size="' . $_fld->size . '" value="' . $_return['fields'][$_fld->name]['value'] . '" ' . ($_fld->required ? ' class="required"' : '') . ($_fld->maxlength ? ' maxlength="' . $_fld->maxlength . '"' : '') . ($_fld->readonly ? ' readonly="readonly"' : '') . ' /> ';
                             break;
                         case 'textarea':
                             $_return['fields'][$_fld->name]['formcode'] = '<textarea id="' . $_prefix . $_fld->name . '_field" name="' . $_prefix . $_fld->name . '" cols="' . $_fld->cols . '" rows="' . $_fld->rows . '" class="inputbox" ' . ($_fld->readonly ? ' readonly="readonly"' : '') . '>' . $_return['fields'][$_fld->name]['value'] . '</textarea>';
                             break;
                         case 'editorta':
                             jimport('joomla.html.editor');
                             $editor = JFactory::getEditor();
                             $_return['fields'][$_fld->name]['formcode'] = $editor->display($_prefix . $_fld->name, $_return['fields'][$_fld->name]['value'], 300, 150, $_fld->cols, $_fld->rows);
                             break;
                         case 'checkbox':
                             $_return['fields'][$_fld->name]['formcode'] = '<input type="checkbox" name="' . $_prefix . $_fld->name . '" id="' . $_prefix . $_fld->name . '_field" value="1" ' . ($_return['fields'][$_fld->name]['value'] ? 'checked="checked"' : '') . '/>';
                             break;
                             // /*##mygruz20120223193710 { :*/
                             // case 'userfieldplugin': //why not just vmuserfieldsplugin ?
                             // JPluginHelper::importPlugin('vmuserfield');
                             // $dispatcher = JDispatcher::getInstance();
                             // //Todo to adjust to new pattern, using &
                             // $html = '' ;
                             // $dispatcher->trigger('plgVmOnUserFieldDisplay',array($_return['fields'][$_fld->name], &$html) );
                             // $_return['fields'][$_fld->name]['formcode'] = $html;
                             // break;
                             // /*##mygruz20120223193710 } */
                         // /*##mygruz20120223193710 { :*/
                         // case 'userfieldplugin': //why not just vmuserfieldsplugin ?
                         // JPluginHelper::importPlugin('vmuserfield');
                         // $dispatcher = JDispatcher::getInstance();
                         // //Todo to adjust to new pattern, using &
                         // $html = '' ;
                         // $dispatcher->trigger('plgVmOnUserFieldDisplay',array($_return['fields'][$_fld->name], &$html) );
                         // $_return['fields'][$_fld->name]['formcode'] = $html;
                         // break;
                         // /*##mygruz20120223193710 } */
                         case 'multicheckbox':
                         case 'select':
                         case 'multiselect':
                         case 'radio':
                             $_qry = 'SELECT fieldtitle, fieldvalue ' . 'FROM #__virtuemart_userfield_values ' . 'WHERE virtuemart_userfield_id = ' . $_fld->virtuemart_userfield_id . ' ORDER BY ordering ';
                             $_values = $this->_getList($_qry);
                             // We need an extra lok here, especially for the Bank info; the values
                             // must be translated.
                             // Don't check on the field name though, since others might be added in the future :-(
                             foreach ($_values as $_v) {
                                 $_v->fieldtitle = JText::_($_v->fieldtitle);
                             }
                             $_attribs = array();
                             if ($_fld->readonly) {
                                 $_attribs['readonly'] = 'readonly';
                             }
                             if ($_fld->required) {
                                 $_attribs['class'] = 'required';
                             }
                             if ($_fld->type == 'radio') {
                                 $_selected = $_return['fields'][$_fld->name]['value'];
                             } else {
                                 $_attribs['size'] = $_fld->size;
                                 // Use for all but radioselects
                                 $_selected = explode("|*|", $_return['fields'][$_fld->name]['value']);
                             }
                             // Nested switch...
                             switch ($_fld->type) {
                                 case 'multicheckbox':
                                     $_return['fields'][$_fld->name]['formcode'] = '';
                                     $_idx = 0;
                                     $rows = $_fld->rows;
                                     $row = 1;
                                     foreach ($_values as $_val) {
                                         if ($row > $rows) {
                                             $row = 1;
                                             $br = '<br />';
                                         } else {
                                             $row++;
                                             $br = '';
                                         }
                                         $_return['fields'][$_fld->name]['formcode'] .= '<input type="checkbox" name="' . $_prefix . $_fld->name . '[]" id="' . $_prefix . $_fld->name . '_field' . $_idx . '" value="' . $_val->fieldvalue . '" ' . (in_array($_val->fieldvalue, $_selected) ? 'checked="checked"' : '') . '/> ' . JText::_($_val->fieldtitle) . $br;
                                         $_idx++;
                                     }
                                     break;
                                 case 'select':
                                     $_return['fields'][$_fld->name]['formcode'] = JHTML::_('select.genericlist', $_values, $_prefix . $_fld->name, $_attribs, 'fieldvalue', 'fieldtitle', $_selected[0]);
                                     break;
                                 case 'multiselect':
                                     $_attribs['multiple'] = 'multiple';
                                     $_attribs['rows'] = $_fld->rows;
                                     $_attribs['cols'] = $_fld->cols;
                                     $_return['fields'][$_fld->name]['formcode'] = JHTML::_('select.genericlist', $_values, $_prefix . $_fld->name . '[]', $_attribs, 'fieldvalue', 'fieldtitle', $_selected);
                                     break;
                                 case 'radio':
                                     $_return['fields'][$_fld->name]['formcode'] = JHTML::_('select.radiolist', $_values, $_prefix . $_fld->name, $_attribs, $_selected, 'fieldvalue', 'fieldtitle');
                                     break;
                             }
                             break;
                     }
                     break;
             }
         }
     } else {
         vmdebug('getUserFieldsFilled $_selection is not an array ', $_selection);
         // 			$_return['fields'][$_fld->name]['formcode'] = '';
     }
     return $_return;
 }
示例#20
0
    /**
     * @author Max Milbers
     * @param $field
     * @param $product_id
     * @param $row
     */
    public function displayProductCustomfieldBE($field, $product, $row)
    {
        //This is a kind of fallback, setting default of custom if there is no value of the productcustom
        $field->customfield_value = empty($field->customfield_value) ? $field->custom_value : $field->customfield_value;
        $field->customfield_price = empty($field->customfield_price) ? 0 : $field->customfield_price;
        if (is_object($product)) {
            $product_id = $product->virtuemart_product_id;
            $virtuemart_vendor_id = $product->virtuemart_vendor_id;
        } else {
            $product_id = $product;
            $virtuemart_vendor_id = vmAccess::isSuperVendor();
            vmdebug('displayProductCustomfieldBE product was not object, use for productId ' . $product_id . ' and $virtuemart_vendor_id = ' . $virtuemart_vendor_id);
        }
        //vmdebug('displayProductCustomfieldBE',$product_id,$field,$virtuemart_vendor_id,$product);
        //the option "is_cart_attribute" gives the possibility to set a price, there is no sense to set a price,
        //if the custom is not stored in the order.
        if ($field->is_input) {
            if (!class_exists('VirtueMartModelVendor')) {
                require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
            }
            if (!class_exists('VirtueMartModelCurrency')) {
                require VMPATH_ADMIN . DS . 'models' . DS . 'currency.php';
            }
            $vendor_model = VmModel::getModel('vendor');
            //$virtuemart_vendor_id = 1;
            $vendor = $vendor_model->getVendor($virtuemart_vendor_id);
            $currency_model = VmModel::getModel('currency');
            $vendor_currency = $currency_model->getCurrency($vendor->vendor_currency);
            $priceInput = '<span style="white-space: nowrap;"><input type="text" size="12" style="text-align:right;" value="' . $field->customfield_price . '" name="field[' . $row . '][customfield_price]" /> ' . $vendor_currency->currency_symbol . "</span>";
        } else {
            $priceInput = ' ';
        }
        switch ($field->field_type) {
            case 'C':
                //vmdebug('displayProductCustomfieldBE $field',$field);
                //if(!isset($field->withParent)) $field->withParent = 0;
                //if(!isset($field->parentOrderable)) $field->parentOrderable = 0;
                //vmdebug('displayProductCustomfieldBE',$field,$product);
                if (!empty($product->product_parent_id) and $product->product_parent_id == $field->virtuemart_product_id) {
                    return 'controlled by parent';
                }
                $html = '';
                if (!class_exists('VmHTML')) {
                    require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
                }
                //$html = vmText::_('COM_VIRTUEMART_CUSTOM_WP').VmHTML::checkbox('field[' . $row . '][withParent]',$field->withParent,1,0,'');
                //$html .= vmText::_('COM_VIRTUEMART_CUSTOM_PO').VmHTML::checkbox('field[' . $row . '][parentOrderable]',$field->parentOrderable,1,0,'').'<br />';
                if (empty($field->selectoptions) or count($field->selectoptions) == 0) {
                    $selectOption = new stdClass();
                    //The json conversts it anyway in an object, so suitable to use an object here
                    $selectOption->voption = 'product_name';
                    $selectOption->slabel = '';
                    $selectOption->clabel = '';
                    $selectOption->canonical = 0;
                    $selectOption->values = '';
                    $c = 0;
                    $field->selectoptions = new stdClass();
                    $field->selectoptions->{$c} = $selectOption;
                    $field->options = new stdClass();
                } else {
                    if (is_array($field->selectoptions)) {
                        $field->selectoptions = (object) $field->selectoptions;
                    }
                }
                $field->options = (object) $field->options;
                $optAttr = array();
                $optAttr[] = array('value' => '0', 'text' => vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'));
                $optAttr[] = array('value' => 'product_name', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_FORM_NAME'));
                $optAttr[] = array('value' => 'product_sku', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_SKU'));
                $optAttr[] = array('value' => 'slug', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_ALIAS'));
                $optAttr[] = array('value' => 'product_length', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_LENGTH'));
                $optAttr[] = array('value' => 'product_width', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_WIDTH'));
                $optAttr[] = array('value' => 'product_height', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_HEIGHT'));
                $optAttr[] = array('value' => 'product_weight', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_WEIGHT'));
                $optAttr[] = array('value' => 'clabels', 'text' => vmText::_('COM_VIRTUEMART_CLABELS'));
                $productModel = VmModel::getModel('product');
                $childIds = array();
                $sorted = array();
                $productModel->getAllProductChildIds($product_id, $childIds);
                if (isset($childIds[$product_id])) {
                    $sorted = self::sortChildIds($product_id, $childIds[$product_id]);
                }
                array_unshift($sorted, array('parent_id' => $product_id, 'vm_product_id' => $product_id));
                $showSku = true;
                $k = 0;
                if (empty($field->selectoptions)) {
                    $field->selectoptions = array();
                }
                foreach ($field->selectoptions as $k => &$soption) {
                    $options = array();
                    $options[] = array('value' => '0', 'text' => vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'));
                    $added = array();
                    if ($soption->voption != 'clabels') {
                        foreach ($sorted as $vmProductId) {
                            if (empty($vmProductId) or $vmProductId['vm_product_id'] == $product_id) {
                                continue;
                            }
                            $product = $productModel->getProductSingle($vmProductId['vm_product_id'], false);
                            $voption = trim($product->{$soption->voption});
                            if (!empty($voption)) {
                                $found = false;
                                //Guys, dont tell me about in_array or array_search, it does not work here
                                foreach ($added as $add) {
                                    if ($add == $voption) {
                                        $found = true;
                                    }
                                }
                                if (!$found) {
                                    $added[] = $voption;
                                }
                            }
                        }
                        if ($soption->voption == 'product_sku') {
                            $showSku = false;
                        }
                    }
                    if (!empty($soption->values)) {
                        $values = explode("\n", $soption->values);
                        foreach ($values as $value) {
                            $found = false;
                            $value = trim($value);
                            foreach ($added as $add) {
                                if ($add == $value) {
                                    $found = true;
                                    vmdebug('Found true due $soption->values');
                                }
                            }
                            if (!$found) {
                                $added[] = $value;
                            }
                        }
                    }
                    $soption->values = implode("\n", $added);
                    foreach ($added as &$value) {
                        $options[] = array('value' => $value, 'text' => $value);
                    }
                    $soption->comboptions = $options;
                    if (!isset($soption->clabel)) {
                        $soption->clabel = '';
                    }
                    $soption->slabel = empty($soption->clabel) ? vmText::_('COM_VIRTUEMART_' . strtoupper($soption->voption)) : vmText::_($soption->clabel);
                    if ($k == 0) {
                        $html .= '<div style="float:left">';
                    } else {
                        $html .= '<div class="removable">';
                    }
                    $idTag = 'selectoptions' . $k;
                    $html .= JHtml::_('select.genericlist', $optAttr, 'field[' . $row . '][selectoptions][' . $k . '][voption]', '', 'value', 'text', $soption->voption, $idTag);
                    $html .= '<input type="text" value="' . $soption->clabel . '" name="field[' . $row . '][selectoptions][' . $k . '][clabel]" style="line-height:2em;margin:5px 5px 0;" />';
                    $html .= '<textarea name="field[' . $row . '][selectoptions][' . $k . '][values]" rows="5" cols="35" style="float:none;margin:5px 5px 0;" >' . $soption->values . '</textarea>';
                    if ($k > 0) {
                        $html .= '<span class="vmicon vmicon-16-remove"></span>';
                    } else {
                    }
                    $html .= '</div>';
                    if ($k == 0) {
                        $html .= '<div style="float:right;max-width:60%;width:45%;min-width:30%" >' . vmText::_('COM_VIRTUEMART_CUSTOM_CV_DESC') . '</div>';
                        $html .= '<div class="clear"></div>';
                    }
                }
                $idTag = 'selectoptions' . ++$k;
                $html .= '<fieldset style="background-color:#F9F9F9;">
					<legend>' . vmText::_('COM_VIRTUEMART_CUSTOM_RAMB_NEW') . '</legend>
					<div id="new_ramification">';
                //$html .= JHtml::_ ('select.genericlist', $options, 'field[' . $row . '][selectoptions]['.$k.'][voption]', '', 'value', 'text', 'product_name',$idTag) ;
                //$html .= '<input type="text" value="" name="field[' . $row . '][selectoptions]['.$k.'][slabel]" />';
                $html .= JHtml::_('select.genericlist', $optAttr, 'voption', '', 'value', 'text', 'product_name', 'voption');
                $html .= '<input type="text" value="" id="vlabel" name="vlabel" />';
                $html .= '<span id="new_ramification_bt"><span class="icon-nofloat vmicon vmicon-16-new"></span>' . vmText::_('COM_VIRTUEMART_ADD') . '</span>
					</div>
				</fieldset>';
                vmJsApi::addJScript('new_ramification', "\n\tjQuery( function(\$) {\n\t\t\$('#new_ramification_bt').click(function() {\n\t\t\tvar Prod = \$('.new_ramification');//obsolete?\n\n\t\t\tvar voption = jQuery('#voption').val();\n\t\t\tvar label = jQuery('#vlabel').val();\n\t\t\t\t//console.log ('my label '+label);\n\t\t\tform = document.getElementById('adminForm');\n\t\t\tvar newdiv = document.createElement('div');\n\t\t\tnewdiv.innerHTML = '<input type=\"text\" value=\"'+voption+'\" name=\"field[" . $row . "][selectoptions][" . $k . "][voption]\" /><input type=\"text\" value=\"'+label+'\" name=\"field[" . $row . "][selectoptions][" . $k . "][clabel]\" />';\n\t\t\tform.appendChild(newdiv);\n\n\t\t\tform.task.value = 'apply';\n\t\t\tform.submit();\n\t\t\treturn false;\n\t\t});\n\t});\n\t");
                if ($product_id) {
                    $link = JRoute::_('index.php?option=com_virtuemart&view=product&task=createChild&virtuemart_product_id=' . $product_id . '&' . JSession::getFormToken() . '=1&target=parent');
                    $add_child_button = "";
                } else {
                    $link = "";
                    $add_child_button = " not-active";
                }
                $html .= '<div class="button2-left ' . $add_child_button . ' btn-wrapper">
						<div class="blank">';
                if ($link) {
                    $html .= '<a href="' . $link . '" class="btn btn-small">';
                } else {
                    $html .= '<span class="hasTip" title="' . vmText::_('COM_VIRTUEMART_PRODUCT_ADD_CHILD_TIP') . '">';
                }
                $html .= vmText::_('COM_VIRTUEMART_PRODUCT_ADD_CHILD');
                if ($link) {
                    $html .= '</a>';
                } else {
                    $html .= '</span>';
                }
                $html .= '</div>
					</div><div class="clear"></div>';
                //vmdebug('my $field->selectoptions',$field->selectoptions,$field->options);
                $html .= '<table id="syncro">';
                $html .= '<tr>
<th style="text-align: left !important;width:130px;">#</th>';
                if ($showSku) {
                    $html .= '<th style="text-align: left !important;width:90px;">' . vmText::_('COM_VIRTUEMART_PRODUCT_SKU') . '</th>';
                }
                $html .= '<th style="text-align: left !important;width:80px;">' . vmText::_('COM_VIRTUEMART_PRODUCT_GTIN') . '</th>
<th style="text-align: left !important;" width="5%">' . vmText::_('COM_VIRTUEMART_PRODUCT_FORM_PRICE_COST') . '</th>
<th style="text-align: left !important;width:30px;">' . vmText::_('COM_VIRTUEMART_PRODUCT_FORM_IN_STOCK') . '</th>
<th style="text-align: left !important;width:30px;">' . vmText::_('COM_VIRTUEMART_PRODUCT_FORM_ORDERED_STOCK') . '</th>';
                foreach ($field->selectoptions as $k => $option) {
                    $html .= '<th>' . vmText::_('COM_VIRTUEMART_' . strtoupper($option->voption)) . '</th>';
                }
                $html .= '</tr>';
                if (isset($childIds[$product_id])) {
                    foreach ($sorted as $i => $line) {
                        $html .= self::renderProductChildLine($i, $line, $field, $productModel, $row, $showSku);
                    }
                }
                $html .= '</table>';
                return $html;
                // 					return 'Automatic Childvariant creation (later you can choose here attributes to show, now product name) </td><td>';
                break;
            case 'A':
                //vmdebug('displayProductCustomfieldBE $field',$field);
                if (!isset($field->withParent)) {
                    $field->withParent = 0;
                }
                if (!isset($field->parentOrderable)) {
                    $field->parentOrderable = 0;
                }
                //vmdebug('displayProductCustomfieldBE',$field);
                if (!class_exists('VmHTML')) {
                    require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
                }
                $html = '</td><td>' . vmText::_('COM_VIRTUEMART_CUSTOM_WP') . VmHTML::checkbox('field[' . $row . '][withParent]', $field->withParent, 1, 0, '') . '<br />';
                $html .= vmText::_('COM_VIRTUEMART_CUSTOM_PO') . VmHTML::checkbox('field[' . $row . '][parentOrderable]', $field->parentOrderable, 1, 0, '');
                $options = array();
                $options[] = array('value' => 'product_name', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_FORM_NAME'));
                $options[] = array('value' => 'product_sku', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_SKU'));
                $options[] = array('value' => 'slug', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_ALIAS'));
                $options[] = array('value' => 'product_length', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_LENGTH'));
                $options[] = array('value' => 'product_width', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_WIDTH'));
                $options[] = array('value' => 'product_height', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_HEIGHT'));
                $options[] = array('value' => 'product_weight', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_WEIGHT'));
                $html .= JHtml::_('select.genericlist', $options, 'field[' . $row . '][customfield_value]', '', 'value', 'text', $field->customfield_value);
                return $html;
                // 					return 'Automatic Childvariant creation (later you can choose here attributes to show, now product name) </td><td>';
                break;
                /* string or integer */
            /* string or integer */
            case 'B':
            case 'S':
                if ($field->is_list) {
                    $options = array();
                    $values = explode(';', $field->custom_value);
                    foreach ($values as $key => $val) {
                        $options[] = array('value' => $val, 'text' => $val);
                    }
                    $currentValue = $field->customfield_value;
                    return $priceInput . '</td><td>' . JHtml::_('select.genericlist', $options, 'field[' . $row . '][customfield_value]', NULL, 'value', 'text', $currentValue);
                } else {
                    return $priceInput . '</td><td><input type="text" value="' . $field->customfield_value . '" name="field[' . $row . '][customfield_value]" />';
                    break;
                }
                break;
                // Property
            // Property
            case 'P':
                $options = array();
                $options[] = array('value' => 'product_name', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_FORM_NAME'));
                $options[] = array('value' => 'product_sku', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_SKU'));
                $options[] = array('value' => 'slug', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_ALIAS'));
                $options[] = array('value' => 'product_length', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_LENGTH'));
                $options[] = array('value' => 'product_width', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_WIDTH'));
                $options[] = array('value' => 'product_height', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_HEIGHT'));
                $options[] = array('value' => 'product_weight', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_WEIGHT'));
                return '</td><td>' . JHtml::_('select.genericlist', $options, 'field[' . $row . '][customfield_value]', '', 'value', 'text', $field->customfield_value) . '<input type="text" value="' . $field->round . '" name="field[' . $row . '][round]" />';
                /* parent hint, this is a GROUP and should be G not P*/
            /* parent hint, this is a GROUP and should be G not P*/
            case 'G':
                return $field->customfield_value . '<input type="hidden" value="' . $field->customfield_value . '" name="field[' . $row . '][customfield_value]" /></td><td>';
                break;
                /* image */
            /* image */
            case 'M':
                if ($field->is_list and $field->is_input) {
                    $html = $priceInput . '</td><td>is list ';
                    $values = explode(';', $field->custom_value);
                    foreach ($values as $val) {
                        $html .= $this->displayCustomMedia($val, 'product');
                    }
                    return $html;
                } else {
                    if (empty($field->custom_value)) {
                        $q = 'SELECT `virtuemart_media_id` as value,`file_title` as text FROM `#__virtuemart_medias` WHERE `published`=1
					AND (`virtuemart_vendor_id`= "' . $virtuemart_vendor_id . '" OR `shared` = "1")';
                        $db = JFactory::getDBO();
                        $db->setQuery($q);
                        $options = $db->loadObjectList();
                    } else {
                        $values = explode(';', $field->custom_value);
                        $mM = VmModel::getModel('media');
                        foreach ($values as $key => $val) {
                            $mM->setId($val);
                            $file = $mM->getFile();
                            $tmp = array('value' => $val, 'text' => $file->file_name);
                            $options[] = (object) $tmp;
                        }
                    }
                    return $priceInput . '</td><td>' . JHtml::_('select.genericlist', $options, 'field[' . $row . '][customfield_value]', '', 'value', 'text', $field->customfield_value);
                }
                break;
            case 'D':
                return $priceInput . '</td><td>' . vmJsApi::jDate($field->customfield_value, 'field[' . $row . '][customfield_value]', 'field_' . $row . '_customvalue');
                break;
                //'X'=>'COM_VIRTUEMART_CUSTOM_EDITOR',
            //'X'=>'COM_VIRTUEMART_CUSTOM_EDITOR',
            case 'X':
                // Not sure why this block is needed to get it to work when editing the customfield (the subsequent block works fine when creating it, ie. in JS)
                $document = JFactory::getDocument();
                if (get_class($document) == 'JDocumentHTML') {
                    $editor = JFactory::getEditor();
                    return '</td><td>' . $editor->display('field[' . $row . '][customfield_value]', $field->customfield_value, '550', '400', '60', '20', false);
                }
                return $priceInput . '</td><td><textarea class="mceInsertContentNew" name="field[' . $row . '][customfield_value]" id="field-' . $row . '-customfield_value">' . $field->customfield_value . '</textarea>
						<script type="text/javascript">// Creates a new editor instance
							tinymce.execCommand("mceAddControl",true,"field-' . $row . '-customfield_value")
						</script>';
                //return '<input type="text" value="'.$field->customfield_value.'" name="field['.$row.'][customfield_value]" /></td><td>'.$priceInput;
                break;
                //'Y'=>'COM_VIRTUEMART_CUSTOM_TEXTAREA'
            //'Y'=>'COM_VIRTUEMART_CUSTOM_TEXTAREA'
            case 'Y':
                return $priceInput . '</td><td><textarea id="field[' . $row . '][customfield_value]" name="field[' . $row . '][customfield_value]" class="inputbox" cols=80 rows=6 >' . $field->customfield_value . '</textarea>';
                //return '<input type="text" value="'.$field->customfield_value.'" name="field['.$row.'][customfield_value]" /></td><td>'.$priceInput;
                break;
                /*Extended by plugin*/
            /*Extended by plugin*/
            case 'E':
                $html = '<input type="hidden" value="' . $field->customfield_value . '" name="field[' . $row . '][customfield_value]" />';
                if (!class_exists('vmCustomPlugin')) {
                    require VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php';
                }
                //vmdebug('displayProductCustomfieldBE $field',$field);
                JPluginHelper::importPlugin('vmcustom', $field->custom_element);
                $dispatcher = JDispatcher::getInstance();
                $retValue = '';
                $dispatcher->trigger('plgVmOnProductEdit', array($field, $product_id, &$row, &$retValue));
                return $html . $priceInput . '</td><td>' . $retValue;
                break;
                /* related category*/
            /* related category*/
            case 'Z':
                if (!$product_id or empty($field->customfield_value)) {
                    return '';
                }
                // special case it's category ID !
                $q = 'SELECT * FROM `#__virtuemart_categories_' . VmConfig::$vmlang . '` INNER JOIN `#__virtuemart_categories` AS p using (`virtuemart_category_id`) WHERE `virtuemart_category_id`= "' . (int) $field->customfield_value . '" ';
                $db = JFactory::getDBO();
                $db->setQuery($q);
                //echo $db->_sql;
                if ($category = $db->loadObject()) {
                    $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_category_medias` WHERE `virtuemart_category_id`= "' . (int) $field->customfield_value . '" ';
                    $db->setQuery($q);
                    $thumb = '';
                    if ($media_id = $db->loadResult()) {
                        $thumb = $this->displayCustomMedia($media_id, 'category');
                    }
                    $display = '<input type="hidden" value="' . $field->customfield_value . '" name="field[' . $row . '][customfield_value]" />';
                    $display .= '<span class="custom_related_image">' . $thumb . '</span><span class="custom_related_title">';
                    $display .= JHtml::link('index.php?option=com_virtuemart&view=category&task=edit&cid=' . (int) $field->customfield_value, $category->category_name, array('title' => $category->category_name, 'target' => 'blank')) . '</span>';
                    return $display;
                } else {
                    return 'no result $product_id = ' . $product_id . ' and ' . $field->customfield_value;
                }
                /* related product*/
            /* related product*/
            case 'R':
                if (!$product_id) {
                    return '';
                }
                $pModel = VmModel::getModel('product');
                $related = $pModel->getProduct((int) $field->customfield_value, TRUE, FALSE, FALSE, 1);
                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->customfield_value . '" name="field[' . $row . '][customfield_value]" />';
                $display .= '<span class="custom_related_image">' . $thumb . '</span><span class="custom_related_title">';
                $display .= JHtml::link('index.php?option=com_virtuemart&view=product&task=edit&virtuemart_product_id=' . $related->virtuemart_product_id, $related->product_name, array('title' => $related->product_name, 'target' => 'blank')) . '</span>';
                return $display;
        }
    }
echo $this->product->max_order_level;
?>
" size="10" />
		</td>
	</tr>
	<tr>
		<td >
			<div style="text-align:right;font-weight:bold;">
				<?php 
echo JText::_('COM_VIRTUEMART_PRODUCT_FORM_AVAILABLE_DATE');
?>
			</div>
		</td>
		<td colspan="3">
			<?php 
echo vmJsApi::jDate($this->product->product_available_date, 'product_available_date');
?>
		</td>
	</tr>
	<tr>
		<td valign="top" >
			<div style="text-align:right;font-weight:bold;">
				<?php 
echo JText::_('COM_VIRTUEMART_AVAILABILITY');
?>
			</div>
		</td>
		<td colspan="2">
			<input type="text" class="input-mini" id="product_availability" name="product_availability" value="<?php 
echo $this->product->product_availability;
?>
示例#22
0
</h2>
        <div id="filterbox">

            <table>
                <tr>
                    <td align="left" width="100%">
						<?php 
echo tsmText::_('com_tsmart_ORDERSTATUS') . $this->lists['state_list'];
?>
						<?php 
echo tsmText::_('com_tsmart_REPORT_INTERVAL') . $this->lists['intervals'];
?>
                        <?php 
echo tsmText::_('com_tsmart_REPORT_SET_PERIOD') . $this->lists['select_date'];
echo tsmText::_('com_tsmart_REPORT_FROM_PERIOD') . vmJsApi::jDate($this->from_period, 'from_period');
echo tsmText::_('com_tsmart_REPORT_UNTIL_PERIOD') . vmJsApi::jDate($this->until_period, 'until_period');
if (tsmConfig::get('multix', 'none') != 'none') {
    $vendorId = tsmConfig::isSuperVendor();
    if (vmAccess::manager('managevendors')) {
        $vendorId = vRequest::getInt('tsmart_vendor_id', $vendorId);
    }
    echo ShopFunctions::renderVendorList($vendorId);
}
?>
                        <button class="btn btn-small" onclick="this.form.period.value='';this.form.submit();"><?php 
echo tsmText::_('com_tsmart_GO');
?>
                        </button>
                    </td>
                </tr>
            </table>