News:

Looking for documentation? Take a look on our wiki

Main Menu

Invaild SQL

Started by n3t, October 21, 2016, 00:28:17 AM

Previous topic - Next topic

n3t

Hi,

on my multilanguage eshop (VM 3.0.18, Joomla 3.6.2), if language is not the defaut one I meet this SQL error:

/administrator/components/com_virtuemart/plugins/vmpsplugin.php:528

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE i.`published` = "1" AND j.`element` = "..."

It is caused bo code on line 492

$useJLback = false;
if(VmConfig::$defaultLang!=VmConfig::$jDefLang){
$joins[] = ' LEFT JOIN `#__virtuemart_'.$this->_psType.'_'.VmConfig::$jDefLang.'` as ljd';
$useJLback = true;
}

which IMO should be

$useJLback = false;
if(VmConfig::$defaultLang!=VmConfig::$jDefLang){
$joins[] = ' LEFT JOIN `#__virtuemart_'.$this->_psType.'methods_'.VmConfig::$jDefLang.'` as ljd using (`virtuemart_'.$this->_psType.'method_id`)';
$useJLback = true;
}

Seems like the code is unfinished.

n3t


n3t

Same situation in /administrator/components/com_virtuemart/models/shipmentmethod.php line 130

$useJLback = false;
if(VmConfig::$defaultLang!=VmConfig::$jDefLang){
$joins .= ' LEFT JOIN `#__virtuemart_shipmentmethods_'.VmConfig::$jDefLang.'` as ljd';
$useJLback = true;
}

should be

$useJLback = false;
if(VmConfig::$defaultLang!=VmConfig::$jDefLang){
$joins .= ' LEFT JOIN `#__virtuemart_shipmentmethods_'.VmConfig::$jDefLang.'` as ljd using (`virtuemart_shipmentmethod_id`)';
$useJLback = true;
}


and also in /administrator/components/com_virtuemart/models/paymentmethod.php line 130


$useJLback = false;
if(VmConfig::$defaultLang!=VmConfig::$jDefLang){
$joins .= ' LEFT JOIN `#__virtuemart_paymentmethods_'.VmConfig::$jDefLang.'` as ljd';
$useJLback = true;
}

should be

$useJLback = false;
if(VmConfig::$defaultLang!=VmConfig::$jDefLang){
$joins .= ' LEFT JOIN `#__virtuemart_paymentmethods_'.VmConfig::$jDefLang.'` as ljd using (`virtuemart_paymentmethod_id`)';
$useJLback = true;
}