Showing results for 
Search instead for 
Did you mean: 

Module is not sending image correctly

Module is not sending image correctly

everything good?

I am implementing a module, but the js file is not pulling the proper image

current js code:


require (['jquery'], function ($) {
    'use strict';

    const STORE_ID = 111233;
    const PRODUCT_ID = $ ('input [name = "product"]'). val ();
    const PRODUCT_NAME = $ ('span [itemprop = "nome"]'). texto ();

    var images = [];
    var imagesEl = document.querySelectorAll ('img.product-image-photo');
    imagesEl.forEach (função (elemento, índice) {
        images.push (element.src);

    window._trustvox =  [];
    _trustvox.push(['_storeId', STORE_ID]);
    _trustvox.push(['_productId',  PRODUCT_ID]);
    _trustvox.push(['_productName', PRODUCT_NAME]);
    _trustvox.push(['_productPhotos', [images]]);

I have the impression that productPhoto is passing as a string, maybe that is the problem, as per manual, productPhoto is an array of images and needs to be passed like this:
[“”] even if you upload only one image, that in itself can be the problem.

URL of the image being uploaded:

In this case, it needs to be inside a list (Array), according to this example:



Magento 2.3.6
PHP 7.3
AWS EC2 - Ubuntu

Extension Trustvox.