Имеется OC 2.0.2.0 Нужно убрать лишние поля при оформлении заказа. Делаю по инструкции http://napositive.co...zakaz-opencart/ С шага "Как убрать страну и область с формы заказа OpenCart", в файлах версии 2,0,2,0 и приведенных в инструкции примерах, есть отличия. Пример видимо построен на версии 1,5. Пробовал удалять строки схожие с теми, что указаны в инструкции, но при попытке оформить заказ вылазят ошибки. Пока разобрался с тем, как поля обязательными для заполнения, сделать не обязательными. В файле контроллера guest.php удалить то, что нужно сделать не обязательным для заполнения. В секции Check if guest checkout is available Например не обязателен email, удаляем Код: if ((utf8_strlen($this->request->post['email']) > 96) || !preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $this->request->post['email'])) { $json['error']['email'] = $this->language->get('error_email'); Поля не обязательные Факс, адрес2 и компанию, я удалил как не нужные, в guest.php шаблона. Поэтому удалил строки, в guest.php контроллера. т. к. выходит ошибка при оформлении заказа. $this->session->data['guest']['fax'] = $this->request->post['fax']; и $this->session->data['payment_address']['company'] = $this->request->post['company']; и $this->session->data['payment_address']['address_2'] = $this->request->post['address_2'] После этих действий процесс оформления заказа переходит на следующий этап без ошибок. Даже если не заполнять поля помеченные звездочкой. Пока не пойму где убрать саму звездочку и как удалить Страну и Область. В файле шаблона есть строки определяющие наличие звездочки (поле обязательно для заполнения): Код: <div class="form-group required"> <label class="control-label" for="input-payment-telephone"><?php echo $entry_telephone; ?></label> <input type="text" name="telephone" value="<?php echo $telephone; ?>" placeholder="<?php echo $entry_telephone; ?>" id="input-payment-telephone" class="form-control" /> </div> <div class="form-group"> <label class="control-label" for="input-payment-fax"><?php echo $entry_fax; ?></label> <input type="text" name="fax" value="<?php echo $fax; ?>" placeholder="<?php echo $entry_fax; ?>" id="input-payment-fax" class="form-control" /> </div> Тут <div class="form-group"> поле не обязательное для заполнения. А <div class="form-group required"> поле озязательное для заполнения. Если удалить required из <div class="form-group required"> сайт выпадает в ошибку. Помогите определить строки которые нужно удалить из файлов guest.php контроллера и шаблона, Чтобы убрать страну и область. А также убрать звездочки *. Сейчас файл шаблона guest.php выглядит так Код: <div class="row"> <div class="col-sm-6"> <fieldset id="account"> <legend><?php echo $text_your_details; ?></legend> <div class="form-group" style="display: <?php echo (count($customer_groups) > 1 ? 'block' : 'none'); ?>;"> <label class="control-label"><?php echo $entry_customer_group; ?></label> <?php foreach ($customer_groups as $customer_group) { ?> <?php if ($customer_group['customer_group_id'] == $customer_group_id) { ?> <div class="radio"> <label> <input type="radio" name="customer_group_id" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?></label> </div> <?php } else { ?> <div class="radio"> <label> <input type="radio" name="customer_group_id" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?></label> </div> <?php } ?> <?php } ?> </div> <div class="form-groupp required"> <label class="control-label" for="input-payment-firstname"><?php echo $entry_firstname; ?></label> <input type="text" name="firstname" value="<?php echo $firstname; ?>" placeholder="<?php echo $entry_firstname; ?>" id="input-payment-firstname" class="form-control" /> </div> <div class="form-groupp required"> <label class="control-label" for="input-payment-lastname"><?php echo $entry_lastname; ?></label> <input type="text" name="lastname" value="<?php echo $lastname; ?>" placeholder="<?php echo $entry_lastname; ?>" id="input-payment-lastname" class="form-control" /> </div> <div class="form-group required"> <label class="control-label" for="input-payment-email"><?php echo $entry_email; ?></label> <input type="text" name="email" value="<?php echo $email; ?>" placeholder="<?php echo $entry_email; ?>" id="input-payment-email" class="form-control" /> </div> <?php foreach ($custom_fields as $custom_field) { ?> <?php if ($custom_field['location'] == 'account') { ?> <?php if ($custom_field['type'] == 'select') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <select name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control"> <option value=""><?php echo $text_select; ?></option> <?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?> <?php if (isset($guest_custom_field[$custom_field['custom_field_id']]) && $custom_field_value['custom_field_value_id'] == $guest_custom_field[$custom_field['custom_field_id']]) { ?> <option value="<?php echo $custom_field_value['custom_field_value_id']; ?>" selected="selected"><?php echo $custom_field_value['name']; ?></option> <?php } else { ?> <option value="<?php echo $custom_field_value['custom_field_value_id']; ?>"><?php echo $custom_field_value['name']; ?></option> <?php } ?> <?php } ?> </select> </div> <?php } ?> <?php if ($custom_field['type'] == 'radio') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label"><?php echo $custom_field['name']; ?></label> <div id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"> <?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?> <div class="radio"> <?php if (isset($guest_custom_field[$custom_field['custom_field_id']]) && $custom_field_value['custom_field_value_id'] == $guest_custom_field[$custom_field['custom_field_id']]) { ?> <label> <input type="radio" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" checked="checked" /> <?php echo $custom_field_value['name']; ?></label> <?php } else { ?> <label> <input type="radio" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" /> <?php echo $custom_field_value['name']; ?></label> <?php } ?> </div> <?php } ?> </div> </div> <?php } ?> <?php if ($custom_field['type'] == 'checkbox') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label"><?php echo $custom_field['name']; ?></label> <div id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"> <?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?> <div class="checkbox"> <?php if (isset($guest_custom_field[$custom_field['custom_field_id']]) && in_array($custom_field_value['custom_field_value_id'], $guest_custom_field[$custom_field['custom_field_id']])) { ?> <label> <input type="checkbox" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>][]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" checked="checked" /> <?php echo $custom_field_value['name']; ?></label> <?php } else { ?> <label> <input type="checkbox" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>][]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" /> <?php echo $custom_field_value['name']; ?></label> <?php } ?> </div> <?php } ?> </div> </div> <?php } ?> <?php if ($custom_field['type'] == 'text') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?>" placeholder="<?php echo $custom_field['name']; ?>" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" /> </div> <?php } ?> <?php if ($custom_field['type'] == 'textarea') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <textarea name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" rows="5" placeholder="<?php echo $custom_field['name']; ?>" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control"><?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?></textarea> </div> <?php } ?> <?php if ($custom_field['type'] == 'file') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label"><?php echo $custom_field['name']; ?></label> <br /> <button type="button" id="button-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-default"><i class="fa fa-upload"></i> <?php echo $button_upload; ?></button> <input type="hidden" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : ''); ?>" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" /> </div> <?php } ?> <?php if ($custom_field['type'] == 'date') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <div class="input-group date"> <input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="YYYY-MM-DD" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" /> <span class="input-group-btn"> <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> </span></div> </div> <?php } ?> <?php if ($custom_field['type'] == 'time') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <div class="input-group time"> <input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="HH:mm" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" /> <span class="input-group-btn"> <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> </span></div> </div> <?php } ?> <?php if ($custom_field['type'] == 'datetime') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <div class="input-group datetime"> <input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="YYYY-MM-DD HH:mm" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" /> <span class="input-group-btn"> <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> </span></div> </div> <?php } ?> <?php } ?> <?php } ?> </fieldset> </div> <div class="col-sm-6"> <fieldset id="address"> <legend><?php echo $text_your_address; ?></legend> <div class="form-group required"> <label class="control-label" for="input-payment-country"><?php echo $entry_country; ?></label> <select name="country_id" id="input-payment-country" class="form-control"> <option value=""><?php echo $text_select; ?></option> <?php foreach ($countries as $country) { ?> <?php if ($country['country_id'] == $country_id) { ?> <option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option> <?php } else { ?> <option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option> <?php } ?> <?php } ?> </select> </div> <div class="form-group required"> <label class="control-label" for="input-payment-zone"><?php echo $entry_zone; ?></label> <select name="zone_id" id="input-payment-zone" class="form-control"> </select> </div> <?php foreach ($custom_fields as $custom_field) { ?> <?php if ($custom_field['location'] == 'address') { ?> <?php if ($custom_field['type'] == 'select') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <select name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control"> <option value=""><?php echo $text_select; ?></option> <?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?> <?php if (isset($guest_custom_field[$custom_field['custom_field_id']]) && $custom_field_value['custom_field_value_id'] == $guest_custom_field[$custom_field['custom_field_id']]) { ?> <option value="<?php echo $custom_field_value['custom_field_value_id']; ?>" selected="selected"><?php echo $custom_field_value['name']; ?></option> <?php } else { ?> <option value="<?php echo $custom_field_value['custom_field_value_id']; ?>"><?php echo $custom_field_value['name']; ?></option> <?php } ?> <?php } ?> </select> </div> <?php } ?> <?php if ($custom_field['type'] == 'radio') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label"><?php echo $custom_field['name']; ?></label> <div id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"> <?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?> <div class="radio"> <?php if (isset($guest_custom_field[$custom_field['custom_field_id']]) && $custom_field_value['custom_field_value_id'] == $guest_custom_field[$custom_field['custom_field_id']]) { ?> <label> <input type="radio" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" checked="checked" /> <?php echo $custom_field_value['name']; ?></label> <?php } else { ?> <label> <input type="radio" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" /> <?php echo $custom_field_value['name']; ?></label> <?php } ?> </div> <?php } ?> </div> </div> <?php } ?> <?php if ($custom_field['type'] == 'checkbox') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label"><?php echo $custom_field['name']; ?></label> <div id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"> <?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?> <div class="checkbox"> <?php if (isset($guest_custom_field[$custom_field['custom_field_id']]) && in_array($custom_field_value['custom_field_value_id'], $guest_custom_field[$custom_field['custom_field_id']])) { ?> <label> <input type="checkbox" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>][]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" checked="checked" /> <?php echo $custom_field_value['name']; ?></label> <?php } else { ?> <label> <input type="checkbox" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>][]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" /> <?php echo $custom_field_value['name']; ?></label> <?php } ?> </div> <?php } ?> </div> </div> <?php } ?> <?php if ($custom_field['type'] == 'text') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?>" placeholder="<?php echo $custom_field['name']; ?>" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" /> </div> <?php } ?> <?php if ($custom_field['type'] == 'textarea') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <textarea name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" rows="5" placeholder="<?php echo $custom_field['name']; ?>" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control"><?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?></textarea> </div> <?php } ?> <?php if ($custom_field['type'] == 'file') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label"><?php echo $custom_field['name']; ?></label> <br /> <button type="button" id="button-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-default"><i class="fa fa-upload"></i> <?php echo $button_upload; ?></button> <input type="hidden" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : ''); ?>" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" /> </div> <?php } ?> <?php if ($custom_field['type'] == 'date') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <div class="input-group date"> <input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="YYYY-MM-DD" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" /> <span class="input-group-btn"> <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> </span></div> </div> <?php } ?> <?php if ($custom_field['type'] == 'time') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <div class="input-group time"> <input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="HH:mm" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" /> <span class="input-group-btn"> <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> </span></div> </div> <?php } ?> <?php if ($custom_field['type'] == 'datetime') { ?> <div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>"> <label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label> <div class="input-group datetime"> <input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($guest_custom_field[$custom_field['custom_field_id']]) ? $guest_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="YYYY-MM-DD HH:mm" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" /> <span class="input-group-btn"> <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> </span></div> </div> <?php } ?> <?php } ?> <?php } ?> </fieldset> </div> </div> <?php if ($shipping_required) { ?> <div class="checkbox"> <label> <?php if ($shipping_address) { ?> <input type="checkbox" name="shipping_address" value="1" checked="checked" /> <?php } else { ?> <input type="checkbox" name="shipping_address" value="1" /> <?php } ?> <?php echo $entry_shipping; ?></label> </div> <?php } ?> <div class="buttons"> <div class="pull-right"> <input type="button" value="<?php echo $button_continue; ?>" id="button-guest" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary" /> </div> </div> <script type="text/javascript"><!-- // Sort the custom fields $('#account .form-group[data-sort]').detach().each(function() { if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#account .form-group').length) { $('#account .form-group').eq($(this).attr('data-sort')).before(this); } if ($(this).attr('data-sort') > $('#account .form-group').length) { $('#account .form-group:last').after(this); } if ($(this).attr('data-sort') < -$('#account .form-group').length) { $('#account .form-group:first').before(this); } }); $('#address .form-group[data-sort]').detach().each(function() { if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#address .form-group').length) { $('#address .form-group').eq($(this).attr('data-sort')).before(this); } if ($(this).attr('data-sort') > $('#address .form-group').length) { $('#address .form-group:last').after(this); } if ($(this).attr('data-sort') < -$('#address .form-group').length) { $('#address .form-group:first').before(this); } }); $('#collapse-payment-address input[name=\'customer_group_id\']').on('change', function() { $.ajax({ url: 'index.php?route=checkout/checkout/customfield&customer_group_id=' + this.value, dataType: 'json', success: function(json) { $('#collapse-payment-address .custom-field').hide(); $('#collapse-payment-address .custom-field').removeClass('required'); for (i = 0; i < json.length; i++) { custom_field = json[i]; $('#payment-custom-field' + custom_field['custom_field_id']).show(); if (custom_field['required']) { $('#payment-custom-field' + custom_field['custom_field_id']).addClass('required'); } else { $('#payment-custom-field' + custom_field['custom_field_id']).removeClass('required'); } } }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); }); $('#collapse-payment-address input[name=\'customer_group_id\']:checked').trigger('change'); //--></script> <script type="text/javascript"><!-- $('#collapse-payment-address button[id^=\'button-payment-custom-field\']').on('click', function() { var node = this; $('#form-upload').remove(); $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>'); $('#form-upload input[name=\'file\']').trigger('click'); if (typeof timer != 'undefined') { clearInterval(timer); } timer = setInterval(function() { if ($('#form-upload input[name=\'file\']').val() != '') { clearInterval(timer); $.ajax({ url: 'index.php?route=tool/upload', type: 'post', dataType: 'json', data: new FormData($('#form-upload')[0]), cache: false, contentType: false, processData: false, beforeSend: function() { $(node).button('loading'); }, complete: function() { $(node).button('reset'); }, success: function(json) { $(node).parent().find('.text-danger').remove(); if (json['error']) { $(node).parent().find('input[name^=\'custom_field\']').after('<div class="text-danger">' + json['error'] + '</div>'); } if (json['success']) { alert(json['success']); $(node).parent().find('input[name^=\'custom_field\']').attr('value', json['code']); } }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); } }, 500); }); //--></script> <script type="text/javascript"><!-- $('.date').datetimepicker({ pickTime: false }); $('.time').datetimepicker({ pickDate: false }); $('.datetime').datetimepicker({ pickDate: true, pickTime: true }); //--></script> <script type="text/javascript"><!-- $('#collapse-payment-address select[name=\'country_id\']').on('change', function() { $.ajax({ url: 'index.php?route=checkout/checkout/country&country_id=' + this.value, dataType: 'json', beforeSend: function() { $('#collapse-payment-address select[name=\'country_id\']').after(' <i class="fa fa-circle-o-notch fa-spin"></i>'); }, complete: function() { $('.fa-spin').remove(); }, success: function(json) { if (json['postcode_required'] == '1') { $('#collapse-payment-address input[name=\'postcode\']').parent().parent().addClass('required'); } else { $('#collapse-payment-address input[name=\'postcode\']').parent().parent().removeClass('required'); } html = '<option value=""><?php echo $text_select; ?></option>'; if (json['zone'] && json['zone'] != '') { for (i = 0; i < json['zone'].length; i++) { html += '<option value="' + json['zone'][i]['zone_id'] + '"'; if (json['zone'][i]['zone_id'] == '<?php echo $zone_id; ?>') { html += ' selected="selected"'; } html += '>' + json['zone'][i]['name'] + '</option>'; } } else { html += '<option value="0" selected="selected"><?php echo $text_none; ?></option>'; } $('#collapse-payment-address select[name=\'zone_id\']').html(html); }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); }); $('#collapse-payment-address select[name=\'country_id\']').trigger('change'); //--></script> файл контрллера guest.php выглядит так Код: <?php class ControllerCheckoutGuest extends Controller { public function index() { $this->load->language('checkout/checkout'); $data['text_select'] = $this->language->get('text_select'); $data['text_none'] = $this->language->get('text_none'); $data['text_your_details'] = $this->language->get('text_your_details'); $data['text_your_account'] = $this->language->get('text_your_account'); $data['text_your_address'] = $this->language->get('text_your_address'); $data['text_loading'] = $this->language->get('text_loading'); $data['entry_firstname'] = $this->language->get('entry_firstname'); $data['entry_lastname'] = $this->language->get('entry_lastname'); $data['entry_email'] = $this->language->get('entry_email'); $data['entry_telephone'] = $this->language->get('entry_telephone'); $data['entry_fax'] = $this->language->get('entry_fax'); $data['entry_company'] = $this->language->get('entry_company'); $data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['entry_address_1'] = $this->language->get('entry_address_1'); $data['entry_address_2'] = $this->language->get('entry_address_2'); $data['entry_postcode'] = $this->language->get('entry_postcode'); $data['entry_city'] = $this->language->get('entry_city'); $data['entry_country'] = $this->language->get('entry_country'); $data['entry_zone'] = $this->language->get('entry_zone'); $data['entry_shipping'] = $this->language->get('entry_shipping'); $data['button_continue'] = $this->language->get('button_continue'); $data['button_upload'] = $this->language->get('button_upload'); $data['customer_groups'] = array(); if (is_array($this->config->get('config_customer_group_display'))) { $this->load->model('account/customer_group'); $customer_groups = $this->model_account_customer_group->getCustomerGroups(); foreach ($customer_groups as $customer_group) { if (in_array($customer_group['customer_group_id'], $this->config->get('config_customer_group_display'))) { $data['customer_groups'][] = $customer_group; } } } if (isset($this->session->data['guest']['customer_group_id'])) { $data['customer_group_id'] = $this->session->data['guest']['customer_group_id']; } else { $data['customer_group_id'] = $this->config->get('config_customer_group_id'); } if (isset($this->session->data['guest']['firstname'])) { $data['firstname'] = $this->session->data['guest']['firstname']; } else { $data['firstname'] = ''; } if (isset($this->session->data['guest']['lastname'])) { $data['lastname'] = $this->session->data['guest']['lastname']; } else { $data['lastname'] = ''; } if (isset($this->session->data['guest']['email'])) { $data['email'] = $this->session->data['guest']['email']; } else { $data['email'] = ''; } if (isset($this->session->data['guest']['telephone'])) { $data['telephone'] = $this->session->data['guest']['telephone']; } else { $data['telephone'] = ''; } if (isset($this->session->data['guest']['fax'])) { $data['fax'] = $this->session->data['guest']['fax']; } else { $data['fax'] = ''; } if (isset($this->session->data['payment_address']['company'])) { $data['company'] = $this->session->data['payment_address']['company']; } else { $data['company'] = ''; } if (isset($this->session->data['payment_address']['address_1'])) { $data['address_1'] = $this->session->data['payment_address']['address_1']; } else { $data['address_1'] = ''; } if (isset($this->session->data['payment_address']['address_2'])) { $data['address_2'] = $this->session->data['payment_address']['address_2']; } else { $data['address_2'] = ''; } if (isset($this->session->data['payment_address']['postcode'])) { $data['postcode'] = $this->session->data['payment_address']['postcode']; } elseif (isset($this->session->data['shipping_address']['postcode'])) { $data['postcode'] = $this->session->data['shipping_address']['postcode']; } else { $data['postcode'] = ''; } if (isset($this->session->data['payment_address']['city'])) { $data['city'] = $this->session->data['payment_address']['city']; } else { $data['city'] = ''; } if (isset($this->session->data['payment_address']['country_id'])) { $data['country_id'] = $this->session->data['payment_address']['country_id']; } elseif (isset($this->session->data['shipping_address']['country_id'])) { $data['country_id'] = $this->session->data['shipping_address']['country_id']; } else { $data['country_id'] = $this->config->get('config_country_id'); } if (isset($this->session->data['payment_address']['zone_id'])) { $data['zone_id'] = $this->session->data['payment_address']['zone_id']; } elseif (isset($this->session->data['shipping_address']['zone_id'])) { $data['zone_id'] = $this->session->data['shipping_address']['zone_id']; } else { $data['zone_id'] = ''; } $this->load->model('localisation/country'); $data['countries'] = $this->model_localisation_country->getCountries(); // Custom Fields $this->load->model('account/custom_field'); $data['custom_fields'] = $this->model_account_custom_field->getCustomFields(); if (isset($this->session->data['guest']['custom_field'])) { if (isset($this->session->data['guest']['custom_field'])) { $guest_custom_field = $this->session->data['guest']['custom_field']; } else { $guest_custom_field = array(); } if (isset($this->session->data['payment_address']['custom_field'])) { $address_custom_field = $this->session->data['payment_address']['custom_field']; } else { $address_custom_field = array(); } $data['guest_custom_field'] = $guest_custom_field + $address_custom_field; } else { $data['guest_custom_field'] = array(); } $data['shipping_required'] = $this->cart->hasShipping(); if (isset($this->session->data['guest']['shipping_address'])) { $data['shipping_address'] = $this->session->data['guest']['shipping_address']; } else { $data['shipping_address'] = true; } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/guest.tpl')) { $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/checkout/guest.tpl', $data)); } else { $this->response->setOutput($this->load->view('default/template/checkout/guest.tpl', $data)); } } public function save() { $this->load->language('checkout/checkout'); $json = array(); // Validate if customer is logged in. if ($this->customer->isLogged()) { $json['redirect'] = $this->url->link('checkout/checkout', '', 'SSL'); } // Validate cart has products and has stock. if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))) { $json['redirect'] = $this->url->link('checkout/cart'); } // Check if guest checkout is available. if (!$this->config->get('config_checkout_guest') || $this->config->get('config_customer_price') || $this->cart->hasDownload()) { $json['redirect'] = $this->url->link('checkout/checkout', '', 'SSL'); } if (!$json) { if ((utf8_strlen($this->request->post['email']) > 96) || !preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $this->request->post['email'])) { $json['error']['email'] = $this->language->get('error_email'); } $this->load->model('localisation/country'); $country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']); if ($country_info && $country_info['postcode_required'] && (utf8_strlen(trim($this->request->post['postcode'])) < 2 || utf8_strlen(trim($this->request->post['postcode'])) > 10)) { $json['error']['postcode'] = $this->language->get('error_postcode'); } if ($this->request->post['country_id'] == '') { $json['error']['country'] = $this->language->get('error_country'); } if (!isset($this->request->post['zone_id']) || $this->request->post['zone_id'] == '') { $json['error']['zone'] = $this->language->get('error_zone'); } // Customer Group if (isset($this->request->post['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('config_customer_group_display'))) { $customer_group_id = $this->request->post['customer_group_id']; } else { $customer_group_id = $this->config->get('config_customer_group_id'); } // Custom field validation $this->load->model('account/custom_field'); $custom_fields = $this->model_account_custom_field->getCustomFields($customer_group_id); foreach ($custom_fields as $custom_field) { if ($custom_field['required'] && empty($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']])) { $json['error']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']); } } } if (!$json) { $this->session->data['account'] = 'guest'; $this->session->data['guest']['customer_group_id'] = $customer_group_id; $this->session->data['guest']['firstname'] = $this->request->post['firstname']; $this->session->data['guest']['lastname'] = $this->request->post['lastname']; $this->session->data['guest']['email'] = $this->request->post['email']; //$this->session->data['guest']['telephone'] = $this->request->post['telephone']; //$this->session->data['guest']['fax'] = $this->request->post['fax']; if (isset($this->request->post['custom_field']['account'])) { $this->session->data['guest']['custom_field'] = $this->request->post['custom_field']['account']; } else { $this->session->data['guest']['custom_field'] = array(); } $this->session->data['payment_address']['firstname'] = $this->request->post['firstname']; $this->session->data['payment_address']['lastname'] = $this->request->post['lastname']; //$this->session->data['payment_address']['company'] = $this->request->post['company']; //$this->session->data['payment_address']['address_1'] = $this->request->post['address_1']; //$this->session->data['payment_address']['address_2'] = $this->request->post['address_2']; //$this->session->data['payment_address']['postcode'] = $this->request->post['postcode']; //$this->session->data['payment_address']['city'] = $this->request->post['city']; $this->session->data['payment_address']['country_id'] = $this->request->post['country_id']; $this->session->data['payment_address']['zone_id'] = $this->request->post['zone_id']; $this->load->model('localisation/country'); $country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']); if ($country_info) { $this->session->data['payment_address']['country'] = $country_info['name']; $this->session->data['payment_address']['iso_code_2'] = $country_info['iso_code_2']; $this->session->data['payment_address']['iso_code_3'] = $country_info['iso_code_3']; $this->session->data['payment_address']['address_format'] = $country_info['address_format']; } else { $this->session->data['payment_address']['country'] = ''; $this->session->data['payment_address']['iso_code_2'] = ''; $this->session->data['payment_address']['iso_code_3'] = ''; $this->session->data['payment_address']['address_format'] = ''; } if (isset($this->request->post['custom_field']['address'])) { $this->session->data['payment_address']['custom_field'] = $this->request->post['custom_field']['address']; } else { $this->session->data['payment_address']['custom_field'] = array(); } $this->load->model('localisation/zone'); $zone_info = $this->model_localisation_zone->getZone($this->request->post['zone_id']); if ($zone_info) { $this->session->data['payment_address']['zone'] = $zone_info['name']; $this->session->data['payment_address']['zone_code'] = $zone_info['code']; } else { $this->session->data['payment_address']['zone'] = ''; $this->session->data['payment_address']['zone_code'] = ''; } if (!empty($this->request->post['shipping_address'])) { $this->session->data['guest']['shipping_address'] = $this->request->post['shipping_address']; } else { $this->session->data['guest']['shipping_address'] = false; } // Default Payment Address if ($this->session->data['guest']['shipping_address']) { $this->session->data['shipping_address']['firstname'] = $this->request->post['firstname']; $this->session->data['shipping_address']['lastname'] = $this->request->post['lastname']; $this->session->data['shipping_address']['company'] = $this->request->post['company']; $this->session->data['shipping_address']['address_1'] = $this->request->post['address_1']; $this->session->data['shipping_address']['address_2'] = $this->request->post['address_2']; $this->session->data['shipping_address']['postcode'] = $this->request->post['postcode']; $this->session->data['shipping_address']['city'] = $this->request->post['city']; $this->session->data['shipping_address']['country_id'] = $this->request->post['country_id']; $this->session->data['shipping_address']['zone_id'] = $this->request->post['zone_id']; if ($country_info) { $this->session->data['shipping_address']['country'] = $country_info['name']; $this->session->data['shipping_address']['iso_code_2'] = $country_info['iso_code_2']; $this->session->data['shipping_address']['iso_code_3'] = $country_info['iso_code_3']; $this->session->data['shipping_address']['address_format'] = $country_info['address_format']; } else { $this->session->data['shipping_address']['country'] = ''; $this->session->data['shipping_address']['iso_code_2'] = ''; $this->session->data['shipping_address']['iso_code_3'] = ''; $this->session->data['shipping_address']['address_format'] = ''; } if ($zone_info) { $this->session->data['shipping_address']['zone'] = $zone_info['name']; $this->session->data['shipping_address']['zone_code'] = $zone_info['code']; } else { $this->session->data['shipping_address']['zone'] = ''; $this->session->data['shipping_address']['zone_code'] = ''; } if (isset($this->request->post['custom_field']['address'])) { $this->session->data['shipping_address']['custom_field'] = $this->request->post['custom_field']['address']; } else { $this->session->data['shipping_address']['custom_field'] = array(); } } unset($this->session->data['shipping_method']); unset($this->session->data['shipping_methods']); unset($this->session->data['payment_method']); unset($this->session->data['payment_methods']); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } }
Не проще симплу установить? Цена вопроса 450р. и все можно сделать за 10 минут и даже больше. Практически все на версии опенкарт 1.5.x устанавливают симплу (есть нуленая), но для 2-й версии лекарства от жадности нет . Так что проще купить и не мучиться.
Всем спасибо за ответы. Про симплу знаю, оставил ее на случай если сам изменить код не смогу. Опишу как удалить страну и область. Вдруг кому пригодится. В админке OC нужно удалить не нужные вам страны и регионы. Оставить например только россия и один город. Затем в файле шаблона guest.php ищем строки Код: <div class="form-group required"> <label class="control-label" for="input-payment-country"><?php echo $entry_country; ?></label> <select name="country_id" id="input-payment-country" class="form-control"> <option value=""><?php echo $text_select; ?></option> <?php foreach ($countries as $country) { ?> <?php if ($country['country_id'] == $country_id) { ?> <option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option> <?php } else { ?> <option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option> <?php } ?> <?php } ?> </select> </div> вместро него ставим <div class="form-group required" style="display:none;"> <label class="control-label" for="input-payment-country"><?php echo $entry_country; ?></label> <input type="text" value="176" name="country_id" id="input-payment-country" class="form-control"> </div> Если вы оставили страну россия то в коде будет value="176" Меняем регион Ищем Код: <div class="form-group required"> <label class="control-label" for="input-payment-zone"><?php echo $entry_zone; ?></label> <select name="zone_id" id="input-payment-zone" class="form-control"> </select> </div> заменяем на Код: <div class="form-group required" style="display:none;"> <label class="control-label" for="input-payment-zone"><?php echo $entry_zone; ?></label> <input type="text" value="1111" name="zone_id" id="input-payment-zone" class="form-control"> </div> вместо 1111 подставьте свое значение из базы данных. Зайдите в phpMyadmin найдите таблицу oc_zone там есть нужные цифры. В моем случае мне нужно было убрать слово "Адрес". Это делается так в файле шаблона ищем строку <div class="col-sm-6"> меняем ее на <div class="col-sm-6" style="display:none;"> После этих изменений процесс оформления заказа переходит на следующий этап без ошибок. Вот такой вариант получился у меня.