News:

Looking for documentation? Take a look on our wiki

Main Menu

Several Custom fields with type "Related Products"

Started by tangouli, August 20, 2020, 12:22:23 PM

Previous topic - Next topic

tangouli

I use an actual system with joomla 3.9.20 and virtuemart 3.8.4

In virtuemart custom filelds I have created new custum fields with type "related products" with different names and descriptions.

In the virtuemart product there is only one area for "related products".
Where are my new created custom fields with this type to fill in?

Thank you for help.

Jörgen

AFAIK there is no possibility to use multiple related products. Why would You do that ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

tangouli

Thank you for you answer.

in this special case I want relate several kinds of volants and bordering tapes to an awning fabic.
For both I want relate products with there own title and description.

(By the way: why is it possible to create several custom fields with this type "related products"?)



PRO



Can you code at all?

I have a plugin for my site that works just like related products. I use it for "accessories" etc. It basically just displays a product and header.


I could give it to you, but you would have to move some functions around, cause I use my own library to streamline a lot of functions.


tangouli

Hel Pro,
that is a very kind offer!
Yes, I am a coder.
I am new to virtuemart but not to php and other shop-systems.

Jörgen

Quote from: tangouli on August 20, 2020, 14:23:38 PM
(By the way: why is it possible to create several custom fields with this type "related products"?)

I guess there was an idea to make this generic, but this was not pulled through. It is a free software, You know that right ?

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

StefanSTS

Did you consider making a module position at the place where you want it and place the mod_virtuemart_product module there?

I made a (slider) module in which you can enter the product IDs of the products to show or a category ID.
https://www.jooglies.com/en/virtuemart-extensions/product-slider-light

You can disable the slider JS in the settings and maybe use it like that, or code a bit around inside.
It is basically mod_virtuemart_products with a few additional features. It's from an earlier version of VM so you might want to compare, if the code is still uptodate.

Regards
Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

PRO

The folder attached.

inside the folder
the zip "product"   is the product plugin you just install.

The folder    "kaizen"   goes into   site/libraries

IF YOU want, you can just take all the functions that are in the library files, and place them into the plugin file product.php
I use a library, cause I use these same functions all across my site, in different plugins and displays.

things to note
if you are not using english  in plugin.php   you will have to change the line to your language.
$product_table=KaizenDatabase::get_table('#__virtuemart_products_en_gb',0);

^^^^ notice   _en_gb   is my language.


I have removed most of the stuff from the library files that does not pertain to this plugin.


You create a custom field, with the position you want.
Then in backend of product, the plugin will create a dropdown list of products you choose (multiple OK)


Then in your product template, you just want to have the position where you want it.


do not private message me, if you need help implementing, reply to this thread

tangouli

Thank you all,

PRO fo yout files and StefanSTS for your ideas.
I will try it in the next days and report next week.

@Jörgen: may be, I make that module in future.
(First I need a quick solution while my customer waits ...)

tangouli

Thank you Pro for your module!

It does just what I wanted it to do!

It is a very good base for me to develop on it.
I need it multilingual ...

Of course I will report.

pinochico

I don't under stand, why I can't duplicate standard VirtueMart Related CustomFileds and setup another position as core Customfileds.

Why I need new plugin for this?

Where is pointer? (maybe my wrong english or google translate :D)
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

pinochico

#11
Ok, I tryied install and setup and maybe I understand what plugin do it and what tangouli want, but I can't chack function - related product is not showed.

Maybe this error?
Warning: mysqli_real_escape_string() expects parameter 2 to be string, object given in /data/www/joomla3.easy.minion.cz/public_html/libraries/joomla/database/driver/mysqli.php on line 251

I setup, add related product from customfield-plugin and add to template:

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

but nothing heapend :(

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

tangouli

Thank you Pro,

I had a problem using the plugin more than once (on different positions with different headings).
It shows then all connected products within all instances of the plugin.

I have corrected it in the plugin, product.php, function plgVmOnDisplayProductFEVM3
by adding the filter-rule:
     foreach ($product->customfields as $field){
     if ((empty($field->product)) ||
         ($group->virtuemart_custom_id != $field->virtuemart_custom_id)) continue;
    ...
you may download the corrected file at
    http://daten.das-web.de/product.zip






Studio 42

I already wrote a plugin that can handel many related products list or list product that can be added to cart
see https://shop.st42.fr/en/products/extra-product.htm
And yes in some shop, this is needed.
For eg a smartphone. You can have related products(memory cards list , phone case list ..... and similar product(other phones) in this case you need 2 lists or more.