VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Products, Prices, Tax and Categories VM 1.1 => Topic started by: flavorgrafix on May 01, 2008, 05:39:01 am

Title: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: flavorgrafix on May 01, 2008, 05:39:01 am
In the 1.1.0 wiki it clearly states that:

"It's now possible to re-order products in a category and create a sort order that is independent of price, name or date."

http://dev.virtuemart.net/cb/wiki/1353

But how exactly does this work? In the back-end, I try to use the change order column by renumbering the order of products, then I click the small disk icon and the order changes in the list  but that change does not reflect on the front end. The order doesn't change.

Then I try the arrows in the reorder column and they do nothing either.

Is my VM install broken? Or is this feature not working yet?
I don't want to have to do it by SKU's or alphabetically or price.

I am using Virtuemart 1.1.0 and Joomla! 1.5.2 Production/Stable
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: billsfriends on May 07, 2008, 04:58:43 am
I concur Mr. Flavor, very frustrating. What's the point of a sort order on the back end?? I want to be able to sort on the front end free of name, date and sku.

I wish someone had a fix for this
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: billsfriends on May 24, 2008, 22:23:51 pm
anyone have a fix for this issue??
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: thomas2411 on June 11, 2008, 16:17:29 pm
Hi guys,
I also had this problem but I succeeded in adding some code in order to make it work. Here is a solution.


File:
administrator\components\com_virtuemart\html\admin.show_cfg.php

