Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

PSWD

Newbie
  
  • Posts

    4
  • Joined

  • Last visited

About PSWD

  • Birthday February 6

Information

  • Gender
    Мужчина

Recent Profile Visitors

1,235 profile views

PSWD's Achievements

Rookie

Rookie (2/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. Суть идеи в следующем. Нужно добавить дополнительные поля при оформлении заказа, стандартный способ не подходит по двум причинам: 1. Данные записываются не в таблицу order. 2. Нельзя раскидывать дополнительные поля между стандартными (Имя, Фамилия...) Реализацию начал с файла guest.tpl: В нужно месте добавил новое поле: <div class="form-group required"> <label class="control-label" for="input-payment-field01">Имя игрока</label> <input type="text" name="field01" value="Сергей" placeholder="Введите имя игрока" id="input-payment-field01" class="form-control" /> </div> Дальше в /catalog/controller/checkout/guest.php в необходимых местах прописал следующее: if (isset($this->session->data['guest']['field01'])) { $data['field01'] = $this->session->data['guest']['field01']; } else { $data['field01'] = ''; } дальше организовал проверку данных: if ((utf8_strlen(trim($this->request->post['field01'])) < 1) || (utf8_strlen(trim($this->request->post['field01'])) > 32)) { $json['error']['field01'] = $this->language->get('error_field01'); } и дальше: 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']; $this->session->data['guest']['field01'] = $this->request->post['field01']; Поправил файл /catalog/controller/checkout/confirm.php: if ($this->customer->isLogged()) { $this->load->model('account/customer'); $customer_info = $this->model_account_customer->getCustomer($this->customer->getId()); $order_data['customer_id'] = $this->customer->getId(); $order_data['customer_group_id'] = $customer_info['customer_group_id']; $order_data['firstname'] = $customer_info['firstname']; $order_data['lastname'] = $customer_info['lastname']; $order_data['field01'] = $customer_info['field01']; $order_data['email'] = $customer_info['email']; $order_data['telephone'] = $customer_info['telephone']; $order_data['fax'] = $customer_info['fax']; $order_data['custom_field'] = json_decode($customer_info['custom_field'], true); } elseif (isset($this->session->data['guest'])) { $order_data['customer_id'] = 0; $order_data['customer_group_id'] = $this->session->data['guest']['customer_group_id']; $order_data['firstname'] = $this->session->data['guest']['firstname']; $order_data['lastname'] = $this->session->data['guest']['lastname']; $order_data['field01'] = $this->session->data['guest']['field01']; $order_data['email'] = $this->session->data['guest']['email']; $order_data['telephone'] = $this->session->data['guest']['telephone']; $order_data['fax'] = $this->session->data['guest']['fax']; $order_data['custom_field'] = $this->session->data['guest']['custom_field']; } В /catalog/model/checkout/order.php изменил данные которые будут записываться в таблицу order: $this->db->query("INSERT INTO `" . DB_PREFIX . "order` SET invoice_prefix = '" . $this->db->escape($data['invoice_prefix']) . "', store_id = '" . (int)$data['store_id'] . "', store_name = '" . $this->db->escape($data['store_name']) . "', store_url = '" . $this->db->escape($data['store_url']) . "', customer_id = '" . (int)$data['customer_id'] . "', customer_group_id = '" . (int)$data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']) ? json_encode($data['custom_field']) : '') . "', payment_firstname = '" . $this->db->escape($data['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($data['payment_lastname']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_country = '" . $this->db->escape($data['payment_country']) . "', payment_country_id = '" . (int)$data['payment_country_id'] . "', payment_zone = '" . $this->db->escape($data['payment_zone']) . "', payment_zone_id = '" . (int)$data['payment_zone_id'] . "', payment_address_format = '" . $this->db->escape($data['payment_address_format']) . "', payment_custom_field = '" . $this->db->escape(isset($data['payment_custom_field']) ? json_encode($data['payment_custom_field']) : '') . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', payment_code = '" . $this->db->escape($data['payment_code']) . "', shipping_firstname = '" . $this->db->escape($data['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($data['shipping_country']) . "', shipping_country_id = '" . (int)$data['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($data['shipping_zone']) . "', shipping_zone_id = '" . (int)$data['shipping_zone_id'] . "', shipping_address_format = '" . $this->db->escape($data['shipping_address_format']) . "', shipping_custom_field = '" . $this->db->escape(isset($data['shipping_custom_field']) ? json_encode($data['shipping_custom_field']) : '') . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', shipping_code = '" . $this->db->escape($data['shipping_code']) . "', comment = '" . $this->db->escape($data['comment']) . "', total = '" . (float)$data['total'] . "', affiliate_id = '" . (int)$data['affiliate_id'] . "', commission = '" . (float)$data['commission'] . "', marketing_id = '" . (int)$data['marketing_id'] . "', tracking = '" . $this->db->escape($data['tracking']) . "', language_id = '" . (int)$data['language_id'] . "', currency_id = '" . (int)$data['currency_id'] . "', currency_code = '" . $this->db->escape($data['currency_code']) . "', currency_value = '" . (float)$data['currency_value'] . "', ip = '" . $this->db->escape($data['ip']) . "', field01 = '" . $this->db->escape($data['field01']) . "', forwarded_ip = '" . $this->db->escape($data['forwarded_ip']) . "', user_agent = '" . $this->db->escape($data['user_agent']) . "', accept_language = '" . $this->db->escape($data['accept_language']) . "', date_added = NOW(), date_modified = NOW()"); Данные заносит в таблицу order в поле field01 без проблем, а вот для уже зарегистрированного пользователя есть проблема, не могу реализовать запись данных. Как правильно сделать дополнительные поля для уже авторизированных пользователей чтобы данные так же записывало в таблицу order?
  2. tim21701, Спасибо за рекомендацию, но сейчас у большинства популярных интернет-магазинов так реализовано, потому не хочется отставать от времени.
  3. Приветствую. Интересует, как сделать такое уведомление об успешном добавление товара в корзину с изображением?
Guest
×
  • 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.