Page 1 of 1
tep_get_all_get_params
Posted: Mon Oct 31, 2022 8:34 am
by heatherbell
Have the following in an old addon but failing to find a solution to modernise the tep_get_all_get_params
Code: Select all
<a href="<?php echo $GLOBALS['Admin']->link('whatever.php', tep_get_all_get_params(array('action', 'sort')) . 'sort=2a'); ?>">a</a>
Grateful for any pointers.
Re: tep_get_all_get_params
Posted: Mon Oct 31, 2022 9:17 am
by Pierre_P
Seems to be
Code: Select all
<a href="<?= ($GLOBALS['Admin']->link('whatever.php'))->retain_query_except(['action', 'sort'])->set_parameter('sort', '2a') ?>">a</a>
Re: tep_get_all_get_params
Posted: Mon Oct 31, 2022 1:29 pm
by heatherbell
Pierre_P wrote: ↑Mon Oct 31, 2022 9:17 amSeems to be
The code you posted has been edited to give the correct solution
Re: tep_get_all_get_params
Posted: Fri Nov 18, 2022 6:21 am
by Pierre_P
I'm updating a couple myself now
@heatherbell
This one i'm pretty stuck at.. if you can help me on this line pls
Code: Select all
echo '<a href="' . $GLOBALS['Admin']->link('specials_advanced.php', 'action=setflag&flag=1&id=' . $specials['specials_id'] . '&' . tep_get_all_get_params(array('id','flag','action','date','discount'))) . '">'
Re: tep_get_all_get_params
Posted: Fri Nov 18, 2022 6:59 am
by ecartz
Code: Select all
echo '<a href="' . $GLOBALS['Admin']->link('specials_advanced.php')->retain_query_except(['date', 'discount'])->set_parameter('action', 'setflag')->set_parameter('flag', '1')->set_parameter('id', $specials['specials_id']) . '">'
Re: tep_get_all_get_params
Posted: Fri Nov 18, 2022 9:18 am
by Pierre_P
ecartz wrote: ↑Fri Nov 18, 2022 6:59 am
Code: Select all
echo '<a href="' . $GLOBALS['Admin']->link('specials_advanced.php')->retain_query_except(['date', 'discount'])->set_parameter('action', 'setflag')->set_parameter('flag', '1')->set_parameter('id', $specials['specials_id']) . '">'
Thanks
@ecartz
Trying to use your example to fix others
Below, i guess i cannot use set_parameter?
Code: Select all
// tep_redirect(tep_href_link('specials_advanced.php', tep_get_all_get_params(array('action','id','discount','date', 'start_date')), $request_type));
Href::redirect($GLOBALS['Admin']->link('specials_advanced.php')->set_parameter(['action', 'id', 'discount', 'date', 'start_date']));
Re: tep_get_all_get_params
Posted: Fri Nov 18, 2022 12:24 pm
by ecartz
set_parameter takes two strings. You're passing an array. I'm guessing that you want ->retain_query_except.