News:

Looking for documentation? Take a look on our wiki

Main Menu

Modal popup is broken when no image. Fix.

Started by Gruz, February 08, 2012, 17:15:16 PM

Previous topic - Next topic

Gruz

VM2.0.1.e
J.2.5

If I click the no image thumbnail, it dimms the page.


Web-Developer FF addon says:
Error: uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.contains]"  nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame :: http://keypro.com.uaa/media/system/js/modal.js :: <TOP_LEVEL> :: line 15"  data: no]

The reason is that the A tag point to folder, not to an image:


Checked also at beez20, the same problem.
The problem is both at the category page and product page.

Fix:
File administrator/components/com_virtuemart/helpers/mediahandler.php
Line 523
code
if ($this->file_url) $href = JURI::root() .$this->file_url ;
replace with:

if ($this->file_url) {
$href = JURI::root() .$this->file_url ;
if (is_dir(JPATH_BASE.DS.$this->file_url)){
$href = $file_url;
}
}


Explanation:

In the case of no image the values here are
[string] $this->file_url = "images/stories/virtuemart/product/" Tooltip
[string] $file_url = "http://keypro.com.uaa/components/com_virtuemart/assets/images/vmgeneral/noimage.gif" Tooltip

So if this works
if ($this->file_url) $href = JURI::root() .$this->file_url ;
then $href == "images/stories/virtuemart/product/" , which is the problem.
So I check if the path is dir, and if it is, then I make $href use the no-image file $href == "http://keypro.com.uaa/components/com_virtuemart/assets/images/vmgeneral/noimage.gif"

----

Fixed in SVN, in 2.0.2+
Your installable language for VM2: http://gruz.org.ua/virtuemart-language-files.html