Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Custom (products) Sort Order


Recommended Posts

Brand new version of the custom product sort order contribution.

 

http://www.oscommerce.com/community/contributions,2541

 

This version allows the sort order of products to be bulk updated rather than writing to the database for each product individually.

 

This modification adds a textbox next to the status radio buttons in categories.php which allows you to enter a default sort order for your products. Simply click the sort-order button and the textbox(s) will be enabled. Enter the sort order value for each product and click save-sort.

 

The benefit of this contribution over similar (but also good) contributions is that it allows you to sort your products all at once with one update to the database rather than one product at a time. I believe this makes it the easiest to use custom sort order for your shop.

 

screenshot.jpg

 

Hopefully some of you will find this modification usefull!!!

 

Brian

Light, in the absence of eyes, illuminates nothing.

Link to comment
Share on other sites

  • Replies 56
  • Created
  • Last Reply

Top Posters In This Topic

I'm not using this (yet) but it does seem like the sensible thing to do ! :)

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

  • 2 weeks later...
Thank you !  This is just what I was looking for !  It installed quite easily and with no problems.  The other product sort contributions would not work for me - but this one is fabulous - Thank you so much for such a great contribution !

 

WooHoo! A happy customer!! :D

Light, in the absence of eyes, illuminates nothing.

Link to comment
Share on other sites

WooHoo! A happy customer!!  :D

 

I am trying to install this contribute and I'm having a problem on the first step (everything else seems pretty straight forward).

 

When I download the .zip, the first thing it tells me to do is

 

To implement this mod,  follow the instructions in this text file. You will need to make the following database changes (using phpmyadmin or similar tool)

 

ALTER TABLE products ADD products_sort_order INT( 4 ) DEFAULT '0' NOT NULL;

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('', 'PRODUCT_LIST_SORT_ORDER', '6', '', '0', '', now());

 

When it says ALTER TABLE products, I'm not sure exactly what that means. I went to phpMyadmin and I went ot my "products" table but I'm not quite sure what to do next. Also, how would I Insert Into configuration? I've gotten pretty good at the coding, now it's the DB's that are confusing to me. Can someone please help me understand this??

Web Development, 365... 366 in a leap year.

Link to comment
Share on other sites

I am trying to install this contribute and I'm having a problem on the first step (everything else seems pretty straight forward). 

 

When I download the .zip, the first thing it tells me to do is

When it says ALTER TABLE products, I'm not sure exactly what that means.  I went to phpMyadmin and I went ot my "products" table but I'm not quite sure what to do next.  Also, how would I Insert Into configuration?  I've gotten pretty good at the coding, now it's the DB's that are confusing to me.  Can someone please help me understand this??

 

You only have to copy/paste these SQL statements into your phpMyAdmin SQL textbox you find when you click the SQL tab.

Paste this whole part

ALTER TABLE products ADD products_sort_order INT( 4 ) DEFAULT '0' NOT NULL;

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('', 'PRODUCT_LIST_SORT_ORDER', '6', '', '0', '', now());

into the textbox there, press Start and that should be it.

Link to comment
Share on other sites

  • 2 weeks later...

Hi, I have just installed this contrib and it works great - I only have one question.

 

Is there anyway to make the top result the highest number (rather than the lowest)? I would like to use the date I add/update the product as the sort number - so newest products are at the top.

 

Cheers!

jeremy

Link to comment
Share on other sites

As others before, i to tried first another one - that didnt work for me - yours looks a lot simpler then that one - and is perfect for what i need. I installed all - and think there is no problem with it.. however - my 'Save Sort' doesnt work.

 

