Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

expand product menu box


ceoshawn

Recommended Posts

hello,

 

i have been really enjoying getting used to oscommerce, but in need of some bit of help, currently i have product menu, but it is not opening up unless you click on it..you can see the site dvrsquad.com, i am trying to figure out the codeing but unsure what to do, this may require a lil more then i know, the coding is as followed.

 

<?php

/*

$Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

?>

<tr>

<td class="MenuColor">

<div class="leftMenuHeading">

<?php echo BOX_HEADING_CATEGORIES; ?>

</div>

 

<?php

 

$products_query = tep_db_query("SELECT * FROM ".TABLE_PRODUCTS_DESCRIPTION);

while ($products = tep_db_fetch_array($products_query)) {

 

$tree[$products['products_id']] = array('name' => $products['products_name']);

}

 

foreach($tree as $pid => $info)

{

$string .= "<li><a href='product_info.php?products_id=".$pid."'>".$info['name']."</a></li>";

}

?>

<div class="leftMenuContents">

<div class="boxLinks">

<ul>

<?php echo $string ?>

</ul>

</div>

</div>

<div class="ModuleDivider"><!-- --></div>

</td>

</tr>

<!-- categories_eof //-->

 

 

 

 

if you need more coding, just let me know thank you all oscommercers.

Link to comment
Share on other sites

Two things I noticed:

 

$tree[$products['products_id']]

should be:

$tree[$products]['products_id']

 

Plus you should set your variable '$string' at the beginning prior to adding to it:

 

I am not sure why you run 2 loops or what this line means:

foreach($tree as $pid => $info),

 

maybe you need this, but this should produce the same result and take away the second loop..

 

<?php

 

$string = '';

$products_query = tep_db_query('select products_id, products_name from' . TABLE_PRODUCTS_DESCRIPTION);

while ($products = tep_db_fetch_array($products_query)) {

$string .= '<li><a href="product_info.php?products_id=' . $products['products_id'] . '">' . $products ['products_name'] . '</a></li>';

}

?>

<div class="leftMenuContents">

<div class="boxLinks">

<ul>

<?php echo $string ?>

</ul>

</div>

</div>

<div class="ModuleDivider"><!-- --></div>

</td>

</tr>

<!-- categories_eof //-->

Lloyd

Link to comment
Share on other sites

Two things I noticed:

 

$tree[$products['products_id']]

should be:

$tree[$products]['products_id']

 

Plus you should set your variable '$string' at the beginning prior to adding to it:

 

I am not sure why you run 2 loops or what this line means:

foreach($tree as $pid => $info),

 

maybe you need this, but this should produce the same result and take away the second loop..

 

<?php

 

$string = '';

$products_query = tep_db_query('select products_id, products_name from' . TABLE_PRODUCTS_DESCRIPTION);

while ($products = tep_db_fetch_array($products_query)) {

$string .= '<li><a href="product_info.php?products_id=' . $products['products_id'] . '">' . $products ['products_name'] . '</a></li>';

}

?>

<div class="leftMenuContents">

<div class="boxLinks">

<ul>

<?php echo $string ?>

</ul>

</div>

</div>

<div class="ModuleDivider"><!-- --></div>

</td>

</tr>

<!-- categories_eof //-->

 

 

 

i tired the result and yes i got the same results, but i want to make it into vertial so no tree just pretty much all open

Link to comment
Share on other sites

Try this

 

$string = '';

$products_query = tep_db_query('select products_id, products_name from ' . TABLE_PRODUCTS_DESCRIPTION);

while ($products = tep_db_fetch_array($products_query)) {

$string .= '<li><a href="product_info.php?products_id=' . $products['products_id'] . '">' . $products ['products_name'] . '</a></li>';

}

?>

<div class="leftMenuContents">

<div class="boxLinks">

<ul>

<?php echo $string ?>

</ul>

</div>

</div>

<div class="ModuleDivider"><!-- --></div>

</td>

</tr>

<!-- categories_eof //-->

Lloyd

Link to comment
Share on other sites

Try this

 

$string = '';

$products_query = tep_db_query('select products_id, products_name from ' . TABLE_PRODUCTS_DESCRIPTION);

while ($products = tep_db_fetch_array($products_query)) {

$string .= '<li><a href="product_info.php?products_id=' . $products['products_id'] . '">' . $products ['products_name'] . '</a></li>';

}

?>

<div class="leftMenuContents">

<div class="boxLinks">

<ul>

<?php echo $string ?>

</ul>

</div>

</div>

<div class="ModuleDivider"><!-- --></div>

</td>

</tr>

<!-- categories_eof //-->

 

 

didnt work =*(

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...