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

Каким образом возможно изменить кол-во(шаг) в карточке товара?


ng81
 Share

Recommended Posts

Люди добрые! Разъясните, пожалуйста, новичку такую вещь. Необходимо изменить шаг кол-ва заказываемого товара в карточке товара (см. вложенный файл), чтобы при нажатии на стрелку "вверх" или "вниз" в поле "количество" менялось кол-во с шагом в 100 единиц. Например, 100г., 200, 300.. вместо 1,2,3,4....99

Возможно ли такое? 

Очень благодарен за конструктивные советы!!!

 

фото карточки товара.jpg

Link to comment
Share on other sites


13 минут назад, ng81 сказал:

Люди добрые! Разъясните, пожалуйста, новичку такую вещь. Необходимо изменить шаг кол-ва заказываемого товара в карточке товара (см. вложенный файл), чтобы при нажатии на стрелку "вверх" или "вниз" в поле "количество" менялось кол-во с шагом в 100 единиц. Например, 100г., 200, 300.. вместо 1,2,3,4....99

Возможно ли такое? 

Очень благодарен за конструктивные советы!!!

 

Это шаблон надо смотреть - как там реализовано + -

Скорее всего скрипт там.

 

Например, вот так:

<script type="text/javascript" ><!--
$(document).ready(function() {
  $('.minus1').click(function () {
  var $input = $(this).parent().find('#cont');
  var count = parseInt($input.val());
  count = count < 1 ? 1 : count;
  $input.val(parseInt($input.val()) -<?php echo $minimum; ?>);
  $input.change();
    
  return false;
  });
  $('.plus1').click(function () {
  var $input = $(this).parent().find('#cont');
     $input.val(parseInt($input.val()) +<?php echo $minimum; ?>);
  $input.change();
  return false;
  });
});
//--></script>

Увеличение здесь идёт на минимальное количество товара.

Link to comment
Share on other sites

58 минут назад, ng81 сказал:

Шаблон вот этот : http://royal-gold.aridius.ru/  Пожалуйста, посмотрите!

Топаем сюды "catalog\view\theme\royal\template\product".
Жмакаем на файл "product.tpl".

Находим такие строчки:
 

function minus(){
    if(document.getElementById("input-quantity").value <= 0) {
        return false;
    }
    document.getElementById("input-quantity").value --;
};
function plus(){
    document.getElementById("input-quantity").value ++;
};

Меняем на:

function minus(){
    if(document.getElementById("input-quantity").value <= 0) {
        return false;
    }
    var inp=parseInt(document.getElementById("input-quantity").value)-100;
	document.getElementById("input-quantity").value=inp;
};
function plus(){
	var inp=parseInt(document.getElementById("input-quantity").value)+100;
	document.getElementById("input-quantity").value=inp;
};


 

Link to comment
Share on other sites


В 21.11.2017 в 16:04, stainer сказал:

Топаем сюды "catalog\view\theme\royal\template\product".
Жмакаем на файл "product.tpl".

Находим такие строчки:
 


function minus(){
    if(document.getElementById("input-quantity").value <= 0) {
        return false;
    }
    document.getElementById("input-quantity").value --;
};
function plus(){
    document.getElementById("input-quantity").value ++;
};

Меняем на:


function minus(){
    if(document.getElementById("input-quantity").value <= 0) {
        return false;
    }
    var inp=parseInt(document.getElementById("input-quantity").value)-100;
	document.getElementById("input-quantity").value=inp;
};
function plus(){
	var inp=parseInt(document.getElementById("input-quantity").value)+100;
	document.getElementById("input-quantity").value=inp;
};


 

Заменил фрагмент кода, который Вы привели, но изменений не произошло... вот скрин: http://joxi.ru/EA4XXZyIwR3kgA

Подскажите, пожалуйста, где я ошибся, ибо все сделал как Вы и посоветовали.Очень благодарен за ответ. 

Link to comment
Share on other sites


  • 3 years later...

Так же можно сделать +(Минимальное количество для заказа этого товара).

Если товар продается минимум по 3 штуки счетчик будет увеличиваться именно на это число.

За это отвечает переменная $minimum в БД, только не забываем перевести ее в числовой тип:

parseInt(<?php echo $minimum; ?>)

 

catalog\view\theme\(имя_вашей_темы)\template\product

Версия ocStore 2.3.0.2.4

 

    $('.quantity-plus-minus #minus').click(function () {
        var $input = $('.quantity input[type="text"]');
        var count = parseInt($input.val()) - parseInt(<?php echo $minimum; ?>);
        count = count < <?php echo $minimum; ?> ? <?php echo $minimum; ?> : count;
        $input.val(count);
        $input.change();
        return false;
    });
    $('.quantity-plus-minus #plus').click(function () {
        var $input = $('.quantity input[type="text"]');
        $input.val(parseInt($input.val()) + parseInt(<?php echo $minimum; ?>));
        $input.change();
        return false;
        });

 

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.