Jump to content


Corporate Sponsors


Latest News: (loading..)

Is it possible to show tables in product description from database?


  • You cannot reply to this topic
4 replies to this topic

#1 narayan_k

  • Community Member
  • 22 posts
  • Real Name:Narayanaraddi
  • Gender:Male
  • Location:Karnataka, India

Posted 17 January 2012, 15:55

Hi

My client is having thousands of products in their OSC based website. In every product info page we need to display product price and shipping charges like following tables -

Product Price

Part Number Painted Zinc Plated

Price Price

124-XXX $3500.00 $4000.00

128-XXX $4100.00 $4500.00


Shipping Charges

Part Number Sydney Melbourne Brisbane Adelaide Perth

124-XXX $65.00 $150.00 $200.00 $250.00 $271.00

128-XXX $65.00 $270.00 $150.00 $300.00 $650.00



Manufacturers & shipping companies revise their prices every year so we need to update details at our store front and it is very annoying to change details for all those products one by one manually in product description window.

So I am just thinking that, can we load price details in mysql database (two separate tables –
Product Price & Shipping Charges) then call both table details in every product info page based on products_id?

Mysql tables
Product Price table
products_id, part_number, price_painted, price_zinc

Shipping Charges table
products_id, part_number, Sydney, Melbourne, Brisbane, Adelaide, Perth


I hope you will understand my query


Thanks and regards,
Narayan K

Edited by narayan_k, 17 January 2012, 15:57.


#2 narayan_k

  • Community Member
  • 22 posts
  • Real Name:Narayanaraddi
  • Gender:Male
  • Location:Karnataka, India

Posted 17 January 2012, 16:54

Hi all,

One my friend advised that we can link external html page (need to create each static html page for each product with product_id file name)

if(file_exists('shipping_tables/' . $products_id . '.html')){
include_once('shipping_tables/' . $products_id . '.html');

if file exists with products id it includes and shows if not no show


But again I need to edit all static html pages


Thanks
Narayan K
India

#3 toyicebear

  • Community Sponsor
  • 5,694 posts
  • Real Name:Nick
  • Location:World Citizen

Posted 17 January 2012, 17:06

You should be able to create something based on what you mentioned in the first post.

Making a db set-up for the wanted info then simply add a query into the product_info.php page accessing and showing the wanted info.
Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce

Check out my profile [click here] for information on professional services, custom coding, templates, SEO optimization, modifications, commercial support and help.

#4 narayan_k

  • Community Member
  • 22 posts
  • Real Name:Narayanaraddi
  • Gender:Male
  • Location:Karnataka, India

Posted 22 January 2012, 06:35

Hi,

I tried to all ways to add table records in product page but still not in success (:

Table records should display as per product_id

Our shipping charges table looks like this
Product_ID, Part Number Sydney Melbourne Brisbane Adelaide Perth
25 124-XXX 65.00 150.00 200.00 250.00 271.00
25 128-XXX 65.00 270.00 150.00 300.00 450.00
26 130-XXX 65.00 160.00 215.00 275.00 325.00
26 132-XXX 65.00 175.00 215.00 300.00 370.00


If Product_ID 25 page loads then these records need to load
Part Number Sydney Melbourne Brisbane Adelaide Perth
124-XXX 65.00 150.00 200.00 250.00 271.00

If Product_ID 26 page loads then these records need to load
Part Number Sydney Melbourne Brisbane Adelaide Perth
130-XXX 65.00 160.00 215.00 275.00 325.00
132-XXX 65.00 175.00 215.00 300.00 370.00


I hope above example will help to understand my query

Thank you

Kind regards,
Narayan

#5 narayan_k

  • Community Member
  • 22 posts
  • Real Name:Narayanaraddi
  • Gender:Male
  • Location:Karnataka, India

Posted 25 January 2012, 12:14

Hi All,

I resolved my issue finally

Now I can display table contents in Product info page (product description column)

Cheers!
Narayan


<?php
$result = mysql_query("select * from " . product_price_table . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'") or die (mysql_error());

echo "<table border='1'>";

echo "<tr> <th>Product ID </th> <th>Part Number</th> <th>Painted</th> <th>Zinc Finish</th> </tr>";

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['products_id'];
echo "</td><td>";
echo $row['part_number'];
echo "</td><td>";
echo $row['price_painted'];
echo "</td><td>";
echo $row['price_zinc'];
echo "</td></tr>";
}

echo "</table>";
?>