Any ideas? (when i go over it with the mouse its not showing a url - i can click it but nothing happens - like there's no <a href set?)

 

I have been deleting and copy pasting for hours/Days now - to get rid of the previeus instalation and add yours - maybe i forgot something small here... any ideas?

 

 

Thnx

kind regards

tom

Even in this dark place, yes, I am afraid of my own shadow.

 

 

 

Contributions | KnowledgeBase | osCommerce 2.2 pdf

Link to comment
Share on other sites

Hi Tom,

 

The save sort button is a form submit button so it doesn't have an <a href.

 

All I can suggest is you go through the install instructions and check that you've followed them correctly.

 

I'm certain it's not a bug in the contribution as there are so many people using it successfully.

 

Most of the changes in this contribution are in the admin/categories.php file. If you pm me a copy of that, I'll check it for you.

 

Don't post it here though, the mods don't like whole files being posted.

 

Brian

Light, in the absence of eyes, illuminates nothing.

Link to comment
Share on other sites

  • 3 weeks later...

I am getting a weird problem after installing this contribution. For some reason there is an extra column showing in the product listing. I have two "Buy Now" buttons showing, but when i remove the "Buy Now" feature, it shows two price listing columns so it looks like it's duplicating the last column.

 

When I revert to a backup database it fixes the problem, but the sort doesn't work and when I take out this line of code..

 

//sort order

$define_list = array('PRODUCT_LIST_SORT_ORDER' => PRODUCT_LIST_SORT_ORDER,

'PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,

//end sort order

 

..and replace it with the original, it fixes the problem, but again the sort doesn't work. I am at a loss as to why this is happening.. :(

 

Is anyone else having this problem? This contribution is exactly what I am looking for so i don't want to uninstall it.

 

Here is a screenshot of the problem..

 

maiddocs.png

Link to comment
Share on other sites

  • 2 weeks later...

Hello....another newbie here.

 

I was carefull when installing this contrib, but when adding the very last section of code I was getting a parse error (unexpected T_STRING), and because of that I was not able to bring up the admin panel.

When I removed the last section of code I was able to get into the admin panel.

 

When viewing the catalog and clicking on a catagory, the letter "n" appears several times in a vertical row above the sub-catagory links.

 

Any tips would be great.

 

Rich

Link to comment
Share on other sites

Hello....another newbie here.

 

I was carefull when installing this contrib, but when adding the very last section of code I was getting a parse error (unexpected T_STRING), and because of that I was not able to bring up the admin panel.

When I removed the last section of code I was able to get into the admin panel.

 

When viewing the catalog and clicking on a catagory, the letter "n" appears several times in a vertical row above the sub-catagory links.

 

Any tips would be great.

 

Rich

 

 

I've gone back to square one, installed the contrib and I'm still getting a parse error.

Made a mistake on my original post, this is the error

 

Parse error: parse error, unexpected T_VARIABLE in /var/www/html/ad/myserver.com/catalog/admin/includes/functions/general.php on line 401

This is line 401:

// Arguments : country country code string

 

I'd love some help on this.

Thanks!

Rich

Link to comment
Share on other sites

I've gone back to square one, installed the contrib and I'm still getting a parse error.

Made a mistake on my original post, this is the error

 

Parse error: parse error, unexpected T_VARIABLE in /var/www/html/ad/myserver.com/catalog/admin/includes/functions/general.php on line 401

This is line 401:

// Arguments : country country code string

 

I'd love some help on this.

Thanks!

Rich

 

My line 401 in admin/includes/functions/general.php reads:

eval("\$address = \"$fmt\";");

 

Also - the contrib only asks you to edit the last line of general.php - so no changes should have been made at line 401 or anywhere before it.

 

my last lines (from the contrib) are:

 

}

//// sort order ////

// Sets the sort order of a product

function tep_set_product_sort_order($products_id, $sort_order) {

return tep_db_query("update " . TABLE_PRODUCTS . " set products_sort_order = '" . $sort_order . "', products_last_modified = now() where products_id = '" . (int)$products_id . "'");

}

?>

 

If you like I can email you my general.php - pm me your address.

Link to comment
Share on other sites

  • 2 weeks later...

Couple things...

 

One: categories.php - I cant select the input box - on click it takes me to edit the product

 

Two: categories.php - the sort buttons do not appear.

 

I have installed this twice now using find and replace features in Dreamweaver with no luck on this little glitch.

 

Any thoughts?

Link to comment
Share on other sites

Skip that - is all better. Apparently I read too far ahead and missed 2 vital steps. My bad.

 

EXCELLENT contribution.

 

 

Yeah, so again a bit premature.... After all the install, and triple checking, it doesnt display the saved sort order in my category listing in the catalog. :o

Link to comment
Share on other sites

i dont' know why i got this errors on admin/catagories.php:

 

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by pd.products_name' at line 1

 

select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_sort_order from products p, products_description pd, products_to_categories p2c where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = '0' order by p.products_sort_order, order by pd.products_name

 

 

anybody knows what that means?

 

 

Thanks

 

sean

Link to comment
Share on other sites

Hi, folks. I'm running into a little trouble with Contrib conflicts. Most of this goes in fine but I had to muck around with instructions to fit it in with the contrib for short descriptions here:

in catalog\includes\modules\product_listing.php

Line 64

 

Replace

  if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {

 

with

//sort order
if ($column_list[$col] == 'PRODUCT_LIST_SORT_ORDER'){break;}
if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') && ($column_list[$col] != 'PRODUCT_LIST_MULTIPLE')) {
  // if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
//end sort order

 

here's the section I think is messing things up.

 // Products Description Hack begins
//sort order
if ($column_list[$col] == 'PRODUCT_LIST_SORT_ORDER'){break;}
if ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW' &&
	$column_list[$col] != 'PRODUCT_LIST_IMAGE' &&
	$column_list[$col] != 'PRODUCT_LIST_DESCRIPTION' &&
	($column_list[$col] != 'PRODUCT_LIST_MULTIPLE')) {

  $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);

if ($column_list[$col] != 'PRODUCT_LIST_DESCRIPTION') {
  $list_box_contents[0][] = array('align' => $lc_align,
										 'params' => 'class="productListing-heading"',
										 'text'  => " " . $lc_text . " ");
}

 }
