Virtuemart Check default Radio Custom field.

The javascript for this is really simple:

radiobtn = document.getElementById("theid"); 
radiobtn.checked = true;

The difficulty will lie in the fact that the id of the element is changing depending on the product. Indeed the product id is used in the radio id.

A convenient option is to use CSS selectors in javascript:


radiobtn =document.querySelector(CSS selectors) .

We want to select the first radio input where the parent is div.controls

radiobtn =document.querySelector(" div.controls> label  > input");  
radiobtn.checked = true;

For good measure we should check that div.controls exists on the page and that we are on a product page.

if(document.querySelector(" div.controls > label  > input")){
radiobtn = document.querySelector(" div.controls > label > input");
radiobtn.checked = true;
}

This query only catch the first radio button custom field. In case we have a second custom field options for our product we need to catch that too. We will use jquery for that purpose to catch the radio button id whatever product page it is set on (remember that the product id is part of the radio button id and that’s the only changing part).

jQuery.noConflict();
jQuery(document).ready(function(){
if (jQuery(“[id$=_885843]”)){
jQuery(“[id$=_885843]”).prop(“checked”,true);
}
});

Repeat the operation for any additional custom fields needed a default check.

Search result pages are displayed with home page layout: solved

Issue: In joomla 3.* (and virtuemart), the first search page result displays the results in the proper search page layout but all the subsequent pages are displayed with the home page layout.

Solution:

Basically, create a hidden menu “search” and give it the Menu item type “search > Search form or search results”. Get the id of this menu item.

Go to the module management page and open your search module for editing. The last field is “Set item id” enter the menu item id there and saved.

If you feel confused, check the link below, they have a nive walk through with screenshot and it’s where I found the solution to this issue, so credit goes to those guys.

https://www.joomla-monster.com/documentation/joomla-tutorials/how-to-display-search-results-on-a-new-page