Main
Minimize Text   Default    Enlarge Text
 
    


3.7. CUSTOMIZING THE PRODUCT INFORMATION PAGE


 3.7. CUSTOMIZING THE PRODUCT INFORMATION PAGE

You can also change the structure of the product information page (Figure 3.35), which contains detailed descriptions of products. For example, the code of the page, /catalog/product_info.php, appears as follows before modification.

<td class="pageHeading" valign="top"><?php

echo $products_name; ?></td>

          Figure 3.35. Product information display.  Figure 3.36. Modified product inforrmation display.

 

<td class="pageHeading" align="right"

valign="top"><?php echo $products_price;

?></td>

…………………………

………………………..

…………………………..

if

(tep_not_null($product_info['products_image'])

) {

?>

<table border="0" cellspacing="0"

cellpadding="2" align="right">

<tr>

<td align="center"

class="smallText">

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

document.write('<?php echo '<a

href="javascript: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 . '</a>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' .

tep_href_link(DIR_WS_IMAGES .

$product_info['products_image']) . '"

target="_blank">' . tep_image(DIR_WS_IMAGES .

$product_info['products_image'],

$product_info['products_name'],

SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT,

'hspace="5" vspace="5"') . '<br>' .

TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

</noscript>

</td>

</tr>

</table>

<?php

}

<p><?php echo

stripslashes($product_info['products_descripti

on']); ?></p>

<?php

$products_attributes_query =

tep_db_query("select count(*) as total from "

. TABLE_PRODUCTS_OPTIONS . " popt, " .

TABLE_PRODUCTS_ATTRIBUTES . " patrib where

patrib.products_id='" .

(int)$HTTP_GET_VARS['products_id'] . "' and

patrib.options_id = popt.products_options_id

and popt.language_id = '" . (int)$languages_id

. "'");

$products_attributes =

tep_db_fetch_array($products_attributes_query)

;

if ($products_attributes['total'] > 0) {

?>

<table border="0" cellspacing="0"

cellpadding="2">

<tr>

<td class="main"

colspan="2"><?php echo TEXT_PRODUCT_OPTIONS;

?></td>

</tr>

<?php

$products_options_name_query =

tep_db_query("select distinct

popt.products_options_id,

popt.products_options_name from " .

TABLE_PRODUCTS_OPTIONS . " popt, " .

TABLE_PRODUCTS_ATTRIBUTES . " patrib where

patrib.products_id='" .

(int)$HTTP_GET_VARS['products_id'] . "' and

patrib.options_id = popt.products_options_id

and popt.language_id = '" . (int)$languages_id

. "' order by popt.products_options_name");

 

The following code changes will modify the page view and arrangement of the page (Figure 3.36).

<td class="pageHeading" valign="top"

bgcolor="#FFCCCC"><?php echo $products_name;

?></td>

<td class="pageHeading" align="left"

valign="top"><?php echo $products_price;

?></td>

…………………………

………………………..

…………………………..

if

(tep_not_null($product_info['products_image'])

) {

?>

<table border="1" cellspacing="0"

cellpadding="2" align="left">

<tr>

<td align="center"

class="smallText">

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

document.write('<?php echo '<a

href="javascript: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 . '</a>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' .

tep_href_link(DIR_WS_IMAGES .

$product_info['products_image']) . '"

target="_blank">' . tep_image(DIR_WS_IMAGES .

$product_info['products_image'],

$product_info['products_name'],

SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT,

'hspace="5" vspace="5"') . '<br>' .

TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

</noscript>

</td>

</tr>

</table>

<?php

}

<p><?php echo "<b>Description</b> : ".

stripslashes($product_info['products_descripti

on']); ?></p>

<?php

products_attributes_query =

tep_db_query("select count(*) as total from "

. TABLE_PRODUCTS_OPTIONS . " popt, " .

TABLE_PRODUCTS_ATTRIBUTES . " patrib where

patrib.products_id='" .

(int)$HTTP_GET_VARS['products_id'] . "' and

patrib.options_id = popt.products_options_id

and popt.language_id = '" . (int)$languages_id

. "'");

$products_attributes =

tep_db_fetch_array($products_attributes_query)

;

if ($products_attributes['total'] > 0) {

?>

<table border="0" cellspacing="0"

cellpadding="2" bgcolor="#66CCCC">

<tr>

<td class="main"

colspan="2"><?php echo TEXT_PRODUCT_OPTIONS;

?></td>

</tr>

<?php

$products_options_name_query =

tep_db_query("select distinct

popt.products_options_id,

popt.products_options_name from " .

TABLE_PRODUCTS_OPTIONS . " popt, " .

TABLE_PRODUCTS_ATTRIBUTES . " patrib where

patrib.products_id='" .

(int)$HTTP_GET_VARS['products_id'] . "' and

patrib.options_id = popt.products_options_id

and popt.language_id = '" . (int)$languages_id

. "' order by popt.products_options_name");

By this process you can change the layout of the /product_info.php page.