Author Topic: HOW TO SETUP A custom field - IN THE CATEGORY/BROWSE VIEW  (Read 713 times)

ch1vph

  • Jr. Member
  • **
  • Posts: 52
  • A beginner
HOW TO SETUP A custom field - IN THE CATEGORY/BROWSE VIEW
« on: January 22, 2018, 13:59:20 pm »
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:

Code: [Select]
<?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...


Code: [Select]
<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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4367
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: HOW TO SETUP A custom field - IN THE CATEGORY/BROWSE VIEW
« Reply #1 on: January 22, 2018, 15:36:16 pm »
This is the original code:
Code: [Select]
<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 :
Code: [Select]
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