Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pager block should support url "fragment". #996

Closed
tzyganu opened this issue Jan 23, 2015 · 3 comments
Closed

Pager block should support url "fragment". #996

tzyganu opened this issue Jan 23, 2015 · 3 comments
Assignees

Comments

@tzyganu
Copy link
Contributor

tzyganu commented Jan 23, 2015

The \Magento\Theme\Block\Html\Pager class does not support "fragments" for generating urls like some-page/?p=2#fragment-here.

Here are some scenarios when this might be needed.

  • A category page has an image and a description and below that the products. Most likely the customer reads the description on the first page he visits and will not care about seeing it again on the second page. So I may want, when he clicks on the second page, to auto scroll to the start of the products list. I know this can be achieved by javascript, but a native support would be nice.
  • I may have a page that has 2 paginated lists (they may be in separate tabs) and when I change the page for one of the list I want the autoscroll (or the selection of a specific tab) to be done via the url fragment.

This can be achieved simply by adding in the \Magento\Theme\Block\Html\Pager class a protected member:

 protected $fragment = null;

2 methods:

public function getFragment()
{
    return $this->fragment;
}
public function setFragment($fragment)
{
    $this->fragment = $fragment;
    return $this;
}

and a change is needed for the getPagerUrl method to include the fragment:

public function getPagerUrl($params = [])
{
    $urlParams = [];
    $urlParams['_current'] = true;
    $urlParams['_escape'] = true;
    $urlParams['_use_rewrite'] = true;
    $urlParams['_fragment'] = $this->getFragment(); //this needs to be added
    $urlParams['_query'] = $params;

    return $this->getUrl('*/*/*', $urlParams);
}

I could do a PR for this, but I wanted first to get your opinion and to see if you may already have this planned.

@airbone42
Copy link

👍

@vpelipenko
Copy link
Contributor

Thank you for contributing this suggestion. It looks as useful improvement, but it is not planned for our future development. Could you create pull request for that?

vpelipenko added a commit that referenced this issue Feb 12, 2015
@vpelipenko
Copy link
Contributor

Pull request is accepted. Thank you for contributing.

vpelipenko added a commit that referenced this issue Feb 13, 2015
magento-team added a commit to abeeskau/magento2-community-edition that referenced this issue Feb 20, 2015
* Various improvements:
    * Existing Builders were replaced with DataFactories in Customer and Tax modules
    * Refactored controller actions in the Checkout and CMS modules
    * Increased coverage with static tests for `.phtml` files
    * Moved Cookie related functionality from `Theme` and `Core` modules into a new `Cookie` module
    * Moved minfication configuration settings to the `View` library level
* UI improvements:
    * Restyled installation wizard
    * Prepared styles for Dashboard in the Backend area
* Framework improvements:
    * Added `setCustomAttribute` and `setCustomAttributes` methods to `ExtensibleDataInterface`
    * Added setter methods to data object interfaces
    * Replaced `Builders` with `Factories`
    * Added `DataObjectHelper.php` which contains the common set of methods of all builders
    * Refactored `__()` to return `Phrase` object
    * Allowed usage of `LocalizedException` on the framework's library level
    * Added expiration/lifetime management of frontend resources
    * Unified MTF configurations format for Framework, TestCase variations and TestCase scenario configurations
* Fixed bugs:
    * Fixed an issue with product reviews list paging
    * Fixed an issue where sold products were not displayed in Bestsellers
    * Fixed an issue with image rendering on the CMS page on Frontend when `webserver rewrites = no`
* GitHub requests:
    * [#790](magento/magento2#790) -- Magento API fails in a CGI env (zf1 issue)
    * [#909](magento/magento2#909) -- Manage Titles in popup window front-end issue
    * [#996](magento/magento2#996) -- Pager block should support url "fragment".
    * [#985](magento/magento2#985) -- Allow camelcase in vendorname for menus
    * [#1025](magento/magento2#1025) -- Wrong parameter for getting base url for 'media' path in "Image" form element.
magento-team pushed a commit that referenced this issue Dec 12, 2017
…s with some valid values. #996

 - Merge Pull Request magento-engcom/magento2ce#996 from nmalevanec/magento2:2907
 - Merged commits:
   1. 1cd27f4
   2. 059c8b4
   3. 70122b5
   4. baaff95
   5. 6b749c0
   6. 7be1e58
magento-team pushed a commit that referenced this issue Dec 12, 2017
fe-lix- pushed a commit to fe-lix-/magento2 that referenced this issue Apr 29, 2018
MSI-875: issue with duplicating SKU in one Order
magento-engcom-team added a commit that referenced this issue Oct 23, 2019
… in AssignShippingAddressToCart, AssignBillingAddressToCart #996

 - Merge Pull Request magento/graphql-ce#996 from magento/graphql-ce:977-address-to-customer
 - Merged commits:
   1. 90557f9
   2. 5bf67e5
   3. f49fe71
magento-engcom-team pushed a commit that referenced this issue Oct 23, 2019
… in AssignShippingAddressToCart, AssignBillingAddressToCart #996
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants