Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can anyone help me with this idea


wra77877

Recommended Posts

i would like to add a rollover or hover for the prouct_listing.php file...when you rollover a particular product it will change the color of the background for that individual product....example http://www.apptools.com/examples/tdcolor.php

anyone have an idea how to make it work in the product_listing file...any help would be great...thanks, bill

Link to comment
Share on other sites

Yes no problem

 

Use Javascript and css like so:

 

Set up the <tr> you want to change the color of the background when rollover like so:(done this on a site and it works for table rows not tried it for table cells but it should work)

<tr class='moduleRow' onMouseOver='rowOverEffect(this)' onMouseOut='rowOutEffect(this)'>

 

Add some Javascript to your page:

<script language="JavaScript" type="text/JavaScript">
<!--
function rowOverEffect(object) {
 if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
 if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
</script>

 

Then add some styles to your stylesheet:

.moduleRow { }
.moduleRowOver { background-color: #CCCCCC; cursor: pointer; cursor: hand; }

 

Simple :thumbsup:

Link to comment
Share on other sites

Yes no problem

 

Use Javascript and css like so:

 

Set up the <tr> you want to change the color of the background when rollover like so:(done this on a site and it works for table rows not tried it for table cells but it should work)

<tr class='moduleRow' onMouseOver='rowOverEffect(this)' onMouseOut='rowOutEffect(this)'>

 

Add some Javascript to your page:

<script language="JavaScript" type="text/JavaScript">
<!--
function rowOverEffect(object) {
?if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
?if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
</script>

 

Then add some styles to your stylesheet:

.moduleRow { }
.moduleRowOver { background-color: #CCCCCC; cursor: pointer; cursor: hand; }

 

Simple :thumbsup:

the problem im having is where to stick the code in the product_listing page..i have no clue where this code goes...this is where im lost

 

any suggestions...

Link to comment
Share on other sites

the problem im having is where to stick the code in the product_listing page..i have no clue where this code goes...this is where im lost

 

any suggestions...

 

heres the code

any clue how to set it up from here

 

<?php

 

} $list_box_contents = array();

 

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_text = TABLE_HEADING_MODEL;

$lc_align = '';

break;

case 'PRODUCT_LIST_NAME':

$lc_text = TABLE_HEADING_PRODUCTS;

$lc_align = '';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_text = TABLE_HEADING_MANUFACTURER;

$lc_align = '';

break;

case 'PRODUCT_LIST_PRICE':

$lc_text = TABLE_HEADING_PRICE;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_text = TABLE_HEADING_QUANTITY;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_text = TABLE_HEADING_WEIGHT;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_text = TABLE_HEADING_IMAGE;

$lc_align = 'center';

break;

case 'PRODUCT_LIST_BUY_NOW':

$lc_text = TABLE_HEADING_BUY_NOW;

$lc_align = 'center';

break;

}

 

if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {

$lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);

}

 

 

$list_box_contents[0][] = array('align' => $lc_align,

'params' => 'class="productListing-heading"',

'text' => ' ' . $lc_text . ' ');

}

 

if ($listing_split->number_of_rows > 0) {

 

$rows = 0;

$listing_query = tep_db_query($listing_split->sql_query);

while ($listing = tep_db_fetch_array($listing_query)) {

$rows++;

 

if (($rows/2) == floor($rows/2)) {

 

$list_box_contents[] = array('params' => 'class="productListing-even"');

} else {

$list_box_contents[] = array('params' => 'class="productListing-odd"');

}

$cur_row = sizeof($list_box_contents) - 1;

 

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

$lc_align = '';

 

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_align = '';

$lc_text = ' ' . $listing['products_model'] . ' ';

break;

case 'PRODUCT_LIST_NAME':

$lc_align = '';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

} else {

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';

}

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_align = '';

$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';

break;

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

 

if (tep_get_products_special_price($listing['products_id'])) {

$lc_text = ' <s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price(tep_get_products_special_price($listing['products_id']), tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';

} else {

$lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';

}

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'right';

$lc_text = ' ' . $listing['products_quantity'] . ' ';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_align = 'right';

$lc_text = ' ' . $listing['products_weight'] . ' ';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_align = 'center';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT,'class=shadow1') . '</a>';

} else {

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=shadow1') . '</a> ';

}

break;

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

break;

}

 

$list_box_contents[$cur_row][] = array('align' => $lc_align,

'params' => 'class="productListing-data"',

'text' => $lc_text);

 

}

}

 

new productListingBox($list_box_contents);

} else {

 

$list_box_contents = array();

 

$list_box_contents[0] = array('params' => 'class="productListing-odd"');

$list_box_contents[0][] = array('params' => 'class="productListing-data"',

'text' => TEXT_NO_PRODUCTS);

 

new productListingBox($list_box_contents);

}

 

if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {

?>

Link to comment
Share on other sites

the problem im having is where to stick the code in the product_listing page..i have no clue where this code goes...this is where im lost

 

any suggestions...

 

 

i use trail and error to solve most problems stick it somewhere if it dont work, stick it somewhere else!

 

try:

if (($rows/2) == floor($rows/2)) {

$list_box_contents[] = array('params' => 'class="productListing-data"');

} else {

$list_box_contents[] = array('params' => 'class="productListing-data"');

}

 

put the first bit in the params above , if that dont work have a look at the code on the page work out how its built up and you will figure it out, within an hour you will have it worked out. Use View source to see the final code layout and compare that with the code your changing and you will see how php works, dig in and try things. Remember to back up the page somewhere else first!

Link to comment
Share on other sites

i use trail and error to solve most problems stick it somewhere if it dont work, stick it somewhere else!

 

try:

      if (($rows/2) == floor($rows/2)) {

        $list_box_contents[] = array('params' => 'class="productListing-data"');

      } else {

        $list_box_contents[] = array('params' => 'class="productListing-data"');

      }

 

put the first bit in the params above , if that dont work have a look at the code on the page work out how its built up and you will figure it out, within an hour you will have it worked out. Use View source to see the final code layout and compare that with the code your changing and you will see how php works,  dig in and try things. Remember to back up the page somewhere else first!

 

i give up ive been trying for days for some reason this is not working...not sure why

 

thanks for the help

Link to comment
Share on other sites

Told ya within a hour simple :thumbsup:

 

ok the answer:

 

in product listing:

 

if (($rows/2) == floor($rows/2)) {

$list_box_contents[] = array('params' => 'class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onclick="java script:;"');

} else {

$list_box_contents[] = array('params' => 'class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onclick="java script:;"');

}

 

Put the javascript code i gave you earlier, in your index.php file

and add the styles to your stylesheet

 

:D :D :D

Link to comment
Share on other sites

Told ya within a hour  simple  :thumbsup:

 

ok the answer:

 

in product listing:

 

      if (($rows/2) == floor($rows/2)) {

        $list_box_contents[] = array('params' => 'class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onclick="java script:;"');

      } else {

        $list_box_contents[] = array('params' => 'class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onclick="java script:;"');

      }

 

Put the javascript code i gave you earlier, in your index.php file

and add the styles to your stylesheet

 

:D  :D  :D

 

Finally got it to work..thanks alot for all your help...

now i got to work on the search result page...if i can make it work lol...thanks again

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...