Author Topic: tag system for custom fields  (Read 921 times)

sadra

  • Beginner
  • *
  • Posts: 4
tag system for custom fields
« on: April 28, 2019, 18:55:02 pm »
Is there any solution to add a custom field to link to it's similar products like a joomla tag system?

For example I have a publisher field in my books custom field group, When a user click on a publisher name in custom fields list, show him all the book from the same publisher.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4017
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: tag system for custom fields
« Reply #1 on: April 28, 2019, 19:45:39 pm »

Ghost

  • Jr. Member
  • **
  • Posts: 419
Re: tag system for custom fields
« Reply #2 on: April 29, 2019, 08:03:06 am »
You can wrap custom field value with a link like this:

Code: [Select]
JRoute::_('index.php?option=com_virtuemart&view=category&keyword=+&customfields[' . $field->virtuemart_custom_id . ']=' . $field->customfield_value);
This links to category view with custom field search applied.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4017
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: tag system for custom fields
« Reply #3 on: April 29, 2019, 11:02:35 am »
You can wrap custom field value with a link like this:

Code: [Select]
JRoute::_('index.php?option=com_virtuemart&view=category&keyword=+&customfields[' . $field->virtuemart_custom_id . ']=' . $field->customfield_value);
This links to category view with custom field search applied.
You can but it's not optimized. My plugin use an index only, so bigger is the shop and faster is my solution compared to VM core. You can see here about text search optimisation in mysql https://hackernoon.com/dont-waste-your-time-with-mysql-full-text-search-61f644a54dfa

sadra

  • Beginner
  • *
  • Posts: 4
Re: tag system for custom fields
« Reply #4 on: May 17, 2019, 23:06:08 pm »
You can wrap custom field value with a link like this:

Code: [Select]
JRoute::_('index.php?option=com_virtuemart&view=category&keyword=+&customfields[' . $field->virtuemart_custom_id . ']=' . $field->customfield_value);
This links to category view with custom field search applied.

is it possible to only use this code for specified custom fields?

sadra

  • Beginner
  • *
  • Posts: 4
Re: tag system for custom fields
« Reply #5 on: May 17, 2019, 23:08:20 pm »
https://shop.st42.fr/en/products/shortcodes.htm
Go on bottom Demo page https://pro.st42.fr/en/android/acer-liquid-z6-plus.html and click TAGS : android for eg.

Thanks your extension seems promising, but I need a free solution for my project.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4017
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: tag system for custom fields
« Reply #6 on: May 18, 2019, 10:02:35 am »
Sadra,
If you have a little shop, you can use the core as explained by ghost.
Add &customfields[45]=value
[/size]where 45 is the ID of your tag customfield

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1378
Re: tag system for custom fields
« Reply #7 on: May 18, 2019, 13:55:28 pm »
I think that you need custom fields for assigning attributes and a filtering system for showing the products based on those attributes.

I am not aware of a free system, but if you are willing to spend a few pennies, please check the Custom Filters system.
https://breakdesigns.net/extensions/custom-filters

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4017
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: tag system for custom fields
« Reply #8 on: May 18, 2019, 16:57:53 pm »
Balai, it dont want pay for it. And want Tags not filters.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2968
  • VirtueMart Version: 3.6.3
Re: tag system for custom fields
« Reply #9 on: May 19, 2019, 12:22:59 pm »
Quote
Thanks your extension seems promising, but I need a free solution for my project.

Note everything can be free - unless of course your shop will also give away all the products it has for free!
regards
A

Joomla 3.9.12
php 7.2

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1378
Re: tag system for custom fields
« Reply #10 on: May 20, 2019, 11:06:40 am »
Quote
Balai, it dont want pay for it. And want Tags not filters.
If you don't want to pay, try to write a letter to Santa Clause, maybe he will get that one  :)
I don't see any difference between the tags and the filters, from functionality aspect.



Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4017
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: tag system for custom fields
« Reply #11 on: May 20, 2019, 11:15:58 am »
I don't see any difference between the tags and the filters.
Tag are displayed inside products.
Filters are all tags, price, search ... displayed in category for eg. So more generic

Ghost

  • Jr. Member
  • **
  • Posts: 419
Re: tag system for custom fields
« Reply #12 on: May 21, 2019, 10:27:27 am »
You can wrap custom field value with a link like this:

Code: [Select]
JRoute::_('index.php?option=com_virtuemart&view=category&keyword=+&customfields[' . $field->virtuemart_custom_id . ']=' . $field->customfield_value);
This links to category view with custom field search applied.

is it possible to only use this code for specified custom fields?

Yes, check the field ID, position or some other property.

Code: [Select]
// IDs of fields to show links for.
$tagFields = array(1, 2 3);


// Inside field loop.
if (in_array($field->virtuemart_custom_id, $tagFields)) :
echo '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=category&keyword=+&customfields[' . $field->virtuemart_custom_id . ']=' . $field->customfield_value) . '">' . $field->display . '</a>';
else :
echo $field->display;
endif;

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10362
  • VirtueMart Version: 3+
Re: tag system for custom fields
« Reply #13 on: May 21, 2019, 23:57:41 pm »
When a user click on a publisher name in custom fields list, show him all the book from the same publisher.

Are you using the manufacturer field for something else?

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