Add market_product_url helper for correct product URLs
market_url('/product/...') was missing the /<page_slug>/<market_slug>/
prefix required by the market app's route structure. New helper
market_product_url() resolves the prefix from request context
(g.post_slug/g.market_slug in market app, g.page_slug + market_place
in cart app).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<ul class="divide-y divide-stone-100 text-xs sm:text-sm">
|
||||
{% for item in order.items %}
|
||||
<li>
|
||||
<a class="w-full py-2 flex gap-3" href="{{ market_url('/product/' + item.product.slug + '/') }}">
|
||||
<a class="w-full py-2 flex gap-3" href="{{ market_product_url(item.product.slug) }}">
|
||||
{# Thumbnail #}
|
||||
<div class="w-12 h-12 sm:w-14 sm:h-14 rounded-md bg-stone-100 flex-shrink-0 overflow-hidden">
|
||||
{% if item.product and item.product.image %}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
{% if not quantity %}
|
||||
<form
|
||||
action="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
action="{{ market_product_url(slug, 'cart') }}"
|
||||
method="post"
|
||||
hx-post="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
hx-post="{{ market_product_url(slug, 'cart') }}"
|
||||
hx-target="#cart-mini"
|
||||
hx-swap="outerHTML"
|
||||
class="rounded flex items-center"
|
||||
@@ -38,9 +38,9 @@
|
||||
<div class="rounded flex items-center gap-2">
|
||||
<!-- minus -->
|
||||
<form
|
||||
action="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
action="{{ market_product_url(slug, 'cart') }}"
|
||||
method="post"
|
||||
hx-post="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
hx-post="{{ market_product_url(slug, 'cart') }}"
|
||||
hx-target="#cart-mini"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
@@ -80,9 +80,9 @@
|
||||
|
||||
<!-- plus -->
|
||||
<form
|
||||
action="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
action="{{ market_product_url(slug, 'cart') }}"
|
||||
method="post"
|
||||
hx-post="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
hx-post="{{ market_product_url(slug, 'cart') }}"
|
||||
hx-target="#cart-mini"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
@@ -139,7 +139,7 @@
|
||||
<div class="flex flex-col sm:flex-row sm:items-start justify-between gap-2 sm:gap-3">
|
||||
<div class="min-w-0">
|
||||
<h2 class="text-sm sm:text-base md:text-lg font-semibold text-stone-900">
|
||||
{% set href=market_url('/product/' + p.slug + '/') %}
|
||||
{% set href=market_product_url(p.slug, market_place=item.market_place) %}
|
||||
<a
|
||||
href="{{ href }}"
|
||||
hx_get="{{href}}"
|
||||
@@ -189,9 +189,9 @@
|
||||
<div class="flex items-center gap-2 text-xs sm:text-sm text-stone-700">
|
||||
<span class="text-[0.65rem] sm:text-xs uppercase tracking-wide text-stone-500">Quantity</span>
|
||||
<form
|
||||
action="{{ market_url('/product/' + p.slug + '/cart') }}"
|
||||
action="{{ market_product_url(p.slug, 'cart', item.market_place) }}"
|
||||
method="post"
|
||||
hx-post="{{ market_url('/product/' + p.slug + '/cart') }}"
|
||||
hx-post="{{ market_product_url(p.slug, 'cart', item.market_place) }}"
|
||||
hx-target="#cart-mini"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
@@ -212,9 +212,9 @@
|
||||
{{ item.quantity }}
|
||||
</span>
|
||||
<form
|
||||
action="{{ market_url('/product/' + p.slug + '/cart') }}"
|
||||
action="{{ market_product_url(p.slug, 'cart', item.market_place) }}"
|
||||
method="post"
|
||||
hx-post="{{ market_url('/product/' + p.slug + '/cart') }}"
|
||||
hx-post="{{ market_product_url(p.slug, 'cart', item.market_place) }}"
|
||||
hx-target="#cart-mini"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user