Forums / Templates, Stylesheets, Page Layout / Custom image mouse over

Custom image mouse over

Locked
Results 1 to 7 of 7
This thread is locked. New replies are disabled.
26 Mar 2007, 08:51
#1
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Posts:
327
Plugin Contributions:
0

Custom image mouse over

Hello everyone,

I need help calling on a products image to use in a javascript command line. This is what I have so far. Let me know what I need to do

<?php
  if (zen_not_null($products_image)) {
  ?>
<?php
/**
 * display the main product image
 */
   require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>


I will have to insert into this code snippet:

showtrail(imagename,title,oriwidth,oriheight,zoomimgwidth,zoomimgheight, image, startx, starty, startw, starth)


And this is what I have so far total:

showtrail(<?php
  if (zen_not_null($products_image)) {
  ?>
<?php
/**
 * display the main product image
 */
   require($template->get_template_dir('rollover/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>,
<?php echo $products_name; ?>,100,80,200,200,this,0,0,100,80)


I am not a php programmer.... so on a scale of 1 to 10 ... how bad did I butcher this.
I am about to try this but i am making this post now because I am pretty confident that this will not work.

-Avel-

ps.. the bolded rollover word is the directory where i have the new size image stored.

this is basically how it will work. when someone rools over an image the script will kick in and pull the image url and then call for the larger image from the rollover directory with the same image name and will also call for the product title name.
27 Mar 2007, 05:42
#2
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Posts:
327
Plugin Contributions:
0

Re: Custom image mouse over

I tried to find were to add the code but have been unsuccessful so far. I want directly in the php that call the and write out the html for the product listing when in the view all or featured products sections of zencart.

Can anyone shed a little light where to look.
27 Mar 2007, 06:03
#3
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Posts:
31,500
Plugin Contributions:
4

Re: Custom image mouse over

Can anyone shed a little light where to look.

You can look at how other mods address this and while not specifically what you are doing you will probably find some leads that will help guide you.
I believe that most use a bit of js to implement but look at the PopUp on Attribute Images, Swap Images via MouseOver or Click and Zen Lightbox modules in the downloads/other section
27 Mar 2007, 07:58
#4
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Posts:
327
Plugin Contributions:
0

Re: Custom image mouse over

ok i think i know where i need to put the code needed to make the image mouseover work:

showtrail(<?php
  if (zen_not_null($products_image)) {
  ?>
<?php
/**
 * display the main product image
 */
   require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>,
<?php echo $products_name; ?>,100,80,200,200,this,0,0,100,80)


I think that is right... the code above is supposed to call the following string to pass to the js file:

showtrail(imagename,title,oriwidth,oriheight,zoomimgwidth,zoomimgheight, image, startx, starty, startw, starth)


I think that I have to put the top code section:

showtrail(<?php
  if (zen_not_null($products_image)) {
  ?>
<?php
/**
 * display the main product image
 */
   require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>,
<?php echo $products_name; ?>,100,80,200,200,this,0,0,100,80)


into here:

if (PRODUCT_ALL_LIST_IMAGE != '0') {
        if ($products_all->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) {
          $display_products_image = str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_IMAGE, 3, 1));
        } else {
          $display_products_image = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'products_id=' . $products_all->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $products_all->fields['products_image'], $products_all->fields['products_name'], IMAGE_PRODUCT_ALL_LISTING_WIDTH, IMAGE_PRODUCT_ALL_LISTING_HEIGHT, INSERT HERE) . '</a>' . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_IMAGE, 3, 1));
        }
      } else {
        $display_products_image = '';
      }


I tested it but got the following error:

Parse error:  syntax error, unexpected '<', expecting ')' in /home/.nightshadow/avel/batteriesinaflash.com/includes/templates/template_biaf/templates/tpl_modules_products_all_listing.php33


any confirmation or guidance will be greatful for...

Thank you kobra for the guidance.. actually gave me a direction on where to look which was pretty close to what i was looking at but just didnt know it.
27 Mar 2007, 14:00
#5
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Posts:
31,500
Plugin Contributions:
4

Re: Custom image mouse over

any confirmation or guidance will be greatful for...

How about some file names where thay came from (cart file or mod file)and approx line or code that precedes your entries
28 Mar 2007, 09:05
#6
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Posts:
327
Plugin Contributions:
0

Re: Custom image mouse over

Sorry about not including important information like that..

I was working with the file:

approx line: 32

/includes/templates/my_template/templates/tpl_modules_products_all_listings.php

I will have to do the code insert into other files to get the result I want(image rollovers) in that section but for now I have been doing the testing with All Products section of zencart
29 Mar 2007, 05:25
#7
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Posts:
327
Plugin Contributions:
0

Re: Custom image mouse over

showtrail(<?php
  if (zen_not_null($products_image)) {
  ?>
<?php
/**
 * display the main product image
 */
   require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>,
<?php echo $products_name; ?>,100,80,200,200,this,0,0,100,80)
In the above section of code I needed to produce this javascript command with the called for parameters to auto loaded into every picture in the View All Product in Zencart
showtrail(imagename,title,oriwidth,oriheight,zoomimgwidth,zoomimgheight, image, startx, starty, startw, starth)
The imagename php code I got from the file:

includes/templates/my_template/templates/tpl_product_info_display.php

[SIZE=2][COLOR=Black]which has the follow code that calls the image for a product when called on to be displayed:
[/COLOR][/SIZE][SIZE=2][COLOR=Black][COLOR=Red]imagename = [/COLOR][/COLOR][/SIZE]
<!--bof Main Product Image -->
<?php
  if (zen_not_null($products_image)) {
  ?>
<?php
/**
 * display the main product image
 */
   require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>
<!--eof Main Product Image-->
I also used the same file to call the title for a product using the code:
title =
<!--bof Product Name-->
<?php echo $products_name; ?>
<!--eof Product Name-->
I inserted those snippets into the js command from the first code box above and I keep getting this error:

Parse error:  syntax error, unexpected '<', expecting ')' in /home/.nightshadow/avel/batteriesinaflash.com/includes/templates/template_biaf/templates/tpl_modules_products_all_listing.php  on line 32
when I insert the the following file:

approx line: 32
/includes/templates/my_template/templates/tpl_modules_products_all_listings.php

[COLOR=Black]at the following section of code:
[/COLOR]
if (PRODUCT_ALL_LIST_IMAGE != '0') {
        if ($products_all->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) {
          $display_products_image = str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_IMAGE, 3, 1));
        } else {
          $display_products_image = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'products_id=' . $products_all->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $products_all->fields['products_image'], $products_all->fields['products_name'], IMAGE_PRODUCT_ALL_LISTING_WIDTH, IMAGE_PRODUCT_ALL_LISTING_HEIGHT, INSERT HERE) . '</a>' . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_IMAGE, 3, 1));
        }
      } else {
        $display_products_image = '';
      }
So I hope that better explains what Im trying to do so that some one can clearly understand me and help me

Thank you in advance