Kerm Posted October 13, 2015 Share Posted October 13, 2015 Hello! I use $_GET in my module code for get some part of link:link have &idreviewsOrderby=10 for example... $orderBy = Tools::getIsset($_GET['idreviewsOrderby']) ? $_GET['idreviewsOrderby'] : 'id_customer_message'; But its not valid code for upload my module on addons... With Tools::getValue() i cant get this data, what i must do for fix that? Link to comment Share on other sites More sharing options...
hilflo Posted October 13, 2015 Share Posted October 13, 2015 Strange that tools::getValue doesn't work ! Have you try with $_REQUEST instead of $_GET Link to comment Share on other sites More sharing options...
Kerm Posted October 13, 2015 Author Share Posted October 13, 2015 Strange that tools::getValue doesn't work ! Have you try with $_REQUEST instead of $_GET You can test that?? I got url like that: http://site.com/admin-dev/index.php?controller=AdminModules&configure=mymodule&tab_module=front_office_features&module_name=mymodule&idreviewsOrderby=33&idreviewsOrderway=asc&token=9692b64cf1fff2b3fa99a9bc0558f294 and normaly i can get with $_GET value of idreviewsOrderby but with Tools::getValue() it dosnt work... Link to comment Share on other sites More sharing options...
hilflo Posted October 14, 2015 Share Posted October 14, 2015 Have you test with Tools::getValue like that $orderBy = Tools::getValue(idreviewsOrderby) ? Tools::getValue(idreviewsOrderby) : 'id_customer_message'; Link to comment Share on other sites More sharing options...
herve25 Posted October 14, 2015 Share Posted October 14, 2015 To define a default value you use this syntax Tools::getValue('idreviewsOrderby','id_customer_message'); The second parameter of the function is the default value.https://github.com/PrestaShop/PrestaShop/blob/1.6.1.x/classes/Tools.php#l453 Link to comment Share on other sites More sharing options...
Kerm Posted October 14, 2015 Author Share Posted October 14, 2015 To define a default value you use this syntax Tools::getValue('idreviewsOrderby','id_customer_message'); The second parameter of the function is the default value. https://github.com/PrestaShop/PrestaShop/blob/1.6.1.x/classes/Tools.php#l453 Hello!, First thanks for your reply. Atm i fix this error this way: $idreviewsOrderby = Tools::getValue('idreviewsOrderby'); $orderBy = (!empty($idreviewsOrderby)) ? $idreviewsOrderby : '31'; Its good to know about Tools::getValue('idreviewsOrderby','id_customer_message');, at this time i upload already my module for validate, may be i include this fix in next versions. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now