Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with sql for products


norgay

Recommended Posts

Hi, I'm running a site where you can hire products from us. Now where expanding and where going to make it possible to buy the products as well as renting them. A third option is that you only can rent the product, it depend on whos the supplier and if the product is still manufactuered. I have added a field in db, products area and the field is calld products_typeofbuy (i know not to good but anyway) in that field (that is a integer) i put a 0,1,2,3 and depending on the value i whant different buttons to come up on the product page. That i think i can fix but i aint to good with sql it seams because i cant make it work. How do i construct a sql statement that can collect a value from products, let's say products_typeofbuy... :o)

 

Anyone who know the sql or can give me a hint....

//Andreas

Link to comment
Share on other sites

In the sql statement on the products page, you just add products_typeofbuy to the select portion of the statement:

 

$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, products_typeofbuy 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 . "'");

 

Then use it like so:

 

$product_info['products_typeofbuy']

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

In the sql statement on the products page, you just add products_typeofbuy to the select portion of the statement:

 

$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, products_typeofbuy 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 . "'");

 

Then use it like so:

 

$product_info['products_typeofbuy']

 

 

 

Thanks!!! It works, finaly i have something to start working with... :)

//Andreas

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...