Offer "Add to cart" when a wishlist product's customization is optional - #542
Offer "Add to cart" when a wishlist product's customization is optional#542boo-code wants to merge 1 commit into
Conversation
The wishlist button branched on product.customizable, which is true for any product carrying customization fields. A product whose fields are all optional can be added to the cart directly - that is the rule UpdateProductQuantityInCartHandler applies, through Product::hasAllRequiredCustomizableFields() - so the wishlist offered Customize, and sent the shopper to the product page, for products that did not need it. The presenter already computes the distinction: ProductLazyArray exposes customization_required alongside customizable, and ProductListingLazyArray extends it, so the flag is already in the payload this component receives. Reported as PrestaShop/PrestaShop#37335.
|
@boo-code I would rather remove all of this Vue bullshit and render the product cards normally via a presenter and a tpl thats there in the core, like all other modules. This is just overengineered to extreme. |
|
The rewrite would not remove this bug on its own. This PR is that rename and nothing else - seven uses, no new Vue surface, no build output. If you would rather land the presenter and tpl version first, say so and I will close this and put the same distinction there instead. |
product.customizable, which is true for any product carrying customization fields. A product whose fields are all optional can be added to the cart directly - that is the rule the cart itself applies, throughProduct::hasAllRequiredCustomizableFields()inUpdateProductQuantityInCartHandler- so the wishlist offered "Customize" and sent the shopper to the product page for products that did not need it. The presenter already computes the distinction:ProductLazyArrayexposescustomization_requirednext tocustomizable, andProductListingLazyArrayextends it, so the flag is already in the payload this component receives. All seven uses inProduct.vuemove to it: the label, the button class, the cart icon, the click condition, the disabled rule and the add-to-cart guard.The built assets are deliberately not included
public/is tracked in this repository and a_devchange normally ships with it rebuilt. I have left it out, becausenpm run buildhere does not reproduce the committed output: bundles my change cannot affect come back with 1 insertion and 19 deletions each, andpublic/productslist.bundle.js- the one that does carry the change - shows 4 insertions and 96 deletions, of which only 2 lines are the change itself. Committing that would bury a two-line behavioural fix under ninety-odd lines of formatting difference and risk shipping an asset built by the wrong toolchain. Regeneratingpublic/with the pinned toolchain is the last step and I would rather a maintainer did it, or tell me which Node version to match and I will.Verification
The module's JS suite does not run on this machine -
npm testfails withTypeError: a.a.emit is not a functioninside mochapack, and it fails identically on the unmodifieddevbranch, so it is a toolchain incompatibility rather than anything this change introduced. There is no existing spec forProduct.vueeither. The change is therefore justified from core's own contract rather than from a test run:customization_requiredis computed atProductLazyArray:169-191, listed among the exposed keys, and read by the cart handler that decides whether a direct add is allowed.