Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

merging php syntaxs


shuweee

Recommended Posts

hey guys, im sure there's a way to do this but i just cant figure out for the life of me.. any suggestions would be appreciated.

 

how do i go about merging the syntax to include two statements..

 

PART (A)

 

order by rand() desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

PART (B)

 

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

 

so my question is, how do i go about having this statement to include those two variables ?

e.g order by rand() and p.products_price desc limit " . MAX_DISPLAY_NEW_PRODUCTS); ??? will that work ??

 

Thanks

Link to comment
Share on other sites

No, ordering randomly is mutually exclusive to any other ordering clause (otherwise, it wouldn't be random!)

If you exaplain a bit more what you are trying to achieve, I'm sure there's a way to do it...

 

im currently trying to figure out how to display slash price on the new_products.php. e.g like a cross on the regular price and display the special price underneth. the reason why im having so much problem is tht i have added buy now feature in the new_products.php so there are a lot of similiar statement and syntaxs.

 

do you know what would be the easist way to acheve that ?

Link to comment
Share on other sites

I'm guessing that you want a random selection of new products, and you want to order that subset of new products by price DESC, yes?

 

Hmmm - one solution would be to just include the order by rand(), read the results into an array, then use array_sort to sort those results by price.

Shouldn't be much overhead for a small array.

 

If you are using PHP 5, it would be easy to write a subquery-type statement (not supported in php 4) to do the same job.

Link to comment
Share on other sites

I'm guessing that you want a random selection of new products, and you want to order that subset of new products by price DESC, yes?

 

Hmmm - one solution would be to just include the order by rand(), read the results into an array, then use array_sort to sort those results by price.

Shouldn't be much overhead for a small array.

 

If you are using PHP 5, it would be easy to write a subquery-type statement (not supported in php 4) to do the same job.

 

thanks man, ur the only one that ever replied to me onthis.. im not muh of a php coder so im hoping you can assist me withthis, i could paste the codes here but it would be too big, do you mind helping me have a look at it?

 

thanks

Link to comment
Share on other sites

I'm guessing that you want a random selection of new products, and you want to order that subset of new products by price DESC, yes?

 

Hmmm - one solution would be to just include the order by rand(), read the results into an array, then use array_sort to sort those results by price.

Shouldn't be much overhead for a small array.

 

If you are using PHP 5, it would be easy to write a subquery-type statement (not supported in php 4) to do the same job.

 

i actually want random selection of new products and also display special prices + regular price

 

the contribution is

 

http://www.oscommerce.com/community/contri...ry,11/search,ne

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...