hello Peter, i let me know by email and i can insert this debug code into the VM file to find out what's going on.
to supress the message you can modify:
\administrator\components\com_virtuemart\models\state.php
comment this line:
- Code: Select all
vmInfo('COM_VIRTUEMART_COUNTRY_STATE_NOTEXIST');
so it looks like:
- Code: Select all
// vmInfo('COM_VIRTUEMART_COUNTRY_STATE_NOTEXIST');
to create debug information on how this happens you can update whole function to this:
- Code: Select all
/**
* Tests if a state and country fits together and if they are published
*
* @author Max Milbers
* @return String Attention, this function gives a 0=false back in case of success
*/
public static function testStateCountry(&$countryId, &$stateId, &$required) {
$countryId = (int)$countryId;
$stateId = (int)$stateId;
if(empty($countryId)) return true;
$db = JFactory::getDBO();
$q = 'SELECT * FROM `#__virtuemart_countries` WHERE `virtuemart_country_id`= "'.$countryId.'" AND `published`="1"';
$db->setQuery($q);
if($db->loadResult()){
//Test if country has states
$q = 'SELECT * FROM `#__virtuemart_states` WHERE `virtuemart_country_id`= "'.$countryId.'" AND `published`="1"';
$db->setQuery($q);
if($db->loadResult()){
if(!empty($stateId)){
//Test if virtuemart_state_id fits to virtuemart_country_id
$q = 'SELECT * FROM `#__virtuemart_states` WHERE `virtuemart_country_id`= "'.$countryId.'" AND `virtuemart_state_id`="'.$stateId.'" and `published`="1"';
$db->setQuery($q);
if($db->loadResult()){
return true;
} else {
//There is a country, but the state does not exist or is unlisted
$stateId = 0;
vmLanguage::loadJLang('com_virtuemart_countries');
$x = debug_backtrace();
$msg = "\n";
$br = "<br />\n";
foreach ($x as $l) $msg .= @$l['file'].' '.@$l['line'].$br;
$msg .= 'country: '.var_export($countryId, true).$br;
$msg .= 'state: '.var_export($stateId, true).$br;
file_put_contents(JPATH_SITE.DIRECTORY_SEPARATOR.'statelog.html', $msg, FILE_APPEND);
//vmInfo('COM_VIRTUEMART_COUNTRY_STATE_NOTEXIST');
return false;
}
}
} else {
//This country has no states listed
$stateId = 0;
$required = false;
return true;
}
} else {
//The given country does not exist, this can happen, when non published country was chosen
$countryId = 0;
$stateId = 0;
vmLanguage::loadJLang('com_virtuemart_countries');
vmInfo('COM_VIRTUEMART_COUNTRY_NOTEXIST');
return false;
}
}
this will create a log file in your domain.com/statelog.html that will look like
https://php72.rupostel.com/purity/statelog.htmland will tell us why this happens.
this mod will be automatically removed upon further VM update so if the problem is not fixed, the message will be shown again.
best regards, stan