Replace shared _added.html with market-owned version using cart-mini fragment
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 53s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 53s
The shared _added.html imported _types/cart/_cart.html which only exists in the cart app. Market now has its own _added.html that: - Fetches cart-mini fragment for the OOB mini cart update - Uses market's own _types/product/_cart.html macros - Drops cart summary/show_cart (not visible on product pages) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -252,19 +252,23 @@ def register():
|
||||
|
||||
# no explicit commit; your session middleware should handle it
|
||||
|
||||
# htmx support (optional)
|
||||
# htmx response: OOB-swap mini cart + product buttons
|
||||
if request.headers.get("HX-Request") == "true":
|
||||
# You can return a small fragment or mini-cart here
|
||||
from shared.infrastructure.fragments import fetch_fragment
|
||||
from shared.infrastructure.cart_identity import current_cart_identity as _ci
|
||||
frag_ident = _ci()
|
||||
cart_params = {}
|
||||
if frag_ident["user_id"] is not None:
|
||||
cart_params["user_id"] = frag_ident["user_id"]
|
||||
if frag_ident["session_id"] is not None:
|
||||
cart_params["session_id"] = frag_ident["session_id"]
|
||||
cart_mini_html = await fetch_fragment("cart", "cart-mini", params=cart_params)
|
||||
|
||||
return await render_template(
|
||||
"_types/product/_added.html",
|
||||
cart_mini_html=cart_mini_html,
|
||||
cart=g.cart,
|
||||
item=ci,
|
||||
total=total,
|
||||
cart_count=sum(i.quantity for i in g.cart),
|
||||
cart_total=total(g.cart),
|
||||
calendar_total=lambda entries: 0,
|
||||
calendar_cart_entries=[],
|
||||
)
|
||||
|
||||
# normal POST: go to cart page
|
||||
|
||||
Reference in New Issue
Block a user