January 11 edition
You get to fill in for the architect. They had to step out early due to a birthday party, and... the client requested some code pushed to staging immediately. Your colleague finished their work on this code and has sent over to you to review just before you close your computer for the day.
What critiques do you have for your colleague? Below is the pull request.
I created this override as there was no other way. The data was pretty easy to access.
1. <?php 2. if ($block->shouldRenderQuantity()): 3. $quantityValidators = $block->getQuantityValidators(); 4. $minQuantity = isset($quantityValidators['validate-item-quantity']['minAllowed'])? 5. $quantityValidators['validate-item-quantity']['minAllowed']:1; 6. ?> 7. <div class="field qty"> 8. <!--<label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>--> 9. <div class="control"> 10. <input type="number" name="qty" id="qty" min="0" value="<?= $block->getProductDefaultQty() * 1 ?>" 11. title="<?= $block->escapeHtmlAttr(__('Qty')) ?>" 12. class="input-text qty" 13. data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" 14. /> 15. 16. <?php if ($_product->getUnitofmeasure()): ?> 17. <span class="unit_of_measure">per <?php echo $_product->getUnitofmeasure(); ?></span> 18. <?php endif; ?> 19. </div> 20. </div> 21. <?php // ... ?>