News:

Looking for documentation? Take a look on our wiki

Main Menu

special fields for products info and filter

Started by 2cool, October 27, 2021, 17:29:33 PM

Previous topic - Next topic

2cool

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

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

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

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

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

Yes, use 2 fields. one to display in a product position and one to use as filter

2cool

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

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