tep_get_all_get_params

Open to all! Ask other shopowners for help.
Post Reply
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

tep_get_all_get_params

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: tep_get_all_get_params

Post 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>
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: tep_get_all_get_params

Post 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
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: tep_get_all_get_params

Post 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'))) . '">'
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: tep_get_all_get_params

Post 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']) . '">'
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: tep_get_all_get_params

Post 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']));
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: tep_get_all_get_params

Post by ecartz »

set_parameter takes two strings. You're passing an array. I'm guessing that you want ->retain_query_except.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply