Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

"View all of our Products" not adding to cart in S


Daibheid

Recommended Posts

Here is the code. It's working on mine. Just paste it into your body part.

 

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td align="right"></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="main">

<td align="left" class="main"><b><?php echo COLUMN_PRODNAME; ?></b></td>

<td align="left" class="main"><b><?php echo COLUMN_MODEL; ?></b></td>

<td align="right" class="main"><b><?php echo COLUMN_PRICE; ?></b></td>

</tr>

<?php

$languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order");

while ($languages = tep_db_fetch_array($languages_query)) {

$languages_array[] = array('id' => $languages['languages_id'],

'name' => $languages['name'],

'code' => $languages['code'],

'image' => $languages['image'],

'directory' => $languages['directory']);

}

for ($i=0; $i<sizeof($languages_array); $i++)

{

$this_language_id = $languages_array[$i]['id'];

$this_language_name = $languages_array[$i]['name'];

$this_language_code = $languages_array[$i]['code'];

$this_language_image = $languages_array[$i]['image'];

$this_language_directory = $languages_array[$i]['directory'];

 

$products_query = tep_db_query("SELECT s.specials_new_products_price, p.products_id, p.products_model, p.products_price, pd.products_name FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd LEFT JOIN " . TABLE_SPECIALS . " s ON p.products_id=s.products_id WHERE p.products_id = pd.products_id AND p.products_status = 1 ORDER BY pd.products_name");

 

//$products_query = tep_db_query("SELECT p.products_id, p.products_model, p.products_price, pd.products_name FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd WHERE p.products_id = pd.products_id AND p.products_status = 1 AND pd.language_id = $this_language_id ORDER BY pd.products_name");

$products_array = array();

while($products = tep_db_fetch_array($products_query))

{

$products_array[] = array('id' => $products['products_id'],

'name' => $products['products_name'],

'model' => $products['products_model'],

'price' => $products['products_price'],

'tax' => $products['products_tax_class_id'],

'special' => $products['specials_new_products_price']);

}

 

$num_prods = sizeof($products_array); // This optimizes that slow FOR loop...

 

for ($i = 0; $i < $num_prods; $i++) // Traverse Rows

{

// Rotate Row Colors

if ($i % 2) // Odd Row

{

$row_col = 'class="productListing-odd"';

}

else // Guess...

{

$row_col = 'class="productListing-even"';

}

 

$this_id = $products_array[$i]['id'];

$this_name = $products_array[$i]['name'];

$this_model = $products_array[$i]['model'];

$this_price = $products_array[$i]['price'];

$this_special = $products_array[$i]['special'];

$this_tax = $products_array[$i]['tax'];

$this_name = str_replace(" ","_",$this_name);

$this_url = tep_href_link(FILENAME_PRODUCT_INFO, '&clothing=' .urlencode($this_name). '&products_id=' . $this_id . (($this_language_code == DEFAULT_LANGUAGE) ? '' : ('&language=' . $this_language_code)), 'NONSSL', false);

 

 

echo "<tr $row_col>";

echo "<td class='productListing-data' align='left'><a href='$this_url'>$this_name</a></td>";

echo "<td class='productListing-data' align='left'>$this_model</td>";

if (tep_not_null($this_special))

{

echo "<td class='productListing-data' align='right'><span class='productSpecialPrice'>".$currencies->display_price($this_special, tep_get_tax_rate($this_tax))."</span></td>";

}

else

{

echo "<td class='productListing-data' align='right'>".$currencies->display_price($this_price, tep_get_tax_rate($this_tax))."</td>";

}

echo "</tr>n";

}

}

 

?>

</td>

</tr>

</table></td>

</tr>

<tr>

<td align="right" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

</tr>

</table></td>

<!-- body_text_eof //-->

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...