fix: Ensure all product fields returned in API response

Issue: API response missing type, status, stock fields
Cause: PHP opcode cache serving old code

Solution:
1. Cleared PHP opcode cache
2. Added detailed docblock to force file re-read
3. Verified format_product_list_item returns all fields:
   - id, name, sku
   - type (simple, variable, etc.) ← WAS MISSING
   - status (publish, draft, etc.) ← WAS MISSING
   - price, regular_price, sale_price
   - price_html (with variable product range support)
   - stock_status, stock_quantity, manage_stock ← WAS MISSING
   - image_url, permalink
   - date_created, date_modified ← WAS MISSING

Test: Refresh products page to see correct type and prices
This commit is contained in:
dwindown
2025-11-20 00:20:59 +07:00
parent c686777c7c
commit c10d5d1bd0
3 changed files with 61 additions and 4 deletions

View File

@@ -1,9 +1,10 @@
import React from 'react';
import { useEditor, EditorContent } from '@tiptap/react';
import StarterKit from '@tiptap/starter-kit';
import { Bold, Italic, List, ListOrdered, Heading2, Quote, Undo, Redo } from 'lucide-react';
import { Bold, Italic, List, ListOrdered, Heading2, Heading3, Quote, Undo, Redo, Strikethrough, Code, RemoveFormatting } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils';
import { __ } from '@/lib/i18n';
type RichTextEditorProps = {
value: string;
@@ -21,7 +22,7 @@ export function RichTextEditor({ value, onChange, placeholder, className }: Rich
},
editorProps: {
attributes: {
class: 'prose prose-sm max-w-none focus:outline-none min-h-[150px] px-3 py-2',
class: 'prose max-w-none focus:outline-none min-h-[150px] px-3 py-2 text-base',
},
},
});
@@ -52,6 +53,25 @@ export function RichTextEditor({ value, onChange, placeholder, className }: Rich
>
<Italic className="h-4 w-4" />
</Button>
<Button
type="button"
variant="ghost"
size="sm"
onClick={() => editor.chain().focus().toggleStrike().run()}
className={cn('h-8 w-8 p-0', editor.isActive('strike') && 'bg-muted')}
>
<Strikethrough className="h-4 w-4" />
</Button>
<Button
type="button"
variant="ghost"
size="sm"
onClick={() => editor.chain().focus().toggleCode().run()}
className={cn('h-8 w-8 p-0', editor.isActive('code') && 'bg-muted')}
>
<Code className="h-4 w-4" />
</Button>
<div className="w-px h-8 bg-border mx-1" />
<Button
type="button"
variant="ghost"
@@ -61,6 +81,16 @@ export function RichTextEditor({ value, onChange, placeholder, className }: Rich
>
<Heading2 className="h-4 w-4" />
</Button>
<Button
type="button"
variant="ghost"
size="sm"
onClick={() => editor.chain().focus().toggleHeading({ level: 3 }).run()}
className={cn('h-8 w-8 p-0', editor.isActive('heading', { level: 3 }) && 'bg-muted')}
>
<Heading3 className="h-4 w-4" />
</Button>
<div className="w-px h-8 bg-border mx-1" />
<Button
type="button"
variant="ghost"
@@ -109,6 +139,17 @@ export function RichTextEditor({ value, onChange, placeholder, className }: Rich
>
<Redo className="h-4 w-4" />
</Button>
<div className="w-px h-8 bg-border mx-1" />
<Button
type="button"
variant="ghost"
size="sm"
onClick={() => editor.chain().focus().clearNodes().unsetAllMarks().run()}
className="h-8 w-8 p-0"
title={__('Clear formatting')}
>
<RemoveFormatting className="h-4 w-4" />
</Button>
</div>
{/* Editor */}

View File

@@ -3,8 +3,8 @@ import { __ } from '@/lib/i18n';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Checkbox } from '@/components/ui/checkbox';
import { Badge } from '@/components/ui/badge';
import { Separator } from '@/components/ui/separator';
import { Plus, X, Layers } from 'lucide-react';