A
A
Alexander2016-10-26 09:38:02
1C-Bitrix
Alexander, 2016-10-26 09:38:02

Where is the error in the cart component, why doesn't it update the price?

Help to deal with the error that appears in the basket, in the template of the sale.basket.basket component. I made a new template for the cart component and now when the quantity of goods is changed, the total amount is not updated in the cart via Ajax, but instead an error appears on the Java Script side (the script writes Cannot set property 'value' of null).
Screenshots of the error: joxi.ru/MAj7BRehvz8Vnr and joxi.ru/v29dG7ysG7LdGm
Why doesn't the cart component update the price, but instead writes an error? Where on the template side is the value property not being set?
Despite the fact that in the component template itself in the basket_items.php file, where the JS function is called, I saved the code as in the original template.
My code in the component template in the basket_items.php file, where the layout of the block for removing/adding goods is formed:

<?
                          $ratio = isset($arItem["MEASURE_RATIO"]) ? $arItem["MEASURE_RATIO"] : 0;
                          $max = isset($arItem["AVAILABLE_QUANTITY"]) ? "max=\"".$arItem["AVAILABLE_QUANTITY"]."\"" : "";
                          $useFloatQuantity = ($arParams["QUANTITY_FLOAT"] == "Y") ? true : false;
                          $useFloatQuantityJS = ($useFloatQuantity ? "true" : "false");
                          ?>
                          <input
                            type="text"
                            size="3"
                            id="QUANTITY_INPUT_<?=$arItem["ID"]?>"
                            name="QUANTITY_INPUT_<?=$arItem["ID"]?>"
                            size="2"
                            maxlength="18"
                            min="0"
                            <?=$max?>
                            step="<?=$ratio?>"
                            style="max-width: 50px"
                            value="<?=$arItem["QUANTITY"]?>"
                            onchange="updateQuantity('QUANTITY_INPUT_<?=$arItem["ID"]?>', '<?=$arItem["ID"]?>', <?=$ratio?>, <?=$useFloatQuantityJS?>)"
                          >
                      
                        <?
                        if (!isset($arItem["MEASURE_RATIO"]))
                        {
                          $arItem["MEASURE_RATIO"] = 1;
                        }

                        if (
                          floatval($arItem["MEASURE_RATIO"]) != 0
                        ):
                        ?>
                          <td id="basket_quantity_control">
                            <div class="basket_quantity_control">
                              <a href="javascript:void(0);" class="plus" onclick="setQuantity(<?=$arItem["ID"]?>, <?=$arItem["MEASURE_RATIO"]?>, 'up', <?=$useFloatQuantityJS?>);"></a>
                              <a href="javascript:void(0);" class="minus" onclick="setQuantity(<?=$arItem["ID"]?>, <?=$arItem["MEASURE_RATIO"]?>, 'down', <?=$useFloatQuantityJS?>);"></a>
                            </div>
                          </td>
                        <?
                        endif;
                        if (isset($arItem["MEASURE_TEXT"]))
                        {
                          ?>
                            <td style="text-align: left"><?=$arItem["MEASURE_TEXT"]?></td>
                          <?
                        }
                        ?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question