Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

products_new.php


MoisesZaragoza

Recommended Posts

Posted

I'm working on the Query products_new.php file.

I need to modify the Query to get the product discription but I dont know the name of the table it's on or the field name. This is the Query

 

<?php 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

?>

at the end of the day the code will be good

Posted

Ok I went to my DB and discoverd that on the table products there is a field called products_2_line

 

and the new Query look like

 

 

  $products_new_query_raw = "select p.products_id, p.products_2_line, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";


# at the Begining I addede select p.products_id, p.products_2_line,

at the end of the day the code will be good

Posted

<?php 

$products_new_query_raw = "select p.products_id, pd.products_name, [COLOR=red]pd.products_description[/COLOR],  p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

?>

 

the table is called `products_description` refered as pd in the query and the field name is `products_description` as well and they areal ready joined by 'p.products_id = pd.products_id'

 

hope I didnt mess it up :/ backup first BACKUP BACKUP BACKUP ;) and try the sniplet

 

dahui

 

forgotto post how to call it than moment please

Posted
forgot to post how to call it than moment please

 

call it than with

<?php echo $products_new['products_description'];?>

and place it in the <td> you want it to appear

 

dahui

Posted

$truncated = substr($products_new['products_description'], 0, 250)

would for example than cut the description very brutally at a lentgh of 250 characters starting at 0

 

not nice but I hven't found out a working way to cut/truncate the decription by words having a maximum altogether lenght of X :(

 

dahui

Archived

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

×
×
  • Create New...