2012-03-02 8 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

それは何のための投票ですか? –

答えて

0

あなたは

$('#cart_block_top dt#cart_block_top_product_'+ domIdProduct)にイメージプレースホルダーを作成する必要があります。

次に、この画像ソースをthis.imageソースとして送信できます。このような何か:

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

グラブimageSourceあなたがそうであるように、彼らが.product_imageに割り当てます。

この製品の画像を送信するdisplayNewProductsに画像src。

+0

なぜ 'content + ='のかわりに追加しないのですか? –

関連する問題