// Products Description Hack ends

 

I've blended the replacement from the instructions to try to fit the description in there but when I surf to a category, I get:

Parse error: parse error, unexpected $ in /homepages/0/d112133822/htdocs/passifloras/catalog/includes/modules/product_listing.php on line 208

which is the last line and usually indicates that I hven't closed a } or a ) I think. Can any of you code folks help? I can post the entire file if it will help.

I have similar trouble in admin and I think it's another contrib, but I'll get to that in a bit.

Link to comment
Share on other sites

  • 2 months later...

I agree with everyone else -- this contribution is great.

 

I'm having one minor issue, though -- when I'm editing products on my site (categories.php), nothing appears in the "Model" column on the far left. Has anyone run into this before? It's not a huge deal, but it's nice to be able to see the model numbers without clicking on individual products!

 

Please let me know if I need to post any more info.

 

Thanks in advance --

 

K. Anderson

Link to comment
Share on other sites

Hi, I installed this contribution today and I have allllllllmost got it working. Sadly, this is what my admin>category/products looks like right now:

 

products_sortorder.gif

 

no products listed within their categories. All the products are still there (show up on the website) but they aren't listed here. I am able to add new products but, again, they aren't listed here once they have been added.

 

Here is what it looks like when I click the 'sort order' button:

 

products_savesort.gif

 

same deal, no product listings.

 

I have gone through each phase of the install instructions and all the appropriate bits appear to be where they are supposed to be in my files. Obviously, I have missed something somewhere - anyone have any ideas where?

 

Thanks in advance! :o)

Edited by sopretty
Link to comment
Share on other sites

Ok, I figured the problem was somewhere in catalog/admin/categories.php so I started with a fresh copy of that file and changed the code as per the instructions for this contribution and, sure enough, that was where my error was. I had simply put one the //$products_query = tep_db_query... bits in the wrong place. It's all fixed now and works like a dream.

 

Thanks so much to Beer Monster for this great contribution. :)

Link to comment
Share on other sites

  • 1 month later...

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...