Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP & osCommerce problem


Guest

Recommended Posts

Hi,

 

I'm currently playing with osCommerce and his database and I'd like to get some help. I'm trying to generate a printable pricelist giving a special format.

 

(as you can see, on http://www.aware.ch/price.php)

 

But the problem is that I'd like to print before each category the category name and I don't know how to do it.

 

Anyone can help me ?

 

Here is the bunch of code needed to generate a collumn :

 

$limitvalue = $page * $limit - ($limit);
$result = mysql_query("SELECT * FROM products, products_description WHERE products.products_id = products_description.products_id AND products.products_status = 1 ORDER BY products.manufacturers_id , products_description.products_name LIMIT $limitvalue, $limit");
$totalrows = mysql_num_rows($result);
$i = 0;
if ($row = mysql_fetch_array($result)) {
      do {  
 if ($i == 0) {
          	 $rows++;
	 $i++;
       echo "<TR>";        
          	 echo "<td align=\"left\" valign=top>".substr($row["products_name"], 0, $maxlength)."</td>\n";
          	 echo "<td align=\"right\" valign=top>".number_format($row["products_price"],0,'.','')."</td>\n";
          	 echo "</tr>\n";
 } elseif ($i == 1) {
          	 $rows++;
	 $i--;
       echo "<TR>";        
          	 echo "<td align=\"left\" valign=top bgcolor=$altcolor>".substr($row["products_name"], 0, $maxlength)."</td>\n";
          	 echo "<td align=\"right\" valign=top bgcolor=$altcolor>".number_format($row["products_price"],0,'.','')."</td>\n";
          	 echo "</tr>\n";
 }

      }
      while($row = mysql_fetch_array($result));
}

 

Some variables like page are null and limit is set to 85.

 

Thanks in advance for your help.

Link to comment
Share on other sites

I've found a way for displaying manufacturers/categories, but I've now another problem, I can't display it anymore on 3 collumns... I think it's LIMIT problem.

 

Please, help me, I'm really blocked with it !

 

Here is the code :

<?php
echo "<table>";

$page++;
$limitvalue = $page * $limit - ($limit);

$result = mysql_query("SELECT * FROM manufacturers ORDER BY manufacturers.manufacturers_name");
while ($row = mysql_fetch_array($result)) {
if ($rows <= $limit && $row[manufacturers_id] != 0) {
 $rows++;
    	 echo "<tr><td><b>$row[manufacturers_name]</b></td><td></td></tr>";
    	 $lebonchoix = $row[manufacturers_id];
 $result2 = mysql_query("SELECT * FROM products, products_description WHERE products.manufacturers_id = $lebonchoix AND products_description.products_id = products.products_id ORDER BY products_description.products_name");
 $i = 0;
 $totalrows = mysql_num_rows($result2);
 if ($row = mysql_fetch_array($result2)) {
      	 do {  
   if ($i == 0) {
            	 $rows++;
  	 $i++;
         echo "<TR>";        
            	 echo "<td align=\"left\" valign=top>".substr($row["products_name"], 0, $maxlength)."</td>\n";
            	 echo "<td align=\"right\" valign=top>".number_format($row["products_price"],0,'.','')."</td>\n";
            	 echo "</tr>\n";
   } elseif ($i == 1) {
            	 $rows++;
  	 $i--;
         echo "<TR>";        
            	 echo "<td align=\"left\" valign=top bgcolor=$altcolor>".substr($row["products_name"], 0, $maxlength)."</td>\n";
            	 echo "<td align=\"right\" valign=top bgcolor=$altcolor>".number_format($row["products_price"],0,'.','')."</td>\n";
            	 echo "</tr>\n";
   }
	 }
	 while($row = mysql_fetch_array($result2));
 }
}
}

echo "</table>";
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...