News:

Support the VirtueMart project and become a member

Main Menu

[solved] menu item selection list length

Started by dontflinch, January 26, 2012, 21:04:33 PM

Previous topic - Next topic

dontflinch

we have many products in our store, hundreds.

I am adding menu items today for them and I just got to a point where when looking for a particular item I realized that the list length for the selection of the product to tie to the menu item cuts off at 50. ("Select a Product *" in VirtueMart Product Details Layout menu type).

it may be that we have our default list limit set to 50 that causes this, but that is not good.  I can raise it to 100, but we will pass that amount at some point as well.  shouldn't this list ignore the list limit and always show all?

bug?  or am I missing a setting somewhere?

I'm going to look around in the files now, but I am not familiar enough with the new vm to know where to look for it yet.


=======================================================================================
edit: pretty sure the problem lies here:
administrator/components/com_virtuemart/elements/vmproductsmenu.php
   
    private function _getProducts() {

if (!class_exists('VirtueMartModelProduct'))
    require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'product.php');
$productModel = new VirtueMartModelProduct();
$products = $productModel->getProductListing(false, false, false, false, true);
$i = 0;
foreach ($products as $product) {
    $list[$i]['value'] = $product->virtuemart_product_id;
    $list[$i]['text'] = $product->product_name. " (". $product->product_sku.")";
    $i++;
}
return $list;
    }


but I am not sure what to do there.  i tried looking in an old vm installation to see how this was handled then but cannot find the function yet there.


dontflinch

#1
well I was gonna make another edit but then I thought no one will know I am updating the topic.


I have looked through my old vm installation and see that "select product" wasn't handled in a dropdown list at all.  there were fields to fill in - (Product ID, Category ID, Flypage, Page) - how could I forget?

and in looking in (old) administrator/components/com_menus/  (in views/item/tmpl/form.php and elsewhere)  I see that lists are sometimes referenced as genericlist and I wonder if this may be what needs to happen there.

anybody have any advice on this list problem?  I am kinda stumped and have a lot more products to list in menus.

dontflinch

#2
and more:


now I see that I must not be editing the right file for the menu item choosing as mentioned in my first post.

I found this answer on joomla forum:
http://forum.joomla.org/viewtopic.php?p=2568432

      // set to 0 to show all
                $this->setState('list.limit', 0);


now if I could just find the right place to put it.....

I tried putting it just before       echo $this->loadTemplate('options'); ?> in administrator/components/com_menus/views/item/tmpl/edit.php but it breaks the page.

I also tried to look for some similar mechanism used by another type of menu item but it appears all choices like this now are modal windows.  =(

dontflinch

can anyone else even confirm they have this problem?  I considered it could be a javascript issue but I don't think so.

dontflinch

well this is now on page three and no one has confirmed or denied this as a bug.

I replicated the problem on another installation myself over the weekend.

I also pm'd asking someone I know has a lot of products to confirm but have not heard back.

I guess I may be able to get around it by editing the menu items in phpmyadmin, but it would be nice if the developers could check that this is in fact a bug so it may be fixed in future versions.

I am using 2.0 stable release.

Milbo

Do you mean the pagination? or the possible selection by the category module? I am sorry, maybe a picture could help.

You maybe see that the code above $productModel->getProductListing(false, false, false, false, true); has no limit or so there. It is taken from the session. When you set the standard to 20 and the user sets it to 50,.. he will have 50 products when using the category module, imho.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

dontflinch

hello!  thanks for replying!

I am attaching a screenshot.

the problem is the most default list limit length can be set for in joomla is 100 and so no matter what this list will never be long enough if you have more than 100 products.

I think it needs to be either modal window choice like most other menu choices or the list needs to be a "show all".

I hope the screenshot helps explain!  I highlighted the problem area (dropdown list length) in yellow.



[attachment cleanup by admin]

dontflinch

I also had someone else with a lot of products confirm they have this same issue.  he says his only shows 10 in the dropdown, mine shows 50.

it seems to me like it takes this setting from whatever the default list limit length is whenever first accessed?  not sure though.

Milbo

Ahhhhh, man you are talking about the joomla menu item creator, what happens, when you choose the productdetails layout. This error was fixed yesterday. The list shows now all, but all product lists have an hardcoded limit of 700 products.

Additionally some explanations: First in 2.0.1 you can set your own sequence. This is then an override for all paginations. Play with the products per row and see how the pagination is changing. It is not perfect yet, but a nice start.

Take a look to the abstract model vmmodel.php in BE/helpers. Just copy this line near line 703
Quote$limits[] = JHTML::_('select.option',JRoute::_( $link.'&limit='. $this->_perRow * 20) , $this->_perRow * 20 );
change the 20 to something higher to get higher numbers.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

dontflinch

okie dokie, I just happened to figure out where this value is coming from.

I was trying to make the edits that Milbo suggested at the same time I was also adjusting the "Max products per view in frontend" setting in Configuration -> Shopfront to change the pagination on a particular category when I noticed that what I changed the "Max products per view in frontend" setting to to fix the pagination problem it also changed the list length to the same amount.  I changed it again and confirmed this was where the issue lies for this problem.

Now I notice Milbo knows about it and am glad it will be considered in future updates.  thanks!