News:

Support the VirtueMart project and become a member

Main Menu

[SOLVED] VM 4.2.6 custom fields errors

Started by razor7, January 29, 2024, 23:41:46 PM

Previous topic - Next topic

razor7

Hi! testing 4.2.6 I found an issue with custom fields. I have a select custom field and after changing the value, the url of the page gets the field value (not the real url) and the page doesn't change at all. I have found some changes in cvfind.js and customfield.php sub layout, here I publish my changes so the dev team can consider them.

cvfind.js

Change this
    //We check first if it is a radio
    jQuery(container).find('input[data-cvselection="true"]:checked').each(function() {
        selection[selection.length] = jQuery(this).val();
        found = true;
    });
    if(!found){
        jQuery(container).find('input[data-cvselection="true"]').each(function() {
            selection[selection.length] = jQuery(this).val();
        });
    }

To this...
    //We check first if it is a radio
    jQuery(container).find('[data-cvselection="true"]:checked').each(function() {
        selection[selection.length] = jQuery(this).val();
        found = true;
    });
    if(!found){
        jQuery(container).find('[data-cvselection="true"]').each(function() {
            selection[selection.length] = jQuery(this).val();
        });
    }

customfield.php
Change this
                        $attribs['data-cvsel'] = 'field' . $customfield->virtuemart_customfield_id ;
                        $fname = $fieldname.'['.$k.']';

To this
                        $attribs['data-cvsel'] = 'field' . $customfield->virtuemart_customfield_id ;
                        $attribs['data-cvselection'] = 'true';
                        $fname = $fieldname.'['.$k.']';

Also in this file, for some reason, if I get Itemid=0 in the url, it adds that 0 to the product ID, so, change this
                    $Itemid = vRequest::getInt('Itemid',''); // '&Itemid=127';
                    if(!empty($Itemid)){
                        $Itemid = '&Itemid='.$Itemid;
                    }

To this...
                    $Itemid = vRequest::getInt('Itemid',''); // '&Itemid=127';
                    if(!empty($Itemid)){
                        $Itemid = '&Itemid='.$Itemid;
                    } else if ($Itemid !== '') {
                        $Itemid = '';
                    }
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store

Milbo

Thank you for your work. I think you send me that via skype, right? That should be enhanced your way in the new version. Please check
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

razor7

Sorry Milbo, I don't even have Skype installed, but maybe another guy found this issue and sumbited similar fix.
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store