PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, June 30, 2022

[FIXED] How do I add a new parameter to the current index in PrestaShop?

 June 30, 2022     php, prestashop, prestashop-1.6     No comments   

Issue

How do I add a new parameter to the current index for the admin page (admin custom module) in PrestaShop?

I tried the following, but it's not working:

$this->setcurrentindex=$this->setcurrentindex.'&view=querydrlog';

What I need is:

http://localhost/raffleV1.3/oknr9hexztcseff5/index.php?controller=query&view=querydrlog&token=d81fcd49d179ae13444df0e8b2cccec6

When I click the asc or the pagination part the USL is:

http://localhost/raffleV1.3/oknr9hexztcseff5/index.php?controller=query&kits_query_drOrderby=id_query_dr&kits_query_drOrderway=desc&token=d81fcd49d179ae13444df0e8b2cccec6

To the above URL, I want to add '&view=querydrlog';, so that my pagination and asc will work correctly.


Solution

You can do it in your module admin controller by overriding the init() function of AdminController.

class YourAdminModuleController extends ModuleAdminController {
    protected $extra_params = '&view=querydrlog';

    public function init() {
        parent::init();
        self::$currentIndex .= $this->extra_params;
        $this->context->smarty->assign('current', self::$currentIndex);
    }
}

This will add your parameter to sorting link hrefs or pagination form action link.



Answered By - TheDrot
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing