Jump to content

How to split listing in column and remove space between rows <ul>


avu

Recommended Posts

How to split the attribute-options after row 15 so it show attribute 1-15 than split the listing than show row 16-30 in a new column split again and show the next 15 attributes and list them in a new column?

Also how to remove the space (3 mm) between each row

 

echo '<tr><td><ul><li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3"> ';
echo tep_draw_hidden_field($i.'_id[' . $products_options_name['products_options_id'] . ']', $products_options_array[$i]['id']) . $products_options_array[$i]['text'];		  
	 echo "</li></ul></td></tr>";[code]

Link to comment
Share on other sites

if ($products_options_array[$i]['id'] == 15) {
$products_options_array[$i]['id'] = 0;
			 echo '<tr><td><ul><li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3"> ';
echo tep_draw_hidden_field($i.'_id[' . $products_options_name['products_options_id'] . ']', $products_options_array[$i]['id']) . $products_options_array[$i]['text'];		  
	 echo "</li></ul></td></tr>";
}

If I do a count like this it show only option 15.

How to split the products_options after row 15 so it show products_options 1-15 than split the listing than show row 16-30 in a new column split again and show the next 15 products_options and list them in a new column?

Also how to remove the space (3 mm) between each row?

 

Link to comment
Share on other sites

This isn't exactly what you're asking for, but it should give you an idea of how to break an array:

 

<?php
//CREATE AN ARRAY TO EXPERIMENT WITH
$testData   = array();
$numOfItems = 25;
for($i=1; $i<=$numOfItems; $i++) {
$testData[] = "item$i";
}

//INITIALIZE VARIABLES
$count       = 1;
$cutOffPoint = 15;

//LOOP THROUGH THE TEST DATA
echo "<ul>";
foreach($testData as $currValue) {
//IF WE'VE REACHED THE CUTOFF POINT, START A NEW LIST
if($count == $cutOffPoint) {
	echo "</ul>";
	echo "<ul>";
}

//DISPLAY CURRENT VALUE
echo "<li>$currValue</li>";

//INCREMENT COUNT
$count++;
}
echo "</ul>";
?>

 

 

Note that the code will display the first 14 items in the first list. Then displays the rest in a secondary list.

Link to comment
Share on other sites

My previous code only splits the test data once. If you want to break the array every 15 entries, you could do something like this:

 

<?php
//CREATE AN ARRAY TO EXPERIMENT WITH
$testData   = array();
$numOfItems = 50;
for($i=1; $i<=$numOfItems; $i++) {
$testData[] = "item$i";
}

//INITIALIZE VARIABLES
$count      = 0;
$maxPerList = 15;

//LOOP THROUGH THE TEST DATA
echo "<ul>";
foreach($testData as $currValue) {
//IF WE'VE REACHED THE CUTOFF POINT
if($count == $maxPerList) {
	//CLOSE THE PREVIOUS LIST AND START A NEW ONE
	echo "</ul>";
	echo "<ul>";

	//RESET THE COUNTER
	$count = 0;
}

//DISPLAY CURRENT VALUE
echo "<li>$currValue</li>";

//INCREMENT COUNT
$count++;
}
echo "</ul>";
?>

 

 

Note: I changed the default of $count to 0 so that it breaks after 15...instead of 14.

Link to comment
Share on other sites

Hi and thanks cyberRobot

 

I tried different things and don’t really get any think to work, not sure also if I put things the right place also.

 

This is what I hawe now

		 $testData   = array($products_options_array[$i]['id']);
$products_options_array[$i]['id'] = 50;
for($i=1; $i<=$products_options_array[$i]['id'];
$i++) {	$testData[] = "item$i";
} 
$count      = 1;
$maxPerList = 15;
			 echo '<tr><td><ul><li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3"> ';
echo tep_draw_hidden_field($i.'_id[' . $products_options_name['products_options_id'] . ']', $products_options_array[$i]['id']) . $products_options_array[$i]['text'];		  
	 echo "</li></ul></td></tr>";
echo "<ul>";
foreach($products_options_array[$i]['id'] as $currValue) {
if($count == $maxPerList) {
echo "</ul>";	
echo "<ul>";
		  $count = 0;	}  
echo "<li>$currValue</li>";
$count++;
}echo "</ul>";

 

This is the all the file

