Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

numerical order!?!?!


lomaximus

Recommended Posts

Hi All!

 

I am having a problem in getting my products to go in numerical order in the drop down lists. they follow an odd pattern.

 

e.g. it goes 1000 flyers

10000 flyers

5000 flyers

 

i want it to go 1000 flyers

5000 flyers

10000 flyers.

 

I am using template 6057 its when you pressed all the categories, it displays the products in list form.

 

Enter this link in your browser it will take you to the page i am talking about.

 

http://xamol.co.uk/shop/6057/index.php?cPath=1_17_99

 

I have been told to add in a sort by product contrib. but i am not sure how i do that

 

Please please please can someone help me with this!?!?

 

 

Thanks

Link to comment
Share on other sites

Hi,

a. Find the SQL Query that is used to fetch records.

b. Run query in phpmyadmin to see how results are showing up.

c. Tweak Query to modify Order By Segment.

 

If you are not sure, please put the query here, and I would try to see what needs to be modified.

 

Thanks,

Best Regards,
Gaurav

Link to comment
Share on other sites

Hi pub

 

unfortunately i'm stuck on the first request!! i'm abit of a noob and i have only done basic changes to code in the file manager part of oscommerce, you'll have to spoon feed me. I know sql is something to do with the database but thats about it!?! Sorry however if you help me it would be very much appreciated!!!!!!!!!!!

 

thanks

 

Hi,

a. Find the SQL Query that is used to fetch records.

b. Run query in phpmyadmin to see how results are showing up.

c. Tweak Query to modify Order By Segment.

 

If you are not sure, please put the query here, and I would try to see what needs to be modified.

 

Thanks,

Link to comment
Share on other sites

Hey pub domains thats impressive!!

 

I actually want them to go the other way tho if thats ok!!! How did you manage to do that??? I obviously have a security issue with my site how can i resolve?? But many thanks anyway!!!!

 

Chris

 

 

Hey Chris,

If you click on Price on your site - does it give you the listing the way you want it ?

Please check and let me know if following link gives you the order you desire --

http://xamol.co.uk/shop/6057/index.php?cPa...e=1&sort=3d

Thx,

Link to comment
Share on other sites

Hey Chris,

No security issue - I didn't get into your system, you can click on price or product Name to sort display in ascending or descending order :P.

 

So what you want is - default display should show up - as in this link with Price(-) http://xamol.co.uk/shop/6057/index.php?cPa...e=1&sort=3d

 

Is that what you seek?

 

Cheers,

Best Regards,
Gaurav

Link to comment
Share on other sites

Ahhhhhhhh

 

Didn't realise it did that well actually i want it to go with Price(+). How do i set that as default then?

 

Thanks

Hey Chris,

No security issue - I didn't get into your system, you can click on price or product Name to sort display in ascending or descending order :P.

 

So what you want is - default display should show up - as in this link with Price(-) http://xamol.co.uk/shop/6057/index.php?cPa...e=1&sort=3d

 

Is that what you seek?

 

Cheers,

Link to comment
Share on other sites

Hi Chris,

In admin - > Configuration -> Product Listing

Switch Value for Product name and Price ( So your cart would show Image | Price | Product )

Default sort order is ascending - so you it would display Product Name the way you want it in ascending order.

 

Hope this helps,

 

Cheers,

Best Regards,
Gaurav

Link to comment
Share on other sites

Hi Pub

 

Tried doing that and it still shows it in the wrong orders. Do you know what the file is called in file manager i could just write it in to go ascending!?

 

Thanks

 

 

Hi Chris,

In admin - > Configuration -> Product Listing

Switch Value for Product name and Price ( So your cart would show Image | Price | Product )

Default sort order is ascending - so you it would display Product Name the way you want it in ascending order.

 

Hope this helps,

 

Cheers,

Link to comment
Share on other sites

Phew... you made me think ... :)

OK,

