News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Translation of error message 404

Started by man.of.earth, September 17, 2019, 17:56:39 PM

Previous topic - Next topic

man.of.earth

Hello,

I noticed that the error message 404 is not translated.
In /components/com_virtuemart/views/productdetails/view.html.php, on lines 115
replace
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
for
header($_SERVER["SERVER_PROTOCOL"]." 404 ".vmText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND'));

on line 132, replace
throw new RuntimeException('VirtueMart product not found.', 404);
for
throw new RuntimeException(vmText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND'), 404);

The line 325 from /language/en-GB/en-GB.virtuemart.ini
COM_VIRTUEMART_PRODUCT_NOT_FOUND="404 The requested product does not exist."
should be modified a bit, so as not to include "404" (otherwise the line 132 above will render it twice, in case a product is not found).

diri

You are aware of the fact that error 404 is system wide and means "page not found" (or: link not found on system, wrong link, ...) normally while "product not found" has to lead to a valid page with according message from VM only in case "product not found"?

I assume there is another error like the one you mention.

man.of.earth

#2
Indeed, there are more such 404 cases. However, is kinda weird for some users to see errors and words they don't understand (not everyone speaks English).
I searched for "404" in Vm files and found that error strings are present in the following files:

com_virtuemart.3.6.1.10150_ext_aio\plugins\vmpayment\sofort\sofort\library\sofortLib_http.inc.php line 161:
return array('code' => 404, 'message' => $this->_xmlError($this->httpStatus, 'URL not found '.$this->url), 'response' => '');

components\com_virtuemart\views\category\view.html.php lines 694:
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
and 734:
throw new RuntimeException('VirtueMart category not found.', 404);

components\com_virtuemart\views\productdetails\view.html.php lines 115:
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
and 132:
throw new RuntimeException('VirtueMart product not found.', 404);

components\com_virtuemart\virtuemart.php lines 131:
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
and 142:
throw new RuntimeException(sprintf('VirtueMart controller not found `%s`.', $_class), 404);


I also looked for "not found" string in VM files.
administrator\components\com_virtuemart\models\config.php line 171:
vmWarn('Fonts not found in '.$dir);

components\com_virtuemart\assets\js\dynupdate.js lines 75 and 184:
alert( "page not found" );

administrator\components\com_virtuemart\helpers\image.php line 180:
vmError('Couldnt create thumb, file not found '.$fullSizeFilenamePath);

administrator\components\com_virtuemart\models\invoice.php line 379
//$data['invoice_number'] = $data['invoice_number'].' not found.';

com_virtuemart.3.6.1.10150_ext_aio\plugins\vmcustom\istraxx_download_simple\istraxx_downloader_simple.php line 267:
vmError (500, 'Downloadplugin getMedia: File not found ');

administrator\components\com_virtuemart\helpers\migrator.php lines 1344
vmWarn('Attention, order is pointing to deleted product (not found in the array of old products)');
line 1939:
vmError("Port Related products: The following SKUs were not found ".implode(',',$out) );
line 1961:
vmError("Port Related products: Some of those SKUs were not found ".implode(',',$skus) );

com_tcpdf_1.0.8\tcpdf.php lines 9009:
$this->Error('Font file not found: '.$ctgfile);
14861:
$this->Error('EPS file not found: '.$file);
and 22729:
$this->Error('SVG file not found: '.$file);

administrator\components\com_virtuemart\controllers\translate.php on line 50:
$json['msg'] = 'Table not found '.$viewKey;

administrator\components\com_virtuemart\views\product\view.html.php on line 344:
$msg= 'Parent with product_parent_id '.$product_parent_id.' not found';

administrator\components\com_virtuemart\helpers\vmlanguage.php on line 69:
vmError('JComponentHelper not found');

administrator\components\com_virtuemart\helpers\vmmodel.php on lines 546:
vmWarn( 'Model '. $name .' not found.' );
and 547:
echo 'File for Model '. $name .' not found.';


So far, in the language file we have only this string:
COM_VIRTUEMART_PRODUCT_NOT_FOUND="404 The requested product does not exist."

We would also need:
COM_VM_ERROR_URL_NOT_FOUND="URL not found."
COM_VM_ERROR_404_NOT_FOUND="404 Not found."
COM_VM_ERROR_CATEGORY_NOT_FOUND="Category not found."
COM_VM_ERROR_PRODUCT_NOT_FOUND="Product not found." - COM_VIRTUEMART_PRODUCT_NOT_FOUND could have _ERROR_ added in it
COM_VM_ERROR_CONTROLLER_NOT_FOUND="Controller not found."
COM_VM_ERROR_FONTS_NOT_FOUND="Fonts not found."
COM_VM_ERROR_PAGE_NOT_FOUND="Page not found."
COM_VM_ERROR_FILE_NOT_FOUND="Couldnt create thumb, file not found."
COM_VM_ERROR_NOT_FOUND="not found."
COM_VM_ERROR_DOWNLOADPLUGIN_GETMEDIA_FILE_NOT_FOUND="Downloadplugin getMedia: File not found "
COM_VM_ERROR_ORDER_POINTING_TO_DELETED_PRODUCT="Attention, order is pointing to deleted product (not found in the array of old products)"
COM_VM_ERROR_THE_FOLLOWING_SKUS_NOT_FOUND="Port Related products: The following SKUs were not found: "
COM_VM_ERROR_SOME_OF_THE_SKUS_NOT_FOUND="Port Related products: Some of those SKUs were not found: "
COM_VM_ERROR_FONT_FILE_NOT_FOUND="Font file not found: "
COM_VM_ERROR_EPS_FILE_NOT_FOUND="EPS file not found: "
COM_VM_ERROR_SVG_FILE_NOT_FOUND="SVG file not found: "
COM_VM_ERROR_TABLE_NOT_FOUND="Table not found: "
COM_VM_ERROR_PARENT_WITH_PRODUCT_PARENT_ID_NOT_FOUND="Parent with product_parent_id %s not found"
COM_VM_ERROR_JCOMPONENTHELPER_NOT_FOUND="JComponentHelper not found."
COM_VM_ERROR_MODEL_NOT_FOUND="Model %s not found."
COM_VM_ERROR_FILE_FOR_MODEL_NOT_FOUND="File for Model %s not found."

(Some already have "404" in the string, some do not, as 404 is added via function.)