News:

Support the VirtueMart project and become a member

Main Menu

Custom field not shown at cart view

Started by Lockerbie, January 05, 2015, 20:33:08 PM

Previous topic - Next topic

Lockerbie

Happy New Year!

I'm migrating a Joomla-VM-webshop from 2.5x to J! 3.3.6 - VM 3.0.2. With some searching and adjusting, all went well, except for one thing: one of the two custom fields isn't showing at cart view. (These are set up as non-stockable custom fields.)
One is set up as a generic cart variant, used to show different colors (childproducts). This one is visible both at product detail (as a dropdown) and cart view.
The other is set up as a string to show sizes, which is visible as a dropdown at product detail view, but it isn't showing at cart view at all.
How can I adjust this so the custom field 'size' (maat) does show up in cart view?

Joomla! 3.3.6 - VirtueMart 3.0.2

(Edit: removed link.)

jenkinhill

Did you convert the custom fields to VM3 format? See "Update vm2 order format of customfields to vm3 format" button under tools/migration.

Test on a backup copy of the site.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Lockerbie

Hello Jenkinhill,

Yes, I did. This button is present twice, and although one leads to a blank page, I tried both buttons. But nothing has changed...

Lockerbie

I've tried and retried with another backup, but no changes concerning the size-field in both cartview and orders.
Tried again after removing all previous orders, but still no difference.
What can I do or what do I have to edit manually in the database so the size-field will be visible in cartview and in the orders?

Lockerbie

#4
In the page-source-code there is a reference for info from the custom fields in both checkout and mini-cart. Still the info itself isn't transferred to and/or visible in both places. The concerning files:

in root/components/com_virtuemart/views/productdetails/tmpl/default.php, line 111:
    <?php
    
// Product Short Description
    
if (!empty($this->product->product_s_desc)) {
?>

        <div class="product-short-description">
    <?php
    
/** @todo Test if content plugins modify the product description */
    echo nl2br($this->product->product_s_desc);
    ?>

        </div>
<?php
    
// Product Short Description END

echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'ontop'));
    
?>


    <div class="vm-product-container">
<div class="vm-product-media-container">
<?php
echo $this->loadTemplate('images');
?>

</div>

<div class="vm-product-details-container">
    <div class="spacer-buy-area">


in root/components/com_virtuemart/views/productdetails/tmpl/default_addtocart.php, line 30:
<div class="addtocart-area">

<form method="post" class="product js-recalculate" action="<?php echo JRoute::('index.php'); ?>">
                <input name="quantity" type="hidden" value="<?php echo $step ?>" />
