News:

Support the VirtueMart project and become a member

Main Menu

label on the category page

Started by Елeна, May 12, 2020, 07:11:05 AM

Previous topic - Next topic

Елeна

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
Labels should be next to the main image.

GJC Web Design

surround the labels with an absolute positioned div and make .product-container position relative

then u can position the labels where ever u want
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Елeна

#2
Thank you for participating.


Thank you very much for your help!
The method works perfectly!

pinochico

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.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Елeна

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

pinochico

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.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products