Add WooCommerce-style featured image and product gallery flow.
Deploy Ladill Woo Manager / deploy (push) Successful in 24s
Deploy Ladill Woo Manager / deploy (push) Successful in 24s
Sync full image sets through the plugin, with upload/URL support in the product editor and thumbnails in the list. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -74,6 +74,31 @@ class WooProduct extends Model
|
||||
return self::STATUSES[$this->status] ?? ucfirst((string) $this->status);
|
||||
}
|
||||
|
||||
/** @return array{id?: int, src?: string, alt?: string, position?: int}|null */
|
||||
public function featuredImage(): ?array
|
||||
{
|
||||
$images = (array) $this->images;
|
||||
|
||||
return $images[0] ?? null;
|
||||
}
|
||||
|
||||
/** @return list<array{id?: int, src?: string, alt?: string, position?: int}> */
|
||||
public function galleryImages(): array
|
||||
{
|
||||
$images = array_values((array) $this->images);
|
||||
|
||||
return array_slice($images, 1);
|
||||
}
|
||||
|
||||
public function thumbnailUrl(): ?string
|
||||
{
|
||||
$featured = $this->featuredImage();
|
||||
|
||||
return is_array($featured) && ! empty($featured['src'])
|
||||
? (string) $featured['src']
|
||||
: null;
|
||||
}
|
||||
|
||||
/** @return list<string> */
|
||||
public function categoryNames(): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user