News:

Looking for documentation? Take a look on our wiki

Main Menu

Choosing custom fields to show on category page SOLVED

Started by nebojsa, August 28, 2020, 10:53:01 AM

Previous topic - Next topic

nebojsa

Hi everyone,

Is there a way to show specific custom fields on category view?
I would like to show related products on category view page.

In previous version of Virtuemart I had to add separate function in shop.browse.php and call that function from category view.
Virtuemart has changed a lot since first versions and I cannot find appropriate files for various functions.

So far I was only able to find how to display addtocart with customfields on category page.
<?php echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop''addtocart'))); ?>

Thank you in advance.

Joomla! 3.9.20
VirtueMart 3.8.4 10335
Using commercial theme template

nebojsa

Still more questions than answers on this forum :(

In case anyone need it, rendering functions for category page is different than on product details page:
So if you want to show related products on category page, here it is:

<?php echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product'position'=>'related_products''class'=> 'product-related-products','customTitle' => true));?>

pinochico

Related products are set for each product separately.
This is the right idea to display related products correctly == is always related to the product and not to the whole category.

Thank you for the information, but I will not use this solution.

And if the owner of the e-shop convinced me that he wanted it (but not really, because the owner of the e-shop does not understand how to make an e-shop), then I would use the Related Products Module (which show products by specific customfiiled) for the category and not this solution.
Module with JS Slideshow, maybe a couple of modules inside tabs...
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

nebojsa

What module exactly you are talking about?
I am a shop owner and I have a product which use spare part which I would like to show on category page along with products. For example - a grinding machines which uses grinding stones - and I want buyers to see grinding stones machine use so they can find and replace easily.

pinochico

For this solution you don't need https://www.minijoomla.org/extensions/virtuemart-extensions/related-products-extended-for-virtuemart, but you can set up a separate category for grinding stones and use core module VirtueMart Product and set up this category and put this module bottom or above products from category a grinding machine.

But if you want, you can use Related Products Extended for Virtuemart for other reasons.
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

nebojsa

I still don't understand what do you see wrong in my solution?
If you make separate module position then it will not look easy and simple for the visitors.
http://www.gravex.rs/en/naslovna/1-pecati-i-stambilji/2-standardni.
Check out my old website and see what I mean.

pinochico

Your solutions are perfect, thanks.
If you have 20 products in category and for every product have 20 related products, then you show 400 products, isn't right?

But I use even so module, better for me, admin and all :)
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

nebojsa

If I want to show 400 related products on category page that's my personal thing.
On the other hand ...
Modules, modules, modules ... and after some time those modules start loosing support, it turns out they are full of security issues and I am left all alone to deal with it.
No thanks to more modules on my website, sorry.

loxlay

Hi,
is there a solution for Joomla 4 and VirtueMart 4?
The code mentioned here unfortunately no longer works. The sub layouts have also been abolished.
Does anyone have an idea?

Thanks loxlay

Studio 42

Are you sure that the code not work ?
You have an option in VM config to disable custom fields in Category view, please verify your settings.

loxlay

Hi,
yes I'm sure. The fields are active in vm config. It is displayed on product detail page, but not on category page.
In Joomla 3 it worked with this command using template overrides but not with Joomla 4.

loxlay

Hi,
which file is the correct one?
I tried this two:

/components/com_virtuemart/views/category/tmpl/default.php
/components/com_virtuemart/sublayouts/products.php


Using this code:
echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product, 'position'=>'related_products', 'class'=> 'product-related-products','customTitle' => true));

Studio 42

You should not edit the virtuemart file directly but use a template override
copy original com_virtuemart/sublayouts/customfields.php
in
templates/YOURTEMPLATE/html/com_virtuemart/sublayouts/customfields.php
calling shopFunctionsF::renderVmSubLayout('customfields' .... is for the sublayout customfields

GJC Web Design

In VM4 to get custom fields to show up on a cat display of the product you have to check "Cart Attribute"

I have no idea why this changed in VM4
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

loxlay