Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can modify products new for specific products?


Guest

Recommended Posts

Hello,

 

I would like to modify products_new.php such that if a customer clicks on a link, that doing so they will display only specific new products for whatever they go to.

 

I know that to specify certain things, the 'LIKE' command works, ie

 

select * from products where products_model like 'DVD%';

 

(using this command on my database displays about 700 products)

 

however I do not understand properly how to combine with this code:

 

  $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" . $new_fields . " 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'" . SHOW_PRODUCTS_NEW_SINCE2 . " and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'" . $order_by;

 

any help is greatly appreciated.

Link to comment
Share on other sites

not sure if you can use an enclosed statement for the existing code and add a

while ($products_new_query_raw){ select * from products where products_model like 'DVD%';}

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Are you trying to add the like clause to the query statement to further limit the results or do you want to issue the like clause on each record in the sql result?

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

what i want to do is create a copy of products_new.php and name it dvd_new.php so i have a new page, and all it will display is new dvds, thus when this section works, i can do the same for vhs, toys, or whatever!

 

to better answer directly, yes to limit the results

Link to comment
Share on other sites

Give the following a try and let me know how it works for you.

 

 $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_model, p.products_tax_class_id, p.products_date_added, m.manufacturers_name" . $new_fields . " 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'" . SHOW_PRODUCTS_NEW_SINCE2 . " and p.products_model like \"" . $products_model . "\" and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'" . $order_by;

Please note that you will need to define $products_model before this either by using a url parameter or something else.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

ok I replaces the line in the first part of the thread with what you gave me, also I assigned $products_model to the select statement, however I get a blank page. Anytime I add just any kind of change to products_new.php it goes out to lunch, says it completes but is completely blank. thus now to turn on the sql logger and the error files, hopefully there is something there.

 

Thanks for your help

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...