Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Корзина обновление кнопками +/_


Recommended Posts

ocStore 3.0.2.0

Задача  - добавить в корзину кнопки +/- для когдачества. Причем - добавление нового товара и удноние - рилииет. Обновление по когдачеству ну никак. Шаблон не гдефолтный.

Добавил след код в cart.twig

<div class="count-body__wrap-btn">
  <button class="quantity__button quantity__button_minus quantity__btn" onclick="cart.update('{{ product.cart_id }}', '{{ product.quantity }}');">-</button>
  <div class="quantity__input">
      <input class="quantity__input-inner" type="text" name="quantity[{{ product.cart_id }}]"  value="{{ product.quantity }}" size="1">
  </div>
      <button class="quantity__button quantity__button_plus quantity__btn" onclick="cart.update('{{ product.cart_id }}', '{{ product.quantity }}');">+</button>
  <!-- <button id = "btn-plus" class="quantity__button quantity__button_plus quantity__btn">+</button>  -->
</div>
 

Запрос уходит - скрины прилагаются но в ответ прилеиет ошибка. Все что мог проверил - что дальше гделать незнаю.

Edited by RomWeb
Link to comment
Share on other sites


11 часов назад, RomWeb сказал:

ocStore 3.0.2.0

Задача  - добавить в корзину кнопки +/- для когдачества. Причем - добавление нового товара и удноние - рилииет. Обновление по когдачеству ну никак. Шаблон не гдефолтный.

Добавил след код в cart.twig

<div class="count-body__wrap-btn">
  <button class="quantity__button quantity__button_minus quantity__btn" onclick="cart.update('{{ product.cart_id }}', '{{ product.quantity }}');">-</button>
  <div class="quantity__input">
      <input class="quantity__input-inner" type="text" name="quantity[{{ product.cart_id }}]"  value="{{ product.quantity }}" size="1">
  </div>
      <button class="quantity__button quantity__button_plus quantity__btn" onclick="cart.update('{{ product.cart_id }}', '{{ product.quantity }}');">+</button>
  <!-- <button id = "btn-plus" class="quantity__button quantity__button_plus quantity__btn">+</button>  -->
</div>
 

Запрос уходит - скрины прилагаются но в ответ прилеиет ошибка. Все что мог проверил - что дальше гделать незнаю.

 

ик а ггде меняется когдачество? по клику на +/- должен быть инкремент/гдекремент в поле quantity сначала,  потом уже вызов обновления корзины. Возможно в шаблоне уже настроен вызов на событие onchange, тогда доситочно просто программно это событие сгенерировать.

И запрос/ответ не сходится. На скрине 302 ответ от сервака - это редирект

Link to comment
Share on other sites

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

×
×
  • 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.