add per-colour product images and gallery colour filtering
Tag product images with their colour during sync (both Printful and Printify providers). Printify images are cherry-picked: hero colour keeps all angles, other colours keep front + back only. Printful MockupEnricher now generates mockups per colour from the color_variant_map. PDP gallery filters by the selected colour, falling back to all images when the selected colour has none. Fix option name mismatch (Printify "Colors" vs variant "Color") by singularizing in Product.option_types. Generator creates multi-colour apparel products so mock data matches real sync behaviour. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,6 +56,24 @@ defmodule SimpleshopTheme.Clients.Printify do
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Make a PUT request to the Printify API.
|
||||
"""
|
||||
def put(path, body, _opts \\ []) do
|
||||
url = @base_url <> path
|
||||
|
||||
case Req.put(url, json: body, headers: auth_headers(), receive_timeout: 60_000) do
|
||||
{:ok, %Req.Response{status: status, body: body}} when status in 200..299 ->
|
||||
{:ok, body}
|
||||
|
||||
{:ok, %Req.Response{status: status, body: body}} ->
|
||||
{:error, {status, body}}
|
||||
|
||||
{:error, reason} ->
|
||||
{:error, reason}
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Make a DELETE request to the Printify API.
|
||||
"""
|
||||
@@ -162,6 +180,13 @@ defmodule SimpleshopTheme.Clients.Printify do
|
||||
get("/shops/#{shop_id}/products.json?limit=#{limit}&page=#{page}")
|
||||
end
|
||||
|
||||
@doc """
|
||||
Update a product in a shop.
|
||||
"""
|
||||
def update_product(shop_id, product_id, product_data) do
|
||||
put("/shops/#{shop_id}/products/#{product_id}.json", product_data)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Delete a product from a shop.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user