pthiou Posted September 17, 2008 Share Posted September 17, 2008 Your idea interests me very much. What are the changes to be done? Pascal Thiou I went with a very simple approach..but this will ONLY work for you if you are NOT shipping by weight, and do not EVER plan toI prefer to bend the cart to my will, with the least possible editing, its all about end result, simplicity and speed! I use flat rate shipping so it works great for me... I sort the products by weight I assign the weight to be the order I want the products to display in. in other words first product gets a weight of 10, second gets a weight of 20, ect... going in 10's allows easy addition of products later...and also allows easy re-shuffling if you want it down the road.. one other make sure you up the max ship weight in the admin settings of your cart.. I use 50000 instead of 50, and then you need not worry about the cart saying....cant ship that, over the limit! Link to comment Share on other sites More sharing options...
spooks Posted October 2, 2008 Author Share Posted October 2, 2008 In need of help?Tried everything on this thread and still cant get my sorting to work. My site is only currently showing all products added last first. Been trying to sort by name, manufacturer, price, and i just dont seem to be getting anywere? Greatly appreciate any help i can get! I assume your looking at setting sort order for the new_products.php module, see my ealier post in this thread for that. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
martimd Posted October 5, 2008 Share Posted October 5, 2008 ;) Great... I was trying to use a complicated module when i found this topic. Here works perfect, very simple to apply. Tankyou ;) If there's something that I can do for you just say it! At this moment there's only two problem's at my store, the days of week, months etc are in english, and i don´t now where is the file that reffer to that. I want to translate it to Portugues (btw, sorry for my bad english). The other problem, I would like to know a way to "massive" apply the same atributte to a category of products, for example editing directly de database, but I dont now how to do it, so I will have to make ir one by one <_< ;) Martim, Lisbon Link to comment Share on other sites More sharing options...
WoodsWalker Posted October 7, 2008 Share Posted October 7, 2008 Hi Spooks! I tried the mod you suggested in your first post, and all went well except that my sort order is not perfect (almost, though). I used PRODUCT_LIST_QUANTITY, as it's not a field I use otherwise. My problem is, although most of my products obey my sort order now, certain products are "stubborn" and insist on being placed fifth, for instance, or last. I have checked everything I can see, inserted the numbers again, used 100, 200, 300 instead of 1, 2, 3, etc. Nothing works. Here's my 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_QUANTITY') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_quantity"; break; } Did I do something weird? Thanks, Wendy Link to comment Share on other sites More sharing options...
spooks Posted October 8, 2008 Author Share Posted October 8, 2008 Are you trying to set your own specific sort order?, If so there is a post above on that Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
WoodsWalker Posted October 8, 2008 Share Posted October 8, 2008 Hi! I read the whole thread again, but I'm not finding anything new (maybe I'm just a bit dense). Yes, I'm trying to set my own specific order, according to your first post, and using the column PRODUCT_LIST_QUANTITY, which is not a column I intend to utilize otherwise. I am placing my own numbers in "Quantity" to set the order of display. As I mentioned, as soon as I made the changes, most products were indeed listed in the order that I wished. Some categories are perfect! But in some, there are certain products that insist on being in their own "custom" position in the list, no matter what I do. Perhaps this will remain a mystery, and I'll try using another column to see if that helps. In any case, I am very glad I found the information you provided on this thread, because before that, I had no idea how to accomplish this. :) ~Wendy Link to comment Share on other sites More sharing options...
spooks Posted October 8, 2008 Author Share Posted October 8, 2008 You could check your query by adding echo '<hr>' . $listing_sql . '<hr>'; at the end of your product_listing.php also look in phpmyadmin, browse the products & check data, also check type setting for products_quantity. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
WoodsWalker Posted October 8, 2008 Share Posted October 8, 2008 OK, I'll see what I find... :) Link to comment Share on other sites More sharing options...
WoodsWalker Posted October 9, 2008 Share Posted October 9, 2008 Hi, Sam, Sorry I don't know how to interpret this, but I tried adding the query to product_listing.php, and this is what it gave me: select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '6' Any idea what this means? Thanks, ~Wendy Link to comment Share on other sites More sharing options...
WoodsWalker Posted October 9, 2008 Share Posted October 9, 2008 Sorry, me again... I was all excited for a minute, when I noticed Leslie's post above and your solution to the problem - Leslie was using a SEO URLS contrib., and you advised turning "search engine friendly URL" to "off". However, I have not installed such a contribution, and my "Use Search-Engine Safe URLS" in admin is set to "false". Thought I'd better tell you... :) Link to comment Share on other sites More sharing options...
spooks Posted October 9, 2008 Author Share Posted October 9, 2008 This should end with order by p.products_quantity which it does'nt thats why you don`t get the order you want. I just reliased why, perhaps I should have realised before but I`ve got lots on right now so cant think of everything. I bet you havent included products quantity in the column list, that means the line: if ($column_list[$i] == 'PRODUCT_LIST_QUANTITY') { will always fail, so $listing_sql .= " order by p.products_quantity"; never gets added so instead of: 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_QUANTITY') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_quantity"; break; } } } else { put: if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { $HTTP_GET_VARS['sort'] = 0 . 'a'; $listing_sql .= " order by p.products_quantity"; } else { Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
WoodsWalker Posted October 9, 2008 Share Posted October 9, 2008 SUCCESS!! B) :lol: Now it works perfectly! And I even learned some stuff. Thanks, Sam! ~Wendy Link to comment Share on other sites More sharing options...
martimd Posted October 11, 2008 Share Posted October 11, 2008 Now it works wonderfully, I dind't realised that there was a problem because I had entered the products by manufacturer, but when I had a new won I saw that it wasn't really sorting, but now it's ok! ;) Thank you! :) Link to comment Share on other sites More sharing options...
Guest Posted November 25, 2008 Share Posted November 25, 2008 Hi Sam, I m trying to sort by date, I use this if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { $HTTP_GET_VARS['sort'] = 0 . 'd'; $listing_sql .= " order by p.products_date_added DESC, pd.products_name"; } else { it works when I click on a manufacturer, or I goes to the end of a category, but in the home page and in the first category level it doesn't work, in home its sort by product id, and in category firts level sort by Category id (i think). what can be wrong? the echo '<hr>' . $listing_sql . '<hr>'; code must be paste in catalog/includes/modules/product_listing.php ??? PD: i also tried to sort by product model editing products_model 1,2,3,4,5,6... (also with weight). My web have the products_next_previous v3.2, maybe it's the problem... Link to comment Share on other sites More sharing options...
Guest Posted November 25, 2008 Share Posted November 25, 2008 Problem resolved, sorry Link to comment Share on other sites More sharing options...
Snowy_River Posted November 30, 2008 Share Posted November 30, 2008 This should end with order by p.products_quantity which it does'nt thats why you don`t get the order you want. I just reliased why, perhaps I should have realised before but I`ve got lots on right now so cant think of everything. I bet you havent included products quantity in the column list, that means the line: if ($column_list[$i] == 'PRODUCT_LIST_QUANTITY') { will always fail, so $listing_sql .= " order by p.products_quantity"; never gets added so instead of: 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_QUANTITY') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_quantity"; break; } } } else { put: if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { $HTTP_GET_VARS['sort'] = 0 . 'a'; $listing_sql .= " order by p.products_quantity"; } else { Hi Sam, I was having a similar problem to what WoodsWalker was describing. I decided to add four characters to the beginning of each product's model number. The first was a letter to signify the general category of the item, the second and third were the sorting number, and the forth was a hyphen, to separate it from the rest of the model number, for example: A04-######## would be the forth item in the Accessories category. This seems to work great, except for a few products that wouldn't sort in the right order. So, finding your post, I tried removing the "if ($column_list[$i] ==..." code. Everything sorted fine, then, but my formating vanished. Suddenly, my background wasn't there, much (if not all) of the text formating was gone. Any clues? For full details: Old 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_MODEL') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_model"; break; } } } else { New 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)) ) { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_model"; } else { Thanks! Link to comment Share on other sites More sharing options...
WoodsWalker Posted November 30, 2008 Share Posted November 30, 2008 Hi Geoffrey! I'd say, "so far, so good" with your ingenious scheme. The hard part was getting the product order to work. Now we just have to get your formatting back. I had a similar occurance once when I was twiddling with column widths in shopping_cart.php. I finally got the columns to behave the way I wanted, but the page formatting suddenly went completely bazoo. I went back to my backup copy and tried to recreate the chain of events (had to do this several times). Finally, I figured out what had happened. I work in Dreamweaver. When I save a page, it usually asks me if I want to "Update Links" - and I usually say no, because I do not know what that does. However, in this instance I had mistakenly said yes. I don't know why Dreamweaver does what it does, but it altered my stylesheet.css (adding an unwanted bit of code to TD.productListing-data). When I corrected this (or I might have reloaded a backup of stylesheet.css), everything was fine. I know there's only a chance that this will help you. Let us know how it goes. ~Wendy Link to comment Share on other sites More sharing options...
WoodsWalker Posted November 30, 2008 Share Posted November 30, 2008 I just wanted to add that if the syntax is off in stylesheet.css by so much as a crumb, the whole stylesheet is non-functional. This is what happened in my case - Dreamweaver added something to stylesheet.css, but it didn't use the right syntax, which brought the whole thing down. Link to comment Share on other sites More sharing options...
Snowy_River Posted December 1, 2008 Share Posted December 1, 2008 Hello Wendy, Thank you. Because of your comments, I went back and took a copy of the working file, made the edits again and uploaded it. Now I've got formatting and proper sorting. It's all wonderful! Clearly something similar must have happened where my editing program made a change that I didn't want it to. When I went back to the original file, it recovered from whatever the change was. So, again, thank you! Geoffrey. Link to comment Share on other sites More sharing options...
WoodsWalker Posted December 1, 2008 Share Posted December 1, 2008 Great to know it's working! :) Link to comment Share on other sites More sharing options...
studioimagen Posted December 2, 2008 Share Posted December 2, 2008 All my products are named by number, i just want it to list by number and not alphabetically, how do i do that? Photo 1 Photo 2 Photo 3 Instead of Photo 1 Photo 10 THANK YOU! Sincerely, Link to comment Share on other sites More sharing options...
spooks Posted December 3, 2008 Author Share Posted December 3, 2008 More info needed, what have tried yourself? Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
studioimagen Posted December 3, 2008 Share Posted December 3, 2008 well this is the code i use for calling from a regular database i just dont know how i would change the store script as such: the ABS is what does it $sql = "SELECT * from homes ORDER BY ABS(floorplan) ASC "; Sincerely, Link to comment Share on other sites More sharing options...
spooks Posted December 3, 2008 Author Share Posted December 3, 2008 You really dont like giving anything do you!!! the best I can say from that limited info is: instead of: 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_QUANTITY') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_quantity"; break; } } } else { put: if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { $HTTP_GET_VARS['sort'] = 0 . 'a'; $listing_sql .= " order by ABS(floorplan) "; } else { You'll have to work out the rest yourself, as you refuse to provide proper details. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
studioimagen Posted December 4, 2008 Share Posted December 4, 2008 i really appreciate your response. Floorplan doesn't really apply here, i just dont know where to stick the ABS to the existing code here is where i need it to list in numerical order http://traciegrant.com/catalog/index.php?cPath=21 Sincerely, Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.