Hello.
VirtueMart 3.6.10 / Joomla! 3.9.12 / protostar / site
To display the label "new" "sale" on the category page I use a Custom Field 'Image'
To output to a file \templates\protostar\html\com_virtuemart\sublayouts\products.php
code
// Show Products ?>
<div class="product vm-col<?php echo ' vm-col-' . $products_per_row . $show_vertical_separator ?>">
<div class="spacer product-container">
<div class="vm-product-media-container">
<?php echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product,'position'=>'yarl'));?>
<?php echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product,'position'=>'yarl1'));?>
<?php echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product,'position'=>'yarl2'));?>
<a title="<?php echo $product->product_name ?>" href="<?php echo $product->link.$ItemidStr; ?>">
<?php
echo $product->images[0]->displayMediaThumb('class="browseProductImage"', false);
?>
</a>
</div>
It works, but the shortcuts are above the main image. screen (https://drive.google.com/open?id=1YEZiK-4JPsZuR5rNcCx6cPHfpE6hAq6l)
Labels should be next to the main image.
surround the labels with an absolute positioned div and make .product-container position relative
then u can position the labels where ever u want
Thank you for participating.
Thank you very much for your help!
The method works perfectly!
New is internal function Virtuemart for every product.
Sale is internal function Virtuemart on every product detail in admin (checkbox).
Then you don't need create customfield and forcing administrators to fill in additional information is unproductive.
Better, develop correctly following this information.
Or you can use one of the existing plugins to create labels.
Please, where in the creation of the product there is a shortcut output to the category page, without using the plugin.
There are many products in the category and only two new ones. One of them is light, the other is heavy.
the label on the product: "new" "heavy"
the label on the product: "new "" light"
Thank
QuotePlease, where in the creation of the product there is a shortcut output to the category page, without using the plugin.
New == date of creation product is saved in DB. Then if you don't use plugin, then must call DB and select all product which is new (setup how long time is for new :)
This select you must save as value and then create if else for every product on category view and after yes, then put label to sublayout product.