Jump to content

MenMarcellino

Members
  • Posts

    3
  • Joined

  • Last visited

MenMarcellino's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi prestashopers. I write a module in which I save information in a complex form - serialized. The display of such information is illegible and unedited, which is why I want to display the input form. I just wanted to insert a value: public function renderForm() { $ unserializedArray = unserialize (AdParameters :: getParametersValue (Tools :: getValue ('id_ad_parameters'))); $ Result = ''; foreach ($ unserializedArray as $ key => $ row) { foreach ($ row as $ element) { $ Result. = '['. $ Element. ']'; } if (isset ($ unserializedArray [$ key + 1])) $ MyValue. = "\ R \ n"; } $ helper-> fields_value ['parameters_value'] = $ MyValue; ................ Form return parent::renderForm(); } AdParameters :: getParametersValue() is function quering DB When I list MyValue everythink is ok but in my list is not ok. However, it does not change the value. I need to replace it in the table and when editing in the form. Can anyone help me with this? Please. if you need a broader explanation, let me know, I'll send them.
  2. Hi, i have to make a query with gives me this structure. P=Array ( [0] => Array ( [id__dic] => 79 [id__shop] => 1 [id__lang] => 2 [symbol] => uoi [parent_symbol] => Mich [root_symbol] => 0 [folder] => 1 [oorder] => 2 [active] => 1 [prefix] => dfield [name] => array( [1] => arrw [2] => arw ) [description] => array( [1] => arrw [2] => arw ) ) ) I created two queries like in bottom code, but i thing there is a better solution. Could you help me and give some suggestion? ..... $sql = " SELECT dic.*, ldic.* FROM "._DB_PREFIX_."dp__shop dic LEFT JOIN "._DB_PREFIX_."dp__lang ldic ON (dic.id_dp = ldic.id_dp AND dic.id__shop = ldic.id__shop) WHERE dic.id_dp__shop = '".$id_shop."' AND dic.symbol = '".$parent_s."' AND ldic.id_dp__lang = '".$id_lang."' ORDER BY dic.oorder ASC, dic.id_dp ASC "; $dic_BySymbol = Db::getInstance()->executeS($sql); $sqls = "SELECT name, description"; $sqls .= "FROM "._DB_PREFIX_."dp__lang"; $sqls .= "WHERE id_dp__shop = '".$id_shop."'"; $sqls .= "AND id_dp = '".$dic_BySymbol['0']['id__dic']."'"; $dic_BySymbolSubqueryLang = Db::getInstance()->executeS($sqls); $dic_BySymbol['name'] = array(); $dic_BySymbol['description'] = array(); foreach ($languages as $language) { $dic_BySymbol['name'][$language['id_lang']] = $dic_BySymbolSubqueryLang->name[$language['id_lang']]; $dic_BySymbol['description'][$language['id_lang']] = $dic_BySymbolSubqueryLang->description[$language['id_lang']]; } return $dic_BySymbol; }
  3. I created a small module with a table that has the option of sorting rows. This looks identical to the table in categories. The sort function works, but does not update data in the DB table module. Below is a significant piece of code. Please suggest what to change, add some parameters, or refer to other variables. <script type="text/javascript" src="../js/jquery/plugins/jquery.tablednd.js"></script> <form id="module_form" class="defaultForm form-horizontal" action="updatePositions" method="post" enctype="multipart/form-data" novalidate=""> <input type="hidden" name="page" value="{$page|intval}"/> <input type="hidden" name="selected_pagination" value="{$selected_pagination|intval}"/> [...] <div class="panel-footer"> <a href="index.php?controller=AdminModules&configure={$name}&token={$token|escape:'html':'UTF-8'}" class="btn btn-default"> <i class="process-icon-back"></i> Back to list</a> </div> </div> </div> </form> <script type="text/javascript" src="../js/admin/dnd.js"></script> <script type="text/javascript"> var come_from = 'dic'; var alternate = '1'; </script> I also tried to create an "ajax.php" file where I would intercept the query, for example: url: {$ url_base | escape: 'html': 'UTF-8'} modules / dpeasyextendproducts / ajax.php? secure_key = {$ secure_key | escape: 'html' : 'UTF-8'} but I do not really know how to construct it in JavaCcriot. Best regards.
×
×
  • Create New...