feat: implement vendor landing pages with multi-template support and fix shop routing
Major improvements to shop URL routing and vendor landing page system:
## Landing Page System
- Add template field to ContentPage model for flexible landing page designs
- Create 4 landing page templates: default, minimal, modern, and full
- Implement smart root handler to serve landing pages or redirect to shop
- Add create_landing_page.py script for easy landing page management
- Support both domain/subdomain and path-based vendor access
- Add comprehensive landing page documentation
## Route Fixes
- Fix duplicate /shop prefix in shop_pages.py routes
- Correct product detail page routing (was /shop/shop/products/{id})
- Update all shop routes to work with router prefix mounting
- Remove unused public vendor endpoints (/api/v1/public/vendors)
## Template Link Corrections
- Fix all shop template links to include /shop/ prefix
- Update breadcrumb 'Home' links to point to vendor root (landing page)
- Update header navigation 'Home' link to point to vendor root
- Correct CMS page links in footer navigation
- Fix account, cart, and error page navigation links
## Navigation Architecture
- Establish two-tier navigation: landing page (/) and shop (/shop/)
- Document complete navigation flow and URL hierarchy
- Support for vendors with or without landing pages (auto-redirect fallback)
- Consistent breadcrumb and header navigation behavior
## Documentation
- Add vendor-landing-pages.md feature documentation
- Add navigation-flow.md with complete URL hierarchy
- Update shop architecture docs with error handling section
- Add orphaned docs to mkdocs.yml navigation
- Document multi-access routing patterns
## Database
- Migration f68d8da5315a: add template field to content_pages table
- Support template values: default, minimal, modern, full
This establishes a complete landing page system allowing vendors to have
custom marketing homepages separate from their e-commerce shop, with
flexible template options and proper navigation hierarchy.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
209
TEST_LANDING_PAGES.md
Normal file
209
TEST_LANDING_PAGES.md
Normal file
@@ -0,0 +1,209 @@
|
||||
# 🧪 Landing Pages Test Guide
|
||||
|
||||
## ✅ Setup Complete!
|
||||
|
||||
Landing pages have been created for three vendors with different templates.
|
||||
|
||||
## 📍 Test URLs
|
||||
|
||||
### 1. WizaMart - Modern Template
|
||||
**Landing Page:**
|
||||
- http://localhost:8000/vendors/wizamart/
|
||||
|
||||
**Shop Page:**
|
||||
- http://localhost:8000/vendors/wizamart/shop/
|
||||
|
||||
**What to expect:**
|
||||
- Full-screen hero section with animations
|
||||
- "Why Choose Us" feature grid
|
||||
- Gradient CTA section
|
||||
- Modern, animated design
|
||||
|
||||
---
|
||||
|
||||
### 2. Fashion Hub - Minimal Template
|
||||
**Landing Page:**
|
||||
- http://localhost:8000/vendors/fashionhub/
|
||||
|
||||
**Shop Page:**
|
||||
- http://localhost:8000/vendors/fashionhub/shop/
|
||||
|
||||
**What to expect:**
|
||||
- Ultra-simple centered design
|
||||
- Single "Enter Shop" button
|
||||
- Clean, minimal aesthetic
|
||||
- No distractions
|
||||
|
||||
---
|
||||
|
||||
### 3. The Book Store - Full Template
|
||||
**Landing Page:**
|
||||
- http://localhost:8000/vendors/bookstore/
|
||||
|
||||
**Shop Page:**
|
||||
- http://localhost:8000/vendors/bookstore/shop/
|
||||
|
||||
**What to expect:**
|
||||
- Split-screen hero layout
|
||||
- Stats section (100+ Products, 24/7 Support, ⭐⭐⭐⭐⭐)
|
||||
- 4-feature grid
|
||||
- Multiple CTA sections
|
||||
- Most comprehensive layout
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Test Scenarios
|
||||
|
||||
### Test 1: Landing Page Display
|
||||
1. Visit each vendor's landing page URL
|
||||
2. Verify the correct template is rendered
|
||||
3. Check that vendor name, logo, and theme colors appear correctly
|
||||
|
||||
### Test 2: Navigation
|
||||
1. Click "Shop Now" / "Enter Shop" button on landing page
|
||||
2. Should navigate to `/shop/` (product catalog)
|
||||
3. Click logo or "Home" in navigation
|
||||
4. Should return to landing page
|
||||
|
||||
### Test 3: Theme Integration
|
||||
1. Each vendor uses their theme colors
|
||||
2. Logo should display correctly
|
||||
3. Dark mode toggle should work
|
||||
|
||||
### Test 4: Responsive Design
|
||||
1. Resize browser window
|
||||
2. All templates should be mobile-friendly
|
||||
3. Navigation should collapse on mobile
|
||||
|
||||
### Test 5: Fallback Behavior (No Landing Page)
|
||||
To test fallback:
|
||||
```python
|
||||
# Delete a landing page
|
||||
python -c "
|
||||
from app.core.database import SessionLocal
|
||||
from models.database.content_page import ContentPage
|
||||
|
||||
db = SessionLocal()
|
||||
page = db.query(ContentPage).filter(ContentPage.vendor_id == 1, ContentPage.slug == 'landing').first()
|
||||
if page:
|
||||
db.delete(page)
|
||||
db.commit()
|
||||
print('Landing page deleted')
|
||||
db.close()
|
||||
"
|
||||
```
|
||||
|
||||
Then visit: http://localhost:8000/vendors/wizamart/
|
||||
- Should automatically redirect to: http://localhost:8000/vendors/wizamart/shop/
|
||||
|
||||
---
|
||||
|
||||
## 🎨 Change Templates
|
||||
|
||||
Want to try a different template? Run:
|
||||
|
||||
```bash
|
||||
python scripts/create_landing_page.py
|
||||
```
|
||||
|
||||
Or programmatically:
|
||||
|
||||
```python
|
||||
from scripts.create_landing_page import create_landing_page
|
||||
|
||||
# Change WizaMart to default template
|
||||
create_landing_page('wizamart', template='default')
|
||||
|
||||
# Change to minimal
|
||||
create_landing_page('wizamart', template='minimal')
|
||||
|
||||
# Change to full
|
||||
create_landing_page('wizamart', template='full')
|
||||
|
||||
# Change back to modern
|
||||
create_landing_page('wizamart', template='modern')
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Current Setup
|
||||
|
||||
| Vendor | Subdomain | Template | Landing Page URL |
|
||||
|--------|-----------|----------|------------------|
|
||||
| WizaMart | wizamart | **modern** | http://localhost:8000/vendors/wizamart/ |
|
||||
| Fashion Hub | fashionhub | **minimal** | http://localhost:8000/vendors/fashionhub/ |
|
||||
| The Book Store | bookstore | **full** | http://localhost:8000/vendors/bookstore/ |
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Verify Database
|
||||
|
||||
Check landing pages in database:
|
||||
|
||||
```bash
|
||||
sqlite3 letzshop.db "SELECT id, vendor_id, slug, title, template, is_published FROM content_pages WHERE slug='landing';"
|
||||
```
|
||||
|
||||
Expected output:
|
||||
```
|
||||
8|1|landing|Welcome to WizaMart|modern|1
|
||||
9|2|landing|Fashion Hub - Style & Elegance|minimal|1
|
||||
10|3|landing|The Book Store - Your Literary Haven|full|1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
### Landing Page Not Showing
|
||||
1. Check database: `SELECT * FROM content_pages WHERE slug='landing';`
|
||||
2. Verify `is_published=1`
|
||||
3. Check vendor ID matches
|
||||
4. Look at server logs for errors
|
||||
|
||||
### Wrong Template Rendering
|
||||
1. Check `template` field in database
|
||||
2. Verify template file exists: `app/templates/vendor/landing-{template}.html`
|
||||
3. Restart server if needed
|
||||
|
||||
### Theme Not Applied
|
||||
1. Verify vendor has theme: `SELECT * FROM vendor_themes WHERE vendor_id=1;`
|
||||
2. Check theme middleware is running (see server logs)
|
||||
3. Inspect CSS variables in browser: `var(--color-primary)`
|
||||
|
||||
### 404 Error
|
||||
1. Ensure server is running: `python main.py` or `make run`
|
||||
2. Check middleware is detecting vendor (see logs)
|
||||
3. Verify route registration in startup logs
|
||||
|
||||
---
|
||||
|
||||
## ✅ Success Checklist
|
||||
|
||||
- [ ] WizaMart landing page loads (modern template)
|
||||
- [ ] Fashion Hub landing page loads (minimal template)
|
||||
- [ ] Book Store landing page loads (full template)
|
||||
- [ ] "Shop Now" buttons work correctly
|
||||
- [ ] Theme colors and logos display
|
||||
- [ ] Mobile responsive design works
|
||||
- [ ] Dark mode toggle works
|
||||
- [ ] Navigation back to landing page works
|
||||
- [ ] Fallback redirect to /shop/ works (when no landing page)
|
||||
|
||||
---
|
||||
|
||||
## 🎉 Next Steps
|
||||
|
||||
Once testing is complete:
|
||||
|
||||
1. **Create Landing Pages via Admin Panel** (future feature)
|
||||
2. **Build Visual Page Builder** (Phase 2)
|
||||
3. **Add More Templates** as needed
|
||||
4. **Customize Content** for each vendor
|
||||
|
||||
For now, use the Python script to manage landing pages:
|
||||
```bash
|
||||
python scripts/create_landing_page.py
|
||||
```
|
||||
|
||||
Happy testing! 🚀
|
||||
Reference in New Issue
Block a user