0

I'm in app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php and I see lines like the following:

$dir = $this->_getData('_current_grid_direction');

$limit = $this->_getData('_current_limit');

Yet when I search the app, I don't see mention of these values anywhere else. Where are these attributes used? Why does nothing else set them? How can I know what other attributes might exist for a collection? How can I know what values are accepted for them?

1

The attributes are used in the Product List Toolbar on the frontend. _current_grid_direction holds data as to whether the product list is currently sorted in Ascending or Descending direction. _current_limit holds data as to how many items show on the current page, aka, per page limit of products to show.

You can see these items in use in the class Mage_Catalog_Block_Product_List_Toolbar

_current_grid_order is used in Mage_Catalog_Block_Product_List_Toolbar::getCurrentOrder(). That function is called in the following functions in the same class:

getOrderUrl
isOrderCurrent
setCollection

_current_grid_direction is used in Mage_Catalog_Block_Product_List_Toolbar::getCurrentOrder(). That function is called in in the following functions in the same class:

setCollection

That function is also called in the following files:

app/design/frontend/base/default/template/catalog/product/list/toolbar.phtml

If you start stepping through the code from toolbar.phtml you should be able to see it in action.

| improve this answer | |
  • Can you offer more about where I might see them used on the frontend in a code-oriented manner? Or will I find them in the dashboard somewhere? If so, where? – jmargolisvt Sep 23 '16 at 14:03
  • Answer updated. From there, you need to step through the code because if you take a look at the files and functions I pointed out, there are very clear usages of these pieces of data that should be relatively easy to understand. I hope this helps! – Shawn Abramson Sep 23 '16 at 14:19
  • I see it now! So they are arbitrary names used to set up convenience getter methods. :) – jmargolisvt Sep 23 '16 at 14:41
  • Yes, thats exactly right. You should be able to override them to, Im pretty sure I did that in one of my modules. – Shawn Abramson Sep 23 '16 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.