<?php // Product custom_fields
if (!empty($this->product->customfieldsCart)) {
?>

<div class="product-fields">
<?php foreach ($this->product->customfieldsCart as $field) { ?>
<div class="product-field product-field-type-<?php echo $field->field_type ?>">
<span class="product-fields-title-wrapper"><span class="product-fields-title"><strong><?php echo JText::($field->custom_title?></strong></span>
<?php if ($field->custom_tip) {
echo JHTML::tooltip ($field->custom_tipJText::($field->custom_title), 'tooltip.png');
?>
</span>
<span class="product-field-display"><?php echo $field->display ?></span>

<span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
</div><br/>
<?php
}
?>

</div>
<?php
}
/* Product custom Childs
 * to display a simple link use $field->virtuemart_product_id as link to child product_id
 * custom_value is relation value to child
 */

if (!empty($this->product->customsChilds)) {
?>

<div class="product-fields">
<?php foreach ($this->product->customsChilds as $field) { ?>
<div class="product-field product-field-type-<?php echo $field->field->field_type ?>">
<span class="product-fields-title"><strong><?php echo JText::($field->field->custom_title?></strong></span>
<span class="product-field-desc"><?php echo JText::($field->field->custom_value?></span>
<span class="product-field-display"><?php echo $field->display ?></span>

</div><br/>
<?php ?>
</div>
<?php }

if (!VmConfig::get('use_as_catalog'0) and !empty($this->product->prices['salesPrice'])) {
?>


in root/components/com_virtuemart/views/productdetails/tmpl/default_customfields.php, line 23:
<div class="product-fields">
    <?php
    
$custom_title null;
    foreach ($this->product->customfieldsSorted[$this->position] as $field) {
     if ( $field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
     continue;
if ($field->display) {
    ?>
<div class="product-field product-field-type-<?php echo $field->field_type ?>">
    <?php if ($field->custom_title != $custom_title && $field->show_title) { ?>
    <span class="product-fields-title" ><?php echo JText::_($field->custom_title); ?></span>
    <?php
    if ($field->custom_tip)
echo JHTML::tooltip($field->custom_tipJText::_($field->custom_title), 'tooltip.png');
}
?>

        <span class="product-field-display"><?php echo $field->display ?></span>
        <span class="product-field-desc"><?php echo jText::_($field->custom_field_desc?></span>
    </div>
    <?php
    $custom_title $field->custom_title;
}
    }
    ?>

        </div>


in root/components/com_virtuemart/helpers/cart.php, line 459:
public function add($virtuemart_product_ids=null,&$errorMsg='') {

$updateSession = false;
$post = vRequest::getRequest();

if(empty($virtuemart_product_ids)){
$virtuemart_product_ids = vRequest::getInt('virtuemart_product_id'); //is sanitized then
}

if (empty($virtuemart_product_ids)) {
vmWarn('COM_VIRTUEMART_CART_ERROR_NO_PRODUCT_IDS');
return false;
}

$products = array();
$this->_productAdded = true;
$productModel = VmModel::getModel('product');
$customFieldsModel = VmModel::getModel('customfields');
//Iterate through the prod_id's and perform an add to cart for each one
foreach ($virtuemart_product_ids as $p_key => $virtuemart_product_id) {

$product = false;
$updateSession = true;
$productData = array();

if(empty($virtuemart_product_id)){
vmWarn('Product could not be added with virtuemart_product_id = 0');
return false;
} else {
$productData['virtuemart_product_id'] = (int)$virtuemart_product_id;
}

if(!empty( $post['quantity'][$p_key])){
$productData['quantity'] = (int) $post['quantity'][$p_key];
} else {
continue;
}

if(!empty( $post['customProductData'][$virtuemart_product_id])){
//$productData['customProductData']
$customProductData  = $post['customProductData'][$virtuemart_product_id];
} else {
$customProductData = array();
}

//Now we check if the delivered customProductData is correct and add missing
$product = $productModel->getProduct($virtuemart_product_id, true, false,true,$productData['quantity']);


if(VmConfig::get('multixcart',0)=='byproduct'){
if(empty($this->vendorId)) $this->vendorId = $product->virtuemart_vendor_id;
if(!empty($this->vendorId) and $this->vendorId != $product->virtuemart_vendor_id){
//Product of another vendor recognised, for now we just return false,
//later we will create here another cart (multicart)
return false;
}
}

$product->customfields = $customFieldsModel->getCustomEmbeddedProductCustomFields($product->allIds,0,1);
$customProductDataTmp=array();

foreach($product->customfields as $customfield){

if($customfield->is_input==1){
if(isset($customProductData[$customfield->virtuemart_custom_id][$customfield->virtuemart_customfield_id])){

if(is_array($customProductData[$customfield->virtuemart_custom_id][$customfield->virtuemart_customfield_id])){
if(!class_exists('vmFilter'))require(VMPATH_ADMIN.'/helpers/vmfilter.php');
foreach($customProductData[$customfield->virtuemart_custom_id][$customfield->virtuemart_customfield_id] as &$customData){

$value = vmFilter::hl( $customData,array('deny_attribute'=>'*'));
//to strong
/* $value = preg_replace('@<[\/\!]*?[^<>]*?>@si','',$value);//remove all html tags  */
//lets use instead
$value = JComponentHelper::filterText($value);
$value = (string)preg_replace('#on[a-z](.+?)\)#si','',$value);//replace start of script onclick() onload()...
$value = trim(str_replace('"', ' ', $value),"'") ;
$customData = (string)preg_replace('#^\'#si','',$value);
}
}
if(!isset($customProductDataTmp[$customfield->virtuemart_custom_id])) $customProductDataTmp[$customfield->virtuemart_custom_id] = array();
$customProductDataTmp[$customfield->virtuemart_custom_id][$customfield->virtuemart_customfield_id] = $customProductData[$customfield->virtuemart_custom_id][$customfield->virtuemart_customfield_id];
}
else if(isset($customProductData[$customfield->virtuemart_custom_id])) {
$customProductDataTmp[$customfield->virtuemart_custom_id] = $customProductData[$customfield->virtuemart_custom_id];
vmdebug('my customp product data ',$customProductData[$customfield->virtuemart_custom_id]);
}
} else {
if(!isset($customProductDataTmp[$customfield->virtuemart_custom_id])){
$customProductDataTmp[$customfield->virtuemart_custom_id] = array();
} else if(!is_array($customProductDataTmp[$customfield->virtuemart_custom_id])){
$customProductDataTmp[$customfield->virtuemart_custom_id] = array($customProductDataTmp[$customfield->virtuemart_custom_id]);
}
$customProductDataTmp[$customfield->virtuemart_custom_id][(int)$customfield->virtuemart_customfield_id] = false;
}

}

$productData['customProductData'] = $customProductDataTmp;

$unsetA = array();
$found = false;


//Now lets check if there is already a product stored with the same id, if yes, increase quantity and recalculate
foreach($this->cartProductsData as $k => &$cartProductData){
$cartProductData = (array)$cartProductData;
if(empty($cartProductData['virtuemart_product_id'])){
$unsetA[] = $k;
} else {
if($cartProductData['virtuemart_product_id'] == $productData['virtuemart_product_id']){

//Okey, the id is already the same, so lets check the customProductData
$diff = !$this->deepCompare($cartProductData['customProductData'],$productData['customProductData']);

if(!$diff){

$newTotal = $cartProductData['quantity'] + $productData['quantity'];

if(!$product)$product = $this->getProduct((int) $productData['virtuemart_product_id'],$cartProductData['quantity']);
if(empty($product->virtuemart_product_id)){
vmWarn('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
$unsetA[] = $k;

} else {
$this->checkForQuantities($product, $newTotal);
vmdebug("add to cart did checkForQuantities",$newTotal,$cartProductData['quantity'],$productData['quantity']);

$product->quantity = $newTotal - $cartProductData['quantity'];
$cartProductData['quantity'] = $newTotal;

vmdebug('add to cart did $product->quantityAdded  ',$cartProductData['quantity']);
}
$found = TRUE;
break;
} else {
vmdebug('product variant is different, I add to cart');
}
}
}


Are these pieces of code above correct, or is something missing? What other files do I have to check?

Edit: these are the pieces of code directly from page-source in 'productdetail-view':

This is from the add-to-cart-part:
<div class="product-fields">
    <div class="product-field product-field-type-A">
        <span class="product-fields-title" >Kleur</span>
            <span class="product-field-display"><select id="352-331customProductData" name="field[352][331][customfield_value]" onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="vm-chzn-select" data-dynamic-update="1" >
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-chocolate-detail">tt190-chocolate</option>
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-risky-detail">tt190-risky</option>
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-fuchsia-detail">tt190-fuchsia</option>
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-pink-detail">tt190-pink</option>
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-detail">tt190</option>
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-navy-detail" selected="selected">tt190-navy</option>
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-crystal-detail">tt190-crystal</option>
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-snow-detail">tt190-snow</option>
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-black-detail">tt190-black</option>
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-lime-detail">tt190-lime</option>
<option value="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-purple-detail">tt190-purple</option>
</select>
</span>
        <span class="product-field-desc"></span>
    </div>
    <div class="product-field product-field-type-S">
        <span class="product-fields-title" >Maat</span>
            <span class="product-field-display"><select id="352-338customProductData" name="customProductData[352][31]" class="vm-chzn-select">
<option value="332">XS </option>
<option value="333">S </option>
<option value="334">M </option>
<option value="335">L </option>
<option value="336">XL </option>
<option value="337">XXL </option>
<option value="338">3XL </option>
</select>
</span>


This is from the mini-cart-part:
<div class="vmCartModule " id="vmCartModule">
<div id="hiddencontainer" style=" display: none; ">
<div class="vmcontainer">
<div class="product_row">
<span class="quantity"></span>&nbsp;x&nbsp;<span class="product_name"></span>

<div class="subtotal_with_tax" style="float: right;"></div>
<div class="customProductData"></div><br>
</div>
</div>
</div>
<div class="vm_cart_products">
<div class="vmcontainer">

<div class="product_row">
<span class="quantity">1</span>&nbsp;x&nbsp;<span class="product_name"><a href="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-navy-detail" >TT190-navy</a></span>
  <div class="subtotal_with_tax" style="float: right;">7,26 €</div>
<div class="customProductData"><div class="vm-customfield-mod"></div></div><br>


</div>
</div>
</div>

<div class="total" style="float: right;">
Totaal <strong>15,16 €</strong> </div>


From the checkout-page, the first table-cell:
<td align="left">
<span class="cart-images">
<img src="/test/mg/joomla/images/stories/virtuemart/product/resized/tt190-navy_110x110.jpg" alt="tt190-navy" /> </span>
<a href="/test/mg/joomla/index.php/werkkleding/werkkleding-algemeen/t-shirts/tt190-navy-detail" >TT190-navy</a><div class="vm-customfield-cart"></div>
</td>

Lockerbie

Ok, perhaps it could be this: I found a thread on another forum with somewhat the same problem, but with VM2-customfields (instead of VM3), see: https://www.gavick.com/forums/bikestore-joomla25/virtuemart-custom-field-disappeared-from-frontend-26526

Somewhere before, during migration and editing the template, I did adjust the same file they're talking about, because the customfields didn't show up on productdetails page. I gave them the position 'ontop', but perhaps this isthe problem for the customfields to not show up in cartview/checkout?
Now I'm confused how to get this all right...

The file (root/templates/chozentemplate//html/com_virtuemart/productdetails/default.php:
<?php
/**
 *
 * Show the product details page
 *
 * @package VirtueMart
 * @subpackage
 * @author Max Milbers, Eugen Stranz
 * @author RolandD,
 * @todo handle child products
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: default.php 6530 2012-10-12 09:40:36Z alatak $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

// addon for joomla modal Box
JHTML::_('behavior.modal');
// JHTML::_('behavior.tooltip');
$document JFactory::getDocument();
$document->addScriptDeclaration("
//<![CDATA[
jQuery(document).ready(function($) {
$('a.ask-a-question').click( function(){
$.facebox({
iframe: '" 
$this->askquestion_url "',
rev: 'iframe|550|550'
});
return false ;
});
/* $('.additional-images a').mouseover(function() {
var himg = this.href ;
var extension=himg.substring(himg.lastIndexOf('.')+1);
if (extension =='png' || extension =='jpg' || extension =='gif') {
$('.main-image img').attr('src',himg );
}
console.log(extension)
});*/
});
//]]>
"
);
/* Let's see if we found the product */
if (empty($this->product)) {
    echo 
JText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
    echo 
'<br /><br />  ' $this->continue_link_html;
    return;
}
?>


<div class="productdetails-view productdetails">

    <?php
    
// Product Navigation
    
if (VmConfig::get('product_navigation'1)) {
?>

        <div class="product-neighbours">
    <?php
    if (!empty(
$this->product->neighbours ['previous'][0])) {
$prev_link JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $this->product->neighbours ['previous'][0] ['virtuemart_product_id'] . '&virtuemart_category_id=' $this->product->virtuemart_category_id);
echo JHTML::_('link'$prev_link$this->product->neighbours ['previous'][0]
['product_name'], array('class' => 'previous-page'));
    }
    if (!empty($this->product->neighbours ['next'][0])) {
$next_link JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $this->product->neighbours ['next'][0] ['virtuemart_product_id'] . '&virtuemart_category_id=' $this->product->virtuemart_category_id);
echo JHTML::_('link'$next_link$this->product->neighbours ['next'][0] ['product_name'], array('class' => 'next-page'));
    }
    ?>

    <div class="clear"></div>
        </div>
    <?php // Product Navigation END
    
?>


<?php // Back To Category Button
if ($this->product->virtuemart_category_id) {
$catURL =  JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$this->product->virtuemart_category_id);
$categoryName $this->product->category_name ;
} else {
$catURL =  JRoute::_('index.php?option=com_virtuemart');
$categoryName jText::_('COM_VIRTUEMART_SHOP_HOME') ;
}
?>

<div class="back-to-category">
    <a href="<?php echo $catURL ?>" class="product-details" title="<?php echo $categoryName ?>"><?php echo JText::sprintf('COM_VIRTUEMART_CATEGORY_BACK_TO',$categoryName?></a>
</div>

    <?php // Product Title   ?>
    <h1><?php echo $this->product->product_name ?></h1>
    <?php // Product Title END   ?>

    <?php // afterDisplayTitle Event
    
echo $this->product->event->afterDisplayTitle ?>


    <?php
    
// Product Edit Link
    
echo $this->edit_link;
    
// Product Edit Link END
    
?>


    <?php
    
// PDF - Print - Email Icon
    
if (VmConfig::get('show_emailfriend') || VmConfig::get('show_printicon') || VmConfig::get('pdf_button_enable')) {
?>

        <div class="icons">
    <?php
    
//$link = (JVM_VERSION===1) ? 'index2.php' : 'index.php';
    $link 'index.php?tmpl=component&option=com_virtuemart&view=productdetails&virtuemart_product_id=' $this->product->virtuemart_product_id;
    $MailLink 'index.php?option=com_virtuemart&view=productdetails&task=recommend&virtuemart_product_id=' $this->product->virtuemart_product_id '&virtuemart_category_id=' $this->product->virtuemart_category_id '&tmpl=component';

    if (VmConfig::get('pdf_icon'1) == '1') {
echo $this->linkIcon($link '&format=pdf''COM_VIRTUEMART_PDF''pdf_button''pdf_button_enable'false);
    }
    echo $this->linkIcon($link '&print=1''COM_VIRTUEMART_PRINT''printButton''show_printicon');
    echo $this->linkIcon($MailLink'COM_VIRTUEMART_EMAIL''emailButton''show_emailfriend');
    ?>

    <div class="clear"></div>
        </div>
    <?php // PDF - Print - Email Icon END
    
?>


    <?php
    
// Product Short Description
    
if (!empty($this->product->product_s_desc)) {
?>

        <div class="product-short-description">
    <?php
    
/** @todo Test if content plugins modify the product description */
    echo nl2br($this->product->product_s_desc);
    ?>

        </div>
<?php
    
// Product Short Description END


    
    
?>


    <div>
<div class="width50 floatleft">
<?php
echo $this->loadTemplate('images');
?>

</div>

<div class="width50 floatright">
    <div class="spacer-buy-area">

<?php
// TODO in Multi-Vendor not needed at the moment and just would lead to confusion
/* $link = JRoute::_('index2.php?option=com_virtuemart&view=virtuemart&task=vendorinfo&virtuemart_vendor_id='.$this->product->virtuemart_vendor_id);
  $text = JText::_('COM_VIRTUEMART_VENDOR_FORM_INFO_LBL');
  echo '<span class="bold">'. JText::_('COM_VIRTUEMART_PRODUCT_DETAILS_VENDOR_LBL'). '</span>'; ?>
<a class="modal" href="<?php echo $link ?>"><?php echo $text ?></a><br />
*/
?>
       
        <?php
// Manufacturer of the Product
if (VmConfig::get('show_manufacturers'1) && !empty($this->product->virtuemart_manufacturer_id)) {
    echo $this->loadTemplate('manufacturer');
}
?>


        <?php
if ($this->showRating) {
    $maxrating VmConfig::get('vm_maximum_rating_scale'5);

    if (empty($this->rating)) {
?>

<span class="vote"><?php echo JText::_('COM_VIRTUEMART_RATING') . ' ' JText::_('COM_VIRTUEMART_UNRATED'?></span>
    <?php
} else {
    $ratingwidth $this->rating->rating 24//I don't use round as percetntage with works perfect, as for me
    ?>

<span class="vote">
<?php echo JText::_('COM_VIRTUEMART_RATING') . ' ' round($this->rating->rating) . '/' $maxrating?><br/>
    <span title=" <?php echo (JText::_("COM_VIRTUEMART_RATING_TITLE") . round($this->rating->rating) . '/' $maxrating?>" class="ratingbox" style="display:inline-block;">
<span class="stars-orange" style="width:<?php echo $ratingwidth.'px'?>">
</span>
    </span>
</span>
<?php
    }
}
if (is_array($this->productDisplayShipments)) {
    foreach ($this->productDisplayShipments as $productDisplayShipment) {
echo $productDisplayShipment '<br />';
    }
}
if (is_array($this->productDisplayPayments)) {
    foreach ($this->productDisplayPayments as $productDisplayPayment) {
echo $productDisplayPayment '<br />';
    }
}
// Product Price
    // the test is done in show_prices
//if ($this->show_prices and (empty($this->product->images[0]) or $this->product->images[0]->file_is_downloadable == 0)) {
    echo $this->loadTemplate('showprices');
//}
?>

       
        <?php 
        
if (!empty($this->product->customfieldsSorted['ontop'])) {
    $this->position 'ontop';
    echo $this->loadTemplate('customfields');
        } 
// Product Custom ontop end
    ?>


<?php
// Add To Cart Button
//  if (!empty($this->product->prices) and !empty($this->product->images[0]) and $this->product->images[0]->file_is_downloadable==0 ) {
// if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices['salesPrice'])) {
    echo $this->loadTemplate('addtocart');
// }  // Add To Cart Button END
?>


<?php
// Availability Image
$stockhandle VmConfig::get('stockhandle''none');
if (($this->product->product_in_stock $this->product->product_ordered) < 1) {
if ($stockhandle == 'risetime' and VmConfig::get('rised_availability') and empty($this->product->product_availability)) {
?>
<div class="availability">
    <?php echo (file_exists(JPATH_BASE .' / 'VmConfig::get('assets_general_path') . 'images/availability/' VmConfig::get('rised_availability'))) ? JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' VmConfig::get('rised_availability''7d.gif'), VmConfig::get('rised_availability''7d.gif'), array('class' => 'availability')) : VmConfig::get('rised_availability'); ?>
</div>
    <?php
} else if (!empty($this->product->product_availability)) {
?>

<div class="availability">
<?php echo (file_exists(JPATH_BASE .' / 'VmConfig::get('assets_general_path') . 'images/availability/' $this->product->product_availability)) ? JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' $this->product->product_availability$this->product->product_availability, array('class' => 'availability')) : $this->product->product_availability?>
</div>
<?php
}
}
?>


<?php
// Ask a question about this product
if (VmConfig::get('ask_question'1) == 1) {
    
?>

    <div class="ask-a-question">
        <a class="ask-a-question" href="<?php echo $this->askquestion_url ?>" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL'?></a>
        <!--<a class="ask-a-question modal" rel="{handler: 'iframe', size: {x: 700, y: 550}}" href="<?php echo $this->askquestion_url ?>"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL'?></a>-->
    </div>
<?php }
?>


</div>
</div>
<div class="clear"></div>
    </div>

<?php // event onContentBeforeDisplay
echo $this->product->event->beforeDisplayContent?>


<?php
// Product Description
if (!empty($this->product->product_desc)) {
    ?>

        <div class="product-description">
<?php /** @todo Test if content plugins modify the product description */ ?>
    <span class="title"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE'?></span>
<?php echo $this->product->product_desc?>
        </div>
<?php
    
// Product Description END

    
if (!empty($this->product->customfieldsSorted['normal'])) {
$this->position 'normal';
echo $this->loadTemplate('customfields');
    } 
// Product custom_fields END
    // Product Packaging
    
$product_packaging '';
    if (
$this->product->product_box) {
?>

        <div class="product-box">
    <?php
        echo 
JText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX') .$this->product->product_box;
    ?>

        </div>
    <?php // Product Packaging END
    
?>


    <?php
    
// Product Files
    // foreach ($this->product->images as $fkey => $file) {
    // Todo add downloadable files again
    // if( $file->filesize > 0.5) $filesize_display = ' ('. number_format($file->filesize, 2,',','.')." MB)";
    // else $filesize_display = ' ('. number_format($file->filesize*1024, 2,',','.')." KB)";

    /* Show pdf in a new Window, other file types will be offered as download */
    // $target = stristr($file->file_mimetype, "pdf") ? "_blank" : "_self";
    // $link = JRoute::_('index.php?view=productdetails&task=getfile&virtuemart_media_id='.$file->virtuemart_media_id.'&virtuemart_product_id='.$this->product->virtuemart_product_id);
    // echo JHTMl::_('link', $link, $file->file_title.$filesize_display, array('target' => $target));
    // }
    
if (!empty($this->product->customfieldsRelatedProducts)) {
echo $this->loadTemplate('relatedproducts');
    } 
// Product customfieldsRelatedProducts END

    
if (!empty($this->product->customfieldsRelatedCategories)) {
echo $this->loadTemplate('relatedcategories');
    } 
// Product customfieldsRelatedCategories END
    // Show child categories
    
if (VmConfig::get('showCategory'1)) {
echo $this->loadTemplate('showcategory');
    }
    if (!empty(
$this->product->customfieldsSorted['onbot'])) {
    
$this->position='onbot';
    
echo $this->loadTemplate('customfields');
    } 
// Product Custom ontop end
    
?>


<?php // onContentAfterDisplay event
echo $this->product->event->afterDisplayContent?>


<?php
echo $this->loadTemplate('reviews');
?>

</div>

Lockerbie

Yes, I found it!

I removed the file:
root/templates/chozentemplate/html/com_virtuemart/productdetails/default.php
and used the original file at:
root/components/com_virtuemart/views/productdetails/tmpl/default.php

There was an error/typo on line 143:
          echo $this->laodTemplate('manufacturer');

changed it to:
          echo $this->loadTemplate('manufacturer');


After that, I changed the layout-position of the custom fields from 'ontop' to 'addtocart' and there it was: the size appeared in the mini-cart and checkout!