Custom field values ​​are not displayed - [VM4.0.X]

Started by hazael, September 14, 2022, 12:35:11 PM

Previous topic - Next topic

hazael

In random cases, the custom field values ​​are not displayed in the product list.
I noticed a clear dependency with the VM template configuration for the product list.
For example
If I enable the "Show featured" option in the product list configuration, then 1 random parent product on the list of other products will not display the custom fields.
If I enable next option: the "Show latest products", then 2 random parent products on the list of other products will not display the custom fields.

For this error to occur, the parent product must have the "disinh" option checked in the selected custom field, which prevents the derivative product from inheriting this value.

The problem has been present since changes were made to the display of custom fields for derived products.

The problem is not related to custom site templates.

Milbo

Crazy thing, but I cannot reproduce it, maybe fixed.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hazael

I tried to install VM 4.0.7.x

Unfortunately, this version does not work with Joomla 3.10. I wrote about it before. Each attempt to edit the product causes loops and freezes of the system.



In general, in the last version 4.0.7.10717, you probably changed something, because now none of the values ​​from the custom fields is displayed on the product list :)
But the funniest thing is that the same template I made displays correctly in the component's search results: com_customfilters
I don't understand what's wrong with my code?

com_virtuemart/sublayouts/bs3-products.php
Quote<ul>
                                                <li class="bedroom">
                            <i class="fa fa-hotel"></i>
<?php if (isset($product->customfieldsSorted['pokoje'])){foreach ((array) $product->customfieldsSorted['pokoje'] as $field) {echo $field->display;}} ?>
                            </li>
                                                <li class="bathroom">
                            <i class="fa fa-s15"></i>
<?php if (isset($product->customfieldsSorted['lazienki'])){foreach ((array) $product->customfieldsSorted['lazienki'] as $field) {echo $field->display;}} ?>
                     </li>
                                                <li class="garage">
                            <i class="fa fa-car"></i>
<?php if (isset($product->customfieldsSorted['garaz'])){foreach ((array) $product->customfieldsSorted['garaz'] as $field) {echo str_replace('brak','0', $field->display);} } ?></li>
                                                <li class="area-size">
                            <span class="img-wrap">
                                <img src="/templates/szeregowe/images/sqft.svg" alt="Powierzchnia użytkowa" title="Powierzchnia użytkowa" width="18px" height="19px">
                            </span>
<?php if (isset($product->customfieldsSorted['uzytkowa'])){foreach ((array) $product->customfieldsSorted['uzytkowa'] as $field) {echo $field->display;}} ?> m<sup>2</sup></li>
                    </ul>

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

hazael

