Author Topic: Alternative image mouse-over doesn't work in VM description  (Read 5207 times)

aravot

  • Peter
  • Moderator
  • Sr. Member
  • *
  • Posts: 2874
    • VirtueMart Extensions
Alternative image mouse-over doesn't work in VM description
« on: October 29, 2010, 19:57:44 pm »
VM 1.1.6 rev 2605

Alternative image mouse-over doesn't work in VM description, it works in Joomla content, see video http://www.protechsystems.us/stuff/joomla/vm/alternative-image.htm

zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
Re: Alternative image mouse-over doesn't work in VM description
« Reply #1 on: October 31, 2010, 12:15:30 pm »
This is because JavaScript is removed by default from product description. In ps_product::add and ps_product::update you have:

Code: [Select]
$fields = array ( 'vendor_id' => $vendor_id,
'product_sku' => vmGet($d,'product_sku'),
'product_name' => vmGet($d,'product_name'),
'product_desc' => vmRequest::getVar('product_desc', '', 'default', '', VMREQUEST_ALLOWHTML),
'product_s_desc' => vmRequest::getVar('product_s_desc', '', 'default', '', VMREQUEST_ALLOWHTML),
...

The mask "VMREQUEST_ALLOWHTML" strips anything except from HTML. If you change that into "VMREQUEST_ALLOWRAW" you will have your "onmouseover" effect.

So this behaviour is "by design", and not a bug. Should we change it? After all, if Joomla content allows this kind of JavaScript, why shouldn't we do that in product description?

I'd like to have other opinions.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter


zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
Re: Alternative image mouse-over doesn't work in VM description
« Reply #3 on: November 03, 2010, 10:04:56 am »
If it's all the same for you i'd like to have some more opinions. I'll ask that in the chat.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter


deannak

  • Beginner
  • *
  • Posts: 3
Re: Alternative image mouse-over doesn't work in VM description
« Reply #5 on: December 21, 2010, 22:07:54 pm »
I was trying to add JavaScript to VM descriptions and ran into the same problem, but I was doing it to set up some Google Optimizer tests.  It would be helpful to me if it didn't strip out the JavaScript.

deannak

  • Beginner
  • *
  • Posts: 3
Re: Alternative image mouse-over doesn't work in VM description
« Reply #6 on: December 22, 2010, 03:00:29 am »
One more note here...  I used your method above so that I could put the Optimizer javascript into the description like I need.  That worked like a charm - thanks!

But, I then noticed that the javascript code also ended up in my Meta Description on the final webpage, which of course is not really the description I'd want showing up anywhere.

Thanks!  This has been very helpful.