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

ARoman

Newbie
  
  • Posts

    1
  • Joined

  • Last visited

ARoman's Achievements

Newbie

Newbie (1/14)

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

Recent Badges

0

Reputation

  1. Здравствуйте, возникла задача - "для специфического товара сделать обязательное поле для ввода шестизначного номера пользователем, без этого номера заказать товар нельзя". Сделал вот что common.js function addToCart(product_id) { if(product_id == 103){ var uid=prompt('Введите Ваш ID (шесть цифр)'); var ticket = true; } else var ticket = false; uid = uid * 1; if((uid >= 100000 && uid<= 999999) || ticket==false) $.ajax({ url: 'index.php?route=checkout/cart/update', type: 'post', data: 'product_id=' + product_id +'&uid='+uid, .... В консоли Хрома видно что данные в POST попадпют далее catalog/controller/checkout/cart.php class ControllerCheckoutCart extends Controller { public function index() { $this->language->load('checkout/cart'); if ($this->request->server['REQUEST_METHOD'] == 'POST') { if (isset($this->request->post['quantity'])) { if (!is_array($this->request->post['quantity'])) { if (isset($this->request->post['option'])) { $option = $this->request->post['option']; } else { $option = array(); } $this->cart->add($this->request->post['product_id'], $this->request->post['quantity'], $option); } else { foreach ($this->request->post['quantity'] as $key => $value) { $this->cart->update($key, $value); } } if(isset($_POST['uid'])) { //ЗАписываем ПОСТ ЮИД $_SESSION['uid'][] = $_POST['uid']; } else { $_SESSION['uid'][] = 'no'; } } if (isset($this->request->post['remove'])) { foreach ($this->request->post['remove'] as $key) { $this->cart->remove($key); } } ...... далее catalog/controller/checkout/payment.php что бы введенные ЮИДЫ отображалитсь в комментарии к заказу ... if(isset($this->session->data['uid'])) { $uids = ''; foreach($this->session->data['uid'] as $uid) { $uids .= ' '.$uid; } } else $uids = '';//print_r($this->session->data, 1); if (isset($this->session->data['comment'])) { $this->data['comment'] = $this->session->data['comment']." ".$uids; } else { $this->data['comment'] = "".$uids; } ... Но ничего не получается так как $_SESSION['uid'][] = $_POST['uid']; почему то не отрабатывает. Не знаю что делать. Подскажите в каком направлении копать? Может быть есть возможность дописывать ЮИДы к названию товара?
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.