fix: add .png extension to image URLs — WC rejects extensionless URLs
WooCommerce requires a file extension in image src URLs to determine file type. Added filename.png to all Odoo image URLs. Also fixed variable name ordering bugs where img_name was used before defined. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -249,9 +249,9 @@ class WooProductMap(models.Model):
|
||||
# Variant image — pass Odoo's public URL, WC downloads it directly
|
||||
if variant.image_variant_1920:
|
||||
odoo_base = inst.env['ir.config_parameter'].sudo().get_param('web.base.url', '')
|
||||
filename = (variant.default_code or 'variant') + '.jpg'
|
||||
filename = (variant.default_code or 'variant') + '.png'
|
||||
if odoo_base:
|
||||
img_url = f"{odoo_base}/web/image/product.product/{variant.id}/image_1920"
|
||||
img_url = f"{odoo_base}/web/image/product.product/{variant.id}/image_1920/{filename}"
|
||||
var_data['image'] = {
|
||||
'src': img_url,
|
||||
'name': filename,
|
||||
|
||||
Reference in New Issue
Block a user