/** * @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; } } }
"> <td align="left"> <a href="<?php echo $editlink; ?> " rel="nofollow"><?php echo $row->order_number; ?> </a> <?php echo shopFunctionsF::getInvoiceDownloadButton($row); ?> </td> <td align="left"> <?php echo vmJsApi::date($row->created_on, 'LC4', true); ?> </td> <!--td align="left"> <?php //echo vmJsApi::date($row->modified_on,'LC3',true); ?> </td --> <td align="left"> <?php echo shopFunctionsF::getOrderStatusName($row->order_status); ?> </td> <td align="left"> <?php echo $this->currency->priceDisplay($row->order_total, $row->currency);
?> </th> <th><?php echo vmText::_('COM_VIRTUEMART_ORDER_LIST_STATUS'); ?> </th> <th><?php echo vmText::_('COM_VIRTUEMART_COMMENT'); ?> </th> </tr> </thead> <?php foreach ($this->orderdetails['history'] as $this->orderbt_event) { echo "<tr >"; echo "<td class='key'>" . vmJsApi::date($this->orderbt_event->created_on, 'LC2', true) . "</td>\n"; if ($this->orderbt_event->customer_notified == 1) { echo '<td align="center">' . vmText::_('COM_VIRTUEMART_YES') . '</td>'; } else { echo '<td align="center">' . vmText::_('COM_VIRTUEMART_NO') . '</td>'; } if (!isset($this->orderstatuslist[$this->orderbt_event->order_status_code])) { if (empty($this->orderbt_event->order_status_code)) { $this->orderbt_event->order_status_code = 'unknown'; } $this->orderstatuslist[$this->orderbt_event->order_status_code] = vmText::_('COM_VIRTUEMART_UNKNOWN_ORDER_STATUS'); } echo '<td align="center">' . $this->orderstatuslist[$this->orderbt_event->order_status_code] . '</td>'; echo "<td>" . $this->orderbt_event->comments . "</td>\n"; echo "</tr>\n"; }
</th> <th align="left" ><?php echo JText::_('COM_VIRTUEMART_ORDER_COMMENT'); ?> </th> </tr> <?php foreach ($this->orderdetails['history'] as $_hist) { if (!$_hist->customer_notified) { continue; } ?> <tr valign="top"> <td align="left"> <?php echo vmJsApi::date($_hist->created_on, 'LC2', true); ?> </td> <td align="left" > <?php echo $this->orderstatuses[$_hist->order_status_code]; ?> </td> <td align="left" > <?php echo $_hist->comments; ?> </td> </tr> <?php }
?> <tr class="row<?php echo $i % 2; ?> "> <!-- Checkbox --> <td><?php echo $checked; ?> </td> <!-- Username + time --> <?php $link = 'index.php?option=' . $option . '&view=ratings&task=edit_review&virtuemart_rating_review_id=' . $review->virtuemart_rating_review_id; ?> <td><?php echo JHTML::_('link', $link, $review->customer . ' (' . vmJsApi::date($review->created_on, 'LC2', true) . ')', array("title" => JText::_('COM_VIRTUEMART_RATING_EDIT_TITLE'))); ?> </td> <!-- Product name TODO Add paren_id in LINK ? not existing here --> <?php $link = 'index.php?option=' . $option . '&view=product&task=edit&virtuemart_product_id=' . $review->virtuemart_product_id; ?> <td><?php echo JHTML::_('link', JRoute::_($link), $review->product_name, array('title' => JText::_('COM_VIRTUEMART_EDIT') . ' ' . $review->product_name)); ?> </td> <!-- Stars rating --> <td align="center"> <?php // echo JHTML::_('image', JURI::root().'/components/com_virtuemart/assets/images/stars/'.round($review->vote).'.gif',$review->vote,array("title" => (JText::_('COM_VIRTUEMART_RATING_TITLE').' : '. $review->vote . ' :: ' . $this->max_rating)));
AdminUIHelper::startAdminArea($this); /* Load some variables */ $rows = count($this->report); $intervalTitle = vRequest::getVar('intervals', 'day'); if ($intervalTitle == 'week' or $intervalTitle == 'month') { $addDateInfo = true; } else { $addDateInfo = false; } //JHtml::_('behavior.framework', true); ?> <form action="index.php" method="post" name="adminForm" id="adminForm"> <div id="header"> <h2><?php echo vmText::sprintf('COM_VIRTUEMART_REPORT_TITLE', vmJsApi::date($this->from_period, 'LC', true), vmJsApi::date($this->until_period, 'LC', true)); ?> </h2> <div id="filterbox"> <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']; ?>
/** * @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; } } }
?> <tr class="row<?php echo $i % 2; ?> "> <!-- Checkbox --> <td><?php echo $checked; ?> </td> <!-- Username + time --> <?php $link = 'index.php?option=' . $option . '&view=ratings&task=edit_review&tsmart_rating_review_id=' . $review->tsmart_rating_review_id; ?> <td><?php echo JHtml::_('link', $link, $review->customer . ' (' . vmJsApi::date($review->created_on, 'LC2', true) . ')', array("title" => tsmText::_('com_tsmart_RATING_EDIT_TITLE'))); ?> </td> <!-- Product name TODO Add paren_id in LINK ? not existing here --> <?php $link = 'index.php?option=' . $option . '&view=product&task=edit&tsmart_product_id=' . $review->tsmart_product_id; ?> <td><?php echo JHtml::_('link', JRoute::_($link), $review->product_name, array('title' => tsmText::_('com_tsmart_EDIT') . ' ' . htmlentities($review->product_name))); ?> </td> <!-- Stars rating --> <td align="center"> <?php // echo JHtml::_('image', JURI::root().'/components/com_tsmart/assets/images/stars/'.round($review->vote).'.gif',$review->vote,array("title" => (vmText::_('com_tsmart_RATING_TITLE').' : '. $review->vote . ' :: ' . $this->max_rating)));
echo JText::_('COM_VIRTUEMART_ORDER_LIST_STATUS'); ?> </div> <div class="col-md-3 span3"> <?php echo JText::_('COM_VIRTUEMART_COMMENT'); ?> </div> </div> <?php foreach ($this->orderdetails['history'] as $this->orderbt_event) { ?> <div class="row-fluid"><?php ?> <div class="col-md-3 span3"> <?php echo vmJsApi::date($this->orderbt_event->created_on, 'LC2', true) . "\n"; ?> </div><?php if ($this->orderbt_event->customer_notified == 1) { echo '<div class="col-md-3 span3">' . JText::_('COM_VIRTUEMART_YES') . '</div>'; } else { echo '<div class="col-md-3 span3">' . JText::_('COM_VIRTUEMART_NO') . '</div>'; } if (!isset($this->orderstatuslist[$this->orderbt_event->order_status_code])) { if (empty($this->orderbt_event->order_status_code)) { $this->orderbt_event->order_status_code = 'unknown'; } $_orderStatusList[$this->orderbt_event->order_status_code] = JText::_('COM_VIRTUEMART_UNKNOWN_ORDER_STATUS'); } echo '<div class="col-md-3 span3">' . $this->orderstatuslist[$this->orderbt_event->order_status_code] . '</div>'; echo '<div class="col-md-3 span3">' . $this->orderbt_event->comments . "</div>\n";
/** * Formating front display by roles * for product only ! */ public function displayProductCustomfieldFE(&$product, $customfield, $row = '') { $virtuemart_custom_id = isset($customfield->virtuemart_custom_id) ? $customfield->virtuemart_custom_id : 0; $value = $customfield->custom_value; $type = $customfield->field_type; $is_list = isset($customfield->is_list) ? $customfield->is_list : 0; $price = isset($customfield->custom_price) ? $customfield->custom_price : 0; $is_cart = isset($customfield->is_cart) ? $customfield->is_cart : 0; //vmdebug('displayProductCustomfieldFE and here is something wrong ',$customfield); if (!class_exists('CurrencyDisplay')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php'; } $currency = CurrencyDisplay::getInstance(); if ($is_list > 0) { $values = explode(';', $value); if ($is_cart != 0) { $options = array(); foreach ($values as $key => $val) { $options[] = array('value' => $val, 'text' => $val); } vmdebug('displayProductCustomfieldFE is a list ', $options); return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', NULL, 'value', 'text', FALSE, TRUE); } else { $html = ''; // if($type=='M'){ // foreach ($values as $key => $val){ // $html .= '<div id="custom_'.$virtuemart_custom_id.'_'.$val.'" >'.$this->displayCustomMedia($val).'</div>'; // } // } else { // foreach ($values as $key => $val){ $html .= '<div id="custom_' . $virtuemart_custom_id . '_' . $value . '" >' . $value . '</div>'; // } // } return $html; } } else { if ($price > 0) { $price = $currency->priceDisplay((double) $price); } switch ($type) { case 'A': $options = array(); $session = JFactory::getSession(); $virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm'); $productModel = VmModel::getModel('product'); //parseCustomParams VirtueMartModelCustomfields::bindParameterableByFieldType($customfield); //Todo preselection as dropdown of children //Note by Max Milbers: This is not necessary, in this case it is better to unpublish the parent and to give the child which should be preselected a category //Or it is withParent, in that case there exists the case, that a parent should be used as a kind of mini category and not be orderable. //There exists already other customs and in special plugins which wanna disable or change the add to cart button. //I suggest that we manipulate the button with a message "choose a variant first" //if(!isset($customfield->pre_selected)) $customfield->pre_selected = 0; $selected = JRequest::getInt('virtuemart_product_id', 0); $html = ''; $uncatChildren = $productModel->getUncategorizedChildren($customfield->withParent); foreach ($uncatChildren as $k => $child) { $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['product_name']); } $html .= JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="inputbox"', "value", "text", JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $selected)); //vmdebug('$customfield',$customfield); if ($customfield->parentOrderable == 0 and $product->product_parent_id == 0) { vmdebug('Should not be orderable'); $product->orderable = FALSE; /* if(!$productModel->product_parent_id){ vmdebug('$customfield parentOrderable'); $document = JFactory::getDocument(); $document->addScriptDeclaration( 'jQuery(document).ready( function($) { addToCartArea = jQuery(".productdetails-view .addtocart-bar"); addToCartBar = addToCartArea.find("input[name$=addtocart]"); addToCartArea.css({ padding: "0px 0px 0px 0px", width: "auto" }).children("span:not(:nth-child(3))").hide() .parent().children("span::nth-child(3)").css({ margin: "0px 0px 0px 0px", width: "auto", float: "left" }); addToCartButtonClassName = addToCartBar.attr("class"); addToCartBar.removeClass(addToCartButtonClassName) .addClass(addToCartButtonClassName + "-disabled") .attr({ disabled: "disabled", value: "'.JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT').'", }); }); '); }*/ } return $html; break; /* variants*/ /* variants*/ case 'V': if ($price == 0) { $price = JText::_('COM_VIRTUEMART_CART_PRICE_FREE'); } /* Loads the product price details */ return '<input type="text" value="' . JText::_($value) . '" name="field[' . $row . '][custom_value]" /> ' . JText::_('COM_VIRTUEMART_CART_PRICE') . $price . ' '; break; /*Date variant*/ /*Date variant*/ case 'D': return '<span class="product_custom_date">' . vmJsApi::date($value, 'LC1', TRUE) . '</span>'; //vmJsApi::jDate($field->custom_value, 'field['.$row.'][custom_value]','field_'.$row.'_customvalue').$priceInput; break; /* text area or editor No JText, only displayed in BE */ /* text area or editor No JText, only displayed in BE */ case 'X': case 'Y': return $value; break; /* string or integer */ /* string or integer */ case 'S': case 'I': return JText::_($value); break; /* bool */ /* bool */ case 'B': if ($value == 0) { return JText::_('COM_VIRTUEMART_NO'); } return JText::_('COM_VIRTUEMART_YES'); break; /* parent */ /* parent */ case 'P': return '<span class="product_custom_parent">' . JText::_($value) . '</span>'; break; /* related */ /* related */ case 'R': $q = 'SELECT l.`product_name`, p.`product_parent_id` , l.`product_name`, x.`virtuemart_category_id` FROM `#__virtuemart_products_' . VMLANG . '` as l JOIN `#__virtuemart_products` AS p using (`virtuemart_product_id`) LEFT JOIN `#__virtuemart_product_categories` as x on x.`virtuemart_product_id` = p.`virtuemart_product_id` WHERE p.`published`=1 AND p.`virtuemart_product_id`= "' . (int) $value . '" '; $this->_db->setQuery($q); $related = $this->_db->loadObject(); if (empty($related)) { return ''; } $thumb = ''; $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_product_medias`WHERE `virtuemart_product_id`= "' . (int) $value . '" AND (`ordering` = 0 OR `ordering` = 1)'; $this->_db->setQuery($q); if ($media_id = $this->_db->loadResult()) { $thumb = $this->displayCustomMedia($media_id); return JHTML::link(JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $value . '&virtuemart_category_id=' . $related->virtuemart_category_id), $thumb . ' ' . $related->product_name, array('title' => $related->product_name)); } break; /* image */ /* image */ case 'M': return $this->displayCustomMedia($value); break; /* categorie */ /* categorie */ case 'Z': $q = 'SELECT * FROM `#__virtuemart_categories_' . VMLANG . '` as l JOIN `#__virtuemart_categories` AS c using (`virtuemart_category_id`) WHERE `published`=1 AND l.`virtuemart_category_id`= "' . (int) $value . '" '; $this->_db->setQuery($q); if ($category = $this->_db->loadObject()) { $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_category_medias`WHERE `virtuemart_category_id`= "' . $category->virtuemart_category_id . '" '; $this->_db->setQuery($q); $thumb = ''; if ($media_id = $this->_db->loadResult()) { $thumb = $this->displayCustomMedia($media_id); } return 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)); } else { return ''; } /* Child Group list * this have no direct display , used for stockable product */ /* Child Group list * this have no direct display , used for stockable product */ case 'G': return ''; //'<input type="text" value="'.JText::_($value).'" name="field['.$row.'][custom_value]" /> '.JText::_('COM_VIRTUEMART_CART_PRICE').' : '.$price .' '; break; break; } } }
?> <br /> <?php echo '<input type="input" title="Smerovací číslo" name="orders[' . $key . '][zip_code]" value="' . $order->zip_code . '"' . $disabled . '>'; ?> <br /> </td> <!-- Payment method --> <td><?php echo $order->payment_method; ?> </td> <!-- Order date --> <td><?php echo vmJsApi::date($order->created_on, 'LC4', true); ?> </td> <!-- Status --> <td style="position:relative;"> <?php echo $order->order_status; ?> </td> <!-- Total --> <td><?php echo $order->order_total; ?> </td>
<?php /** * details_orders file view orders in com_virtuemart for Template * @package Getshopped * @subpackage Template * @author Das Infomedia. * @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // no direct access defined('_JEXEC') or die('Restricted access'); ?> <p class="order-date"><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_PO_DATE') ?> : <?php echo vmJsApi::date($this->orderdetails['details']['BT']->created_on, 'LC4', true); ?> </p> <div class="col2-set order-info-box"> <div class="col-md-6"> <div class="box"> <div class="box-title"> <h3><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_SHIP_TO_LBL') ?></h3> </div> <table class="detail_order_table" border="0"> <?php foreach ($this->shipmentfields['fields'] as $field) { if (!empty($field['value'])) { echo '<tr><td class="key">' . $field['title'] . '</td>' . '<td>' . $field['value'] . '</td></tr>'; } } ?> </table> </div>
$i = 0; $keyword = JRequest::getWord('keyword'); foreach ($this->ratingslist as $key => $review) { $checked = JHTML::_('grid.id', $i, $review->virtuemart_rating_id); $published = $this->toggle($review->published, $i, 'published'); ?> <tr > <!-- Checkbox --> <td><?php echo $checked; ?> </td> <!-- Username + time --> <td> <?php echo $this->editLink($review->virtuemart_product_id, vmJsApi::date($review->created_on, 'LC2', true), 'virtuemart_product_id', array("title" => JText::_('COM_VIRTUEMART_RATING_EDIT_TITLE')), null, 'listreviews'); ?> </td> <!-- Product edit link --> <td> <?php echo $this->editLink($review->virtuemart_product_id, $review->product_name, 'virtuemart_product_id', array('class' => 'hasTooltip', 'title' => JText::_('COM_VIRTUEMART_EDIT') . ' ' . $review->product_name, 'product')); ?> </td> <!-- Stars rating --> <td align="center"> <?php // Rating Stars output $maxrating = VmConfig::get('vm_maximum_rating_scale', 5); $ratingwidth = round($review->rating) * 24;
<span><a href="<?php echo $editlink; ?>"><?php echo $row->order_number; ?></a></span> </p> <p> <span><?php echo JText::_('COM_VIRTUEMART_ORDER_LIST_CDATE'); ?>: </span> <span><?php echo vmJsApi::date($row->created_on,'LC4',true); ?></span> </p> <p> <span><?php echo JText::_('COM_VIRTUEMART_ORDER_LIST_STATUS'); ?>: </span> <span><?php echo ShopFunctions::getOrderStatusName($row->order_status); ?></span> </p> <p> <span><?php echo JText::_('COM_VIRTUEMART_ORDER_LIST_TOTAL'); ?>: </span> <span><span class="price"><?php echo $this->currency->priceDisplay($row->order_total, $row->currency); ?></span></span> </p> </td> </tr> <tr class="<?php echo "row$k"; ?> for-desktop even"> <td align="left"><a href="<?php echo $editlink; ?>"><?php echo $row->order_number; ?></a></td> <td align="left"><?php echo vmJsApi::date($row->created_on,'LC4',true); ?></td> <td align="left"><?php echo ShopFunctions::getOrderStatusName($row->order_status); ?></td> <td class="a-right"><span class="price"><?php echo $this->currency->priceDisplay($row->order_total, $row->currency); ?></span></td> </tr> <?php $k = 1 - $k; } ?> </table> </div> <?php } ?> </div>
$invoice_link .= '<span class="hasTip invoice_32" title="' . JText::_('COM_VIRTUEMART_INVOICE') . '"></span></a>'; } ?> <td><?php echo $print_link; echo $invoice_link; ?> </td> <!-- Order date --> <td><?php echo vmJsApi::date($order->created_on, 'LC2', true); ?> </td> <!-- Last modified --> <td><?php echo vmJsApi::date($order->modified_on, 'LC2', true); ?> </td> <!-- Status --> <td style="position:relative;"> <?php echo JHTML::_('select.genericlist', $this->orderstatuses, "orders[" . $order->virtuemart_order_id . "][order_status]", '', 'order_status_code', 'order_status_name', $order->order_status, 'order_status' . $i, true); ?> <input type="hidden" name="orders[<?php echo $order->virtuemart_order_id; ?> ][current_order_status]" value="<?php echo $order->order_status; ?> " /> <br />
/** * @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; } } }
?> <tr class="row<?php echo $k; ?> "> <!-- Checkbox --> <td class="admin-checkbox"><?php echo $checked; ?> </td> <!-- Username + time --> <?php $link = 'index.php?option=' . $option . '&view=ratings&task=listreviews&virtuemart_product_id=' . $review->virtuemart_product_id; ?> <td><?php echo JHtml::_('link', $link, vmJsApi::date($review->created_on, 'LC2', true), array("title" => vmText::_('COM_VIRTUEMART_RATING_EDIT_TITLE'))); ?> </td> <!-- Product name --> <?php $link = 'index.php?option=' . $option . '&view=product&task=edit&virtuemart_product_id=' . $review->virtuemart_product_id; ?> <td><?php echo JHtml::_('link', JRoute::_($link), $review->product_name, array('title' => vmText::_('COM_VIRTUEMART_EDIT') . ' ' . htmlentities($review->product_name))); ?> </td> <!-- Stars rating --> <td align="center"> <?php // Rating Stars output
$checked = JHTML::_('grid.id', $i, $review->virtuemart_rating_review_id, null, 'virtuemart_rating_review_id'); $published = $this->toggle($review->published, $i, 'published'); ?> <tr class="row<?php echo $i % 2; ?> "> <!-- Checkbox --> <td><?php echo $checked; ?> </td> <!-- Username + time --> <td> <?php echo $this->editLink($review->virtuemart_rating_review_id, $review->customer . ' (' . vmJsApi::date($review->created_on, 'LC2', true) . ')', 'virtuemart_rating_review_id', array("title" => JText::_('COM_VIRTUEMART_RATING_EDIT_TITLE')), null, 'edit_review'); ?> </td> <!-- Product name TODO Add paren_id in LINK ? not existing here --> <?php $link = 'index.php?option=' . $option . '&view=product&task=edit&virtuemart_product_id=' . $review->virtuemart_product_id; ?> <td><?php echo JHTML::_('link', JRoute::_($link), $review->product_name, array('title' => JText::_('COM_VIRTUEMART_EDIT') . ' ' . $review->product_name)); ?> </td> <!-- Stars rating --> <td align="center"> <?php // echo JHTML::_('image', JURI::root().'/components/com_virtuemart/assets/images/stars/'.round($review->vote).'.gif',$review->vote,array("title" => (JText::_('COM_VIRTUEMART_RATING_TITLE').' : '. $review->vote . ' :: ' . $this->max_rating)));
} ?> <td><?php echo $print_link; echo $deliverynote_link; echo $invoice_link; ?> </td> <!-- Order date --> <td><?php echo vmJsApi::date($order->created_on, 'LC2', TRUE); ?> </td> <!-- Last modified --> <td><?php echo vmJsApi::date($order->modified_on, 'LC2', TRUE); ?> </td> <!-- Status --> <td style="position:relative;"> <?php echo JHTML::_('select.genericlist', $this->orderstatuses, "orders[" . $order->virtuemart_order_id . "][order_status]", 'class="orderstatus_select"', 'order_status_code', 'order_status_name', $order->order_status, 'order_status' . $i, TRUE); ?> <input type="hidden" name="orders[<?php echo $order->virtuemart_order_id; ?> ][current_order_status]" value="<?php echo $order->order_status; ?> "/> <input type="hidden" name="orders[<?php
<td class="key"><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_PO_PASS'); ?> </strong></td> <td><?php echo $this->orderbt->order_pass; ?> </td> </tr> <tr> <td class="key"><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_PO_DATE'); ?> </strong></td> <td><?php echo vmJsApi::date($this->orderbt->created_on, 'LC2', true); ?> </td> </tr> <tr> <td class="key"><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_PO_STATUS'); ?> </strong></td> <td><?php echo $this->orderstatuslist[$this->orderbt->order_status]; ?> </td> </tr> <tr> <td class="key"></td>
<td class=""><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_PO_STATUS'); ?> </td> <td align="left"><?php echo $this->orderstatuses[$this->orderdetails['details']['BT']->order_status]; ?> </td> </tr> <tr> <td class=""><?php echo JText::_('COM_VIRTUEMART_LAST_UPDATED'); ?> </td> <td align="left"><?php echo vmJsApi::date($this->orderdetails['details']['BT']->modified_on, 'LC4', true); ?> </td> </tr> <tr> <td class=""><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_SHIPMENT_LBL'); ?> </td> <td align="left"><?php echo $this->shipment_name; ?> </td> </tr> <tr> <td class=""><?php
$deliverynote_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=deliverynote&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'&create_invoice=1'; $deliverynote_link = "<a href=\"{$deliverynote_url}\" >" . '<span class="hasTip deliverynotenew_32" title="' . vmText::_('COM_VIRTUEMART_DELIVERYNOTE_CREATE') . '"></span></a>'; } elseif (!shopFunctions::InvoiceNumberReserved($order->invoiceNumber)) { $deliverynote_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=deliverynote&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'<span class="hasTip deliverynote_32" title="' . vmText::_('COM_VIRTUEMART_DELIVERYNOTE') . '"></span></a>'; } ?> <td><?php echo $print_link; echo $deliverynote_link; echo $invoice_link; ?> </td> <!-- Order date --> <td><?php echo vmJsApi::date($order->created_on, 'LC2', TRUE); ?> </td> <!-- Last modified --> <td><?php echo $orderDetails['items'][0]->order_item_name; ?> </td> <td><?php if ($orderDetails['items'][0]->virtuemart_product_id != 5) { echo $orderDetails['items'][0]->product_quantity; } ?> </td> <!-- Status --> <td style="position:relative;">
</td> <td align="center"> <?php // echo $print_link; ?> </td> <td align="left"> <?php echo vmJsApi::date($row->created_on, 'LC2', true); ?> </td> <td align="left"> <?php echo vmJsApi::date($row->modified_on, 'LC2', true); ?> </td> <td align="left"> <?php echo shopFunctionsF::getOrderStatusName($row->order_status); ?> </td> <td align="left"> <?php echo $this->currency->priceDisplay($row->order_total); ?> </td>
public static function getRevenueDiag($vendorId, $orderstates, $intervals, $filterorders, $orderdir, $virtuemart_product_id, $from_period, $until_period) { $reportM = VmModel::getModel('report'); $report = $reportM->getRevenueSortListOrderQuery($vendorId, $orderstates, $intervals, $filterorders, $orderdir, $virtuemart_product_id); $rows = count($report); $intervalTitle = 'day'; $addDateInfo = false; $i = 0; $reports = array_reverse($report); $reports_date = array(); foreach ($reports as $_report) { $reports_date[$_report['intervals']] = $_report; } $begin = new DateTime($reportM->from_period); $end = new DateTime($reportM->until_period); $js = "\r\r\n google.load(\"visualization\", \"1\", {packages:[\"corechart\"]});\r\r\n google.setOnLoadCallback(drawChart);\r\r\n function drawChart() {\r\r\n var data = google.visualization.arrayToDataTable([\r\r\n ['" . vmText::_('COM_VIRTUEMART_DAY') . "', '" . vmText::_('COM_VIRTUEMART_REPORT_BASIC_ORDERS') . "', '" . vmText::_('COM_VIRTUEMART_REPORT_BASIC_TOTAL_ITEMS') . "', '" . vmText::_('COM_VIRTUEMART_REPORT_BASIC_REVENUE_NETTO') . "'],"; $interval = DateInterval::createFromDateString('1 day'); $period = new DatePeriod($begin, $interval, $end); foreach ($period as $dt) { $day = $dt->format('Y-m-d'); if (array_key_exists($day, $reports_date)) { $r = $reports_date[$day]; } else { $r = array('intervals' => $day, 'count_order_id' => 0, 'product_quantity' => 0, 'order_subtotal_netto' => 0); } $js .= " ['" . $r['intervals'] . "', " . $r['count_order_id'] . "," . $r['product_quantity'] . "," . $r['order_subtotal_netto'] . "],"; } $js = substr($js, 0, -1); $js .= " ]);"; $js .= "\r\r\n var options = {\r\r\n title: '" . vmText::sprintf('COM_VIRTUEMART_REPORT_TITLE', vmJsApi::date($reportM->from_period, 'LC', true), vmJsApi::date($reportM->until_period, 'LC', true)) . "',\r\r\n series: {0: {targetAxisIndex:0},\r\r\n 1:{targetAxisIndex:0},\r\r\n 2:{targetAxisIndex:1},\r\r\n },\r\r\n colors: [\"#00A1DF\", \"#A4CA37\",\"#E66A0A\"],\r\r\n };\r\r\n\r\r\n var chart = new google.visualization.LineChart(document.getElementById('vm_stats_chart'));\r\r\n\r\r\n chart.draw(data, options);\r\r\n }\r\r\n"; return array('report' => $report, 'js' => $js); }
</td> <td align="left"><strong> <?php echo $this->orderDetails['details']['BT']->order_number; ?> </strong> </td> </tr> <tr> <td class=""><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_PO_DATE'); ?> </td> <td align="left"><?php echo vmJsApi::date($this->orderDetails['details']['BT']->created_on, 'LC4', true); ?> </td> </tr> <tr> <td class=""><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_PO_STATUS'); ?> </td> <td align="left"><?php echo $this->orderstatuses[$this->orderDetails['details']['BT']->order_status]; ?> </td> </tr> <tr> <td class=""><?php
/** * Formating front display by roles * for product only ! */ public function displayType($value, $type, $is_list = 0, $price = 0, $row = '', $is_cart = 0, $virtuemart_custom_id = 0) { if (!class_exists('CurrencyDisplay')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php'; } $currency = CurrencyDisplay::getInstance(); if ($is_list > 0) { $values = explode(';', $value); if ($is_cart != 0) { $options = array(); foreach ($values as $key => $val) { $options[] = array('value' => $val, 'text' => $val); } return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', null, 'value', 'text', false, true); } else { $html = ''; // if($type=='M'){ // foreach ($values as $key => $val){ // $html .= '<div id="custom_'.$virtuemart_custom_id.'_'.$val.'" >'.$this->displayCustomMedia($val).'</div>'; // } // } else { // foreach ($values as $key => $val){ $html .= '<div id="custom_' . $virtuemart_custom_id . '_' . $value . '" >' . $value . '</div>'; // } // } return $html; } } else { if ($price > 0) { $price = $currency->priceDisplay((double) $price); } switch ($type) { case 'A': $options = array(); $session = JFactory::getSession(); $virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm'); $productModel = VmModel::getModel('product'); $selected = JRequest::getInt('virtuemart_product_id'); // $product = $productModel->getProductSingle($selected); // if($product->product_parent_id == 0){ // $options[] = array( 'value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id='.$virtuemart_category_id.'&virtuemart_product_id='.$product->virtuemart_product_id) ,'text' =>$product->product_name); $uncatChildren = $productModel->getUncategorizedChildren($selected); // } else { // $parent = $productModel->getProductSingle($product->virtuemart_parent_id); // $options[] = array( 'value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id='.$virtuemart_category_id.'&virtuemart_product_id='.$parent->virtuemart_product_id) ,'text' =>$parent->product_name); // $uncatChildren = $productModel->getUncategorizedChildren($product->virtuemart_parent_id); // } foreach ($uncatChildren as $k => $child) { $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['product_name']); } return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="inputbox"', "value", "text", JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $selected)); break; /* variants*/ /* variants*/ case 'V': if ($price == 0) { $price = JText::_('COM_VIRTUEMART_CART_PRICE_FREE'); } /* Loads the product price details */ return '<input type="text" value="' . JText::_($value) . '" name="field[' . $row . '][custom_value]" /> ' . JText::_('COM_VIRTUEMART_CART_PRICE') . $price . ' '; break; /*Date variant*/ /*Date variant*/ case 'D': return '<span class="product_custom_date">' . vmJsApi::date($value, 'LC1', true) . '</span>'; //vmJsApi::jDate($field->custom_value, 'field['.$row.'][custom_value]','field_'.$row.'_customvalue').$priceInput; break; /* text area or editor No JText, only displayed in BE */ /* text area or editor No JText, only displayed in BE */ case 'X': case 'Y': return $value; break; /* string or integer */ /* string or integer */ case 'S': case 'I': return JText::_($value); break; /* bool */ /* bool */ case 'B': if ($value == 0) { return JText::_('COM_VIRTUEMART_NO'); } return JText::_('COM_VIRTUEMART_YES'); break; /* parent */ /* parent */ case 'P': return '<span class="product_custom_parent">' . JText::_($value) . '</span>'; break; /* related */ /* related */ case 'R': $q = 'SELECT l.`product_name`, p.`product_parent_id` , l.`product_name`, x.`virtuemart_category_id` FROM `#__virtuemart_products_' . VMLANG . '` as l JOIN `#__virtuemart_products` AS p using (`virtuemart_product_id`) LEFT JOIN `#__virtuemart_product_categories` as x on x.`virtuemart_product_id` = p.`virtuemart_product_id` WHERE p.`published`=1 AND p.`virtuemart_product_id`= "' . (int) $value . '" '; $this->_db->setQuery($q); $related = $this->_db->loadObject(); if (empty($related)) { return ''; } $thumb = ''; $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_product_medias`WHERE `virtuemart_product_id`= "' . (int) $value . '" AND (`ordering` = 0 OR `ordering` = 1)'; $this->_db->setQuery($q); if ($media_id = $this->_db->loadResult()) { $thumb = $this->displayCustomMedia($media_id); return JHTML::link(JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $value . '&virtuemart_category_id=' . $related->virtuemart_category_id), $thumb . ' ' . $related->product_name, array('title' => $related->product_name)); } break; /* image */ /* image */ case 'M': return $this->displayCustomMedia($value); break; /* categorie */ /* categorie */ case 'Z': $q = 'SELECT * FROM `#__virtuemart_categories_' . VMLANG . '` as l JOIN `#__virtuemart_categories` AS c using (`virtuemart_category_id`) WHERE `published`=1 AND l.`virtuemart_category_id`= "' . (int) $value . '" '; $this->_db->setQuery($q); if ($category = $this->_db->loadObject()) { $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_category_medias`WHERE `virtuemart_category_id`= "' . $category->virtuemart_category_id . '" '; $this->_db->setQuery($q); $thumb = ''; if ($media_id = $this->_db->loadResult()) { $thumb = $this->displayCustomMedia($media_id); } return 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)); } else { return ''; } /* Child Group list * this have no direct display , used for stockable product */ /* Child Group list * this have no direct display , used for stockable product */ case 'G': return ''; //'<input type="text" value="'.JText::_($value).'" name="field['.$row.'][custom_value]" /> '.JText::_('COM_VIRTUEMART_CART_PRICE').' : '.$price .' '; break; break; } } }
<tbody> <?php if (count($this->ratingslist) > 0) { $i = 0; $k = 0; $keyword = JRequest::getWord('keyword'); foreach ($this->ratingslist as $key => $review) { $checked = JHTML::_('grid.id', $i , $review->virtuemart_rating_id); $published = JHTML::_('grid.published', $review, $i ); ?> <tr class="row<?php echo $k ; ?>"> <!-- Checkbox --> <td><?php echo $checked; ?></td> <!-- Username + time --> <?php $link = 'index.php?option='.$option.'&view=ratings&task=listreviews&virtuemart_product_id='.$review->virtuemart_product_id; ?> <td><?php echo JHTML::_('link', $link,vmJsApi::date($review->created_on,'LC2',true) , array("title" => JText::_('COM_VIRTUEMART_RATING_EDIT_TITLE'))); ?></td> <!-- Product name --> <?php $link = 'index.php?option='.$option.'&view=product&task=edit&virtuemart_product_id='.$review->virtuemart_product_id ; ?> <td><?php echo JHTML::_('link', JRoute::_($link), $review->product_name, array('title' => JText::_('COM_VIRTUEMART_EDIT').' '.$review->product_name)); ?></td> <!-- Stars rating --> <td align="center"> <?php // Rating Stars output $maxrating = VmConfig::get('vm_maximum_rating_scale', 5); $ratingwidth = round($review->rating) * 24; ?> <span title="<?php echo (JText::_("COM_VIRTUEMART_RATING_TITLE").' '. round($review->rating) . '/' . $maxrating) ?>" class="ratingbox" style="display:inline-block;"> <span class="stars-orange" style="width:<?php echo $ratingwidth.'px'; ?>"> </span> </span>
</td> <?php /* <td align="center"> <a href="#" onclick="return listItemTask('cb<?php echo $i;?>', 'toggle.calc_vendor_published')" title="<?php echo ( $row->calc_vendor_published == '1' ) ? JText::_('COM_VIRTUEMART_YES') : JText::_('COM_VIRTUEMART_NO');?>"> <?php echo JHtml::_('image.administrator', ((JVM_VERSION===1) ? '' : 'admin/') . ($row->calc_vendor_published ? 'tick.png' : 'publish_x.png')); ?> </a> </td> */ ?> <td> <?php echo vmJsApi::date($row->publish_up, 'LC4', true); ?> </td> <td> <?php echo vmJsApi::date($row->publish_down, 'LC4', true); ?> </td> <?php /* <td> <?php echo $row->calc_amount_cond; ?> </td> <td> <?php echo JText::_($row->calc_amount_dimunit); ?> </td> */ ?> <td> <?php echo JText::_($row->calcCountriesList); ?> </td>
/** * Formating front display by roles * for product only ! */ public function displayProductCustomfieldFE(&$product, $customfield, $row = '') { $virtuemart_custom_id = isset($customfield->virtuemart_custom_id) ? $customfield->virtuemart_custom_id : 0; $value = $customfield->custom_value; $type = $customfield->field_type; $is_list = isset($customfield->is_list) ? $customfield->is_list : 0; $price = isset($customfield->custom_price) ? $customfield->custom_price : 0; $is_cart = isset($customfield->is_cart) ? $customfield->is_cart : 0; //vmdebug('displayProductCustomfieldFE and here is something wrong ',$customfield); JLoader::register('CurrencyDisplay', JPATH_VM_ADMINISTRATOR . '/helpers/currencydisplay.php'); $currency = CurrencyDisplay::getInstance(); if ($is_list > 0) { $values = explode(';', $value); if ($is_cart != 0) { $options = array(); foreach ($values as $key => $val) { $options[] = array('value' => $val, 'text' => $val); } // J3 use chosen vmJsApi::chosenDropDowns(); return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', NULL, 'value', 'text', FALSE, TRUE); } else { $html = ''; $html .= '<div id="custom_' . $virtuemart_custom_id . '_' . $value . '" >' . $value . '</div>'; return $html; } } else { if ($price > 0) { $price = $currency->priceDisplay((double) $price); } switch ($type) { case 'A': $options = array(); $session = JFactory::getSession(); $virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm'); $productModel = VmModel::getModel('product'); //parseCustomParams VirtueMartModelCustomfields::bindParameterableByFieldType($customfield); //Todo preselection as dropdown of children //Note by Max Milbers: This is not necessary, in this case it is better to unpublish the parent and to give the child which should be preselected a category //Or it is withParent, in that case there exists the case, that a parent should be used as a kind of mini category and not be orderable. //There exists already other customs and in special plugins which wanna disable or change the add to cart button. //I suggest that we manipulate the button with a message "choose a variant first" //if(!isset($customfield->pre_selected)) $customfield->pre_selected = 0; $selected = JRequest::getVar('virtuemart_product_id', 0); if (is_array($selected)) { $selected = $selected[0]; } $selected = (int) $selected; $html = ''; $uncatChildren = $productModel->getUncategorizedChildren($customfield->withParent); if (empty($uncatChildren)) { return $html; break; } foreach ($uncatChildren as $k => $child) { $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['product_name']); } $html .= JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="inputbox"', "value", "text", JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $selected, 'cf' . $row . '-' . $selected)); //vmdebug('$customfield',$customfield); if ($customfield->parentOrderable == 0 and $product->product_parent_id == 0) { $product->orderable = FALSE; } return $html; break; /* variants*/ /* variants*/ case 'V': if ($price == 0) { $price = JText::_('COM_VIRTUEMART_CART_PRICE_FREE'); } /* Loads the product price details */ return '<input type="text" value="' . JText::_($value) . '" name="field[' . $row . '][custom_value]" /> ' . JText::_('COM_VIRTUEMART_CART_PRICE') . $price . ' '; break; /*Date variant*/ /*Date variant*/ case 'D': return '<span class="product_custom_date">' . vmJsApi::date($value, 'LC1', TRUE) . '</span>'; //vmJsApi::jDate($field->custom_value, 'field['.$row.'][custom_value]','field_'.$row.'_customvalue').$priceInput; break; /* text area or editor No JText, only displayed in BE */ /* text area or editor No JText, only displayed in BE */ case 'X': case 'Y': return $value; break; /* string or integer */ /* string or integer */ case 'S': case 'I': return JText::_($value); break; /* bool */ /* bool */ case 'B': if ($value == 0) { return JText::_('COM_VIRTUEMART_NO'); } return JText::_('COM_VIRTUEMART_YES'); break; /* parent */ /* parent */ case 'P': return '<span class="product_custom_parent">' . JText::_($value) . '</span>'; break; /* product kit(bundle) */ /* product kit(bundle) */ case 'K': $pModel = VmModel::getModel('product'); $related = $pModel->getProduct((int) $value, TRUE, TRUE, TRUE, 1, FALSE); if (!$related) { vmError('related product is missing, maybe unpublished'); return false; } $param = json_decode($customfield->custom_param); if (empty($param->is_hidden)) { $thumb = ''; if (!empty($related->virtuemart_media_id[0])) { $thumb = $this->displayCustomMedia($related->virtuemart_media_id[0]) . ' '; } else { $thumb = $this->displayCustomMedia(0) . ' '; } return '<span class="span2">' . $thumb . '</span> <span class="span8">' . $related->product_name . '</span></span> <input type="hidden" name="virtuemart_product_id[]" value="' . $related->virtuemart_product_id . '"/> <input type="text" class="quantity-input span2" name="quantity[]" value="1"/> '; } else { return '<input type="hidden" name="virtuemart_product_id[]" value="' . $related->virtuemart_product_id . '"/> <input type="hidden" class="quantity-input" name="quantity[]" value="1"/>'; } break; /* related */ /* related */ case 'R': $pModel = VmModel::getModel('product'); $related = $pModel->getProduct((int) $value, TRUE, TRUE, TRUE, 1, FALSE); if (!$related) { vmError('related product is missing, maybe unpublished'); return false; } $thumb = ''; if (!empty($related->virtuemart_media_id[0])) { $thumb = $this->displayCustomMedia($related->virtuemart_media_id[0]) . ' '; } else { $thumb = $this->displayCustomMedia(0) . ' '; } return JHTML::link(JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $related->virtuemart_product_id . '&virtuemart_category_id=' . $related->virtuemart_category_id, FALSE), $thumb . $related->product_name, array('title' => $related->product_name)); break; /* image */ /* image */ case 'M': return $this->displayCustomMedia($value); break; /* categorie */ /* categorie */ case 'Z': $q = 'SELECT * FROM `#__virtuemart_categories_' . VMLANG . '` as l JOIN `#__virtuemart_categories` AS c using (`virtuemart_category_id`) WHERE `published`=1 AND l.`virtuemart_category_id`= "' . (int) $value . '" '; $this->_db->setQuery($q); if ($category = $this->_db->loadObject()) { $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_category_medias`WHERE `virtuemart_category_id`= "' . $category->virtuemart_category_id . '" '; $this->_db->setQuery($q); $thumb = ''; if ($media_id = $this->_db->loadResult()) { $thumb = $this->displayCustomMedia($media_id, 'category'); } return JHTML::link(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id, 'cf' . $row . '-' . (int) $value), $thumb . ' ' . $category->category_name, array('title' => $category->category_name)); } else { return ''; } /* Child Group list * this have no direct display , used for stockable product */ /* Child Group list * this have no direct display , used for stockable product */ case 'G': return ''; //'<input type="text" value="'.JText::_($value).'" name="field['.$row.'][custom_value]" /> '.JText::_('COM_VIRTUEMART_CART_PRICE').' : '.$price .' '; break; break; } } }
if (!$order->invoiceNumber) { $deliverynote_url = juri::root () . 'index.php?option=com_virtuemart&view=invoice&layout=deliverynote&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'&create_invoice=1'; $deliverynote_link = "<a href=\"$deliverynote_url\" >" . '<span class="hasTip deliverynotenew_32" title="' . vmText::_ ('COM_VIRTUEMART_DELIVERYNOTE_CREATE') . '"></span></a>'; } elseif (!shopFunctions::InvoiceNumberReserved ($order->invoiceNumber)) { $deliverynote_url = juri::root () . 'index.php?option=com_virtuemart&view=invoice&layout=deliverynote&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'<span class="hasTip deliverynote_32" title="' . vmText::_ ('COM_VIRTUEMART_DELIVERYNOTE') . '"></span></a>'; } ?> <td><?php echo $print_link; echo $deliverynote_link; echo $invoice_link; ?></td> <!-- Order date --> <td><?php echo vmJsApi::date ($order->created_on, 'LC2', TRUE); ?></td> <!-- Last modified --> <td><?php echo vmJsApi::date ($order->modified_on, 'LC2', TRUE); ?></td> <!-- Status --> <td style="position:relative;"> <?php echo JHtml::_ ('select.genericlist', $this->orderstatuses, "orders[" . $order->virtuemart_order_id . "][order_status]", 'class="orderstatus_select"', 'order_status_code', 'order_status_name', $order->order_status, 'order_status' . $i, TRUE); ?> <input type="hidden" name="orders[<?php echo $order->virtuemart_order_id; ?>][current_order_status]" value="<?php echo $order->order_status; ?>"/> <input type="hidden" name="orders[<?php echo $order->virtuemart_order_id; ?>][coupon_code]" value="<?php echo $order->coupon_code; ?>"/> <br/> <textarea class="element-hidden vm-order_comment vm-showable" name="orders[<?php echo $order->virtuemart_order_id; ?>][comments]" cols="5" rows="5"></textarea> <?php echo JHtml::_ ('link', '#', vmText::_ ('COM_VIRTUEMART_ADD_COMMENT'), array('class' => 'show_comment')); ?> </td> <!-- Update --> <td><?php echo VmHTML::checkbox ('orders[' . $order->virtuemart_order_id . '][customer_notified]', 0) . vmText::_ ('COM_VIRTUEMART_ORDER_LIST_NOTIFY'); ?> <br/> <?php echo VmHTML::checkbox ('orders[' . $order->virtuemart_order_id . '][customer_send_comment]', 1) . vmText::_ ('COM_VIRTUEMART_ORDER_HISTORY_INCLUDE_COMMENT'); ?> <br/> <?php echo VmHTML::checkbox ('orders[' . $order->virtuemart_order_id . '][update_lines]', 1) . vmText::_ ('COM_VIRTUEMART_ORDER_UPDATE_LINESTATUS'); ?>