VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: sadra on April 28, 2019, 18:55:02 PM

Title: tag system for custom fields
Post by: sadra 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.
Title: Re: tag system for custom fields
Post by: Studio 42 on April 28, 2019, 19:45:39 PM
https://shop.st42.fr/en/products/shortcodes.htm (https://shop.st42.fr/en/products/shortcodes.htm)
Go on bottom Demo page https://pro.st42.fr/en/android/acer-liquid-z6-plus.html (https://pro.st42.fr/en/android/acer-liquid-z6-plus.html) and click TAGS : android for eg.
Title: Re: tag system for custom fields
Post by: Ghost on April 29, 2019, 08:03:06 AM
You can wrap custom field value with a link like this:

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.
Title: Re: tag system for custom fields
Post by: Studio 42 on April 29, 2019, 11:02:35 AM
Quote from: Ghost on April 29, 2019, 08:03:06 AM
You can wrap custom field value with a link like this:

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
Title: Re: tag system for custom fields
Post by: sadra on May 17, 2019, 23:06:08 PM
Quote from: Ghost on April 29, 2019, 08:03:06 AM
You can wrap custom field value with a link like this:

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?
Title: Re: tag system for custom fields
Post by: sadra on May 17, 2019, 23:08:20 PM
Quote from: Studio 42 on April 28, 2019, 19:45:39 PM
https://shop.st42.fr/en/products/shortcodes.htm (https://shop.st42.fr/en/products/shortcodes.htm)
Go on bottom Demo page https://pro.st42.fr/en/android/acer-liquid-z6-plus.html (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.
Title: Re: tag system for custom fields
Post by: Studio 42 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
Title: Re: tag system for custom fields
Post by: balai 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
Title: Re: tag system for custom fields
Post by: Studio 42 on May 18, 2019, 16:57:53 PM
Balai, it dont want pay for it. And want Tags not filters.
Title: Re: tag system for custom fields
Post by: AH on May 19, 2019, 12:22:59 PM
QuoteThanks 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!
Title: Re: tag system for custom fields
Post by: balai on May 20, 2019, 11:06:40 AM
QuoteBalai, 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.


Title: Re: tag system for custom fields
Post by: Studio 42 on May 20, 2019, 11:15:58 AM
Quote from: balai on May 20, 2019, 11:06:40 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
Title: Re: tag system for custom fields
Post by: Ghost on May 21, 2019, 10:27:27 AM
Quote from: sadra on May 17, 2019, 23:06:08 PM
Quote from: Ghost on April 29, 2019, 08:03:06 AM
You can wrap custom field value with a link like this:

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.


// 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;
Title: Re: tag system for custom fields
Post by: PRO on May 21, 2019, 23:57:41 PM
Quote from: sadra on April 28, 2019, 18:55:02 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?