Find
Code: [Select]
    <tr>
        <td class="labelcell"><?php echo $VM_LANG->_('VM_BROWSE_ORDERBY_DEFAULT_FIELD_LBL'?></td>
        <td>
                <select class="inputbox" name="conf_VM_BROWSE_ORDERBY_FIELD">
                        <option value="product_name" <?php if (@VM_BROWSE_ORDERBY_FIELD == 'product_name') echo "selected=\"selected\""?>><?php echo $VM_LANG->_('PHPSHOP_PRODUCT_NAME_TITLE'?></option>
                        <option value="product_price" <?php if (@VM_BROWSE_ORDERBY_FIELD == 'product_price') echo "selected=\"selected\""?>><?php echo $VM_LANG->_('PHPSHOP_PRODUCT_PRICE_TITLE'?></option>
                        <option value="product_sku" <?php if (@VM_BROWSE_ORDERBY_FIELD == 'product_sku') echo "selected=\"selected\""?>><?php echo $VM_LANG->_('PHPSHOP_CART_SKU'?></option>
                        <option value="product_cdate" <?php if (@VM_BROWSE_ORDERBY_FIELD == 'product_cdate') echo "selected=\"selected\""?>><?php echo $VM_LANG->_('PHPSHOP_LATEST'?></option>
            </select>
        </td>
        <td><?php echo vmToolTip$VM_LANG->_('VM_BROWSE_ORDERBY_DEFAULT_FIELD_LBL_TIP') ) ?></td>
    </tr>

And add new option to input, type select:

Code: [Select]
                        <option value="product_list" <?php if (@VM_BROWSE_ORDERBY_FIELD == 'product_list') echo "selected=\"selected\""?>><?php echo $VM_LANG->_('PHPSHOP_PRODUCT_ORDER_DEFAULT_MODIFIED'?></option>

Find:

Code: [Select]
    <tr>
        <td class="labelcell"><?php echo $VM_LANG->_('VM_BROWSE_ORDERBY_FIELDS_LBL'?></td>
        <td>
                        <input name="conf_VM_BROWSE_ORDERBY_FIELDS[]" type="checkbox" value="product_name" <?php if (in_array'product_name'$VM_BROWSE_ORDERBY_FIELDS )) echo "checked=\"checked\""?> id="conf_VM_BROWSE_ORDERBY_FIELDS1" />
                        <label for="conf_VM_BROWSE_ORDERBY_FIELDS1"><?php echo $VM_LANG->_('PHPSHOP_PRODUCT_NAME_TITLE'?></label><br />
           
                        <input name="conf_VM_BROWSE_ORDERBY_FIELDS[]" type="checkbox" value="product_price" <?php if (in_array'product_price'$VM_BROWSE_ORDERBY_FIELDS )) echo "checked=\"checked\""?> id="conf_VM_BROWSE_ORDERBY_FIELDS2" />
                        <label for="conf_VM_BROWSE_ORDERBY_FIELDS2"><?php echo $VM_LANG->_('PHPSHOP_PRODUCT_PRICE_TITLE'?></label><br />

                        <input name="conf_VM_BROWSE_ORDERBY_FIELDS[]" type="checkbox" value="product_cdate" <?php if (in_array'product_cdate'$VM_BROWSE_ORDERBY_FIELDS )) echo "checked=\"checked\""?> id="conf_VM_BROWSE_ORDERBY_FIELDS3" />
                        <label for="conf_VM_BROWSE_ORDERBY_FIELDS3"><?php echo $VM_LANG->_('PHPSHOP_LATEST'?></label><br />

                        <input name="conf_VM_BROWSE_ORDERBY_FIELDS[]" type="checkbox" value="product_sku" <?php if (in_array'product_sku'$VM_BROWSE_ORDERBY_FIELDS )) echo "checked=\"checked\""?> id="conf_VM_BROWSE_ORDERBY_FIELDS4" />
                        <label for="conf_VM_BROWSE_ORDERBY_FIELDS4"><?php echo $VM_LANG->_('PHPSHOP_CART_SKU'?></label>
        </td>
        <td><?php echo vmToolTip$VM_LANG->_('VM_BROWSE_ORDERBY_FIELDS_LBL_TIP') ) ?></td>
    </tr>

And add new checkbox

Code: [Select]
<input name="conf_VM_BROWSE_ORDERBY_FIELDS[]" type="checkbox" value="product_list" <?php if (in_array'product_list'$VM_BROWSE_ORDERBY_FIELDS )) echo "checked=\"checked\""?> id="conf_VM_BROWSE_ORDERBY_FIELDS5" />
                        <label for="conf_VM_BROWSE_ORDERBY_FIELDS5"><?php echo $VM_LANG->_('PHPSHOP_PRODUCT_ORDER_DEFAULT_MODIFIED'?></label>


File:
administrator\components\com_virtuemart\html\shop_browse_queries.php

Find:

Code: [Select]
switch( $orderby ) {
case 'product_name':
$orderbyField = '`#__{vm}_product`.`product_name`'; break;
case 'product_price':
$orderbyField = '`#__{vm}_product_price`.`product_price`'; break;
case 'product_sku':
$orderbyField = '`#__{vm}_product`.`product_sku`'; break;
case 'product_cdate':
$orderbyField = '`#__{vm}_product`.`cdate`'; break;
default:
$orderbyField = '`#__{vm}_product`.`product_name`'; break;
}


And add new case:


Code: [Select]
case 'product_list':
$orderbyField = '`#__{vm}_product_category_xref`.`product_list`'; break;
}


File:
components\com_virtuemart\themes\default\templates\browse\includes\browse_orderbyfields.tpl.php

Find:

Code: [Select]
// SORT BY PRODUCT NAME
if( in_array( 'product_name', $VM_BROWSE_ORDERBY_FIELDS)) { ?>
        <option value="product_name" <?php echo $orderby=="product_name" "selected=\"selected\"" "";?>>
        <?php echo $VM_LANG->_('PHPSHOP_PRODUCT_NAME_TITLE'?></option>
<?php
}

And add before it or wherever you want - it is up to you which option will be shown in which order "in sort by list"


Code: [Select]
// SORT BY MY OWN ORDER - MOJA ZMIANA
if( in_array( 'product_list', $VM_BROWSE_ORDERBY_FIELDS)) { ?>
        <option value="product_list" <?php echo $orderby=="product_list" "selected=\"selected\"" "";?>>
        <?php echo $VM_LANG->_('PHPSHOP_PRODUCT_ORDER_DEFAULT_MODIFIED_LBL'?></option>
<?php
}


Last thing is to add to your language 2 new variables:

File:
administrator\components\com_virtuemart\languages\common\yourlanguage.php


Code: [Select]
'PHPSHOP_PRODUCT_ORDER_DEFAULT_MODIFIED' => 'Own sort order',
'PHPSHOP_PRODUCT_ORDER_DEFAULT_MODIFIED_LBL' => 'Default sorting',

Of course you can name it as you want :)

Good luck! :)
Tom Ignatiuk
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: urso.lv on June 13, 2008, 16:25:18 pm
Thank you a lot!

I just did those changes and it worked just fine.
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: Printopia on June 19, 2008, 11:16:17 am
I have more or less the same problem, but then with Child items. When I go to a parent item and click on 'item information', I get a list of the child items. In the front end, these will show up as a drop down menu.

I would like to set the order in the backend, but the arrows don't do anything. If I click them, the page refreshes, but order stays the same. The same happens when I manually fill out the order in numbers and click the 'save' symbol. How to work around this?

I've tried the fix above but it did not work for me. I've probably done something wrong, but I also think (maybe I'm wrong) it's not the solution to my problem?
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: webrule on July 17, 2008, 20:43:39 pm
Hello,

i tried this code but getting error in admin side

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/waterion/public_html/administrator/components/com_virtuemart/html/admin.show_cfg.php on line 792


and on client side this error


Parse error: syntax error, unexpected T_DEFAULT in /home/waterion/public_html/administrator/components/com_virtuemart/html/shop_browse_queries.php on line 58

i inserted the same thing you said but got this error

i basically want sorting by product id

thanks
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: gavn8r on July 24, 2008, 17:30:22 pm
THANK YOU SO MUCH!  This was really driving me crazy and I was trying to find everything I needed to change to order by product_list.  I decided on a whim to do a Google search and I found this post.  Excellent job, thomas2411.  you saved me a lot of work and a huge headache.  Well done.
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: vbsouthern on July 29, 2008, 04:45:15 am
Thank you thomas2411 for your solution to this problem.  You may be a Newbie to the VirtueMart Forum but you are obviously a first rate programmer.  Thanks again.

http://forum.virtuemart.net/index.php?topic=39525.msg131553#msg131553
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: sparkiii on August 07, 2008, 00:55:41 am
HI and thankyou. This is working as far as there are no errors coming up and it all seems fine in the admin, but it doesnt change the sort order in the front end?? Does this make sense. I want to set it Jan - Dec in order.

Mt URL is

http://www.sri.com.au/index.php?option=com_virtuemart&page=shop.browse&category_id=6&Itemid=42 (http://www.sri.com.au/index.php?option=com_virtuemart&page=shop.browse&category_id=6&Itemid=42)

Please see a screen shot of my admin page below.
(http://www.sri.com.au/images/sri.gif)
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: vbsouthern on August 07, 2008, 04:34:23 am
If you followed all of the instructions in the post:
http://forum.virtuemart.net/index.php?topic=39525.msg131553#msg131553
then go to VirtueMart >> Configuration and select the Site tab.  Go to (Default product sort order) and select the Product Order that you defined in the code you changed.
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: sparkiii on August 07, 2008, 05:36:12 am
 ;D Thanks, that did the trick.
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: ipimen on August 10, 2008, 06:25:29 am
Thanks a lot! Great post thomas2411, clear and flawless. It worked perfectly.
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: thomas2411 on August 10, 2008, 12:32:24 pm
I'm happy to hear that :)
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: elixa on September 08, 2008, 15:36:02 pm
Dear thomas2411, This worked for me wonderfully just as I was feeling the crushing weight of a nagging client on my back. Wish you well.
thanks again - elixa
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: urbandriftwood on September 26, 2008, 21:23:10 pm

I have more or less the same problem, but then with Child items. When I go to a parent item and click on 'item information', I get a list of the child items. In the front end, these will show up as a drop down menu.
I would like to set the order in the backend, but the arrows don't do anything. If I click them, the page refreshes, but order stays the same. The same happens when I manually fill out the order in numbers and click the 'save' symbol. How to work around this?
I've tried the fix above but it did not work for me. I've probably done something wrong, but I also think (maybe I'm wrong) it's not the solution to my problem?

I am having the same issue with Child Items. Global site configuration does not seem to control the child list.  The drop down list does not appear to be sorting by option value, SKU, or Item Name.

Joomla 1.5.6, Virtuemart 1.1.2
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: lcasterman on November 06, 2008, 04:00:43 am
hello Thomas2411,

thanks thanks thanks thanks... and many more!
I've been searching all night long before I found your solution.

thanks a million for sharing your experience with us.

Have a lovely day! Cheers!
Luc
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: Eric Brown on November 14, 2008, 22:15:36 pm
Okay...so what IS the solution?
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: j37h3r on November 24, 2008, 23:52:47 pm
Is there some like manual sort for VM 1.0.1x?

Thanks!
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: thomas2411 on November 29, 2008, 01:20:09 am
Okay...so what IS the solution?

Read through this post and you will see whole (long) instruction :)
Is there some like manual sort for VM 1.0.1x?
Thanks!

Could you be more specific? (Better english)
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: scubasapiens on December 29, 2008, 14:17:20 pm
Great fix, Thomas2411! Is there any way to make it sort the products randomly?

/Chris
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: bheppner on March 18, 2009, 16:23:47 pm
Hey,
interesting discussion/information about sort-order.  But the description doesn´t work with VM 1.1.3, as there are some files not existing as described.

In the backend I have sorted the products, but in the frontend there is only alphabetic order.   I want to show the products in this kind of sorting.

Any idea?

Thanks
Bernd

Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: gtech on May 18, 2009, 14:06:28 pm
This is working for me.
Joomla 1.5.10 and VM 1.1.3
Thank you! You are my HERO!

I can now show the products in order I like.
example:
http://www.gtechonline.co.uk/products/floor-care-products
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: plunk on May 20, 2009, 16:56:12 pm
Found all the files in VM1.1.3 too. But I am not yet totally exited. I think I am missing a bit of the clue. How to arrange backend the order, so it will appear in the right order frontend?

Default product sort order: I choose 'Own sort order'
Available "Sort-by" fields: i choose 'Own sort order'

When I try to re-arrange, i go to products - List Products
Filter is set to 'reserveonderdelen' (spareparts)

I suppose the arrows under reorder are meant to reorder, but when i klik on them, nothing moves  :o! And it surprices me that under column 'save order' 4 products have the same number (1). (To see that, move scrollbar to the right.)

What am I doing wrong?

(http://www.screentech.nl/images/vm-product-sorting.jpg)


..... found the answer myself
just go to your productpage
select a category of products using 'Filter'
use the up and down buttons onder 'Reorder' or...
set numbers under A-Z and press A_Z (it's a button)

This probably is the way reordering was supposed to work.
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: bkewl on June 18, 2009, 01:54:58 am
I'm not sure if this is a new thing or not, but you don't have to do a hack to get this to work. Under

Admin -> Configuration -> Site -> Default product sort order

Choose "Default". Now your product listing will obey the order you set using the "reorder" buttons on the product list backend admin page!
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: gdwoods on June 18, 2009, 22:04:16 pm
Yes, the trick is to make sure that you have your sort numerals filled in. If the sort boxes are empty in the backend it will not work. Fill in the numbers and presto! all is well
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: esedic on June 25, 2009, 23:45:42 pm
Great hack Thomas2411!

But I would like to sort products by multiple product types I have set up.

I understand every step of this hack but I have trouble with modification of MySQL queries in the shop_browse_queries.php. I tried to add product type tables to query but no success, I get a blank page.

Can someone help me with this?

Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: bachelorzdb on September 22, 2009, 11:23:40 am
Thanks a lot! thomas2411
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: aforantman on May 26, 2010, 06:55:59 am
you can set the default order in the site config settings:
go to Admin - Configuration - Site Tab
see the drop down: Default Product Sort Order
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: weeonesbyjajoc on May 27, 2010, 01:10:25 am
thank you so very much!  This works great  ;D
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: MSH on September 01, 2010, 17:18:48 pm
Hi,

I have tried this but it doesn't solve my problem I am using version 1.1.4 and I am unable to sort the products. I can sort them in the backend but they don't change position in the front display page.

Can anyone help here.

Mike
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: formfranska on September 01, 2010, 18:01:55 pm
Hello Mike,
I've struggled like you with VM but since I rarely got any help in this forum I've abandoned VM and switched to redSHOP. I'm very pleased so far. You get immediate help in the forum there if you are a subscriber which involves paying for membership but it's worth it a million times.

I wish you the best of luck :-)
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: neilforrester on October 28, 2010, 01:51:05 am
I had this issue too but this is how I reordered my products in a category without messing with the code:

Click Site in VirtueMart. Where is says "Default product sort order" select Default. Save.

Now click Products / Lists Products

Under Filter select the category where you want to reorder your products.

When your list appears click the little AZ icon to the right or the Reorder Column.

Now each product will be assigned an order number and that is the order that they will appear in at the front end because we have selected Default Order under Site.

If you want to change the order of the product is shown at the front end, simply use the arrow keys in the Reorder Column to move the product up or down.

I hope this is the answer you were looking for as I had the same issue but I don't like to mess with the code if I can get away with it.

Cheers,
Neil.

Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: jaydenl on December 07, 2010, 01:24:21 am
neilforrester = legend.  Thanks so much!! Such an easy fix that I was stressing over.....
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: krofeta on January 08, 2011, 02:05:26 am
this is not working for child products!!!
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: kobiavr on February 16, 2011, 09:15:53 am
thanks you very much thomas2411

When I change the order of a product that appears in two categories
The order of the products takes place in both categories.

There is a way to solve this?

sorry for my bad english
kobi
Title: Re: HELP!!! - Can't Manually Change the Sort Order for Products in Frontend
Post by: klezmer41 on October 17, 2011, 22:27:04 pm
thanks you very much thomas2411

When I change the order of a product that appears in two categories
The order of the products takes place in both categories.

There is a way to solve this?

sorry for my bad english
kobi

I have this same issue, the reordering by up/down arrows affect the ordering in all categories. I can usually get around it by avoiding the arrows and instead typing numbers in the boxes, but that's really annoying to have to type in 1-50 for each category. I just posted a new thread about this, hopefully somebody knows of a solution: http://forum.virtuemart.net/index.php?topic=92099.msg302802