VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: 2cool on October 27, 2021, 17:29:33 PM

Title: special fields for products info and filter
Post by: 2cool on October 27, 2021, 17:29:33 PM
I want to build a new site with 1000 articles.
Each article has title, short descr, price, sku, ean

But I want to use special fields to add style info, color, material, usage, etc

This to have additional article info to add after product discription
And also to use these fields for customers to filter.

Can this be done in VM  3.8.8 core or are plugins necessary?
Running Joomla 3.10.3

Regards,
Pas

Title: Re: special fields for products info and filter
Post by: Jörgen on October 28, 2021, 00:24:36 AM
From what I can tell this would be done with standard custom fields.

Jörgen @ Kreativ Fotografi
Title: Re: special fields for products info and filter
Post by: 2cool on October 28, 2021, 11:27:17 AM
Thanks,
For color and material it works fine.
But for style I can't figure out how to configure....
This needs to be a title and description for each style.
I tried custom fields 'textarea' and editor' using semicolon betweeen each style description. But can't select the different styles.
Would be nice to have a custom field to select the right style which adds the right style title and description.

Any suggestions.

Regards,
Pas
Title: Re: special fields for products info and filter
Post by: balai on October 28, 2021, 11:44:50 AM
Try Custom Fields For All and Custom Filters.
https://breakdesigns.net/extensions/joomla/custom-fields-for-all
https://breakdesigns.net/extensions/joomla/custom-filters
Title: Re: special fields for products info and filter
Post by: 2cool on October 28, 2021, 12:09:15 PM
Thanks, ill contact them.
Title: Re: special fields for products info and filter
Post by: 2cool on November 02, 2021, 10:55:02 AM
Unfortunately not possible....

Guess it should be possible with plain text area.
Only issue I have, can't create a custom field 'style' and add texts (paragraphs) separated by semicolon...
Does anyone know how this can be modified? is it character restricted maybe...

Regards,
Pas
Title: Re: special fields for products info and filter
Post by: pinochico on November 02, 2021, 11:13:36 AM
QuoteUnfortunately not possible....

I'm sorry, maybe you're taking the wrong steps.

We use these extensions and your additional field and filtering requirements work great :)
https://www.kolo-park.cz/obchod/kola-a-elektrokola
Title: Re: special fields for products info and filter
Post by: Jörgen on November 02, 2021, 11:16:50 AM
Show us an example (with images), I guess this would be possible to do with standard custom fields too.

Jörgen
Title: Re: special fields for products info and filter
Post by: pinochico on November 02, 2021, 11:21:17 AM
QuoteShow us an example (with images), I guess this would be possible to do with standard custom fields too.

to Jörgen:
But modul filtering?
If I use filtering modul from CF, then better for me use CF custom fields :)
Title: Re: special fields for products info and filter
Post by: Jörgen on November 02, 2021, 11:32:21 AM
He sais he has no truoble filtering.

He has trouble creating a custom item with some styling text, he does not tell us how this should look.

Filtering can then always be done with CF.

Jörgen

Title: Re: special fields for products info and filter
Post by: 2cool on November 02, 2021, 11:33:55 AM
You mean custom fields for all?

Attached a quick sketch of the question...

Thanks,
Pas
Title: Re: special fields for products info and filter
Post by: 2cool on November 02, 2021, 11:55:36 AM
Right now it seems to work as I added this locally to my vm custom field.
Selecting this in custom fields looks a bit weird but works.
Only filter is not visible yet.

Regards,
Pas
Title: Re: special fields for products info and filter
Post by: pinochico on November 02, 2021, 12:09:04 PM
QuoteAnd also to use these fields for customers to filter.

Why do you setup textarea custom field, if you want filtering them?
I don't understand :)

Title: Re: special fields for products info and filter
Post by: 2cool on November 02, 2021, 12:15:08 PM
Hi pinochico,
This way i'm more flexible creating product descriptions (have relevant content)
Also when new trends occur it's possible to modify easier.
For customers it's nice and easy to choose/filter on their desired style.

Right now filter works but shows full text of custom fields.
Would be nice to only show title instead.

Regards,
Pas
Title: Re: special fields for products info and filter
Post by: pinochico on November 02, 2021, 13:20:56 PM
QuoteWould be nice to have a custom field to select the right style which adds the right style title and description.

Of course
define value as name of type of style - for custom field "Style" define value "Standard"
define module with name Standard, .... (all values from customfiled) and maybe better setup right position from position of custom field
create override for template productdetail nad customfield
load module with title if value of custom filed is the same

But is my way :)
Title: Re: special fields for products info and filter
Post by: 2cool on November 03, 2021, 15:01:01 PM
Hi pinochico,

