@lat9, sorry to be a pain, but have a new issue I could use some help with--I'm assuming it's something I did, but maybe you can identify the root cause. On shopping cart page, I combined the update button and delete buttons to be within the same div/column. Pretty much a straight cut and paste of the code which I initiated because the update icon was disappearing completely on smaller screens with the original bootstrap code (I think). However, the issue is the "update" icon actually deletes the item. More specifically, if there is one item in the cart, it deletes that item. If there are multiple items in the cart, it deletes all but the first item and changes the quantity for the wrong item (e.g. change quantity on item #3 to 5, code deletes item #2 and #3 and changes quantity of item #1 to 5).
Code:<tr> <td class="qtyCell text-center pb-1"> <?php if ($product['flagShowFixedQuantity']) { echo $product['showFixedQuantityAmount'] . ' ' . $product['flagStockCheck'] . ' ' . $product['showMinUnits']; } else { echo $product['quantityField'] . ' ' . $product['flagStockCheck'] . ' ' . $product['showMinUnits']; } ?> <div class="d-sm-none mt-2"> <?php echo (!empty($product['buttonUpdate'])) ? $product['buttonUpdate'] : ''; ?> <?php if ($product['buttonDelete']) { ?> <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&product_id=' . $product['id']); ?>" class="btn btn-sm" aria-label="<?php echo ICON_TRASH_ALT; ?>" title="<?php echo ICON_TRASH_ALT; ?>"><i aria-hidden="true" class="fas fa-sm fa-trash-alt"></i></a> <?php } if ($product['checkBoxDelete'] ) { $checkbox_field = zen_draw_checkbox_field('cart_delete[]', $product['id'], false, 'id="del-r-' . $product['id'] . '"'); $checkbox_field = str_replace('custom-control-input', 'form-check-input', $checkbox_field); ?> <div class="form-check mt-1"> <?php echo $checkbox_field; ?> <label class="form-check-label sr-only" for="del-r-<?php echo $product['id']; ?>"><?php echo ARIA_DELETE_ITEM_FROM_CART; ?></label> </div> <?php } ?> </div> </td> <td class="qtyUpdateCell text-center align-middle d-none d-sm-table-cell"><?php echo (!empty($product['buttonUpdate'])) ? $product['buttonUpdate'] : ''; ?> <?php if ($product['buttonDelete']) { ?> <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&product_id=' . $product['id']); ?>" class="btn btn-sm" aria-label="<?php echo ICON_TRASH_ALT; ?>" title="<?php echo ICON_TRASH_ALT; ?>"><i aria-hidden="true" class="fas fa-sm fa-trash-alt"></i></a> <?php } if ($product['checkBoxDelete'] ) { $checkbox_field = zen_draw_checkbox_field('cart_delete[]', $product['id'], false, 'id="del-' . $product['id'] . '"'); $checkbox_field = str_replace('custom-control-input', 'form-check-input', $checkbox_field); ?> <div class="form-check mt-1"> <?php echo $checkbox_field; ?> <label class="form-check-label sr-only" for="del-<?php echo $product['id']; ?>"><?php echo ARIA_DELETE_ITEM_FROM_CART; ?></label> </div> <?php } ?> </td> <td class="productsCell"> <a href="<?php echo $product['linkProductsName']; ?>"> <span class="d-none d-sm-block float-left mr-3"><?php echo $product['productsImage']; ?></span> <?php echo $product['productsName'] . ' ' . $product['flagStockCheck']; ?> </a> <?php echo $product['attributeHiddenField']; if (isset($product['attributes']) && is_array($product['attributes'])) { ?> <div class="productsCell-attributes"> <ul> <?php foreach ($product['attributes'] as $option => $value) { ?> <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li> <?php } ?> </ul> </div> <?php } ?> </td> <td class="priceCell text-right"><?php echo $product['productsPriceEach']; ?></td> <td class="totalsCell text-right"><?php echo $product['productsPrice']; ?></td> <!--changed price text to right align, hiding column, combined with update <td class="removeCell text-center d-none d-sm-table-cell"> </td> --> </tr>


Reply With Quote


