Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Having slighte syntax error with writing this simple php


stevennickelby

Recommended Posts

sorry about the mispelling of slight.

hello everyone,

 

for this part of query script

 

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price)

as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $new_products_category_id . "' and p.products_status = '1'

order by p.products_date_available desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

 

I've been trying to add this in...

 

pd where to_days(products_date_available) >= to_days(now())

 

but I keep getting syntax errors...

how can it fit in to the top script?

(idealy i want

p.products_date_available desc limit

to be

p.products_date_available asc limit

and have

pd where to_days(products_date_available) >= to_days(now())

in there so it takes the earliest dates only from today's date onwards similar to the script below....

can someone help me?thanks for yor time!

 

$upcoming_products_query = tep_db_query("

select p.products_id, pd.products_name, products_date_available as date_expected from " .

TABLE_PRODUCTS . " p,

" . TABLE_PRODUCTS_DESCRIPTION . "

pd where to_days(products_date_available) >= to_days(now()) and p.products_id = pd.products_id and pd.language_id = '

" . (int)$languages_id . "

' order by " .

EXPECTED_PRODUCTS_FIELD . " asc limit " . MAX_DISPLAY_UPCOMING_PRODUCTS);

Edited by stevennickelby
Link to comment
Share on other sites

At first glance it looks fine to me. You haven't posted any actual error messages, so it's hard to tell what's wrong.

 

 

The red script sorts the products by the furthest in the future first,

 

Instead i would like the script to sort by the the least furthest in the future first (not the furthest).

 

I think this script can do that, but i don't know where to place him?

pd where to_days(products_date_available) >= to_days(now())

 

I tried placing just after TABLE_PRODUCTS_TO_CATEGORIES . " but i came up with an error,

 

I'm not to sure how to put this into the script??

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...