2019-05-10 02:01
浏览 82

如何在PrestaShop 1.7中使用javascript更改当前产品封面照片

I am trying to set customized product preview (t-shirt with uploaded logotype) as product thumbnail. It's image, file type: jpeg - I have full url with http: NEW_PRODUCT_THUMB.

How to set this url as product image / cover / thumbnail?

For tests, I tried to set it with jQuery:

// <section id="main"> , first <img> child element
$('section#main img:eq(0)').attr("src", NEW_PRODUCT_THUMB );

Problem: Every changes - t-shirt size, color are triggering refresh product page, and then - default image was loaded (from database, not from my customization JS editor).

Here is webpage, where customized product image is set as thumbnail in correct way, but I have no idea how?

图片转代码服务由CSDN问答提供 功能建议

我正在尝试设置自定义产品预览</ strong>( T-shirt with uploaded 标识</ em>)作为产品缩略图</ strong>。 它的图像,文件类型:jpeg - 我有完整的URL与http: NEW_PRODUCT_THUMB </ code>。</ p>

如何将此网址设置为产品图片</ strong> / cover / thumbnail?</ p>

对于测试,我尝试使用jQuery设置它:</ p>

  //&lt; section id =“main”&gt;  ,首先&lt; img&gt; 子元素
 $('section #main img:eq(0)')。attr(“src”,NEW_PRODUCT_THUMB); 
 </ code> </ pre> 

问题: </ strong>每次更改 - T恤尺寸,颜色都会触发刷新产品页面,然后 - 加载默认图像(来自数据库,而不是来自我的自定义JS编辑器)。</ p>

此处 是网页,其中自定义产品图像以正确的方式设置为缩略图,但我不知道如何? </ a > </ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题