Author Topic: special fields for products info and filter  (Read 1986 times)

2cool

  • Jr. Member
  • **
  • Posts: 282
Re: special fields for products info and filter
« Reply #15 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

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1439
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: special fields for products info and filter
« Reply #16 on: November 03, 2021, 19:15:00 pm »
Quote
A 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

Code: [Select]
echo $ this-> loadTemplate ('params');
C2) Create a new sublayout

Code: [Select]
default_params.php
C3) You manually program the rendering of the "style" customfield in position

Quote
onparams_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)

Code: [Select]
<?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)
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

2cool

  • Jr. Member
  • **
  • Posts: 282
Re: special fields for products info and filter
« Reply #17 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

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4607
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: special fields for products info and filter
« Reply #18 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

2cool

  • Jr. Member
  • **
  • Posts: 282
Re: special fields for products info and filter
« Reply #19 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


Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4607
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: special fields for products info and filter
« Reply #20 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

2cool

  • Jr. Member
  • **
  • Posts: 282
Re: special fields for products info and filter
« Reply #21 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

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4607
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: special fields for products info and filter
« Reply #22 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