News:

Support the VirtueMart project and become a member

Main Menu

HOW TO SETUP A custom field - IN THE CATEGORY/BROWSE VIEW

Started by ch1vph, January 22, 2018, 13:59:20 PM

Previous topic - Next topic

ch1vph

Hi there,

I have a problem with a Virtuemart custom field (the 'breakdesigns' colour swatch) not being displayed in category/browse view...due to a  template level error says the plugin dev.

I have tested an upload of the latest ver of the VM 'products' file in my templates/mytemplate/html/com_virtuemart/sublayouts folder, and the swatch does show up but when I copy the latest 'customfields' code (as below) into various lines (whilst testing) in my current 'customized' products file the changes don't seem to work.

This is the new VM products file code:

<?php //echo $rowsHeight[$row]['customs'] ?>
<div class="vm3pr-<?php echo $rowsHeight[$row]['customfields'?>"> <?php
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop''addtocart'))); ?>

</div>


And then this is my code at present: My file also has an additional first line as below...


<div class="product-action">
<?php //echo $rowsHeight[$row]['customs'] ?>
<div class="vm3pr-<?php echo $rowsHeight[$row]['customfields'?>"> <?php
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop''addtocart'))); ?>

</div>



AS YOU CAN SEE THEY BOTH SEEM TO BE THE SAME APART FROM THE FIRST LINE BUT I just need to figure out what else needs to change in my products file, to get the swatch to display

Can anyone please advise me on how this can be accomplished please.

VirtueMart 3.2.4
Joomla! 3.8.1
PHP Version 5.6.32

Studio 42

This is the original code:
<div class="vm3pr-<?php echo $rowsHeight[$row]['customfields'?> addcart-box">
<?php
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product'customs' =>$customs,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop''addtocart'))); ?>

</div>

So excluded the HTML class, same as your.
Are you sure the problem is in this code ?

You can add this for test :
echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product,'position'=>'ontop'));

echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product,'position'=>'addtocart'));

And see if something is rendered.
Else the problem is in your addtocart file
JOOMLAROOT/templates/YOURTEMPLATE/html/com_virtuemart/sublayouts/addtocart.php