Author Topic: Several Custom fields with type "Related Products"  (Read 1017 times)

tangouli

  • Beginner
  • *
  • Posts: 14
  • A beginner
  • Skype Name: Ulrich Heiwolt
  • VirtueMart Version: 3.8
Several Custom fields with type "Related Products"
« on: August 20, 2020, 12:22:23 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3149
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Several Custom fields with type "Related Products"
« Reply #1 on: August 20, 2020, 13:56:55 pm »
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

  • Beginner
  • *
  • Posts: 14
  • A beginner
  • Skype Name: Ulrich Heiwolt
  • VirtueMart Version: 3.8
Re: Several Custom fields with type "Related Products"
« Reply #2 on: August 20, 2020, 14:23:38 pm »
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

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10423
  • VirtueMart Version: 3+
Re: Several Custom fields with type "Related Products"
« Reply #3 on: August 20, 2020, 16:01:59 pm »


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.

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

tangouli

  • Beginner
  • *
  • Posts: 14
  • A beginner
  • Skype Name: Ulrich Heiwolt
  • VirtueMart Version: 3.8
Re: Several Custom fields with type "Related Products"
« Reply #4 on: August 20, 2020, 16:10:51 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3149
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Several Custom fields with type "Related Products"
« Reply #5 on: August 20, 2020, 17:07:55 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

  • Global Moderator
  • Full Member
  • *
  • Posts: 550
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: Several Custom fields with type "Related Products"
« Reply #6 on: August 20, 2020, 18:37:09 pm »
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

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10423
  • VirtueMart Version: 3+
Re: Several Custom fields with type "Related Products"
« Reply #7 on: August 20, 2020, 19:21:23 pm »
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
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

tangouli

  • Beginner
  • *
  • Posts: 14
  • A beginner
  • Skype Name: Ulrich Heiwolt
  • VirtueMart Version: 3.8
Re: Several Custom fields with type "Related Products"
« Reply #8 on: August 21, 2020, 09:03:41 am »
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

  • Beginner
  • *
  • Posts: 14
  • A beginner
  • Skype Name: Ulrich Heiwolt
  • VirtueMart Version: 3.8
Re: Several Custom fields with type "Related Products"
« Reply #9 on: September 15, 2020, 21:46:39 pm »
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

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 818
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Several Custom fields with type "Related Products"
« Reply #10 on: September 16, 2020, 02:31:03 am »
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 from products, orders and database table
Virtuemart Email Manager - customs email templates

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 818
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Several Custom fields with type "Related Products"
« Reply #11 on: September 16, 2020, 03:04:19 am »
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 from products, orders and database table
Virtuemart Email Manager - customs email templates

tangouli

  • Beginner
  • *
  • Posts: 14
  • A beginner
  • Skype Name: Ulrich Heiwolt
  • VirtueMart Version: 3.8
Re: Several Custom fields with type "Related Products"
« Reply #12 on: September 16, 2020, 13:37:38 pm »
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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4387
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Several Custom fields with type "Related Products"
« Reply #13 on: September 16, 2020, 14:59:37 pm »
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.