Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

can someone walk me through some javascript...


scheistermeister

Recommended Posts

specifically this line from the product_info.php:

 

"<script language="javascript"><!--

 

document.write('<?php echo '<a class="ProductInfoImage" href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . 'click_to_enlarge.gif') . '</a>'; ?>');

 

//--></script>"

 

ive bolded what im really interested in. i was wondering if someone could tell me what its doing step by step. thanks

Link to comment
Share on other sites

tep_href_link is a function that creates hyperlinks.

 

FILENAME_POPUP_IMAGE is the file referenced in /includes/filenames.php, the defualt english value is popup_image.php

 

$product_info['products_id'] is a variable that passes the product id to popup_image.php so it knows which image put in the popup window.

while (!succeed) {try()};

 

GMT -6:00

Link to comment
Share on other sites

Backslash is an escape character; it tells the script not to process the next character.

 

So document.write is going to use these escape characters to pass the first occurrence as \" to the popupWindow JavaScript function and the second occurrence as \'

 

The popupWindow JavaScript function then processes these escape characters to become " and ' respectively.

 

You end up with something like this: http://host.domainname.com/popup_image.php?pID=12

 

 

  function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true)

 

To use tep_href_link(the filename, any additional parameters like product id in this example, NOSSL or SSL connection type, don't put anything here, don't put anything here)

while (!succeed) {try()};

 

GMT -6:00

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...