feat: Add product images support with WP Media Library integration
- Add WP Media Library integration for product and variation images - Support images array (URLs) conversion to attachment IDs - Add images array to API responses (Admin & Customer SPA) - Implement drag-and-drop sortable images in Admin product form - Add image gallery thumbnails in Customer SPA product page - Initialize WooCommerce session for guest cart operations - Fix product variations and attributes display in Customer SPA - Add variation image field in Admin SPA Changes: - includes/Api/ProductsController.php: Handle images array, add to responses - includes/Frontend/ShopController.php: Add images array for customer SPA - includes/Frontend/CartController.php: Initialize WC session for guests - admin-spa/src/lib/wp-media.ts: Add openWPMediaGallery function - admin-spa/src/routes/Products/partials/tabs/GeneralTab.tsx: WP Media + sortable images - admin-spa/src/routes/Products/partials/tabs/VariationsTab.tsx: Add variation image field - customer-spa/src/pages/Product/index.tsx: Add gallery thumbnails display
This commit is contained in:
45
customer-spa/src/types/product.ts
Normal file
45
customer-spa/src/types/product.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Product Types
|
||||
*/
|
||||
|
||||
export interface ProductCategory {
|
||||
id: number;
|
||||
name: string;
|
||||
slug: string;
|
||||
count?: number;
|
||||
}
|
||||
|
||||
export interface Product {
|
||||
id: number;
|
||||
name: string;
|
||||
slug: string;
|
||||
type: string;
|
||||
status: string;
|
||||
price: string;
|
||||
regular_price?: string;
|
||||
sale_price?: string;
|
||||
on_sale: boolean;
|
||||
stock_status: 'instock' | 'outofstock' | 'onbackorder';
|
||||
stock_quantity?: number;
|
||||
image?: string;
|
||||
images?: string[];
|
||||
short_description?: string;
|
||||
description?: string;
|
||||
sku?: string;
|
||||
categories?: ProductCategory[];
|
||||
tags?: any[];
|
||||
attributes?: any[];
|
||||
variations?: number[];
|
||||
permalink?: string;
|
||||
}
|
||||
|
||||
export interface ProductsResponse {
|
||||
products: Product[];
|
||||
total: number;
|
||||
total_pages: number;
|
||||
current_page: number;
|
||||
}
|
||||
|
||||
export interface CategoriesResponse {
|
||||
categories: ProductCategory[];
|
||||
}
|
||||
Reference in New Issue
Block a user