News:

Support the VirtueMart project and become a member

Main Menu

Really strange behavior with Custom Fields

Started by chabi01, June 25, 2020, 15:33:24 PM

Previous topic - Next topic

chabi01

Hi Everybody,

I'm searching for 2 days now and i cant find out what is happening on a site.
I dont know if this is linked to the last update of VM or not, i have checked the database, I dont find any "issue", I have emptied the cache, no more results..
I explain what i have (i have prepared several screenshots !).

For my products, i have 2 custom fields. Each one are called in 2 positions, and my template is override to allow me to custom the template to show products and products in category.
Note : for each point, I give your the screenshot like (thescreenshot).

So i have 2 custom fields (Vm-customfields1)
The first custom field is (vm-customfield2)
The second custom field is (vm-customfield3)

I call my plugin in the category with (vm-codetoshowCF_in_category)

Now, i have some product which are working well and some not...

A product showing the custom fields correctly are here : http://biosource2020.xlcrea373030.com/produits/isolation/fibre-de-bois.html
You can see the 2 custom fields below the product ("disponibilité" = availability and "basic price" = "à partir de....")

Now, i have other products and with the custom field exactly the same, i have nothing shown ???
http://biosource2020.xlcrea373030.com/produits/peintures-traitements/peintures-vegetales.html

I will paste the 2 products details below as i cannot put more that 4 files at the time on the question..

Xavier


chabi01

Ok, i have no more editor..
Here are the 4 links to check the product admin screenshot :
Product 1 - first tab : https://www.dropbox.com/s/zy5e95pnzwb8xzu/VM-Prod1A_20200625_151515.png?dl=0
Product 1 - custom field tab : https://www.dropbox.com/s/v65fo8f0jbxcjut/VM-PROD1B_20200625_151515.png?dl=0

Product 2 - first tab : https://www.dropbox.com/s/1xqxcczicn4cnm9/VM-Prod2A_20200625_151515.png?dl=0
Product 2 - custom field tab : https://www.dropbox.com/s/yp40ueearwj9ilq/VM-Prod2B_20200625_151515.png?dl=0

So, i have several questions !
1 - How to explain the custom field are correctly shown on some part of the site and not on other ?
2 - How to call the custom field in the product page details ? I have tried "echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'dispo'));" but if this is working on sublayer products, it shows nothing on the product details..

Thanks for the help :)
Xavier

chabi01

For the question 2, i found the solution !

chabi01

unbelivable !I found how to call the field in the product details but now it is not show any more in the sublayout product !
What am i doing...

I'm still searching...

(what a headbreak...)
:)
Xavier

chabi01

very very strange...
I have my code since the beginning and it was working.
No, i have to change from :

echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('myposition')));

to

echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product,'position'=>'myposition'));

and it is working again...

The strangest thing is : if the code was wrong before, why it was working ? And why it change from "working" to "not working anymore" ??? This is not a question of "cache"... So strange....

So, a question solved but in a very strange manner : if someone have a explanation for this to explain all this, be my guest :)

Best regards,
Xavier