Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding info to my allprods page?


billybrag

Recommended Posts

I currently use the all products page on my site as you can see here Linky? and it is working fine, i was just wondering how i could go about adding a little extra infon this page, all i want to do, essentially is add the manufacturer (which i have changed to author) for each product

so instead of looking like

 

Product Name Model Price   

2010 Odyssey Two M0066 ?7.50 
633 Squadron M0034 ?11.25 
A Checklist of the Birds of the World S7594 ?8.00 
A Few Kind Words and a Loaded Gun M0153 ?8.00

 

it would look more like....

Product Name Model Price   

2010 Odyssey Two M0066 ?7.50 
-Arthur C Clarke
633 Squadron M0034 ?11.25 
-Frederick Smith
A Checklist of the Birds of the World S7594 ?8.00 
etc..

 

any help or suggestions on how to move forward with this would be greatly appreciated

 

Mike

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

i have had a go at adding text in the right place but it keeps going wrong, this is what im working with, any suggestions?

<tr> 
       <td> 
       <table border="0" width="100%" cellspacing="0" cellpadding="2"> 
       <tr class="productListing-heading"> 
       <td align="left" class="productListing-heading">Product Name</td> 
      <td align="center" class="productListing-heading">Model</td> 
      <td align="right" class="productListing-heading">Price  </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']; 
   echo " <tr>\n";
     
         $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 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_url = tep_href_link(FILENAME_PRODUCT_INFO, '&products_id=' . $this_id . (($this_language_code == DEFAULT_LANGUAGE) ? '' : ('&language=' . $this_language_code)), 'NONSSL'); 

              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='center'><a href='$this_url'>$this_model</a></td>"; 
    
    if (tep_not_null($this_special)) 
              { 
                 echo "<td class='productListing-data' align='right'><a href='$this_url'><span class='productSpecialPrice'>".$currencies->display_price($this_special, tep_get_tax_rate($this_tax))."</span></a></td>"; 
              } 
              else 
              { 
                 echo "<td class='productListing-data' align='right'><a href='$this_url'>".$currencies->display_price($this_price, tep_get_tax_rate($this_tax))."</a></td>"; 
              } 
              echo "</tr>\n"; 
           } 
        } 
        
        
         

 

i have cut the top and bottom of the file to save space space

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

i also assume i will need to use this function from includes/functions/general.php

 

function tep_get_manufacturers($manufacturers_array = '') {
   if (!is_array($manufacturers_array)) $manufacturers_array = array();

   $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
   while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
     $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']);
   }

   return $manufacturers_array;
 }

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...