Look in index.php for following code

	if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
  for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
	if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
	  $HTTP_GET_VARS['sort'] = $i+1 . 'a';
	  $listing_sql .= " order by pd.products_name";
	  break;

Make following changes {Always good to save original index.php - should you mess up with something you shouldn't have}

1.	   $HTTP_GET_VARS['sort'] = $i+1 . 'a';	--->	   $HTTP_GET_VARS['sort'] = $i+2 . 'a';   (Note 2 instead of 1 - so price is the column to show up with + and used)

2. order by pd.products_name ----> becomes order by p.products_price	 [pd becomes p, and name becomes price.. ]

 

Also please roll back changes i suggested in previous post to modify listing, i noticed you have implemented it .. and it kind of destroys the good looks with price coming before product.

 

Cheers,

Best Regards,
Gaurav

Link to comment
Share on other sites

Gosh, I swear i didn't see your response before i posted mine....(1 min difference...) but I could see from your site what is going wrong.. new post should put this case at rest :D

 

Cheers,

Best Regards,
Gaurav

Link to comment
Share on other sites

Hmmm,

So you have reverted product listing :) but in case confused about index.php, just replace original code with following (and please make sure you take a copy of index.php - before you make ANY changes

if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
  for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
	if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
	  $HTTP_GET_VARS['sort'] = $i+2 . 'a';
	  $listing_sql .= " order by p.products_price";
	  break;

Cheers,

Best Regards,
Gaurav

Link to comment
Share on other sites

Hi pub!

 

hmmmmm I am going to have to order it by price. I have changed it back to price at the end but when i change to the code as you said to it still orders it wrong!!! Bit of a pain isnt it!!! I have tried to change the figure to 3 instead of 2 but it doesn't like that! Do i need to write something different if i change it to 3?

 

Thanks

 

 

 

Gosh, I swear i didn't see your response before i posted mine....(1 min difference...) but I could see from your site what is going wrong.. new post should put this case at rest :D

 

Cheers,

Link to comment
Share on other sites

You were getting error with pd.product_price - did you change PD to P in last line?

+2 is for showing plus (to indicate what is the current sort order, and order by is what actually sorts the display - so you are on right track, just make sure it is order by P.PRODUCTS_PRICE (and not pd.xxx as it was when it was giving error)

 

Cheers,

Best Regards,
Gaurav

Link to comment
Share on other sites

Hi Pub!!

 

Success!!!!!!!!!!!!!!!!!!!!!!!!!

 

It wasnt recognising PRODUCTS_PRICE instead i noticed in the rest of the code products price was recognised as final_price!!! So changed the no. to 3 and changed the name to FINAL_PRICE!! Hey presto!!!

 

Thankyou for all the help it was really annoying me!!!!

 

I notice on your website you sell SSL I am not secured on my website for customers is it easy to intergrate (i.e How does it work??)

 

Thanks

 

You were getting error with pd.product_price - did you change PD to P in last line?

+2 is for showing plus (to indicate what is the current sort order, and order by is what actually sorts the display - so you are on right track, just make sure it is order by P.PRODUCTS_PRICE (and not pd.xxx as it was when it was giving error)

 

Cheers,

Link to comment
Share on other sites

Awesome,

My demo site has just 2 products ... so kind of difficult to trace sort order when you have to choose only between 2 items!!! But all is well that ends well and good to see you make the effort (so no longer a noob :) you can teach a few things to others now...

 

On SSL front, when a request is made to your site which is SSL enabled (so URL is https:// instead of http://) a key is sent from your server to client machine (while one key is kept by the server).

Now data sent from user would first get encrypted by the key (sent by server) - and thus become secure. It takes approx more then a decade to decrypt data (when you don't have other part of the key)

Server has the key to decrypt the data and thus transactions become secure and people would be more comfortable to buy from you since SSL ensures that their personal details and Credit card information would not be available to anyone during transmission from their PC to your server.

 

I have also left a PM for you .. please have a look.

 

Thanks, and once again well done !!!

Best Regards,
Gaurav

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...