Sorry I don't understand what you explained...
The product with style description works fine, just the fllter is showing too mich ;)

Could you send a screen with you setup?

Regards,
Pas
Title: Re: special fields for products info and filter
Post by: pinochico on November 03, 2021, 19:15:00 PM
QuoteA product with a style description works well, only the fllter is displayed too much;)

But come on, why are you lying? :)
If it works well (as you say), there is no need to ask questions here and everything is done and you can go.

But because you are asking questions, obviously your solution is not working as well as you came up with.

I have already written to you that you made a mistake (you inserted the HTML code into the value of the customfield).
Do I need to write again that you made a mistake?
Picture for settings? - unfortunately, sorry I do not understand, I have no picture.

A) simply insert only the following values ​​into the customfiled "style" (without HTML code):
standard;
modern;
retro

and adjust the position

onparams_style

B) Now you need to assign a non-existent description to these values.
Define this description in separate modules ==
create 3 custom modules:
First:
- title: standard
- position: standard
- value: your HTML code from customfield value for standard
Second:
- title: modern
- position: modern
- value: your HTML code from customfield value for modern
Third:
- title: retro
- position: retro
- value: your HTML code from customfield value for retro

C) You will now create an override to display the customfiled "style" and the new modules on the product detail

C1) You create in the file template / your_template / html / com_virtuemart / productdetails / default.php

link to a new sublayout

echo $ this-> loadTemplate ('params');

C2) Create a new sublayout

default_params.php

C3) You manually program the rendering of the "style" customfield in position

Quoteonparams_style

and at the same time modules in customfield value positions

Something in this spirit (I do not guarantee the exact wording, I am not a developer)


<?php // NEW SYSTEM FOR DISPLAY CUSTOMFIELDS - STYLE
if (!empty($this->product->customfieldsSorted['onparams_style'])) {
$this->position='onparams_style';
?>

<div class="product-fields">
<div class="product-fields-title-wrapper">
<span class="product-fields-title"><?php echo vmText::_('COM_VIRTUEMART_CUSTOM_PARAMS_STYLE_TITLE'); ?></span>
</div>

<div class="product-fields-display-wrapper">
<?php foreach ($this->product->customfieldsSorted['onparams_style'] as $field) { ?>
<span class="product-field-value">
<?php echo $field->display ?>
</span>
<span class="product-field-description">
<?php
$document JFactory::getDocument();
$renderer $document->loadRenderer('modules');
$position $field->display;
$options  = array('style' => 'raw');
echo $renderer->render($position$optionsnull);
?>

</span>
<?php ?>
</div>
</div>
<?php 
// STYLE END
?>




Everything is very clear and simple.

---

But like I said, it's my way.

You can see a similar solution (not exactly the same, but rendering modules in the position of customfield values here and it works here):

https://www.archivbox.cz/document-box-a4-skola-k26-010bc12-0001

(link to the description of the icons, which can be found on the detail of the product description)
Title: Re: special fields for products info and filter
Post by: 2cool on December 13, 2021, 11:59:07 AM
Thanks for your reply,

But still it's not clear how this works, sorry i'm not a developer but I think this should be possible.
I did follow your steps as described in A; create a vm custom field, layout position: onparams
At B you created 3 custom modules? (are these custom joomla modules?)
And C: I duplicate and rename default.php, but where and how should I add 'echo $ this-> loadTemplate ('params');' and 'default_params.php'?

Regards,
Pas
Title: Re: special fields for products info and filter
Post by: Studio 42 on December 13, 2021, 16:38:03 PM
Why you do not create 2 fields ?
one with the description and one for the filter ?
So you have not the problem with too long description and you can exactly set the text you want
Title: Re: special fields for products info and filter
Post by: 2cool on December 13, 2021, 17:01:44 PM
Not sure how you this should look like and how this also can be used for filtering...

Do you suggest this setup:

Custom field: Modern style (for filter)
Custom field: Modern description (for product description)

Thanks,
Pas

Title: Re: special fields for products info and filter
Post by: Studio 42 on December 14, 2021, 10:25:49 AM
Yes, use 2 fields. one to display in a product position and one to use as filter
Title: Re: special fields for products info and filter
Post by: 2cool on December 14, 2021, 11:19:22 AM
Thanks,
This is an option but not real efficient, it means adding 2 custom fields to every product.
But if there's no other way I guess it should be done.

Regards,
Pas
Title: Re: special fields for products info and filter
Post by: Studio 42 on December 14, 2021, 17:28:11 PM
2cool, with my tool VM Be pro, you can add the 2 fields in some hours for all your shop or you can use the import view to use a CSV file
Of course using directly virtuemart for this job is a pain