Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display Products Outside of OSCom (Contr. or Inst. Request)


Guest

Recommended Posts

I have been searching to no avail for the php code neccesary to pull product info from the database, so as to display them (the products from a specific catagory) outside the OSCommerce environment. Basically, i am stumped at the PHP necessary to select from the various tables.

 

To descibe it in another fashion:

I want to list products from catagory x, by date, on a new .php page on my server. The neccessary "select from X, where Z, and Y = blah blah blah" is beyond my ability with SQL at the moment.

 

I do appreciate any help on this matter.

 

Thanks

Link to comment
Share on other sites

I just looked it over and found that there is no provisions for specifying the products catagory. Do you or another member know what changes are neccessary to the following code to filter (hard code is fine in my application) by product catagory?

 

// create SQL statement

$sql = "SELECT * FROM `products` ORDER BY RAND() LIMIT 1";

Link to comment
Share on other sites

ok, it looks like i figured it out.. I am going to spend the rest of the night cleaning this up, but here is the first draft.

mysql_select_db($database_shop, $shop);

$query_productlist = "SELECT * FROM products_to_categories, products, products_description WHERE products.products_id = products_to_categories.products_id AND products_to_categories.categories_id = 35 AND products.products_id = products_description.products_id ORDER BY products.products_date_added";

$query_limit_productlist = sprintf("%s LIMIT %d, %d", $query_productlist, $startRow_productlist, $maxRows_productlist);

$productlist = mysql_query($query_limit_productlist, $shop) or die(mysql_error());

$row_productlist = mysql_fetch_assoc($productlist);

Link to comment
Share on other sites

  • 1 month later...

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