<?php
/*
  $Id$
  adapted for Separate Pricing Per Customer v4.2 2007/06/23

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
  $product_check = tep_db_fetch_array($product_check_query);
// BOF Separate Pricing per Customer
  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
    $customer_group_id = $_SESSION['sppc_customer_group_id'];
  } else {
    $customer_group_id = '0';
  }
// EOF Separate Pricing per Customer

  require(DIR_WS_INCLUDES . 'template_top.php');

  if ($product_check['total'] < 1) {
?>

<div class="contentContainer">
  <div class="contentText">
    <?php echo TEXT_PRODUCT_NOT_FOUND; ?>
  </div>

  <div style="float: right;">
    <?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
  </div>
</div>

<?php
  } else {
    $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $product_info = tep_db_fetch_array($product_info_query);

    tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

    if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
// BOF Separate Pricing per Customer
      if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail
        $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
        if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
          $product_info['products_price']= $scustomer_group_price['customers_group_price'];
      }
      } // end if ($customer_group_id > 0)
// EOF Separate Pricing per Customer
      $products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
    } else {
// BOF Separate Pricing per Customer
      if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail
        $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
        if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
				$product_info['products_price']= $scustomer_group_price['customers_group_price'];
			}
		} // end if ($customer_group_id > 0)
// EOF Separate Pricing per Customer
      $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
    }

    if (tep_not_null($product_info['products_model'])) {
      $products_name = $product_info['products_name'] . '<br /><span class="smallText">[' . $product_info['products_model'] . ']</span>';
    } else {
      $products_name = $product_info['products_name'];
    }
?>

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

<div>
  <style="float: right;"><?php echo $products_price; ?>
  <h1><?php echo $products_name; ?></h1>
</div>

<div class="contentContainer">
  <div class="contentText">

<?php
    if (tep_not_null($product_info['products_image'])) {
      $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");

      if (tep_db_num_rows($pi_query) > 0) {
?>

    <div id="piGal" style="float: right;">
      <ul>

<?php
        $pi_counter = 0;
        while ($pi = tep_db_fetch_array($pi_query)) {
          $pi_counter++;

          $pi_entry = '        <li><a href="';

          if (tep_not_null($pi['htmlcontent'])) {
            $pi_entry .= '#piGalimg_' . $pi_counter;
          } else {
            $pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image']);
          }

          $pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>';

          if (tep_not_null($pi['htmlcontent'])) {
            $pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div></div>';
          }

          $pi_entry .= '</li>';

          echo $pi_entry;
        }
?>

      </ul>
    </div>

<script type="text/javascript">
$('#piGal ul').bxGallery({
  maxwidth: 300,
  maxheight: 200,
  thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>,
  thumbcontainer: 300,
  load_image: 'ext/jquery/bxGallery/spinner.gif'
});
</script>

<?php
      } else {
?>

    <div id="piGal" style="float: right;">
      <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), null, null, 'hspace="5" vspace="5"') . '</a>'; ?>
    </div>

<?php
      }
?>

<script type="text/javascript">
$("#piGal a[rel^='fancybox']").fancybox({
  cyclic: true
});
</script>

<?php
    }
?>

<?php echo stripslashes($product_info['products_description']); ?>

<?php
// BOF SPPC Hide attributes from customer groups
    $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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 ");
    $products_attributes = tep_db_fetch_array($products_attributes_query);
    if ($products_attributes['total'] > 0) {
?>

    <p><?php echo TEXT_PRODUCT_OPTIONS; ?></p>

    <p>
<!--
            // Code segment includes/modified for Multiple product option lines.
    // maintainance and Qns : Harishyam :> feenix_666@yahoo.com
-->
<?php	     
       if ($products_options_total['total'] == 1) {
		for($i=0;$i<$products_attributes['total'];$i++)
		{
      $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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name");
      while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
        $products_options_array = array();
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
			$list_of_prdcts_attributes_id = '';
			$products_options = array(); // makes sure this array is empty again
        while ($_products_options = tep_db_fetch_array($products_options_query)) {
				$products_options[] = $_products_options;
				$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
			}

			if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') { 
				 $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
				 $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
				 while ($pag_array = tep_db_fetch_array($pag_query)) {
					 $cg_attr_prices[] = $pag_array;
				 }

				 // substitute options_values_price and prefix for those for the customer group (if available)
				 if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
					 for ($n = 0 ; $n < count($products_options); $n++) {
						 for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
							 if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {
									$products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
									$products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
							 }
						 } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
					 }
				 } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
			 } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')

			 for ($n = 0 ; $n < count($products_options); $n++) {
					$products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']);
					if ($products_options[$n]['options_values_price'] != '0') {
						$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
					}
				}
// EOF SPPC attributes mod

        if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {        
	    $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
	  } else {
	    $selected_attribute = false;
	  }	
?>
	      
	        
<?php         	   
	 $testData   = array($products_options_array[$i]['id']);
$products_options_array[$i]['id'] = 50;
for($i=1; $i<=$products_options_array[$i]['id'];
$i++) {	$testData[] = "item$i";
} 
$count      = 1;
$maxPerList = 15;
			 echo '<tr><td><ul><li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3"> ';
echo tep_draw_hidden_field($i.'_id[' . $products_options_name['products_options_id'] . ']', $products_options_array[$i]['id']) . $products_options_array[$i]['text'];		  
	 echo "</li></ul></td></tr>";
echo "<ul>";
foreach($products_options_array[$i]['id'] as $currValue) {
if($count == $maxPerList) {
echo "</ul>";	
echo "<ul>";
		  $count = 0;	}  
echo "<li>$currValue</li>";
$count++;
}echo "</ul>";
	}	} // End of loop

    } else {
    //do your regular thing
    

      $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");
      while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
        $products_options_array = array();
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
        while ($products_options = tep_db_fetch_array($products_options_query)) {
          $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
          if ($products_options['options_values_price'] != '0') {
            $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
          }
        }

        if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
          $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
        } else {
          $selected_attribute = false;
        }
	}        
?>
      <strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br />
<?php
      }
?>
    </p>

<?php
    }
?>

    <div style="clear: both;"></div>

<?php
    if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>

    <p style="text-align: center;"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></p>

<?php
    }	    
?>

  </div>

<?php
    $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and reviews_status = 1");
    $reviews = tep_db_fetch_array($reviews_query);
?>

  <div class="buttonSet">
    <span class="buttonAction"><?php if ($products_options_total['total'] != 1) { echo 'Enter Quantity: ' . tep_draw_input_field('cart_quantity','1','size="3" style="text-align:right;"') . ' ' ; } ?>
<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>
</div>

<?php
    if ((USE_CACHE == 'true') && empty($SID)) {
      echo tep_cache_also_purchased(3600);
    } else {
      include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
    }
?>

</div>

</form>

<?php
  }

  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Link to comment
Share on other sites

what to change

$testData[] = "item$i";

to

 

and

 

foreach($testData as $currValue) {

 

   $testData   = ($products_options_array[$i]['id']);   
$numOfItems = 50;
for($i=1; $i<=$numOfItems; $i++) {
$testData[] = "item$i";
}
$count      = 0;
$maxPerList = 15;

echo "<ul>";
foreach($testData as $currValue) {
if($count == $maxPerList) {
echo "</ul>";
echo "<ul>";
$count = 0;
}
echo '<li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3"> ';
echo tep_draw_hidden_field($i.'_id[' . $products_options_name['products_options_id'] . ']', $products_options_array[$i]['id']) . $products_options_array[$i]['text'];   
   echo "</li>";      
$count++;
echo "</ul>";
}

Link to comment
Share on other sites

The following portion of the code isn't necessary since you already have an array:

 

<?php
//CREATE AN ARRAY TO EXPERIMENT WITH
$testData = array();
$numOfItems = 25;
for($i=1; $i<=$numOfItems; $i++) {
$testData[] = "item$i";
}
?>

 

 

It was just provided for you to experiment with the code and/or customize the code to meet your needs. Note that the code provided in the previous replies doesn't utilize table rows/columns.

 

 

After removing the test array code above, you'll need to replace $testData below with whatever variable you're using that contains the array to be broken into chunks:

 

<?php
//...
foreach($testData as $currValue) {
//...
?>

 

 

Note that the foreach loop needs to go after whatever code you are using to create the array to be broken. Hopefully that helps.  :-\

Link to comment
Share on other sites

Now it show all options without splitting it up

 

foreach($products_options_name as $currValue) {

or

foreach($products_options_array as $currValue) { 

give the same result

 

 

$count      = 0;
$maxPerList = 15;


echo '<li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3">&#8194;';
echo tep_draw_hidden_field($i.'_id[' . $products_options_name['products_options_id'] . ']', $products_options_array[$i]['id']) . $products_options_array[$i]['text'];   
echo "<ul>";
foreach($products_options_name as $currValue) {
if($count == $maxPerList) {
echo "</ul>";
echo "<ul>";
$count = 0;
}   
echo "</li>";      
$count++;
echo "</ul>";
}

Link to comment
Share on other sites

The problem is likely caused by the existing for loop(s) which displays the data. Instead of using the foreach code that I provided as is, you'll need to adapt it to fit the existing code. I wish I could be of more help, but I don't have a lot of time to dig through the entire script. :'(

 

If you have more questions, I'll do my best to answer them.

Link to comment
Share on other sites

Hi CyberRobot and thanks a lot for you help

 

Also i ned to remove the space (3 mm) between each row?

will that be in the stylesheet.css?

 

so you means the code like it is now is ok and will work. if not interrobt with another foreach loop? I search the file efter "foreach" but find only the one we make now

 

I think the problem is within this code

 

<?php	     
       if ($products_options_total['total'] == 1) {
		for($i=0;$i<$products_attributes['total'];$i++)
		{
      $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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name");
      while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
        $products_options_array = array();
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
			$list_of_prdcts_attributes_id = '';
			$products_options = array(); // makes sure this array is empty again
        while ($_products_options = tep_db_fetch_array($products_options_query)) {
				$products_options[] = $_products_options;
				$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
			}

			if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') { 
				 $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
				 $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
				 while ($pag_array = tep_db_fetch_array($pag_query)) {
					 $cg_attr_prices[] = $pag_array;
				 }

				 // substitute options_values_price and prefix for those for the customer group (if available)
				 if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
					 for ($n = 0 ; $n < count($products_options); $n++) {
						 for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
							 if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {
									$products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
									$products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
							 }
						 } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
					 }
				 } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
			 } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')

			 for ($n = 0 ; $n < count($products_options); $n++) {
					$products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']);
					if ($products_options[$n]['options_values_price'] != '0') {
						$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
					}
				}
// EOF SPPC attributes mod

        if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {        
	    $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
	  } else {
	    $selected_attribute = false;
	  }	
?>
	      
	        
<?php         	   
$count      = 0;
$maxPerList = 15;


echo '<li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3">&#8194;';
echo tep_draw_hidden_field($i.'_id[' . $products_options_name['products_options_id'] . ']', $products_options_array[$i]['id']) . $products_options_array[$i]['text'];   


echo "<ul>";
foreach($products_options_name as $currValue) {
if($count == $maxPerList) {
echo "</ul>";
echo "<ul>";
$count = 0;
}   
echo "</li>";      
$count++;
echo "</ul>";
}

// anything else you want to do
//         echo '<tr><td><ul><li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3">&#8194;';
//echo tep_draw_hidden_field($i.'_id[' . $products_options_name['products_options_id'] . ']', $products_options_array[$i]['id']) . $products_options_array[$i]['text'];   
//   echo "</li></ul></td></tr>";
  } } // End of loop

Link to comment
Share on other sites

Also i ned to remove the space (3 mm) between each row?

will that be in the stylesheet.css?

 

Maybe. The first thing that you'll want to look at is your <table> tag. For example, if you create a new page with the following code:

 

<table>
<tr><td>test</td><td>test</td></tr>
<tr><td>test</td><td>test</td></tr>
<tr><td>test</td><td>test</td></tr>
</table>

<table cellpadding="0" cellspacing="0">
<tr><td>test</td><td>test</td></tr>
<tr><td>test</td><td>test</td></tr>
<tr><td>test</td><td>test</td></tr>
</table>

 

 

Note the differences between the two tables. As for the code, the only difference is the table attributes.

Link to comment
Share on other sites

i don't find any Table taks

 

but I changed

echo '<li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3">&#8194;';

to

echo '<ul style="list-style: none; padding-left: 0px; margin: 0px; "><li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3">&#8194;';

now the space between the row is ok.

 

So now I just have the loop problem left. to splet the listing.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.