Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

Trying to create a mouseover popup tag, but having trouble calling product name and price. Any help? 
Sr. Member
Total Posts:  80
Joined:  2008-10-21

Okay, I’ve been trying to bring up a css box with the product name and price on mouseover. So far, I can get the css box to pop up once you mouseove the product, but how do you call the product name and price so it appears inside the box?

Below is the code from list.phtml:

<a href="<?php echo $_product->getProductUrl() ?>” id="infotextid1">

This is the javascript to bring up the box:

<script type="text/javascript\">

var helptexts = [

//Pace where product name/price should be
‘ ***************AREA THAT NEEDS PRODUCT NAME*********** ‘,

function showbox(e) {
if (!e)
var e = window.event;
var linkID = e.srcElement? :;
var helpbox = document.getElementById(’infobox’);
helpbox.innerHTML = ‘Product:’ + helptexts[linkID.substr(10) - 1]; = ‘block’;

var posx = (typeof e.pageX!= ‘undefined’)? e.pageX : e.clientX + (document.documentElement? document.documentElement.scrollLeft
: document.body.scrollLeft);

var posy = (typeof e.pageY!= ‘undefined’)? e.pageY
: e.clientY + (document.documentElement? document.documentElement.scrollTop
: document.body.scrollTop);

<!-- set x-axis and y-axis position for displaying helpbox/tipbox here --> = posy - 20 + ‘px’; = posx + 10 + ‘px’;


<!-- code for hidding helpbox -->
function hidebox() {
document.getElementById(’infobox’).style.display = ‘none’;

<!-- Code for Initializing helpbox [Attaching Mouseover, Mouseout event for helpbox] -->
function init() {
var hrefs = document.getElementsByTagName(’a’);
for (var i = 0; i < hrefs.length; i++) {
if (,10) == ‘infotextid’) {
if (hrefs.attachEvent)
hrefs.attachEvent(’onmouseover’, showbox);
hrefs.attachEvent(’onmouseout’, hidebox);
else if(hrefs.addEventListener)
hrefs.addEventListener(’mouseover’, showbox, false);
hrefs.addEventListener(’mouseout’, hidebox, false);

<div id="infobox"></div>
<script type="text/javascript\">

Magento Community Magento Community
Magento Community
Magento Community
Total Posts:  767
Joined:  2007-12-29

getAttributeText(’name’) might be it. There is a function for prices, formatPrice($this->getPrice()) is what is used elsewhere, it puts the currency sign in, I believe…

Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top