Quote from: GJC Web Design on October 06, 2022, 22:05:21 PM
4.0.7.10717 custom field loop is fixed I think
It is not the custom fields that cause the loops. The loop is created after starting the product edition in the administration panel in Joomla 3 and VM 4.0.7.x. During this time, you may notice a freeze of website. (Joomla 3 and VM4.0.6 it's ok)
Unfortunately - this last version also has this problem. I note - it only appears with Joomla 3.10.x. Joomla 4 has no problem with that.
-------------------------------------------

The non-appearance of custom fields in the product list is an additional weird effect - as the primary thread in this topic
I don't understand why custom fields don't appear in the product list - what's wrong?


Milbo

Yes, I changed it back, so that it loads only cartattributes, before it loaded all, but only showed cart attributes. Should make no difference. Editing products works for me in j3 with new and old template. There was never a problem. Do you have this with a new product?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hazael

I don't just want cart attributes. Without this additional data in the product list Virtuemart won't make any sense to me.


I don't know what you've done, but from version com_virtuemart.4.0.7.10714  in the product list no longer shows me any custom field data.
But I found a solution to it.
Additional fields (not for the basket) in the list of products are now displayed to me if I enable the search option for them. Some products, unfortunately, still don't display them



---------------------------------------
PS. the loop I wrote about above is related to your correction for custom fields related to the text editor in the file customfields.php - it is incompatible with other editors
https://forum.virtuemart.net/index.php?topic=147269.msg531701#msg531701


hazael

Will these checkboxes visible in the basic version of the template be finally removed from parents products? I can see that this is no longer present in the new template.
I admit that the idea of ​​introducing them for parents' products is definitely better than the old solution, which works the other way around - in child-products.
Unfortunately, it was this new solution that impossible custom fields from appearing in some products on the list. I went back to the old cumbersome solution that takes a lot more time to edit products in this store. :-/

Operating an online store should be convenient not only for the buyer, but also for the seller ...

You can always add the option of mass checking checkboxes or clearing all custom fields in child products. I did it once, and it's an effective way to reduce my working time
https://forum.virtuemart.net/index.php?topic=147849.msg527457#msg527457

Milbo

Quote from: hazael on October 12, 2022, 13:40:31 PM
Will these checkboxes visible in the basic version of the template be finally removed from parents products? I can see that this is no longer present in the new template.
I admit that the idea of ​​introducing them for parents' products is definitely better than the old solution, which works the other way around - in child-products.
Imho it works both ways.

Quote from: hazael on October 12, 2022, 13:40:31 PM
Unfortunately, it was this new solution that impossible custom fields from appearing in some products on the list. I went back to the old cumbersome solution that takes a lot more time to edit products in this store. :-/
I understand what you wrote, but I dont get it. The checkbox "disinh" means "Inheritable". I need to rename it. So if the attribute should be only for the parent, you can disable it here for all children. So you say, if you use this setting for customfields with cart attribute set, then you do not see this customfield for the parent anylonger?

Quote from: hazael on October 12, 2022, 13:40:31 PM
Operating an online store should be convenient not only for the buyer, but also for the seller ...

You can always add the option of mass checking checkboxes or clearing all custom fields in child products. I did it once, and it's an effective way to reduce my working time
https://forum.virtuemart.net/index.php?topic=147849.msg527457#msg527457
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hazael

Quote from: Milbo on October 12, 2022, 22:01:31 PM
(...) So if the attribute should be only for the parent, you can disable it here for all children. So you say, if you use this setting for customfields with cart attribute set, then you do not see this customfield for the parent anylonger?
If the custom field is not assigned to the cart, it is not displayed in the product list. If I select the search option in the custom field settings, the custom fields will be shown in product list. Previously, this worked without these dependencies.

Milbo

The question is, if it does depend on the  "Inheritable" setting.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hazael

1. In the new version (from 4.0.7.10714), all custom fields disappear from the list of products - regardless of whether they are children's products or parents' products. The problem disappears if I select "search" in the custom field options.
------------------------------------
2. In the base VM template - in the parent product, if in the added custom fields I check the option of blocking inheritance of this in children's products, some the parents products in the product list are not displaying custom field data
------------------------------------
3. If in the child product I block or overwrite the inheritance of custom fields from the parent product, the above problem does not exist as in point 2

Quote from: Milbo on October 12, 2022, 22:01:31 PM
I understand what you wrote, but I dont get it. The checkbox "disinh" means "Inheritable".
In VM, the term "disinh" has probably always existed -  I thought it was "something" is written in German  ;)

PS. Forgive me for my linguistic incorrectness - I'm trying my best  :D

Studio 42

A customer reported me that in the cart adding 2 time same product with different cart attributes  setting do not show anymore the fiels for the second product in the cart.
If he remove the first product, the attributes are show for the remaining product in the cart.
The problem appear  only with Virtuemart 4, so  certainly a problem with this code too.

Milbo

Please search in view.html.php of the category view for $this->productModel->cartattribute = 1; (around line 105), what happens, when you set it to 0? $this->productModel->cartattribute = 0;
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hazael

After this change, custom field data is displayed in the product list without having to be assigned to a search engine.
So the problem I wrote about in point 1 is solved...

...But it doesn't solve the problem I wrote about in the first post.

I do not understand this. Why is the custom field data from the parents' products inherited at the same time, when the child's product has its own independent data? What is it for?
There are other fields such as product name, short and long description, price - In this case I do not see double data - it is automatically replaced by the child product. Why can't it be the same with custom fields?