2012-03-02 75 views
-1

我需要購物車中的商品圖片。現在我只有產品名稱。這裏是鏈接 - http://layot.prestatrend.com/ 這裏是代碼產品的名稱在車:購物車中的商品圖片

//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); 
       } 

所以可能有人幫助在車來分析產品的形象?

+0

這是什麼反對?! – 2012-03-02 17:59:39

回答

0

您需要在

$('#cart_block_top dt#cart_block_top_product_'+ domIdProduct)創建圖像佔位符。

然後你可以發送圖像的源作爲this.image源。事情是這樣的:

content += '<img src="' + this.imageSource' />'; 

抓住imageSource因爲你是將它們分配給.product_image

只需將此產品圖片src發送至displayNewProducts功能。

+0

爲什麼你不附加內容而不是'content + ='? – 2012-03-02 17:57:03

相關問題