Guillaume_KS Posted August 24, 2022 Share Posted August 24, 2022 I have a php file in the root and I would like to retrieve a variable that is in a function on another php file. I need it to make a SQL query My php file in the root <?php require dirname(__FILE__) . '/config/config.inc.php'; require 'modules/pricefrom/pricefrom.php'; $lowestPrice = Db::getInstance()->getValue(' SELECT MIN(`price`) FROM `' . _DB_PREFIX_ . 'product_attribute` WHERE `id_product` = ' . (int)$id_product ); I need the $id_product from another file who is required and who is in a function and use a parameters of this function <?php ... public function hookDisplayPriceBlock($param) { $id_product = $param['id_product']; $id_product_attribute = $param['id_product_attribute']; $product = new Product(); ... I know there is an easy way to make it but I'm searching for hours and I can't find, can you help me guys ? Link to comment Share on other sites More sharing options...
Ali Samie Posted August 25, 2022 Share Posted August 25, 2022 I would like to make it easier for you and help you, just out of curiosity, what is your final expectations? What are you trying to do at the end? Maybe I can give you an easier solution. Because the idea that you are explaining in your question seems to be no a standard way to do things in Prestashop. So if you tell me what did you plan to achieve with this code I might be able to give you another workaround. Link to comment Share on other sites More sharing options...
Guillaume_KS Posted September 2, 2022 Author Share Posted September 2, 2022 (edited) Sorry for the time, I find another way for this. You're right, my way wasn't a good standard for Prestashop !! Edited September 2, 2022 by Guillaume_KS (see edit history) 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