Search the Community
Showing results for tags 'getValue'.
-
I use two functions in my custom code lets say function Query and function QueryLang The first one returns db::getInstance()->executeS($sql); In the second one after I prepare my query to include the respective _lang table, I call the first one but in bux fixing when I was doing var_dump($result) it was showing as text and not array. Why?
-
Hi, I am writting a script, that use a db. Last 2 hours I trying to get a value in datetime "from" and "to" column, but withnout sucess. Trying like this: $foreach_speci_price = "2"; $get_speci_to = Db::getInstance()->getValue('SELECT to FROM '._DB_PREFIX_.'specific_price WHERE id_specific_price = \''.pSQL($foreach_speci_price).'\''); echo $get_speci_to; But it is not working. Can anyone help? Thank you. Shaft :-)
- 1 reply
-
- special price
- DB
-
(and 3 more)
Tagged with:
-
hello I have upload my module to prestashop addons but it give me response with " Hello, Use of $_GETis forbidden, please use Tools::getValue(); ", now when I am print $_GET it will return all the parametes in url, so how can I get same result with the help of Tools calss..?
- 4 replies
-
- URL
- parameters
-
(and 4 more)
Tagged with:
-
Im wondering where can i find all the Tools::getValue list and how is this working, is there other function that is useful other than this? for example i want to get the product reference and generate it in my controller.php
-
Good evening. I'm trying to make a kind of pagination for Stores. There are more than 200 stores to view (when I search for postcode and range 100km for example). That page viewing 20 stores. It's specified in the LIMIT option of the query in StoresController.php: $stores = Db::getInstance()->executeS(' SELECT s.*, cl.name country, st.iso_code state, ('.(int)($multiplicator).' * acos( cos(radians('.(float)(Tools::getValue('latitude')).')) * cos(radians(latitude)) * cos(radians(longitude) - radians('.(float)(Tools::getValue('longitude')).')) + sin(radians('.(float)(Tools::getValue('latitude')).')) * sin(radians(latitude)) ) ) distance, cl.id_country id_country FROM '._DB_PREFIX_.'store s '.Shop::addSqlAssociation('store', 's').' LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country) LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state) WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id.' HAVING distance < '.(int)($distance).' ORDER BY distance ASC LIMIT 0,20); I can change it to 200 but it's not a good idea to view 200 stores in one page. So i'm trying to make this pagination. To accomplish this function i have to pass html variables from stores.tpl to StoresController. I found that the method is this: $distance = (int)(Tools::getValue('radius', 100)); With this option radius is passed from stores.tpl where we have this select: <select name="radius" id="radiusSelect" class="form-control"> <option value="15">15</option> <option value="25">25</option> <option value="50">50</option> <option value="100">100</option> </select> I tried to do the passage of variables in this way, but nothing to do. Nothing arrives to StoresController.php. What i'm doing wrong? Is there an easiest way to do that pagination? Thanks for replies. Yari.
- 5 replies
-
- pagination
- stores
-
(and 2 more)
Tagged with:
-
I want to add a custom input field to the form where the customers confirm their order. I'm struggling with where to read the value of this field. This is what I did: In order-carrier.tpl I added this: <p>{l s='TEST'}</p> <p><input type="text" name="my_test"></p> And so far no problem. It shows perfectly and the customer can give the input. But now.... I have to retrieve the input. I suppose I have to use: $my_test = Tools::getValue('my_test'); Also tried: $my_test = $_POST['my_test']; I tried to place this in several files. But it looks like I cannot find the right place to do this (or I'm overseeing something else). I tried: modules\bankwire\controllers\front\validation.php OrderController.php OrderConfirmationController.php OrderOpcController.php bankwire.php ParentOrderController.php I thought the last one would be the best, since logging shows me that it's the first (processed) in line. EDIT: I thought the first location (validation.php - function postProcess) would be the best, since logging shows me that it's the first (processed) in line. Unfortunately until now I cannot read the value of the input. Of course I would appreciate very much finding someone who's able to give me the hint which will get me out of this headache :-)
-
Hello everybody again, I'm trying to get the data from the product table and i'm having this problem. I'M NEW ON PRESTASHOP DEVELOPING!!!. well, this is my code. $sql = 'SELECT COUNT(*) FROM ' . _DB_PREFIX_ . 'product'; $totalShop = Db::getInstance()->getValue($sql); $output .= $this->displayConfirmation($this->l("print sql ". "((($sql)))" . "number of products (" . $totalShop) . ")"); Well, im doing a simple count and im getting 7, this is okay, but now i want to get the data, i change the SQL by $sql = 'SELECT * FROM ' . _DB_PREFIX_ . 'product'; (it works fine on phpmyadmin) How can i get the data from the SQL? Using getvalue also? or this just will return the number of rows? Thanks for your time. I solved the problem using the executeS function.
-
$ret = (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? $_GET[$key] : $defaultValue)); is the code above the same as: if(){ } elseif(){ } else{ } That syntax is new flr me... //Andreas