Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL Help Needed


dforce

Recommended Posts

Posted

Hello and thank you for looking.

 

I have a problem where i want to show a field called product_subtitle under product_name in the product listing without it having its own column.

 

I can get the subtitle field to work with it using a column but i want it under product name as i use subtitle field to give more description.

 

I have already used product_extra_fields contribution which is great but is no good for what i need.

 

If i am thinking on the right lines i need a SQL query to pull the field direct from the database but i am totally useless when it comes to SQL...lol

 

This is where i think the sql needs to go.

 

the new field that is already in the database and working is products_subtitle in table products

 

case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '<br>';
           } else {			
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> <br><br>' . [b]SUBTITLE TO GO HERE[/b] . '<br>';

           }
           break;

 

Any help would be very much appreciated.

Posted

please please help.. This is the final piece to my jigsaw...

 

need a SQL to pull products_subtitle

 

im so bad at sql...

Posted

If i am thinking on the right lines i need a SQL query to pull the field direct from the database but i am totally useless when it comes to SQL...lol

 

This is where i think the sql needs to go.

 

the new field that is already in the database and working is products_subtitle in table products

 

case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '<br>';
           } else {			
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> <br><br>' . [b]SUBTITLE TO GO HERE[/b] . '<br>';

           }
           break;

Since you already retrieve data from the table products there is no need for another query. You need to add p.products_subtitle, to the relevant query on index.php and then you can use $listing['products_subtitle'] in product_listing.php.

I would use 'manufacturers_id=' . (int)$HTTP_GET_VARS['manufacturers_id'] . ' in the code above though. You can manually change the url with manufacturers_id=**whateveryoulikehere*

Posted

Since you already retrieve data from the table products there is no need for another query. You need to add p.products_subtitle, to the relevant query on index.php and then you can use $listing['products_subtitle'] in product_listing.php.

I would use 'manufacturers_id=' . (int)$HTTP_GET_VARS['manufacturers_id'] . ' in the code above though. You can manually change the url with manufacturers_id=**whateveryoulikehere*

 

 

thank you for that.. i will give it a try now and let you know what happens...

Posted

worked like a charm mate.. Thank you kindly..

 

You wouldnt know how to control the width of each column on the product listing would you.

 

The sub header goes under product name but pushes the other columns over also.

 

I need it to wrap the text so it does not effect the other columns..

Archived

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

×
×
  • Create New...