Javascript 购物车中的产品图像

Javascript 购物车中的产品图像,javascript,jquery,Javascript,Jquery,我需要在购物车的产品形象。现在我只有产品名了。以下是链接- 这是购物车上产品名称的代码: //if product is not in the displayed cart, add a new product's line var domIdProduct = this.id + (this.idCombination ? '_' + this.idCombination : ''); var domIdProductAt

我需要在购物车的产品形象。现在我只有产品名了。以下是链接- 这是购物车上产品名称的代码:

//if product is not in the displayed cart, add a new product's line
                    var domIdProduct = this.id + (this.idCombination ? '_' + this.idCombination : '');
                var domIdProductAttribute = this.id + '_' + (this.idCombination ? this.idCombination : '0');
                if($('#cart_block_top dt#cart_block_top_product_'+ domIdProduct ).length == 0)
                {
                    var productId = parseInt(this.id);
                    var productAttributeId = (this.hasAttributes ? parseInt(this.attributes) : 0);
                    var content =  '<dt class="hidden" id="cart_block_top_product_' + domIdProduct + '">';
                        content += '<span class="quantity-formated"><span class="quantity">' + this.quantity + '</span>x</span>';
                        var name = (this.name.length > 12 ? this.name.substring(0, 10) + '...' : this.name);
                        content += '<a href="' + this.link + '" title="' + this.name + '">' + name + '</a>';
                        content += '<span class="remove_link"><a rel="nofollow" class="ajax_cart_block_top_remove_link" href="' + baseDir + 'cart.php?delete&amp;id_product=' + productId + '&amp;token=' + static_token + (this.hasAttributes ? '&amp;ipa=' + parseInt(this.idCombination) : '') + '"> </a></span>';
                        content += '<span class="price">' + this.priceByLine + '</span>';
                        content += '</dt>';
                    if (this.hasAttributes)
                        content += '<dd id="cart_block_top_combination_of_' + domIdProduct + '" class="hidden"><a href="' + this.link + '" title="' + this.name + '">' + this.attributes + '</a>';
                    if (this.hasCustomizedDatas)
                        content += ajaxCart.displayNewCustomizedDatas(this);
                    if (this.hasAttributes) content += '</dd>';
                    $('#cart_block_top dl.products').append(content);
                }
//如果产品不在显示的购物车中,请添加新产品的行
var domindproduct=this.id+(this.idcomposition?'\'+this.idcomposition:'');
var domindproductAttribute=this.id+''+(this.idcomposition?this.idcomposition:'0');
if($('#车#块(顶dt#车)块(顶)产品(顶)+DOMDPRODUCT).length==0)
{
var productId=parseInt(this.id);
var productAttributeId=(this.hasAttributes?parseInt(this.attributes):0);
var内容=“”;
content+=''+this.quantity+'x';
var name=(this.name.length>12?this.name.substring(0,10)+'…':this.name);
内容+='';
内容+='';
content+=''+this.priceByLine+'';
内容+='';
if(this.hasAttributes)
内容+='';
if(this.hasCustomizedDatas)
content+=ajaxCart.displayNewCustomizedDatas(此);
如果(this.hasAttributes)内容+='';
$(“#购物车"区块"顶级dl.products')。追加(内容);
}

那么,有人可以帮助解析购物车中的产品图像吗?

您需要在购物车上创建一个图像占位符

$('cart\u block\u top dt.'cart\u block\u top\u product.+domIdProduct)

然后您可以将图像源作为this.image source发送。大概是这样的:

 content += '<img src="' + this.imageSource' />';
content+='';
在将图像分配给
.product\u image
时,抓取
imageSource


只需将此产品图像src发送到
displayNewProducts
函数。

为什么不添加而不是
content+=