abonnent Posted December 7, 2017 Share Posted December 7, 2017 Привет, народ. Переделываю модуль от 2.3 под 3. Возникла сложность с твигом, т.к. я его не знаю. В общем есть такой код: <input type="text" name="cs_group_shipping[<?php echo $language['language_id']; ?>][shipping_name]" value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" placeholder="<?php echo $entry_shipping_title; ?>" class="form-control" /> это обычный php, переделываю в твиг так: <input type="text" name="cs_group_shipping[ {{ language.language_id }} ][shipping_name]" value="{{ cs_group_shipping.language.language_id.shipping_name }}" placeholder="{{ entry_shipping_title }}" class="form-control" /> ругается на то, что в атрибуте value массив. подскажите что делать то??? Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 тут cs_group_shipping[ {{ language.language_id }} ] cs_group_shipping[{{ language.language_id }}] Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 3 минуты назад, chukcha сказал: тут cs_group_shipping[ {{ language.language_id }} ] cs_group_shipping[{{ language.language_id }}] так cs_group_shipping - тоже переменная Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 cs_group_shipping[language.language_id].shipping_name наверное так Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 1 минуту назад, chukcha сказал: cs_group_shipping[language.language_id].shipping_name наверное так и не так Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 тренируйтесь, тем более я не знаю структуру вашего массива Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 Только что, chukcha сказал: тренируйтесь, тем более я не знаю структуру вашего массива могу предоставить код контроллера и шаблона Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 это контроллер: Спойлер <?php class ControllerExtensionShippingCs extends Controller { private $error = array(); public function index() { $this->load->language('extension/shipping/cs'); $this->document->setTitle($this->language->get('heading_title')); $this->load->model('setting/setting'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { $this->model_setting_setting->editSetting('cs', $this->request->post); $this->session->data['success'] = $this->language->get('text_success'); $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); } $data['heading_title'] = $this->language->get('heading_title'); $data['text_edit'] = $this->language->get('text_edit'); $data['text_enabled'] = $this->language->get('text_enabled'); $data['text_disabled'] = $this->language->get('text_disabled'); $data['text_all_zones'] = $this->language->get('text_all_zones'); $data['text_none'] = $this->language->get('text_none'); $data['entry_shipping_title'] = $this->language->get('entry_shipping_title'); $data['entry_name'] = $this->language->get('entry_name'); $data['entry_cost'] = $this->language->get('entry_cost'); $data['entry_allcost'] = $this->language->get('entry_allcost'); $data['entry_newcost'] = $this->language->get('entry_newcost'); $data['entry_tax_class'] = $this->language->get('entry_tax_class'); $data['entry_geo_zone'] = $this->language->get('entry_geo_zone'); $data['entry_status'] = $this->language->get('entry_status'); $data['entry_sort_order'] = $this->language->get('entry_sort_order'); $data['button_add'] = $this->language->get('button_add'); $data['button_remove'] = $this->language->get('button_remove'); $data['button_save'] = $this->language->get('button_save'); $data['button_cancel'] = $this->language->get('button_cancel'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extension'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true) ); $data['action'] = $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true); $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); $this->load->model('localisation/language'); $data['languages'] = $this->model_localisation_language->getLanguages(); if (isset($this->request->post['cs'])) { $data['multiple_shippings']['cs'] = $this->request->post['cs']; } else { $data['multiple_shippings'] = $this->model_setting_setting->getSetting('cs'); } $this->load->model('localisation/tax_class'); $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); $this->load->model('localisation/geo_zone'); $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); //Error if (isset($this->error['name'])) { $data['error_name'] = $this->error['name']; } else { $data['error_name'] = array(); } if (isset($this->error['shipping_option'])) { $data['error_shipping_option'] = $this->error['shipping_option']; } else { $data['error_shipping_option'] = array(); } if (isset($this->request->post['cs_group_shipping'])) { $data['cs_group_shipping'] = $this->request->post['cs_group_shipping']; } else { $data['cs_group_shipping'] = $this->config->get('cs_group_shipping'); } if (isset($this->request->post['cs_status'])) { $data['cs_status'] = $this->request->post['cs_status']; } else { $data['cs_status'] = $this->config->get('cs_status'); } if (isset($this->request->post['cs_sort_order'])) { $data['cs_sort_order'] = $this->request->post['cs_sort_order']; } else { $data['cs_sort_order'] = $this->config->get('cs_sort_order'); } $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('extension/shipping/cs', $data)); } protected function validate() { if (!$this->user->hasPermission('modify', 'extension/shipping/cs')) { $this->error['warning'] = $this->language->get('error_permission'); } foreach ($this->request->post['cs_group_shipping'] as $language_id => $value) { if ((utf8_strlen($value['shipping_name']) < 1) || (utf8_strlen($value['shipping_name']) > 64)) { $this->error['name'][$language_id] = $this->language->get('error_name'); } } if (isset($this->request->post['cs'])) { foreach ($this->request->post['cs'] as $shipping_id => $shipping) { foreach ($shipping['shipping_description'] as $language_id => $shipping_description) { if ((utf8_strlen($shipping_description['name']) < 1) || (utf8_strlen($shipping_description['name']) > 64)) { $this->error['shipping_option'][$shipping_id][$language_id] = $this->language->get('error_shipping_option'); } } } } return !$this->error; } } это переделанный шаблон: Спойлер {{ header }}{{ column_left }} <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1>{{ heading_title }}</h1> <ul class="breadcrumb"> {% for breadcrumb in breadcrumbs %} <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> {% endfor %} </ul> </div> </div> <div class="container-fluid"> {% if error_warning %} <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} <button type="button" class="close" data-dismiss="alert">×</button> </div> {% endif %} <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3> </div> <div class="panel-body"> <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs_group_shipping[ {{ language.language_id }} ][shipping_name]" value="cs_group_shipping[language.language_id].shipping_name" placeholder="{{ entry_shipping_title }}" class="form-control" /> </div> {% if error_name.language.language_id %} <div class="text-danger">{{ error_name.language.language_id }}</div> {% endif %} {% endfor %} </td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> {% if cs_status %} <option value="1" selected="selected">{{ text_enabled }}</option> <option value="0">{{ text_disabled }}</option> {% else %} <option value="1">{{ text_enabled }}</option> <option value="0" selected="selected">{{ text_disabled }}</option> {% endif %} </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="{{ cs_sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required">{{ entry_name }}</td> <td>{{ entry_cost }}</td> <td>{{ entry_allcost }}</td> <td>{{ entry_newcost }}</td> <td>{{ entry_tax_class }}</td> <td>{{ entry_geo_zone }}</td> </thead> <tbody> {% set shipping_row = 0 %} {% if multiple_shippings.cs %} {% for multiple_shipping in multiple_shippings.cs %} <tr id="shipping-row{{ shipping_row }}"> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs[{{ shipping_row }}][shipping_description][{{language.language_id}}][name]" value="{{ multiple_shipping.shipping_description }}[{{language_id }}]['name']; ?>" placeholder="{{ entry_name }}" class="form-control" /> </div> {% if error_shipping_option.shipping_row.language.language_id %} <div class="text-danger">{{ error_shipping_option.shipping_row.language.language_id }}</div> {% endif %} {% endfor %} </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][cost]" value="{{multiple_shipping.cost}}" placeholder="{{entry_cost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][allcost]" value="{{multiple_shipping.allcost}}" placeholder="{{entry_allcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][newcost]" value="{{multiple_shipping.newcost}}" placeholder="{{entry_newcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{shipping_row}}][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0">{{text_none}}</option> {% for tax_class in tax_classes %} {% if tax_class.tax_class_id == multiple_shipping.cs_tax_class_id %} <option value="{{ tax_class.tax_class_id }}" selected="selected">{{ tax_class.title }}</option> {% else %} <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option> {% endif %} {% endfor %} </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{ shipping_row }}][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0">{{ text_all_zones }}</option> {% for geo_zone in geo_zones %} {% if geo_zone.geo_zone_id == multiple_shipping.cs_geo_zone_id %} <option value="{{ geo_zone.geo_zone_id }}" selected="selected">{{ geo_zone.name }}</option> {% else %} <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option> {% endif %} {% endfor %} </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row{{ shipping_row }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> {% set shipping_row = shipping_row + 1 %} {% endfor %} {% endif %} </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> {% block javascripts %} <script> var shipping_row = {{ shipping_row }}; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; {% for language in languages %} html += '<div class="input-group required"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][{{ language.language_id }}][name]" value="" placeholder="{{ entry_name }}" class="form-control" /></div>'; {% endfor %} html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="{{ entry_cost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="{{ entry_allcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="{{ entry_newcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for tax_class in tax_classes %} html += ' <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for geo_zone in geo_zones %} html += ' <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); {% set shipping_row = shipping_row + 1 %} } </script> {% endblock %} </div> {{ footer }} а это оригинальный шаблон: Спойлер <?php echo $header; ?><?php echo $column_left; ?> <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1><?php echo $heading_title; ?></h1> <ul class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li> <?php } ?> </ul> </div> </div> <div class="container-fluid"> <?php if ($error_warning) { ?> <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?> <button type="button" class="close" data-dismiss="alert">×</button> </div> <?php } ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3> </div> <div class="panel-body"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> <?php foreach($languages as $language){ ?><div class="input-group required"> <span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span> <input type="text" name="cs_group_shipping[<?php echo $language['language_id']; ?>][shipping_name]" value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" placeholder="<?php echo $entry_shipping_title; ?>" class="form-control" /> </div> <?php if (isset($error_name[$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_name[$language['language_id']]; ?></div> <?php } ?> <?php } ?></td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> <?php if ($cs_status) { ?> <option value="1" selected="selected"><?php echo $text_enabled; ?></option> <option value="0"><?php echo $text_disabled; ?></option> <?php } else { ?> <option value="1"><?php echo $text_enabled; ?></option> <option value="0" selected="selected"><?php echo $text_disabled; ?></option> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="<?php echo $cs_sort_order; ?>" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required"><?php echo $entry_name;?></td> <td><?php echo $entry_cost;?></td> <td><?php echo $entry_allcost;?></td> <td><?php echo $entry_newcost;?></td> <td><?php echo $entry_tax_class;?></td> <td><?php echo $entry_geo_zone;?></td> </thead> <tbody> <?php $shipping_row = 0; ?> <?php if(!empty($multiple_shippings['cs'])){ ?> <?php foreach($multiple_shippings['cs'] as $multiple_shipping){ ?> <tr id="shipping-row<?php echo $shipping_row; ?>"> <td class="text-left"><?php foreach($languages as $language){ ?><div class="input-group required"><span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span><input type="text" name="cs[<?php echo $shipping_row; ?>][shipping_description][<?php echo $language['language_id']; ?>][name]" value="<?php echo $multiple_shipping['shipping_description'][$language['language_id']]['name']; ?>" placeholder="<?php echo $entry_name; ?>" class="form-control" /> </div> <?php if (isset($error_shipping_option[$shipping_row][$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_shipping_option[$shipping_row][$language['language_id']]; ?></div> <?php } ?> <?php } ?> </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][cost]" value="<?php echo $multiple_shipping['cost']; ?>" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][allcost]" value="<?php echo $multiple_shipping['allcost']; ?>" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][newcost]" value="<?php echo $multiple_shipping['newcost']; ?>" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0"><?php echo $text_none; ?></option> <?php foreach ($tax_classes as $tax_class) { ?> <?php if ($tax_class['tax_class_id'] == $multiple_shipping['cs_tax_class_id']) { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>" selected="selected"><?php echo $tax_class['title']; ?></option> <?php } else { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0"><?php echo $text_all_zones; ?></option> <?php foreach ($geo_zones as $geo_zone) { ?> <?php if ($geo_zone['geo_zone_id'] == $multiple_shipping['cs_geo_zone_id']) { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>" selected="selected"><?php echo $geo_zone['name']; ?></option> <?php } else { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row<?php echo $shipping_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> <?php $shipping_row++; ?> <?php } ?> <?php } ?> </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> <script type="text/javascript"><!-- var shipping_row = <?php echo $shipping_row; ?>; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; <?php foreach($languages as $language){ ?> html += '<div class="input-group required"><span class="input-group-addon"><img src="language/<?php echo $language['code']; ?>/<?php echo $language['code']; ?>.png" title="<?php echo $language['name']; ?>" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][<?php echo $language['language_id']; ?>][name]" value="" placeholder="<?php echo $entry_name; ?>" class="form-control" /></div>'; <?php } ?> html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($tax_classes as $tax_class) { ?> html += ' <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($geo_zones as $geo_zone) { ?> html += ' <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); shipping_row++; } //--></script></div> <?php echo $footer; ?> Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Для этого придумали спойлер Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 7 минут назад, AlexDW сказал: value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) а что такого в этом пробеле? это просто массив в массиве Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
chukcha Posted December 7, 2017 Share Posted December 7, 2017 тут cs_group_shipping[ {{ language.language_id }} ] cs_group_shipping[{{ language.language_id }}] Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 3 минуты назад, chukcha сказал: тут cs_group_shipping[ {{ language.language_id }} ] cs_group_shipping[{{ language.language_id }}] так cs_group_shipping - тоже переменная Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 cs_group_shipping[language.language_id].shipping_name наверное так Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 1 минуту назад, chukcha сказал: cs_group_shipping[language.language_id].shipping_name наверное так и не так Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 тренируйтесь, тем более я не знаю структуру вашего массива Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 Только что, chukcha сказал: тренируйтесь, тем более я не знаю структуру вашего массива могу предоставить код контроллера и шаблона Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 это контроллер: Спойлер <?php class ControllerExtensionShippingCs extends Controller { private $error = array(); public function index() { $this->load->language('extension/shipping/cs'); $this->document->setTitle($this->language->get('heading_title')); $this->load->model('setting/setting'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { $this->model_setting_setting->editSetting('cs', $this->request->post); $this->session->data['success'] = $this->language->get('text_success'); $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); } $data['heading_title'] = $this->language->get('heading_title'); $data['text_edit'] = $this->language->get('text_edit'); $data['text_enabled'] = $this->language->get('text_enabled'); $data['text_disabled'] = $this->language->get('text_disabled'); $data['text_all_zones'] = $this->language->get('text_all_zones'); $data['text_none'] = $this->language->get('text_none'); $data['entry_shipping_title'] = $this->language->get('entry_shipping_title'); $data['entry_name'] = $this->language->get('entry_name'); $data['entry_cost'] = $this->language->get('entry_cost'); $data['entry_allcost'] = $this->language->get('entry_allcost'); $data['entry_newcost'] = $this->language->get('entry_newcost'); $data['entry_tax_class'] = $this->language->get('entry_tax_class'); $data['entry_geo_zone'] = $this->language->get('entry_geo_zone'); $data['entry_status'] = $this->language->get('entry_status'); $data['entry_sort_order'] = $this->language->get('entry_sort_order'); $data['button_add'] = $this->language->get('button_add'); $data['button_remove'] = $this->language->get('button_remove'); $data['button_save'] = $this->language->get('button_save'); $data['button_cancel'] = $this->language->get('button_cancel'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extension'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true) ); $data['action'] = $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true); $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); $this->load->model('localisation/language'); $data['languages'] = $this->model_localisation_language->getLanguages(); if (isset($this->request->post['cs'])) { $data['multiple_shippings']['cs'] = $this->request->post['cs']; } else { $data['multiple_shippings'] = $this->model_setting_setting->getSetting('cs'); } $this->load->model('localisation/tax_class'); $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); $this->load->model('localisation/geo_zone'); $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); //Error if (isset($this->error['name'])) { $data['error_name'] = $this->error['name']; } else { $data['error_name'] = array(); } if (isset($this->error['shipping_option'])) { $data['error_shipping_option'] = $this->error['shipping_option']; } else { $data['error_shipping_option'] = array(); } if (isset($this->request->post['cs_group_shipping'])) { $data['cs_group_shipping'] = $this->request->post['cs_group_shipping']; } else { $data['cs_group_shipping'] = $this->config->get('cs_group_shipping'); } if (isset($this->request->post['cs_status'])) { $data['cs_status'] = $this->request->post['cs_status']; } else { $data['cs_status'] = $this->config->get('cs_status'); } if (isset($this->request->post['cs_sort_order'])) { $data['cs_sort_order'] = $this->request->post['cs_sort_order']; } else { $data['cs_sort_order'] = $this->config->get('cs_sort_order'); } $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('extension/shipping/cs', $data)); } protected function validate() { if (!$this->user->hasPermission('modify', 'extension/shipping/cs')) { $this->error['warning'] = $this->language->get('error_permission'); } foreach ($this->request->post['cs_group_shipping'] as $language_id => $value) { if ((utf8_strlen($value['shipping_name']) < 1) || (utf8_strlen($value['shipping_name']) > 64)) { $this->error['name'][$language_id] = $this->language->get('error_name'); } } if (isset($this->request->post['cs'])) { foreach ($this->request->post['cs'] as $shipping_id => $shipping) { foreach ($shipping['shipping_description'] as $language_id => $shipping_description) { if ((utf8_strlen($shipping_description['name']) < 1) || (utf8_strlen($shipping_description['name']) > 64)) { $this->error['shipping_option'][$shipping_id][$language_id] = $this->language->get('error_shipping_option'); } } } } return !$this->error; } } это переделанный шаблон: Спойлер {{ header }}{{ column_left }} <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1>{{ heading_title }}</h1> <ul class="breadcrumb"> {% for breadcrumb in breadcrumbs %} <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> {% endfor %} </ul> </div> </div> <div class="container-fluid"> {% if error_warning %} <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} <button type="button" class="close" data-dismiss="alert">×</button> </div> {% endif %} <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3> </div> <div class="panel-body"> <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs_group_shipping[ {{ language.language_id }} ][shipping_name]" value="cs_group_shipping[language.language_id].shipping_name" placeholder="{{ entry_shipping_title }}" class="form-control" /> </div> {% if error_name.language.language_id %} <div class="text-danger">{{ error_name.language.language_id }}</div> {% endif %} {% endfor %} </td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> {% if cs_status %} <option value="1" selected="selected">{{ text_enabled }}</option> <option value="0">{{ text_disabled }}</option> {% else %} <option value="1">{{ text_enabled }}</option> <option value="0" selected="selected">{{ text_disabled }}</option> {% endif %} </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="{{ cs_sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required">{{ entry_name }}</td> <td>{{ entry_cost }}</td> <td>{{ entry_allcost }}</td> <td>{{ entry_newcost }}</td> <td>{{ entry_tax_class }}</td> <td>{{ entry_geo_zone }}</td> </thead> <tbody> {% set shipping_row = 0 %} {% if multiple_shippings.cs %} {% for multiple_shipping in multiple_shippings.cs %} <tr id="shipping-row{{ shipping_row }}"> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs[{{ shipping_row }}][shipping_description][{{language.language_id}}][name]" value="{{ multiple_shipping.shipping_description }}[{{language_id }}]['name']; ?>" placeholder="{{ entry_name }}" class="form-control" /> </div> {% if error_shipping_option.shipping_row.language.language_id %} <div class="text-danger">{{ error_shipping_option.shipping_row.language.language_id }}</div> {% endif %} {% endfor %} </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][cost]" value="{{multiple_shipping.cost}}" placeholder="{{entry_cost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][allcost]" value="{{multiple_shipping.allcost}}" placeholder="{{entry_allcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][newcost]" value="{{multiple_shipping.newcost}}" placeholder="{{entry_newcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{shipping_row}}][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0">{{text_none}}</option> {% for tax_class in tax_classes %} {% if tax_class.tax_class_id == multiple_shipping.cs_tax_class_id %} <option value="{{ tax_class.tax_class_id }}" selected="selected">{{ tax_class.title }}</option> {% else %} <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option> {% endif %} {% endfor %} </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{ shipping_row }}][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0">{{ text_all_zones }}</option> {% for geo_zone in geo_zones %} {% if geo_zone.geo_zone_id == multiple_shipping.cs_geo_zone_id %} <option value="{{ geo_zone.geo_zone_id }}" selected="selected">{{ geo_zone.name }}</option> {% else %} <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option> {% endif %} {% endfor %} </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row{{ shipping_row }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> {% set shipping_row = shipping_row + 1 %} {% endfor %} {% endif %} </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> {% block javascripts %} <script> var shipping_row = {{ shipping_row }}; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; {% for language in languages %} html += '<div class="input-group required"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][{{ language.language_id }}][name]" value="" placeholder="{{ entry_name }}" class="form-control" /></div>'; {% endfor %} html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="{{ entry_cost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="{{ entry_allcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="{{ entry_newcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for tax_class in tax_classes %} html += ' <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for geo_zone in geo_zones %} html += ' <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); {% set shipping_row = shipping_row + 1 %} } </script> {% endblock %} </div> {{ footer }} а это оригинальный шаблон: Спойлер <?php echo $header; ?><?php echo $column_left; ?> <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1><?php echo $heading_title; ?></h1> <ul class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li> <?php } ?> </ul> </div> </div> <div class="container-fluid"> <?php if ($error_warning) { ?> <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?> <button type="button" class="close" data-dismiss="alert">×</button> </div> <?php } ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3> </div> <div class="panel-body"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> <?php foreach($languages as $language){ ?><div class="input-group required"> <span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span> <input type="text" name="cs_group_shipping[<?php echo $language['language_id']; ?>][shipping_name]" value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" placeholder="<?php echo $entry_shipping_title; ?>" class="form-control" /> </div> <?php if (isset($error_name[$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_name[$language['language_id']]; ?></div> <?php } ?> <?php } ?></td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> <?php if ($cs_status) { ?> <option value="1" selected="selected"><?php echo $text_enabled; ?></option> <option value="0"><?php echo $text_disabled; ?></option> <?php } else { ?> <option value="1"><?php echo $text_enabled; ?></option> <option value="0" selected="selected"><?php echo $text_disabled; ?></option> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="<?php echo $cs_sort_order; ?>" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required"><?php echo $entry_name;?></td> <td><?php echo $entry_cost;?></td> <td><?php echo $entry_allcost;?></td> <td><?php echo $entry_newcost;?></td> <td><?php echo $entry_tax_class;?></td> <td><?php echo $entry_geo_zone;?></td> </thead> <tbody> <?php $shipping_row = 0; ?> <?php if(!empty($multiple_shippings['cs'])){ ?> <?php foreach($multiple_shippings['cs'] as $multiple_shipping){ ?> <tr id="shipping-row<?php echo $shipping_row; ?>"> <td class="text-left"><?php foreach($languages as $language){ ?><div class="input-group required"><span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span><input type="text" name="cs[<?php echo $shipping_row; ?>][shipping_description][<?php echo $language['language_id']; ?>][name]" value="<?php echo $multiple_shipping['shipping_description'][$language['language_id']]['name']; ?>" placeholder="<?php echo $entry_name; ?>" class="form-control" /> </div> <?php if (isset($error_shipping_option[$shipping_row][$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_shipping_option[$shipping_row][$language['language_id']]; ?></div> <?php } ?> <?php } ?> </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][cost]" value="<?php echo $multiple_shipping['cost']; ?>" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][allcost]" value="<?php echo $multiple_shipping['allcost']; ?>" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][newcost]" value="<?php echo $multiple_shipping['newcost']; ?>" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0"><?php echo $text_none; ?></option> <?php foreach ($tax_classes as $tax_class) { ?> <?php if ($tax_class['tax_class_id'] == $multiple_shipping['cs_tax_class_id']) { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>" selected="selected"><?php echo $tax_class['title']; ?></option> <?php } else { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0"><?php echo $text_all_zones; ?></option> <?php foreach ($geo_zones as $geo_zone) { ?> <?php if ($geo_zone['geo_zone_id'] == $multiple_shipping['cs_geo_zone_id']) { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>" selected="selected"><?php echo $geo_zone['name']; ?></option> <?php } else { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row<?php echo $shipping_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> <?php $shipping_row++; ?> <?php } ?> <?php } ?> </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> <script type="text/javascript"><!-- var shipping_row = <?php echo $shipping_row; ?>; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; <?php foreach($languages as $language){ ?> html += '<div class="input-group required"><span class="input-group-addon"><img src="language/<?php echo $language['code']; ?>/<?php echo $language['code']; ?>.png" title="<?php echo $language['name']; ?>" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][<?php echo $language['language_id']; ?>][name]" value="" placeholder="<?php echo $entry_name; ?>" class="form-control" /></div>'; <?php } ?> html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($tax_classes as $tax_class) { ?> html += ' <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($geo_zones as $geo_zone) { ?> html += ' <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); shipping_row++; } //--></script></div> <?php echo $footer; ?> Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Для этого придумали спойлер Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 7 минут назад, AlexDW сказал: value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) а что такого в этом пробеле? это просто массив в массиве Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 3 минуты назад, chukcha сказал: тут cs_group_shipping[ {{ language.language_id }} ] cs_group_shipping[{{ language.language_id }}] так cs_group_shipping - тоже переменная Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 cs_group_shipping[language.language_id].shipping_name наверное так Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 1 минуту назад, chukcha сказал: cs_group_shipping[language.language_id].shipping_name наверное так и не так Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 тренируйтесь, тем более я не знаю структуру вашего массива Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 Только что, chukcha сказал: тренируйтесь, тем более я не знаю структуру вашего массива могу предоставить код контроллера и шаблона Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 это контроллер: Спойлер <?php class ControllerExtensionShippingCs extends Controller { private $error = array(); public function index() { $this->load->language('extension/shipping/cs'); $this->document->setTitle($this->language->get('heading_title')); $this->load->model('setting/setting'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { $this->model_setting_setting->editSetting('cs', $this->request->post); $this->session->data['success'] = $this->language->get('text_success'); $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); } $data['heading_title'] = $this->language->get('heading_title'); $data['text_edit'] = $this->language->get('text_edit'); $data['text_enabled'] = $this->language->get('text_enabled'); $data['text_disabled'] = $this->language->get('text_disabled'); $data['text_all_zones'] = $this->language->get('text_all_zones'); $data['text_none'] = $this->language->get('text_none'); $data['entry_shipping_title'] = $this->language->get('entry_shipping_title'); $data['entry_name'] = $this->language->get('entry_name'); $data['entry_cost'] = $this->language->get('entry_cost'); $data['entry_allcost'] = $this->language->get('entry_allcost'); $data['entry_newcost'] = $this->language->get('entry_newcost'); $data['entry_tax_class'] = $this->language->get('entry_tax_class'); $data['entry_geo_zone'] = $this->language->get('entry_geo_zone'); $data['entry_status'] = $this->language->get('entry_status'); $data['entry_sort_order'] = $this->language->get('entry_sort_order'); $data['button_add'] = $this->language->get('button_add'); $data['button_remove'] = $this->language->get('button_remove'); $data['button_save'] = $this->language->get('button_save'); $data['button_cancel'] = $this->language->get('button_cancel'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extension'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true) ); $data['action'] = $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true); $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); $this->load->model('localisation/language'); $data['languages'] = $this->model_localisation_language->getLanguages(); if (isset($this->request->post['cs'])) { $data['multiple_shippings']['cs'] = $this->request->post['cs']; } else { $data['multiple_shippings'] = $this->model_setting_setting->getSetting('cs'); } $this->load->model('localisation/tax_class'); $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); $this->load->model('localisation/geo_zone'); $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); //Error if (isset($this->error['name'])) { $data['error_name'] = $this->error['name']; } else { $data['error_name'] = array(); } if (isset($this->error['shipping_option'])) { $data['error_shipping_option'] = $this->error['shipping_option']; } else { $data['error_shipping_option'] = array(); } if (isset($this->request->post['cs_group_shipping'])) { $data['cs_group_shipping'] = $this->request->post['cs_group_shipping']; } else { $data['cs_group_shipping'] = $this->config->get('cs_group_shipping'); } if (isset($this->request->post['cs_status'])) { $data['cs_status'] = $this->request->post['cs_status']; } else { $data['cs_status'] = $this->config->get('cs_status'); } if (isset($this->request->post['cs_sort_order'])) { $data['cs_sort_order'] = $this->request->post['cs_sort_order']; } else { $data['cs_sort_order'] = $this->config->get('cs_sort_order'); } $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('extension/shipping/cs', $data)); } protected function validate() { if (!$this->user->hasPermission('modify', 'extension/shipping/cs')) { $this->error['warning'] = $this->language->get('error_permission'); } foreach ($this->request->post['cs_group_shipping'] as $language_id => $value) { if ((utf8_strlen($value['shipping_name']) < 1) || (utf8_strlen($value['shipping_name']) > 64)) { $this->error['name'][$language_id] = $this->language->get('error_name'); } } if (isset($this->request->post['cs'])) { foreach ($this->request->post['cs'] as $shipping_id => $shipping) { foreach ($shipping['shipping_description'] as $language_id => $shipping_description) { if ((utf8_strlen($shipping_description['name']) < 1) || (utf8_strlen($shipping_description['name']) > 64)) { $this->error['shipping_option'][$shipping_id][$language_id] = $this->language->get('error_shipping_option'); } } } } return !$this->error; } } это переделанный шаблон: Спойлер {{ header }}{{ column_left }} <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1>{{ heading_title }}</h1> <ul class="breadcrumb"> {% for breadcrumb in breadcrumbs %} <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> {% endfor %} </ul> </div> </div> <div class="container-fluid"> {% if error_warning %} <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} <button type="button" class="close" data-dismiss="alert">×</button> </div> {% endif %} <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3> </div> <div class="panel-body"> <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs_group_shipping[ {{ language.language_id }} ][shipping_name]" value="cs_group_shipping[language.language_id].shipping_name" placeholder="{{ entry_shipping_title }}" class="form-control" /> </div> {% if error_name.language.language_id %} <div class="text-danger">{{ error_name.language.language_id }}</div> {% endif %} {% endfor %} </td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> {% if cs_status %} <option value="1" selected="selected">{{ text_enabled }}</option> <option value="0">{{ text_disabled }}</option> {% else %} <option value="1">{{ text_enabled }}</option> <option value="0" selected="selected">{{ text_disabled }}</option> {% endif %} </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="{{ cs_sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required">{{ entry_name }}</td> <td>{{ entry_cost }}</td> <td>{{ entry_allcost }}</td> <td>{{ entry_newcost }}</td> <td>{{ entry_tax_class }}</td> <td>{{ entry_geo_zone }}</td> </thead> <tbody> {% set shipping_row = 0 %} {% if multiple_shippings.cs %} {% for multiple_shipping in multiple_shippings.cs %} <tr id="shipping-row{{ shipping_row }}"> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs[{{ shipping_row }}][shipping_description][{{language.language_id}}][name]" value="{{ multiple_shipping.shipping_description }}[{{language_id }}]['name']; ?>" placeholder="{{ entry_name }}" class="form-control" /> </div> {% if error_shipping_option.shipping_row.language.language_id %} <div class="text-danger">{{ error_shipping_option.shipping_row.language.language_id }}</div> {% endif %} {% endfor %} </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][cost]" value="{{multiple_shipping.cost}}" placeholder="{{entry_cost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][allcost]" value="{{multiple_shipping.allcost}}" placeholder="{{entry_allcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][newcost]" value="{{multiple_shipping.newcost}}" placeholder="{{entry_newcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{shipping_row}}][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0">{{text_none}}</option> {% for tax_class in tax_classes %} {% if tax_class.tax_class_id == multiple_shipping.cs_tax_class_id %} <option value="{{ tax_class.tax_class_id }}" selected="selected">{{ tax_class.title }}</option> {% else %} <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option> {% endif %} {% endfor %} </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{ shipping_row }}][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0">{{ text_all_zones }}</option> {% for geo_zone in geo_zones %} {% if geo_zone.geo_zone_id == multiple_shipping.cs_geo_zone_id %} <option value="{{ geo_zone.geo_zone_id }}" selected="selected">{{ geo_zone.name }}</option> {% else %} <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option> {% endif %} {% endfor %} </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row{{ shipping_row }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> {% set shipping_row = shipping_row + 1 %} {% endfor %} {% endif %} </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> {% block javascripts %} <script> var shipping_row = {{ shipping_row }}; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; {% for language in languages %} html += '<div class="input-group required"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][{{ language.language_id }}][name]" value="" placeholder="{{ entry_name }}" class="form-control" /></div>'; {% endfor %} html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="{{ entry_cost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="{{ entry_allcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="{{ entry_newcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for tax_class in tax_classes %} html += ' <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for geo_zone in geo_zones %} html += ' <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); {% set shipping_row = shipping_row + 1 %} } </script> {% endblock %} </div> {{ footer }} а это оригинальный шаблон: Спойлер <?php echo $header; ?><?php echo $column_left; ?> <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1><?php echo $heading_title; ?></h1> <ul class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li> <?php } ?> </ul> </div> </div> <div class="container-fluid"> <?php if ($error_warning) { ?> <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?> <button type="button" class="close" data-dismiss="alert">×</button> </div> <?php } ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3> </div> <div class="panel-body"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> <?php foreach($languages as $language){ ?><div class="input-group required"> <span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span> <input type="text" name="cs_group_shipping[<?php echo $language['language_id']; ?>][shipping_name]" value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" placeholder="<?php echo $entry_shipping_title; ?>" class="form-control" /> </div> <?php if (isset($error_name[$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_name[$language['language_id']]; ?></div> <?php } ?> <?php } ?></td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> <?php if ($cs_status) { ?> <option value="1" selected="selected"><?php echo $text_enabled; ?></option> <option value="0"><?php echo $text_disabled; ?></option> <?php } else { ?> <option value="1"><?php echo $text_enabled; ?></option> <option value="0" selected="selected"><?php echo $text_disabled; ?></option> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="<?php echo $cs_sort_order; ?>" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required"><?php echo $entry_name;?></td> <td><?php echo $entry_cost;?></td> <td><?php echo $entry_allcost;?></td> <td><?php echo $entry_newcost;?></td> <td><?php echo $entry_tax_class;?></td> <td><?php echo $entry_geo_zone;?></td> </thead> <tbody> <?php $shipping_row = 0; ?> <?php if(!empty($multiple_shippings['cs'])){ ?> <?php foreach($multiple_shippings['cs'] as $multiple_shipping){ ?> <tr id="shipping-row<?php echo $shipping_row; ?>"> <td class="text-left"><?php foreach($languages as $language){ ?><div class="input-group required"><span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span><input type="text" name="cs[<?php echo $shipping_row; ?>][shipping_description][<?php echo $language['language_id']; ?>][name]" value="<?php echo $multiple_shipping['shipping_description'][$language['language_id']]['name']; ?>" placeholder="<?php echo $entry_name; ?>" class="form-control" /> </div> <?php if (isset($error_shipping_option[$shipping_row][$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_shipping_option[$shipping_row][$language['language_id']]; ?></div> <?php } ?> <?php } ?> </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][cost]" value="<?php echo $multiple_shipping['cost']; ?>" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][allcost]" value="<?php echo $multiple_shipping['allcost']; ?>" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][newcost]" value="<?php echo $multiple_shipping['newcost']; ?>" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0"><?php echo $text_none; ?></option> <?php foreach ($tax_classes as $tax_class) { ?> <?php if ($tax_class['tax_class_id'] == $multiple_shipping['cs_tax_class_id']) { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>" selected="selected"><?php echo $tax_class['title']; ?></option> <?php } else { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0"><?php echo $text_all_zones; ?></option> <?php foreach ($geo_zones as $geo_zone) { ?> <?php if ($geo_zone['geo_zone_id'] == $multiple_shipping['cs_geo_zone_id']) { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>" selected="selected"><?php echo $geo_zone['name']; ?></option> <?php } else { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row<?php echo $shipping_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> <?php $shipping_row++; ?> <?php } ?> <?php } ?> </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> <script type="text/javascript"><!-- var shipping_row = <?php echo $shipping_row; ?>; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; <?php foreach($languages as $language){ ?> html += '<div class="input-group required"><span class="input-group-addon"><img src="language/<?php echo $language['code']; ?>/<?php echo $language['code']; ?>.png" title="<?php echo $language['name']; ?>" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][<?php echo $language['language_id']; ?>][name]" value="" placeholder="<?php echo $entry_name; ?>" class="form-control" /></div>'; <?php } ?> html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($tax_classes as $tax_class) { ?> html += ' <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($geo_zones as $geo_zone) { ?> html += ' <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); shipping_row++; } //--></script></div> <?php echo $footer; ?> Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Для этого придумали спойлер Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 7 минут назад, AlexDW сказал: value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) а что такого в этом пробеле? это просто массив в массиве Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
chukcha Posted December 7, 2017 Share Posted December 7, 2017 cs_group_shipping[language.language_id].shipping_name наверное так Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 1 минуту назад, chukcha сказал: cs_group_shipping[language.language_id].shipping_name наверное так и не так Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 тренируйтесь, тем более я не знаю структуру вашего массива Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 Только что, chukcha сказал: тренируйтесь, тем более я не знаю структуру вашего массива могу предоставить код контроллера и шаблона Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 это контроллер: Спойлер <?php class ControllerExtensionShippingCs extends Controller { private $error = array(); public function index() { $this->load->language('extension/shipping/cs'); $this->document->setTitle($this->language->get('heading_title')); $this->load->model('setting/setting'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { $this->model_setting_setting->editSetting('cs', $this->request->post); $this->session->data['success'] = $this->language->get('text_success'); $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); } $data['heading_title'] = $this->language->get('heading_title'); $data['text_edit'] = $this->language->get('text_edit'); $data['text_enabled'] = $this->language->get('text_enabled'); $data['text_disabled'] = $this->language->get('text_disabled'); $data['text_all_zones'] = $this->language->get('text_all_zones'); $data['text_none'] = $this->language->get('text_none'); $data['entry_shipping_title'] = $this->language->get('entry_shipping_title'); $data['entry_name'] = $this->language->get('entry_name'); $data['entry_cost'] = $this->language->get('entry_cost'); $data['entry_allcost'] = $this->language->get('entry_allcost'); $data['entry_newcost'] = $this->language->get('entry_newcost'); $data['entry_tax_class'] = $this->language->get('entry_tax_class'); $data['entry_geo_zone'] = $this->language->get('entry_geo_zone'); $data['entry_status'] = $this->language->get('entry_status'); $data['entry_sort_order'] = $this->language->get('entry_sort_order'); $data['button_add'] = $this->language->get('button_add'); $data['button_remove'] = $this->language->get('button_remove'); $data['button_save'] = $this->language->get('button_save'); $data['button_cancel'] = $this->language->get('button_cancel'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extension'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true) ); $data['action'] = $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true); $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); $this->load->model('localisation/language'); $data['languages'] = $this->model_localisation_language->getLanguages(); if (isset($this->request->post['cs'])) { $data['multiple_shippings']['cs'] = $this->request->post['cs']; } else { $data['multiple_shippings'] = $this->model_setting_setting->getSetting('cs'); } $this->load->model('localisation/tax_class'); $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); $this->load->model('localisation/geo_zone'); $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); //Error if (isset($this->error['name'])) { $data['error_name'] = $this->error['name']; } else { $data['error_name'] = array(); } if (isset($this->error['shipping_option'])) { $data['error_shipping_option'] = $this->error['shipping_option']; } else { $data['error_shipping_option'] = array(); } if (isset($this->request->post['cs_group_shipping'])) { $data['cs_group_shipping'] = $this->request->post['cs_group_shipping']; } else { $data['cs_group_shipping'] = $this->config->get('cs_group_shipping'); } if (isset($this->request->post['cs_status'])) { $data['cs_status'] = $this->request->post['cs_status']; } else { $data['cs_status'] = $this->config->get('cs_status'); } if (isset($this->request->post['cs_sort_order'])) { $data['cs_sort_order'] = $this->request->post['cs_sort_order']; } else { $data['cs_sort_order'] = $this->config->get('cs_sort_order'); } $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('extension/shipping/cs', $data)); } protected function validate() { if (!$this->user->hasPermission('modify', 'extension/shipping/cs')) { $this->error['warning'] = $this->language->get('error_permission'); } foreach ($this->request->post['cs_group_shipping'] as $language_id => $value) { if ((utf8_strlen($value['shipping_name']) < 1) || (utf8_strlen($value['shipping_name']) > 64)) { $this->error['name'][$language_id] = $this->language->get('error_name'); } } if (isset($this->request->post['cs'])) { foreach ($this->request->post['cs'] as $shipping_id => $shipping) { foreach ($shipping['shipping_description'] as $language_id => $shipping_description) { if ((utf8_strlen($shipping_description['name']) < 1) || (utf8_strlen($shipping_description['name']) > 64)) { $this->error['shipping_option'][$shipping_id][$language_id] = $this->language->get('error_shipping_option'); } } } } return !$this->error; } } это переделанный шаблон: Спойлер {{ header }}{{ column_left }} <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1>{{ heading_title }}</h1> <ul class="breadcrumb"> {% for breadcrumb in breadcrumbs %} <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> {% endfor %} </ul> </div> </div> <div class="container-fluid"> {% if error_warning %} <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} <button type="button" class="close" data-dismiss="alert">×</button> </div> {% endif %} <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3> </div> <div class="panel-body"> <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs_group_shipping[ {{ language.language_id }} ][shipping_name]" value="cs_group_shipping[language.language_id].shipping_name" placeholder="{{ entry_shipping_title }}" class="form-control" /> </div> {% if error_name.language.language_id %} <div class="text-danger">{{ error_name.language.language_id }}</div> {% endif %} {% endfor %} </td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> {% if cs_status %} <option value="1" selected="selected">{{ text_enabled }}</option> <option value="0">{{ text_disabled }}</option> {% else %} <option value="1">{{ text_enabled }}</option> <option value="0" selected="selected">{{ text_disabled }}</option> {% endif %} </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="{{ cs_sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required">{{ entry_name }}</td> <td>{{ entry_cost }}</td> <td>{{ entry_allcost }}</td> <td>{{ entry_newcost }}</td> <td>{{ entry_tax_class }}</td> <td>{{ entry_geo_zone }}</td> </thead> <tbody> {% set shipping_row = 0 %} {% if multiple_shippings.cs %} {% for multiple_shipping in multiple_shippings.cs %} <tr id="shipping-row{{ shipping_row }}"> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs[{{ shipping_row }}][shipping_description][{{language.language_id}}][name]" value="{{ multiple_shipping.shipping_description }}[{{language_id }}]['name']; ?>" placeholder="{{ entry_name }}" class="form-control" /> </div> {% if error_shipping_option.shipping_row.language.language_id %} <div class="text-danger">{{ error_shipping_option.shipping_row.language.language_id }}</div> {% endif %} {% endfor %} </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][cost]" value="{{multiple_shipping.cost}}" placeholder="{{entry_cost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][allcost]" value="{{multiple_shipping.allcost}}" placeholder="{{entry_allcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][newcost]" value="{{multiple_shipping.newcost}}" placeholder="{{entry_newcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{shipping_row}}][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0">{{text_none}}</option> {% for tax_class in tax_classes %} {% if tax_class.tax_class_id == multiple_shipping.cs_tax_class_id %} <option value="{{ tax_class.tax_class_id }}" selected="selected">{{ tax_class.title }}</option> {% else %} <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option> {% endif %} {% endfor %} </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{ shipping_row }}][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0">{{ text_all_zones }}</option> {% for geo_zone in geo_zones %} {% if geo_zone.geo_zone_id == multiple_shipping.cs_geo_zone_id %} <option value="{{ geo_zone.geo_zone_id }}" selected="selected">{{ geo_zone.name }}</option> {% else %} <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option> {% endif %} {% endfor %} </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row{{ shipping_row }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> {% set shipping_row = shipping_row + 1 %} {% endfor %} {% endif %} </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> {% block javascripts %} <script> var shipping_row = {{ shipping_row }}; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; {% for language in languages %} html += '<div class="input-group required"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][{{ language.language_id }}][name]" value="" placeholder="{{ entry_name }}" class="form-control" /></div>'; {% endfor %} html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="{{ entry_cost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="{{ entry_allcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="{{ entry_newcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for tax_class in tax_classes %} html += ' <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for geo_zone in geo_zones %} html += ' <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); {% set shipping_row = shipping_row + 1 %} } </script> {% endblock %} </div> {{ footer }} а это оригинальный шаблон: Спойлер <?php echo $header; ?><?php echo $column_left; ?> <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1><?php echo $heading_title; ?></h1> <ul class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li> <?php } ?> </ul> </div> </div> <div class="container-fluid"> <?php if ($error_warning) { ?> <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?> <button type="button" class="close" data-dismiss="alert">×</button> </div> <?php } ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3> </div> <div class="panel-body"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> <?php foreach($languages as $language){ ?><div class="input-group required"> <span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span> <input type="text" name="cs_group_shipping[<?php echo $language['language_id']; ?>][shipping_name]" value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" placeholder="<?php echo $entry_shipping_title; ?>" class="form-control" /> </div> <?php if (isset($error_name[$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_name[$language['language_id']]; ?></div> <?php } ?> <?php } ?></td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> <?php if ($cs_status) { ?> <option value="1" selected="selected"><?php echo $text_enabled; ?></option> <option value="0"><?php echo $text_disabled; ?></option> <?php } else { ?> <option value="1"><?php echo $text_enabled; ?></option> <option value="0" selected="selected"><?php echo $text_disabled; ?></option> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="<?php echo $cs_sort_order; ?>" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required"><?php echo $entry_name;?></td> <td><?php echo $entry_cost;?></td> <td><?php echo $entry_allcost;?></td> <td><?php echo $entry_newcost;?></td> <td><?php echo $entry_tax_class;?></td> <td><?php echo $entry_geo_zone;?></td> </thead> <tbody> <?php $shipping_row = 0; ?> <?php if(!empty($multiple_shippings['cs'])){ ?> <?php foreach($multiple_shippings['cs'] as $multiple_shipping){ ?> <tr id="shipping-row<?php echo $shipping_row; ?>"> <td class="text-left"><?php foreach($languages as $language){ ?><div class="input-group required"><span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span><input type="text" name="cs[<?php echo $shipping_row; ?>][shipping_description][<?php echo $language['language_id']; ?>][name]" value="<?php echo $multiple_shipping['shipping_description'][$language['language_id']]['name']; ?>" placeholder="<?php echo $entry_name; ?>" class="form-control" /> </div> <?php if (isset($error_shipping_option[$shipping_row][$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_shipping_option[$shipping_row][$language['language_id']]; ?></div> <?php } ?> <?php } ?> </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][cost]" value="<?php echo $multiple_shipping['cost']; ?>" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][allcost]" value="<?php echo $multiple_shipping['allcost']; ?>" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][newcost]" value="<?php echo $multiple_shipping['newcost']; ?>" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0"><?php echo $text_none; ?></option> <?php foreach ($tax_classes as $tax_class) { ?> <?php if ($tax_class['tax_class_id'] == $multiple_shipping['cs_tax_class_id']) { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>" selected="selected"><?php echo $tax_class['title']; ?></option> <?php } else { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0"><?php echo $text_all_zones; ?></option> <?php foreach ($geo_zones as $geo_zone) { ?> <?php if ($geo_zone['geo_zone_id'] == $multiple_shipping['cs_geo_zone_id']) { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>" selected="selected"><?php echo $geo_zone['name']; ?></option> <?php } else { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row<?php echo $shipping_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> <?php $shipping_row++; ?> <?php } ?> <?php } ?> </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> <script type="text/javascript"><!-- var shipping_row = <?php echo $shipping_row; ?>; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; <?php foreach($languages as $language){ ?> html += '<div class="input-group required"><span class="input-group-addon"><img src="language/<?php echo $language['code']; ?>/<?php echo $language['code']; ?>.png" title="<?php echo $language['name']; ?>" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][<?php echo $language['language_id']; ?>][name]" value="" placeholder="<?php echo $entry_name; ?>" class="form-control" /></div>'; <?php } ?> html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($tax_classes as $tax_class) { ?> html += ' <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($geo_zones as $geo_zone) { ?> html += ' <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); shipping_row++; } //--></script></div> <?php echo $footer; ?> Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Для этого придумали спойлер Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 7 минут назад, AlexDW сказал: value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) а что такого в этом пробеле? это просто массив в массиве Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 1 минуту назад, chukcha сказал: cs_group_shipping[language.language_id].shipping_name наверное так и не так Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 тренируйтесь, тем более я не знаю структуру вашего массива Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 Только что, chukcha сказал: тренируйтесь, тем более я не знаю структуру вашего массива могу предоставить код контроллера и шаблона Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 это контроллер: Спойлер <?php class ControllerExtensionShippingCs extends Controller { private $error = array(); public function index() { $this->load->language('extension/shipping/cs'); $this->document->setTitle($this->language->get('heading_title')); $this->load->model('setting/setting'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { $this->model_setting_setting->editSetting('cs', $this->request->post); $this->session->data['success'] = $this->language->get('text_success'); $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); } $data['heading_title'] = $this->language->get('heading_title'); $data['text_edit'] = $this->language->get('text_edit'); $data['text_enabled'] = $this->language->get('text_enabled'); $data['text_disabled'] = $this->language->get('text_disabled'); $data['text_all_zones'] = $this->language->get('text_all_zones'); $data['text_none'] = $this->language->get('text_none'); $data['entry_shipping_title'] = $this->language->get('entry_shipping_title'); $data['entry_name'] = $this->language->get('entry_name'); $data['entry_cost'] = $this->language->get('entry_cost'); $data['entry_allcost'] = $this->language->get('entry_allcost'); $data['entry_newcost'] = $this->language->get('entry_newcost'); $data['entry_tax_class'] = $this->language->get('entry_tax_class'); $data['entry_geo_zone'] = $this->language->get('entry_geo_zone'); $data['entry_status'] = $this->language->get('entry_status'); $data['entry_sort_order'] = $this->language->get('entry_sort_order'); $data['button_add'] = $this->language->get('button_add'); $data['button_remove'] = $this->language->get('button_remove'); $data['button_save'] = $this->language->get('button_save'); $data['button_cancel'] = $this->language->get('button_cancel'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extension'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true) ); $data['action'] = $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true); $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); $this->load->model('localisation/language'); $data['languages'] = $this->model_localisation_language->getLanguages(); if (isset($this->request->post['cs'])) { $data['multiple_shippings']['cs'] = $this->request->post['cs']; } else { $data['multiple_shippings'] = $this->model_setting_setting->getSetting('cs'); } $this->load->model('localisation/tax_class'); $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); $this->load->model('localisation/geo_zone'); $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); //Error if (isset($this->error['name'])) { $data['error_name'] = $this->error['name']; } else { $data['error_name'] = array(); } if (isset($this->error['shipping_option'])) { $data['error_shipping_option'] = $this->error['shipping_option']; } else { $data['error_shipping_option'] = array(); } if (isset($this->request->post['cs_group_shipping'])) { $data['cs_group_shipping'] = $this->request->post['cs_group_shipping']; } else { $data['cs_group_shipping'] = $this->config->get('cs_group_shipping'); } if (isset($this->request->post['cs_status'])) { $data['cs_status'] = $this->request->post['cs_status']; } else { $data['cs_status'] = $this->config->get('cs_status'); } if (isset($this->request->post['cs_sort_order'])) { $data['cs_sort_order'] = $this->request->post['cs_sort_order']; } else { $data['cs_sort_order'] = $this->config->get('cs_sort_order'); } $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('extension/shipping/cs', $data)); } protected function validate() { if (!$this->user->hasPermission('modify', 'extension/shipping/cs')) { $this->error['warning'] = $this->language->get('error_permission'); } foreach ($this->request->post['cs_group_shipping'] as $language_id => $value) { if ((utf8_strlen($value['shipping_name']) < 1) || (utf8_strlen($value['shipping_name']) > 64)) { $this->error['name'][$language_id] = $this->language->get('error_name'); } } if (isset($this->request->post['cs'])) { foreach ($this->request->post['cs'] as $shipping_id => $shipping) { foreach ($shipping['shipping_description'] as $language_id => $shipping_description) { if ((utf8_strlen($shipping_description['name']) < 1) || (utf8_strlen($shipping_description['name']) > 64)) { $this->error['shipping_option'][$shipping_id][$language_id] = $this->language->get('error_shipping_option'); } } } } return !$this->error; } } это переделанный шаблон: Спойлер {{ header }}{{ column_left }} <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1>{{ heading_title }}</h1> <ul class="breadcrumb"> {% for breadcrumb in breadcrumbs %} <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> {% endfor %} </ul> </div> </div> <div class="container-fluid"> {% if error_warning %} <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} <button type="button" class="close" data-dismiss="alert">×</button> </div> {% endif %} <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3> </div> <div class="panel-body"> <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs_group_shipping[ {{ language.language_id }} ][shipping_name]" value="cs_group_shipping[language.language_id].shipping_name" placeholder="{{ entry_shipping_title }}" class="form-control" /> </div> {% if error_name.language.language_id %} <div class="text-danger">{{ error_name.language.language_id }}</div> {% endif %} {% endfor %} </td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> {% if cs_status %} <option value="1" selected="selected">{{ text_enabled }}</option> <option value="0">{{ text_disabled }}</option> {% else %} <option value="1">{{ text_enabled }}</option> <option value="0" selected="selected">{{ text_disabled }}</option> {% endif %} </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="{{ cs_sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required">{{ entry_name }}</td> <td>{{ entry_cost }}</td> <td>{{ entry_allcost }}</td> <td>{{ entry_newcost }}</td> <td>{{ entry_tax_class }}</td> <td>{{ entry_geo_zone }}</td> </thead> <tbody> {% set shipping_row = 0 %} {% if multiple_shippings.cs %} {% for multiple_shipping in multiple_shippings.cs %} <tr id="shipping-row{{ shipping_row }}"> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs[{{ shipping_row }}][shipping_description][{{language.language_id}}][name]" value="{{ multiple_shipping.shipping_description }}[{{language_id }}]['name']; ?>" placeholder="{{ entry_name }}" class="form-control" /> </div> {% if error_shipping_option.shipping_row.language.language_id %} <div class="text-danger">{{ error_shipping_option.shipping_row.language.language_id }}</div> {% endif %} {% endfor %} </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][cost]" value="{{multiple_shipping.cost}}" placeholder="{{entry_cost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][allcost]" value="{{multiple_shipping.allcost}}" placeholder="{{entry_allcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][newcost]" value="{{multiple_shipping.newcost}}" placeholder="{{entry_newcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{shipping_row}}][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0">{{text_none}}</option> {% for tax_class in tax_classes %} {% if tax_class.tax_class_id == multiple_shipping.cs_tax_class_id %} <option value="{{ tax_class.tax_class_id }}" selected="selected">{{ tax_class.title }}</option> {% else %} <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option> {% endif %} {% endfor %} </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{ shipping_row }}][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0">{{ text_all_zones }}</option> {% for geo_zone in geo_zones %} {% if geo_zone.geo_zone_id == multiple_shipping.cs_geo_zone_id %} <option value="{{ geo_zone.geo_zone_id }}" selected="selected">{{ geo_zone.name }}</option> {% else %} <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option> {% endif %} {% endfor %} </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row{{ shipping_row }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> {% set shipping_row = shipping_row + 1 %} {% endfor %} {% endif %} </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> {% block javascripts %} <script> var shipping_row = {{ shipping_row }}; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; {% for language in languages %} html += '<div class="input-group required"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][{{ language.language_id }}][name]" value="" placeholder="{{ entry_name }}" class="form-control" /></div>'; {% endfor %} html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="{{ entry_cost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="{{ entry_allcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="{{ entry_newcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for tax_class in tax_classes %} html += ' <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for geo_zone in geo_zones %} html += ' <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); {% set shipping_row = shipping_row + 1 %} } </script> {% endblock %} </div> {{ footer }} а это оригинальный шаблон: Спойлер <?php echo $header; ?><?php echo $column_left; ?> <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1><?php echo $heading_title; ?></h1> <ul class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li> <?php } ?> </ul> </div> </div> <div class="container-fluid"> <?php if ($error_warning) { ?> <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?> <button type="button" class="close" data-dismiss="alert">×</button> </div> <?php } ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3> </div> <div class="panel-body"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> <?php foreach($languages as $language){ ?><div class="input-group required"> <span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span> <input type="text" name="cs_group_shipping[<?php echo $language['language_id']; ?>][shipping_name]" value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" placeholder="<?php echo $entry_shipping_title; ?>" class="form-control" /> </div> <?php if (isset($error_name[$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_name[$language['language_id']]; ?></div> <?php } ?> <?php } ?></td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> <?php if ($cs_status) { ?> <option value="1" selected="selected"><?php echo $text_enabled; ?></option> <option value="0"><?php echo $text_disabled; ?></option> <?php } else { ?> <option value="1"><?php echo $text_enabled; ?></option> <option value="0" selected="selected"><?php echo $text_disabled; ?></option> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="<?php echo $cs_sort_order; ?>" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required"><?php echo $entry_name;?></td> <td><?php echo $entry_cost;?></td> <td><?php echo $entry_allcost;?></td> <td><?php echo $entry_newcost;?></td> <td><?php echo $entry_tax_class;?></td> <td><?php echo $entry_geo_zone;?></td> </thead> <tbody> <?php $shipping_row = 0; ?> <?php if(!empty($multiple_shippings['cs'])){ ?> <?php foreach($multiple_shippings['cs'] as $multiple_shipping){ ?> <tr id="shipping-row<?php echo $shipping_row; ?>"> <td class="text-left"><?php foreach($languages as $language){ ?><div class="input-group required"><span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span><input type="text" name="cs[<?php echo $shipping_row; ?>][shipping_description][<?php echo $language['language_id']; ?>][name]" value="<?php echo $multiple_shipping['shipping_description'][$language['language_id']]['name']; ?>" placeholder="<?php echo $entry_name; ?>" class="form-control" /> </div> <?php if (isset($error_shipping_option[$shipping_row][$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_shipping_option[$shipping_row][$language['language_id']]; ?></div> <?php } ?> <?php } ?> </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][cost]" value="<?php echo $multiple_shipping['cost']; ?>" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][allcost]" value="<?php echo $multiple_shipping['allcost']; ?>" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][newcost]" value="<?php echo $multiple_shipping['newcost']; ?>" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0"><?php echo $text_none; ?></option> <?php foreach ($tax_classes as $tax_class) { ?> <?php if ($tax_class['tax_class_id'] == $multiple_shipping['cs_tax_class_id']) { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>" selected="selected"><?php echo $tax_class['title']; ?></option> <?php } else { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0"><?php echo $text_all_zones; ?></option> <?php foreach ($geo_zones as $geo_zone) { ?> <?php if ($geo_zone['geo_zone_id'] == $multiple_shipping['cs_geo_zone_id']) { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>" selected="selected"><?php echo $geo_zone['name']; ?></option> <?php } else { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row<?php echo $shipping_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> <?php $shipping_row++; ?> <?php } ?> <?php } ?> </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> <script type="text/javascript"><!-- var shipping_row = <?php echo $shipping_row; ?>; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; <?php foreach($languages as $language){ ?> html += '<div class="input-group required"><span class="input-group-addon"><img src="language/<?php echo $language['code']; ?>/<?php echo $language['code']; ?>.png" title="<?php echo $language['name']; ?>" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][<?php echo $language['language_id']; ?>][name]" value="" placeholder="<?php echo $entry_name; ?>" class="form-control" /></div>'; <?php } ?> html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($tax_classes as $tax_class) { ?> html += ' <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($geo_zones as $geo_zone) { ?> html += ' <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); shipping_row++; } //--></script></div> <?php echo $footer; ?> Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Для этого придумали спойлер Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 7 минут назад, AlexDW сказал: value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) а что такого в этом пробеле? это просто массив в массиве Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
chukcha Posted December 7, 2017 Share Posted December 7, 2017 тренируйтесь, тем более я не знаю структуру вашего массива Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 Только что, chukcha сказал: тренируйтесь, тем более я не знаю структуру вашего массива могу предоставить код контроллера и шаблона Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 это контроллер: Спойлер <?php class ControllerExtensionShippingCs extends Controller { private $error = array(); public function index() { $this->load->language('extension/shipping/cs'); $this->document->setTitle($this->language->get('heading_title')); $this->load->model('setting/setting'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { $this->model_setting_setting->editSetting('cs', $this->request->post); $this->session->data['success'] = $this->language->get('text_success'); $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); } $data['heading_title'] = $this->language->get('heading_title'); $data['text_edit'] = $this->language->get('text_edit'); $data['text_enabled'] = $this->language->get('text_enabled'); $data['text_disabled'] = $this->language->get('text_disabled'); $data['text_all_zones'] = $this->language->get('text_all_zones'); $data['text_none'] = $this->language->get('text_none'); $data['entry_shipping_title'] = $this->language->get('entry_shipping_title'); $data['entry_name'] = $this->language->get('entry_name'); $data['entry_cost'] = $this->language->get('entry_cost'); $data['entry_allcost'] = $this->language->get('entry_allcost'); $data['entry_newcost'] = $this->language->get('entry_newcost'); $data['entry_tax_class'] = $this->language->get('entry_tax_class'); $data['entry_geo_zone'] = $this->language->get('entry_geo_zone'); $data['entry_status'] = $this->language->get('entry_status'); $data['entry_sort_order'] = $this->language->get('entry_sort_order'); $data['button_add'] = $this->language->get('button_add'); $data['button_remove'] = $this->language->get('button_remove'); $data['button_save'] = $this->language->get('button_save'); $data['button_cancel'] = $this->language->get('button_cancel'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extension'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true) ); $data['action'] = $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true); $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); $this->load->model('localisation/language'); $data['languages'] = $this->model_localisation_language->getLanguages(); if (isset($this->request->post['cs'])) { $data['multiple_shippings']['cs'] = $this->request->post['cs']; } else { $data['multiple_shippings'] = $this->model_setting_setting->getSetting('cs'); } $this->load->model('localisation/tax_class'); $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); $this->load->model('localisation/geo_zone'); $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); //Error if (isset($this->error['name'])) { $data['error_name'] = $this->error['name']; } else { $data['error_name'] = array(); } if (isset($this->error['shipping_option'])) { $data['error_shipping_option'] = $this->error['shipping_option']; } else { $data['error_shipping_option'] = array(); } if (isset($this->request->post['cs_group_shipping'])) { $data['cs_group_shipping'] = $this->request->post['cs_group_shipping']; } else { $data['cs_group_shipping'] = $this->config->get('cs_group_shipping'); } if (isset($this->request->post['cs_status'])) { $data['cs_status'] = $this->request->post['cs_status']; } else { $data['cs_status'] = $this->config->get('cs_status'); } if (isset($this->request->post['cs_sort_order'])) { $data['cs_sort_order'] = $this->request->post['cs_sort_order']; } else { $data['cs_sort_order'] = $this->config->get('cs_sort_order'); } $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('extension/shipping/cs', $data)); } protected function validate() { if (!$this->user->hasPermission('modify', 'extension/shipping/cs')) { $this->error['warning'] = $this->language->get('error_permission'); } foreach ($this->request->post['cs_group_shipping'] as $language_id => $value) { if ((utf8_strlen($value['shipping_name']) < 1) || (utf8_strlen($value['shipping_name']) > 64)) { $this->error['name'][$language_id] = $this->language->get('error_name'); } } if (isset($this->request->post['cs'])) { foreach ($this->request->post['cs'] as $shipping_id => $shipping) { foreach ($shipping['shipping_description'] as $language_id => $shipping_description) { if ((utf8_strlen($shipping_description['name']) < 1) || (utf8_strlen($shipping_description['name']) > 64)) { $this->error['shipping_option'][$shipping_id][$language_id] = $this->language->get('error_shipping_option'); } } } } return !$this->error; } } это переделанный шаблон: Спойлер {{ header }}{{ column_left }} <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1>{{ heading_title }}</h1> <ul class="breadcrumb"> {% for breadcrumb in breadcrumbs %} <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> {% endfor %} </ul> </div> </div> <div class="container-fluid"> {% if error_warning %} <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} <button type="button" class="close" data-dismiss="alert">×</button> </div> {% endif %} <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3> </div> <div class="panel-body"> <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs_group_shipping[ {{ language.language_id }} ][shipping_name]" value="cs_group_shipping[language.language_id].shipping_name" placeholder="{{ entry_shipping_title }}" class="form-control" /> </div> {% if error_name.language.language_id %} <div class="text-danger">{{ error_name.language.language_id }}</div> {% endif %} {% endfor %} </td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> {% if cs_status %} <option value="1" selected="selected">{{ text_enabled }}</option> <option value="0">{{ text_disabled }}</option> {% else %} <option value="1">{{ text_enabled }}</option> <option value="0" selected="selected">{{ text_disabled }}</option> {% endif %} </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="{{ cs_sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required">{{ entry_name }}</td> <td>{{ entry_cost }}</td> <td>{{ entry_allcost }}</td> <td>{{ entry_newcost }}</td> <td>{{ entry_tax_class }}</td> <td>{{ entry_geo_zone }}</td> </thead> <tbody> {% set shipping_row = 0 %} {% if multiple_shippings.cs %} {% for multiple_shipping in multiple_shippings.cs %} <tr id="shipping-row{{ shipping_row }}"> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs[{{ shipping_row }}][shipping_description][{{language.language_id}}][name]" value="{{ multiple_shipping.shipping_description }}[{{language_id }}]['name']; ?>" placeholder="{{ entry_name }}" class="form-control" /> </div> {% if error_shipping_option.shipping_row.language.language_id %} <div class="text-danger">{{ error_shipping_option.shipping_row.language.language_id }}</div> {% endif %} {% endfor %} </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][cost]" value="{{multiple_shipping.cost}}" placeholder="{{entry_cost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][allcost]" value="{{multiple_shipping.allcost}}" placeholder="{{entry_allcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][newcost]" value="{{multiple_shipping.newcost}}" placeholder="{{entry_newcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{shipping_row}}][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0">{{text_none}}</option> {% for tax_class in tax_classes %} {% if tax_class.tax_class_id == multiple_shipping.cs_tax_class_id %} <option value="{{ tax_class.tax_class_id }}" selected="selected">{{ tax_class.title }}</option> {% else %} <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option> {% endif %} {% endfor %} </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{ shipping_row }}][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0">{{ text_all_zones }}</option> {% for geo_zone in geo_zones %} {% if geo_zone.geo_zone_id == multiple_shipping.cs_geo_zone_id %} <option value="{{ geo_zone.geo_zone_id }}" selected="selected">{{ geo_zone.name }}</option> {% else %} <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option> {% endif %} {% endfor %} </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row{{ shipping_row }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> {% set shipping_row = shipping_row + 1 %} {% endfor %} {% endif %} </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> {% block javascripts %} <script> var shipping_row = {{ shipping_row }}; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; {% for language in languages %} html += '<div class="input-group required"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][{{ language.language_id }}][name]" value="" placeholder="{{ entry_name }}" class="form-control" /></div>'; {% endfor %} html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="{{ entry_cost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="{{ entry_allcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="{{ entry_newcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for tax_class in tax_classes %} html += ' <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for geo_zone in geo_zones %} html += ' <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); {% set shipping_row = shipping_row + 1 %} } </script> {% endblock %} </div> {{ footer }} а это оригинальный шаблон: Спойлер <?php echo $header; ?><?php echo $column_left; ?> <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1><?php echo $heading_title; ?></h1> <ul class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li> <?php } ?> </ul> </div> </div> <div class="container-fluid"> <?php if ($error_warning) { ?> <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?> <button type="button" class="close" data-dismiss="alert">×</button> </div> <?php } ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3> </div> <div class="panel-body"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> <?php foreach($languages as $language){ ?><div class="input-group required"> <span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span> <input type="text" name="cs_group_shipping[<?php echo $language['language_id']; ?>][shipping_name]" value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" placeholder="<?php echo $entry_shipping_title; ?>" class="form-control" /> </div> <?php if (isset($error_name[$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_name[$language['language_id']]; ?></div> <?php } ?> <?php } ?></td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> <?php if ($cs_status) { ?> <option value="1" selected="selected"><?php echo $text_enabled; ?></option> <option value="0"><?php echo $text_disabled; ?></option> <?php } else { ?> <option value="1"><?php echo $text_enabled; ?></option> <option value="0" selected="selected"><?php echo $text_disabled; ?></option> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="<?php echo $cs_sort_order; ?>" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required"><?php echo $entry_name;?></td> <td><?php echo $entry_cost;?></td> <td><?php echo $entry_allcost;?></td> <td><?php echo $entry_newcost;?></td> <td><?php echo $entry_tax_class;?></td> <td><?php echo $entry_geo_zone;?></td> </thead> <tbody> <?php $shipping_row = 0; ?> <?php if(!empty($multiple_shippings['cs'])){ ?> <?php foreach($multiple_shippings['cs'] as $multiple_shipping){ ?> <tr id="shipping-row<?php echo $shipping_row; ?>"> <td class="text-left"><?php foreach($languages as $language){ ?><div class="input-group required"><span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span><input type="text" name="cs[<?php echo $shipping_row; ?>][shipping_description][<?php echo $language['language_id']; ?>][name]" value="<?php echo $multiple_shipping['shipping_description'][$language['language_id']]['name']; ?>" placeholder="<?php echo $entry_name; ?>" class="form-control" /> </div> <?php if (isset($error_shipping_option[$shipping_row][$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_shipping_option[$shipping_row][$language['language_id']]; ?></div> <?php } ?> <?php } ?> </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][cost]" value="<?php echo $multiple_shipping['cost']; ?>" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][allcost]" value="<?php echo $multiple_shipping['allcost']; ?>" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][newcost]" value="<?php echo $multiple_shipping['newcost']; ?>" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0"><?php echo $text_none; ?></option> <?php foreach ($tax_classes as $tax_class) { ?> <?php if ($tax_class['tax_class_id'] == $multiple_shipping['cs_tax_class_id']) { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>" selected="selected"><?php echo $tax_class['title']; ?></option> <?php } else { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0"><?php echo $text_all_zones; ?></option> <?php foreach ($geo_zones as $geo_zone) { ?> <?php if ($geo_zone['geo_zone_id'] == $multiple_shipping['cs_geo_zone_id']) { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>" selected="selected"><?php echo $geo_zone['name']; ?></option> <?php } else { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row<?php echo $shipping_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> <?php $shipping_row++; ?> <?php } ?> <?php } ?> </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> <script type="text/javascript"><!-- var shipping_row = <?php echo $shipping_row; ?>; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; <?php foreach($languages as $language){ ?> html += '<div class="input-group required"><span class="input-group-addon"><img src="language/<?php echo $language['code']; ?>/<?php echo $language['code']; ?>.png" title="<?php echo $language['name']; ?>" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][<?php echo $language['language_id']; ?>][name]" value="" placeholder="<?php echo $entry_name; ?>" class="form-control" /></div>'; <?php } ?> html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($tax_classes as $tax_class) { ?> html += ' <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($geo_zones as $geo_zone) { ?> html += ' <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); shipping_row++; } //--></script></div> <?php echo $footer; ?> Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Для этого придумали спойлер Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 7 минут назад, AlexDW сказал: value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) а что такого в этом пробеле? это просто массив в массиве Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 Только что, chukcha сказал: тренируйтесь, тем более я не знаю структуру вашего массива могу предоставить код контроллера и шаблона Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 это контроллер: Спойлер <?php class ControllerExtensionShippingCs extends Controller { private $error = array(); public function index() { $this->load->language('extension/shipping/cs'); $this->document->setTitle($this->language->get('heading_title')); $this->load->model('setting/setting'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { $this->model_setting_setting->editSetting('cs', $this->request->post); $this->session->data['success'] = $this->language->get('text_success'); $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); } $data['heading_title'] = $this->language->get('heading_title'); $data['text_edit'] = $this->language->get('text_edit'); $data['text_enabled'] = $this->language->get('text_enabled'); $data['text_disabled'] = $this->language->get('text_disabled'); $data['text_all_zones'] = $this->language->get('text_all_zones'); $data['text_none'] = $this->language->get('text_none'); $data['entry_shipping_title'] = $this->language->get('entry_shipping_title'); $data['entry_name'] = $this->language->get('entry_name'); $data['entry_cost'] = $this->language->get('entry_cost'); $data['entry_allcost'] = $this->language->get('entry_allcost'); $data['entry_newcost'] = $this->language->get('entry_newcost'); $data['entry_tax_class'] = $this->language->get('entry_tax_class'); $data['entry_geo_zone'] = $this->language->get('entry_geo_zone'); $data['entry_status'] = $this->language->get('entry_status'); $data['entry_sort_order'] = $this->language->get('entry_sort_order'); $data['button_add'] = $this->language->get('button_add'); $data['button_remove'] = $this->language->get('button_remove'); $data['button_save'] = $this->language->get('button_save'); $data['button_cancel'] = $this->language->get('button_cancel'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extension'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true) ); $data['action'] = $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true); $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); $this->load->model('localisation/language'); $data['languages'] = $this->model_localisation_language->getLanguages(); if (isset($this->request->post['cs'])) { $data['multiple_shippings']['cs'] = $this->request->post['cs']; } else { $data['multiple_shippings'] = $this->model_setting_setting->getSetting('cs'); } $this->load->model('localisation/tax_class'); $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); $this->load->model('localisation/geo_zone'); $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); //Error if (isset($this->error['name'])) { $data['error_name'] = $this->error['name']; } else { $data['error_name'] = array(); } if (isset($this->error['shipping_option'])) { $data['error_shipping_option'] = $this->error['shipping_option']; } else { $data['error_shipping_option'] = array(); } if (isset($this->request->post['cs_group_shipping'])) { $data['cs_group_shipping'] = $this->request->post['cs_group_shipping']; } else { $data['cs_group_shipping'] = $this->config->get('cs_group_shipping'); } if (isset($this->request->post['cs_status'])) { $data['cs_status'] = $this->request->post['cs_status']; } else { $data['cs_status'] = $this->config->get('cs_status'); } if (isset($this->request->post['cs_sort_order'])) { $data['cs_sort_order'] = $this->request->post['cs_sort_order']; } else { $data['cs_sort_order'] = $this->config->get('cs_sort_order'); } $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('extension/shipping/cs', $data)); } protected function validate() { if (!$this->user->hasPermission('modify', 'extension/shipping/cs')) { $this->error['warning'] = $this->language->get('error_permission'); } foreach ($this->request->post['cs_group_shipping'] as $language_id => $value) { if ((utf8_strlen($value['shipping_name']) < 1) || (utf8_strlen($value['shipping_name']) > 64)) { $this->error['name'][$language_id] = $this->language->get('error_name'); } } if (isset($this->request->post['cs'])) { foreach ($this->request->post['cs'] as $shipping_id => $shipping) { foreach ($shipping['shipping_description'] as $language_id => $shipping_description) { if ((utf8_strlen($shipping_description['name']) < 1) || (utf8_strlen($shipping_description['name']) > 64)) { $this->error['shipping_option'][$shipping_id][$language_id] = $this->language->get('error_shipping_option'); } } } } return !$this->error; } } это переделанный шаблон: Спойлер {{ header }}{{ column_left }} <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1>{{ heading_title }}</h1> <ul class="breadcrumb"> {% for breadcrumb in breadcrumbs %} <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> {% endfor %} </ul> </div> </div> <div class="container-fluid"> {% if error_warning %} <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} <button type="button" class="close" data-dismiss="alert">×</button> </div> {% endif %} <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3> </div> <div class="panel-body"> <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs_group_shipping[ {{ language.language_id }} ][shipping_name]" value="cs_group_shipping[language.language_id].shipping_name" placeholder="{{ entry_shipping_title }}" class="form-control" /> </div> {% if error_name.language.language_id %} <div class="text-danger">{{ error_name.language.language_id }}</div> {% endif %} {% endfor %} </td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> {% if cs_status %} <option value="1" selected="selected">{{ text_enabled }}</option> <option value="0">{{ text_disabled }}</option> {% else %} <option value="1">{{ text_enabled }}</option> <option value="0" selected="selected">{{ text_disabled }}</option> {% endif %} </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="{{ cs_sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required">{{ entry_name }}</td> <td>{{ entry_cost }}</td> <td>{{ entry_allcost }}</td> <td>{{ entry_newcost }}</td> <td>{{ entry_tax_class }}</td> <td>{{ entry_geo_zone }}</td> </thead> <tbody> {% set shipping_row = 0 %} {% if multiple_shippings.cs %} {% for multiple_shipping in multiple_shippings.cs %} <tr id="shipping-row{{ shipping_row }}"> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs[{{ shipping_row }}][shipping_description][{{language.language_id}}][name]" value="{{ multiple_shipping.shipping_description }}[{{language_id }}]['name']; ?>" placeholder="{{ entry_name }}" class="form-control" /> </div> {% if error_shipping_option.shipping_row.language.language_id %} <div class="text-danger">{{ error_shipping_option.shipping_row.language.language_id }}</div> {% endif %} {% endfor %} </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][cost]" value="{{multiple_shipping.cost}}" placeholder="{{entry_cost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][allcost]" value="{{multiple_shipping.allcost}}" placeholder="{{entry_allcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][newcost]" value="{{multiple_shipping.newcost}}" placeholder="{{entry_newcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{shipping_row}}][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0">{{text_none}}</option> {% for tax_class in tax_classes %} {% if tax_class.tax_class_id == multiple_shipping.cs_tax_class_id %} <option value="{{ tax_class.tax_class_id }}" selected="selected">{{ tax_class.title }}</option> {% else %} <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option> {% endif %} {% endfor %} </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{ shipping_row }}][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0">{{ text_all_zones }}</option> {% for geo_zone in geo_zones %} {% if geo_zone.geo_zone_id == multiple_shipping.cs_geo_zone_id %} <option value="{{ geo_zone.geo_zone_id }}" selected="selected">{{ geo_zone.name }}</option> {% else %} <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option> {% endif %} {% endfor %} </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row{{ shipping_row }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> {% set shipping_row = shipping_row + 1 %} {% endfor %} {% endif %} </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> {% block javascripts %} <script> var shipping_row = {{ shipping_row }}; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; {% for language in languages %} html += '<div class="input-group required"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][{{ language.language_id }}][name]" value="" placeholder="{{ entry_name }}" class="form-control" /></div>'; {% endfor %} html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="{{ entry_cost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="{{ entry_allcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="{{ entry_newcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for tax_class in tax_classes %} html += ' <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for geo_zone in geo_zones %} html += ' <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); {% set shipping_row = shipping_row + 1 %} } </script> {% endblock %} </div> {{ footer }} а это оригинальный шаблон: Спойлер <?php echo $header; ?><?php echo $column_left; ?> <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1><?php echo $heading_title; ?></h1> <ul class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li> <?php } ?> </ul> </div> </div> <div class="container-fluid"> <?php if ($error_warning) { ?> <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?> <button type="button" class="close" data-dismiss="alert">×</button> </div> <?php } ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3> </div> <div class="panel-body"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> <?php foreach($languages as $language){ ?><div class="input-group required"> <span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span> <input type="text" name="cs_group_shipping[<?php echo $language['language_id']; ?>][shipping_name]" value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" placeholder="<?php echo $entry_shipping_title; ?>" class="form-control" /> </div> <?php if (isset($error_name[$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_name[$language['language_id']]; ?></div> <?php } ?> <?php } ?></td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> <?php if ($cs_status) { ?> <option value="1" selected="selected"><?php echo $text_enabled; ?></option> <option value="0"><?php echo $text_disabled; ?></option> <?php } else { ?> <option value="1"><?php echo $text_enabled; ?></option> <option value="0" selected="selected"><?php echo $text_disabled; ?></option> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="<?php echo $cs_sort_order; ?>" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required"><?php echo $entry_name;?></td> <td><?php echo $entry_cost;?></td> <td><?php echo $entry_allcost;?></td> <td><?php echo $entry_newcost;?></td> <td><?php echo $entry_tax_class;?></td> <td><?php echo $entry_geo_zone;?></td> </thead> <tbody> <?php $shipping_row = 0; ?> <?php if(!empty($multiple_shippings['cs'])){ ?> <?php foreach($multiple_shippings['cs'] as $multiple_shipping){ ?> <tr id="shipping-row<?php echo $shipping_row; ?>"> <td class="text-left"><?php foreach($languages as $language){ ?><div class="input-group required"><span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span><input type="text" name="cs[<?php echo $shipping_row; ?>][shipping_description][<?php echo $language['language_id']; ?>][name]" value="<?php echo $multiple_shipping['shipping_description'][$language['language_id']]['name']; ?>" placeholder="<?php echo $entry_name; ?>" class="form-control" /> </div> <?php if (isset($error_shipping_option[$shipping_row][$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_shipping_option[$shipping_row][$language['language_id']]; ?></div> <?php } ?> <?php } ?> </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][cost]" value="<?php echo $multiple_shipping['cost']; ?>" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][allcost]" value="<?php echo $multiple_shipping['allcost']; ?>" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][newcost]" value="<?php echo $multiple_shipping['newcost']; ?>" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0"><?php echo $text_none; ?></option> <?php foreach ($tax_classes as $tax_class) { ?> <?php if ($tax_class['tax_class_id'] == $multiple_shipping['cs_tax_class_id']) { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>" selected="selected"><?php echo $tax_class['title']; ?></option> <?php } else { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0"><?php echo $text_all_zones; ?></option> <?php foreach ($geo_zones as $geo_zone) { ?> <?php if ($geo_zone['geo_zone_id'] == $multiple_shipping['cs_geo_zone_id']) { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>" selected="selected"><?php echo $geo_zone['name']; ?></option> <?php } else { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row<?php echo $shipping_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> <?php $shipping_row++; ?> <?php } ?> <?php } ?> </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> <script type="text/javascript"><!-- var shipping_row = <?php echo $shipping_row; ?>; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; <?php foreach($languages as $language){ ?> html += '<div class="input-group required"><span class="input-group-addon"><img src="language/<?php echo $language['code']; ?>/<?php echo $language['code']; ?>.png" title="<?php echo $language['name']; ?>" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][<?php echo $language['language_id']; ?>][name]" value="" placeholder="<?php echo $entry_name; ?>" class="form-control" /></div>'; <?php } ?> html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($tax_classes as $tax_class) { ?> html += ' <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($geo_zones as $geo_zone) { ?> html += ' <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); shipping_row++; } //--></script></div> <?php echo $footer; ?> Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Для этого придумали спойлер Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 7 минут назад, AlexDW сказал: value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) а что такого в этом пробеле? это просто массив в массиве Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 это контроллер: Спойлер <?php class ControllerExtensionShippingCs extends Controller { private $error = array(); public function index() { $this->load->language('extension/shipping/cs'); $this->document->setTitle($this->language->get('heading_title')); $this->load->model('setting/setting'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { $this->model_setting_setting->editSetting('cs', $this->request->post); $this->session->data['success'] = $this->language->get('text_success'); $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); } $data['heading_title'] = $this->language->get('heading_title'); $data['text_edit'] = $this->language->get('text_edit'); $data['text_enabled'] = $this->language->get('text_enabled'); $data['text_disabled'] = $this->language->get('text_disabled'); $data['text_all_zones'] = $this->language->get('text_all_zones'); $data['text_none'] = $this->language->get('text_none'); $data['entry_shipping_title'] = $this->language->get('entry_shipping_title'); $data['entry_name'] = $this->language->get('entry_name'); $data['entry_cost'] = $this->language->get('entry_cost'); $data['entry_allcost'] = $this->language->get('entry_allcost'); $data['entry_newcost'] = $this->language->get('entry_newcost'); $data['entry_tax_class'] = $this->language->get('entry_tax_class'); $data['entry_geo_zone'] = $this->language->get('entry_geo_zone'); $data['entry_status'] = $this->language->get('entry_status'); $data['entry_sort_order'] = $this->language->get('entry_sort_order'); $data['button_add'] = $this->language->get('button_add'); $data['button_remove'] = $this->language->get('button_remove'); $data['button_save'] = $this->language->get('button_save'); $data['button_cancel'] = $this->language->get('button_cancel'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extension'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true) ); $data['action'] = $this->url->link('extension/shipping/cs', 'user_token=' . $this->session->data['user_token'], true); $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); $this->load->model('localisation/language'); $data['languages'] = $this->model_localisation_language->getLanguages(); if (isset($this->request->post['cs'])) { $data['multiple_shippings']['cs'] = $this->request->post['cs']; } else { $data['multiple_shippings'] = $this->model_setting_setting->getSetting('cs'); } $this->load->model('localisation/tax_class'); $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); $this->load->model('localisation/geo_zone'); $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); //Error if (isset($this->error['name'])) { $data['error_name'] = $this->error['name']; } else { $data['error_name'] = array(); } if (isset($this->error['shipping_option'])) { $data['error_shipping_option'] = $this->error['shipping_option']; } else { $data['error_shipping_option'] = array(); } if (isset($this->request->post['cs_group_shipping'])) { $data['cs_group_shipping'] = $this->request->post['cs_group_shipping']; } else { $data['cs_group_shipping'] = $this->config->get('cs_group_shipping'); } if (isset($this->request->post['cs_status'])) { $data['cs_status'] = $this->request->post['cs_status']; } else { $data['cs_status'] = $this->config->get('cs_status'); } if (isset($this->request->post['cs_sort_order'])) { $data['cs_sort_order'] = $this->request->post['cs_sort_order']; } else { $data['cs_sort_order'] = $this->config->get('cs_sort_order'); } $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('extension/shipping/cs', $data)); } protected function validate() { if (!$this->user->hasPermission('modify', 'extension/shipping/cs')) { $this->error['warning'] = $this->language->get('error_permission'); } foreach ($this->request->post['cs_group_shipping'] as $language_id => $value) { if ((utf8_strlen($value['shipping_name']) < 1) || (utf8_strlen($value['shipping_name']) > 64)) { $this->error['name'][$language_id] = $this->language->get('error_name'); } } if (isset($this->request->post['cs'])) { foreach ($this->request->post['cs'] as $shipping_id => $shipping) { foreach ($shipping['shipping_description'] as $language_id => $shipping_description) { if ((utf8_strlen($shipping_description['name']) < 1) || (utf8_strlen($shipping_description['name']) > 64)) { $this->error['shipping_option'][$shipping_id][$language_id] = $this->language->get('error_shipping_option'); } } } } return !$this->error; } } это переделанный шаблон: Спойлер {{ header }}{{ column_left }} <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1>{{ heading_title }}</h1> <ul class="breadcrumb"> {% for breadcrumb in breadcrumbs %} <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> {% endfor %} </ul> </div> </div> <div class="container-fluid"> {% if error_warning %} <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} <button type="button" class="close" data-dismiss="alert">×</button> </div> {% endif %} <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3> </div> <div class="panel-body"> <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs_group_shipping[ {{ language.language_id }} ][shipping_name]" value="cs_group_shipping[language.language_id].shipping_name" placeholder="{{ entry_shipping_title }}" class="form-control" /> </div> {% if error_name.language.language_id %} <div class="text-danger">{{ error_name.language.language_id }}</div> {% endif %} {% endfor %} </td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> {% if cs_status %} <option value="1" selected="selected">{{ text_enabled }}</option> <option value="0">{{ text_disabled }}</option> {% else %} <option value="1">{{ text_enabled }}</option> <option value="0" selected="selected">{{ text_disabled }}</option> {% endif %} </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="{{ cs_sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required">{{ entry_name }}</td> <td>{{ entry_cost }}</td> <td>{{ entry_allcost }}</td> <td>{{ entry_newcost }}</td> <td>{{ entry_tax_class }}</td> <td>{{ entry_geo_zone }}</td> </thead> <tbody> {% set shipping_row = 0 %} {% if multiple_shippings.cs %} {% for multiple_shipping in multiple_shippings.cs %} <tr id="shipping-row{{ shipping_row }}"> <td class="text-left"> {% for language in languages %} <div class="input-group required"> <span class="input-group-addon"> <img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> </span> <input type="text" name="cs[{{ shipping_row }}][shipping_description][{{language.language_id}}][name]" value="{{ multiple_shipping.shipping_description }}[{{language_id }}]['name']; ?>" placeholder="{{ entry_name }}" class="form-control" /> </div> {% if error_shipping_option.shipping_row.language.language_id %} <div class="text-danger">{{ error_shipping_option.shipping_row.language.language_id }}</div> {% endif %} {% endfor %} </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][cost]" value="{{multiple_shipping.cost}}" placeholder="{{entry_cost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][allcost]" value="{{multiple_shipping.allcost}}" placeholder="{{entry_allcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[{{shipping_row}}][newcost]" value="{{multiple_shipping.newcost}}" placeholder="{{entry_newcost}}" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{shipping_row}}][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0">{{text_none}}</option> {% for tax_class in tax_classes %} {% if tax_class.tax_class_id == multiple_shipping.cs_tax_class_id %} <option value="{{ tax_class.tax_class_id }}" selected="selected">{{ tax_class.title }}</option> {% else %} <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option> {% endif %} {% endfor %} </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[{{ shipping_row }}][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0">{{ text_all_zones }}</option> {% for geo_zone in geo_zones %} {% if geo_zone.geo_zone_id == multiple_shipping.cs_geo_zone_id %} <option value="{{ geo_zone.geo_zone_id }}" selected="selected">{{ geo_zone.name }}</option> {% else %} <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option> {% endif %} {% endfor %} </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row{{ shipping_row }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> {% set shipping_row = shipping_row + 1 %} {% endfor %} {% endif %} </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> {% block javascripts %} <script> var shipping_row = {{ shipping_row }}; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; {% for language in languages %} html += '<div class="input-group required"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][{{ language.language_id }}][name]" value="" placeholder="{{ entry_name }}" class="form-control" /></div>'; {% endfor %} html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="{{ entry_cost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="{{ entry_allcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="{{ entry_newcost }}" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for tax_class in tax_classes %} html += ' <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0">{{ text_none }}</option>'; {% for geo_zone in geo_zones %} html += ' <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>'; {% endfor %} html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); {% set shipping_row = shipping_row + 1 %} } </script> {% endblock %} </div> {{ footer }} а это оригинальный шаблон: Спойлер <?php echo $header; ?><?php echo $column_left; ?> <div id="content"> <div class="page-header"> <div class="container-fluid"> <div class="pull-right"> <button type="submit" form="form-layout" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button> <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <h1><?php echo $heading_title; ?></h1> <ul class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li> <?php } ?> </ul> </div> </div> <div class="container-fluid"> <?php if ($error_warning) { ?> <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?> <button type="button" class="close" data-dismiss="alert">×</button> </div> <?php } ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3> </div> <div class="panel-body"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal"> <table class="table table-striped table-bordered table-hover"> <tr> <td class="text-left"> <?php foreach($languages as $language){ ?><div class="input-group required"> <span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span> <input type="text" name="cs_group_shipping[<?php echo $language['language_id']; ?>][shipping_name]" value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" placeholder="<?php echo $entry_shipping_title; ?>" class="form-control" /> </div> <?php if (isset($error_name[$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_name[$language['language_id']]; ?></div> <?php } ?> <?php } ?></td> <td colspan="4" style="min-width: 170px;"><select name="cs_status" id="input-status" class="form-control"> <?php if ($cs_status) { ?> <option value="1" selected="selected"><?php echo $text_enabled; ?></option> <option value="0"><?php echo $text_disabled; ?></option> <?php } else { ?> <option value="1"><?php echo $text_enabled; ?></option> <option value="0" selected="selected"><?php echo $text_disabled; ?></option> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><input type="text" name="cs_sort_order" value="<?php echo $cs_sort_order; ?>" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td> </tr> </table> <table id="shiping" class="table table-striped table-bordered table-hover"> <thead> <td class="required"><?php echo $entry_name;?></td> <td><?php echo $entry_cost;?></td> <td><?php echo $entry_allcost;?></td> <td><?php echo $entry_newcost;?></td> <td><?php echo $entry_tax_class;?></td> <td><?php echo $entry_geo_zone;?></td> </thead> <tbody> <?php $shipping_row = 0; ?> <?php if(!empty($multiple_shippings['cs'])){ ?> <?php foreach($multiple_shippings['cs'] as $multiple_shipping){ ?> <tr id="shipping-row<?php echo $shipping_row; ?>"> <td class="text-left"><?php foreach($languages as $language){ ?><div class="input-group required"><span class="input-group-addon"> <img src="language/<?php echo $language["code"]; ?>/<?php echo $language["code"]; ?>.png" title="<?php echo $language["name"]; ?>" /> </span><input type="text" name="cs[<?php echo $shipping_row; ?>][shipping_description][<?php echo $language['language_id']; ?>][name]" value="<?php echo $multiple_shipping['shipping_description'][$language['language_id']]['name']; ?>" placeholder="<?php echo $entry_name; ?>" class="form-control" /> </div> <?php if (isset($error_shipping_option[$shipping_row][$language['language_id']])) { ?> <div class="text-danger"><?php echo $error_shipping_option[$shipping_row][$language['language_id']]; ?></div> <?php } ?> <?php } ?> </td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][cost]" value="<?php echo $multiple_shipping['cost']; ?>" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][allcost]" value="<?php echo $multiple_shipping['allcost']; ?>" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 120px;"><input type="text" name="cs[<?php echo $shipping_row; ?>][newcost]" value="<?php echo $multiple_shipping['newcost']; ?>" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_tax_class_id]" id="input-tax-class" class="form-control"> <option value="0"><?php echo $text_none; ?></option> <?php foreach ($tax_classes as $tax_class) { ?> <?php if ($tax_class['tax_class_id'] == $multiple_shipping['cs_tax_class_id']) { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>" selected="selected"><?php echo $tax_class['title']; ?></option> <?php } else { ?> <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-right" style="min-width: 170px;"><select name="cs[<?php echo $shipping_row; ?>][cs_geo_zone_id]" id="input-geo-zone" class="form-control"> <option value="0"><?php echo $text_all_zones; ?></option> <?php foreach ($geo_zones as $geo_zone) { ?> <?php if ($geo_zone['geo_zone_id'] == $multiple_shipping['cs_geo_zone_id']) { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>" selected="selected"><?php echo $geo_zone['name']; ?></option> <?php } else { ?> <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option> <?php } ?> <?php } ?> </select></td> <td class="text-left"><button type="button" onclick="$('#shipping-row<?php echo $shipping_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td> </tr> <?php $shipping_row++; ?> <?php } ?> <?php } ?> </tbody> <tfoot> <tr> <td colspan="6"></td> <td class="text-left"><button type="button" onclick="addShipping();" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td> </tr> </tfoot> </table> </form> </div> </div> </div> <script type="text/javascript"><!-- var shipping_row = <?php echo $shipping_row; ?>; function addShipping() { html = '<tr id="shipping-row' + shipping_row + '">'; html += '<td class="text-left">'; <?php foreach($languages as $language){ ?> html += '<div class="input-group required"><span class="input-group-addon"><img src="language/<?php echo $language['code']; ?>/<?php echo $language['code']; ?>.png" title="<?php echo $language['name']; ?>" /></span>'; html += ' <input type="text" name="cs[' + shipping_row + '][shipping_description][<?php echo $language['language_id']; ?>][name]" value="" placeholder="<?php echo $entry_name; ?>" class="form-control" /></div>'; <?php } ?> html += '</td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][cost]" value="" placeholder="<?php echo $entry_cost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][allcost]" value="999999999999" placeholder="<?php echo $entry_allcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><input type="text" name="cs[' + shipping_row + '][newcost]" value="" placeholder="<?php echo $entry_newcost; ?>" class="form-control" /></td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_tax_class_id]" id="input-tax-class" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($tax_classes as $tax_class) { ?> html += ' <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><select name="cs[' + shipping_row + '][cs_geo_zone_id]" id="input-geo-zone" class="form-control">'; html += ' <option value="0"><?php echo $text_none; ?></option>'; <?php foreach ($geo_zones as $geo_zone) { ?> html += ' <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option>'; <?php } ?> html += ' </select>'; html += ' </td>'; html += ' <td class="text-left"><button type="button" onclick="$(\'#shipping-row' + shipping_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>'; html += '</tr>'; $('#shiping tbody').append(html); shipping_row++; } //--></script></div> <?php echo $footer; ?> Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Спойлер Для этого придумали спойлер Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 7 минут назад, AlexDW сказал: value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) а что такого в этом пробеле? это просто массив в массиве Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
AlexDW Posted December 7, 2017 Share Posted December 7, 2017 value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) Link to comment Share on other sites More sharing options... abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 7 минут назад, AlexDW сказал: value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) а что такого в этом пробеле? это просто массив в массиве Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
abonnent Posted December 7, 2017 Author Share Posted December 7, 2017 7 минут назад, AlexDW сказал: value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" value="{{ cs_group_shipping[ language.language_id].shipping_name }}" обратите внимание на пробел перед language (если он у вас действительно есть в php варианте) а что такого в этом пробеле? это просто массив в массиве Link to comment Share on other sites More sharing options... AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
AlexDW Posted December 7, 2017 Share Posted December 7, 2017 да по старой памяти наложилось вообще - должно работать попробуйте так value="{{ cs_group_shipping[language.language_id] ? cs_group_shipping[language.language_id].shipping_name }}" Link to comment Share on other sites More sharing options... chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
chukcha Posted December 7, 2017 Share Posted December 7, 2017 Я уже обратил внимание на пробел, но в другом месте.. value="<?php echo $cs_group_shipping[ $language['language_id']]['shipping_name'];?>" php это съест cs_group_shipping[ language.language_id].shipping_name твиг - не знаю cs_group_shipping[language.language_id].shipping_name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) Всем привет. Попробовал вчера ваши предложения, но почему-то не работает. То ли лыжи не едут, то ли я долбанутый. Должна вернуться строка, а возвращается массив. В БД сохранилось вот это значение: {" 1 ":{"shipping_name":"7"}} Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
shoputils Posted December 8, 2017 Share Posted December 8, 2017 Кеш твига обновлён после изменений? Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options... lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 В twig через точку идет обращение к объекту. Доступ к элементам многомерного массива осуществляется как в php {{ myVar[0][1] }} {{ myVar[0][a(n-2)] }} Twig как получить значение из двумерного массива - PHP Link to comment Share on other sites More sharing options...
lexxkrt Posted December 8, 2017 Share Posted December 8, 2017 Есть вопрос по контроллеру. В контроллере грузишь языковые переменные, разве в ОС3 надо их грузить? Link to comment Share on other sites More sharing options...
chukcha Posted December 8, 2017 Share Posted December 8, 2017 32 минуты назад, lexxkrt сказал: разве в ОС3 надо их грузить? Не обязательно, это делает событие Link to comment Share on other sites More sharing options... AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
AlexDW Posted December 8, 2017 Share Posted December 8, 2017 11 часов назад, chukcha сказал: твиг - не знаю твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 7 минут назад, AlexDW сказал: твиг тоже по теме, тс явно с самим массивом намудрил конструкция выше у меня прекрасно работает в общем дело в том, что значение (value) не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
chukcha Posted December 8, 2017 Share Posted December 8, 2017 а оно есть? посмотрите <input name Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 1 минуту назад, chukcha сказал: а оно есть? посмотрите <input name ну, конечно, я же его записываю. но после сохранения ничего не выводится Link to comment Share on other sites More sharing options... chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
chukcha Posted December 8, 2017 Share Posted December 8, 2017 Я вам показал лишний пробел, вы исправили? Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Language Folders in URL (for ocStore 3.x) By SergeTkach HPMrr for OC 2.3/3 By kJlukOo OpenGram | Your store in Telegram By kevdev PDF Рахунок-фактура - Видаткова накладна - Гарантія (Українська) PRO By Speaker12 SAP - SMS / OTP By S_A_P
abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 23 минуты назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? Только вечером будет возможность проверить Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Twig twig
abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 3 часа назад, chukcha сказал: Я вам показал лишний пробел, вы исправили? В общем все пробелы удалил, но это не решило ничего. Данные в БД улетают, но не выводятся Link to comment Share on other sites More sharing options... abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Из tpl в twig By Yusoval, April 1 5 replies 139 views Speaker12 April 2 Вывести контент из одного файла twig в другой By Yurasic, April 19 1 reply 147 views clarionio April 25 После переноса на хостинг, диаг.сообщение об устаревшем Twig-синтаксисе By TakOtog, April 21 2 replies 156 views TakOtog April 22 Преобразовать twig в php (tpl) By Vladislavchik1989, January 30 2 replies 236 views esculapra January 30 PHP to TWIG converter By markimax, July 23, 2017 twig converter 19 replies 7,081 views kazbanov January 20 Recently Browsing 0 members No registered users viewing this page.
abonnent Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) кто-нибудь знает как распечатать массив в твиге? print_r . когда пишу это {{ dump(user) }} выводится белая страница Edited December 8, 2017 by abonnent Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0
Recommended Posts