2013-07-02 32 views
-1

當用戶單擊訂單詳細信息鏈接時,需要在訂單詳細信息頁面中顯示產品圖像。如何在prestashop中顯示訂單歷史記錄中的產品圖像

我已編輯下面的代碼,以便-detail.tpl但不顯示產品圖像,僅顯示一些虛擬圖像

<td> 
<a href="{$link->getProductLink($product.product_id, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'htmlall':'UTF-8'}"> 
<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small_default')}" alt="{$product.name|escape:'htmlall':'UTF-8'}" {if isset($smallSize)}width="{$smallSize.width}" height="{$smallSize.height}" {/if} /></a> 

</td> 

Screenshot

回答

0

如果該頁面可以查看變量會發生什麼用$產品。喜歡這個。

{$product|var_dump} 

,你會發現,$產品有一個數組值圖像這是一個對象

所以現在這個去。

{$product.image|var_dump} 

並且您將查看所有此值。

    object(Image)#490 (26) { 
    ["id"]=&gt; 
    int(1) 
    ["id_image"]=&gt; 
    string(1) "1" 
    ["id_product"]=&gt; 
    string(1) "3" 
    ["position"]=&gt; 
    string(1) "1" 
    ["cover"]=&gt; 
    string(1) "1" 
    ["image_format"]=&gt; 
    string(3) "jpg" 
    ["source_index"]=&gt; 
    string(52) "/Applications/MAMP/htdocs/prestashop/img/p/index.php" 
    ["folder":protected]=&gt; 
    NULL 
    ["existing_path":protected]=&gt; 
    NULL 
    ["id_lang":protected]=&gt; 
    NULL 
    ["id_shop":protected]=&gt; 
    int(1) 
    ["id_shop_list"]=&gt; 
    NULL 
    ["get_shop_from_context":protected]=&gt; 
    bool(true) 
    ["table":protected]=&gt; 
    string(5) "image" 
    ["identifier":protected]=&gt; 
    string(8) "id_image" 
    ["fieldsRequired":protected]=&gt; 
    array(1) { 
    [0]=&gt; 
    string(10) "id_product" 
    } 
    ["fieldsSize":protected]=&gt; 
    array(0) { 
    } 
    ["fieldsValidate":protected]=&gt; 
    array(3) { 
    ["id_product"]=&gt; 
    string(12) "isUnsignedId" 
    ["position"]=&gt; 
    string(13) "isUnsignedInt" 
    ["cover"]=&gt; 
    string(6) "isBool" 
    } 
    ["fieldsRequiredLang":protected]=&gt; 
    array(0) { 
    } 
    ["fieldsSizeLang":protected]=&gt; 
    array(0) { 
    } 
    ["fieldsValidateLang":protected]=&gt; 
    array(0) { 
    } 
    ["tables":protected]=&gt; 
    array(0) { 
    } 
    ["webserviceParameters":protected]=&gt; 
    array(0) { 
    } 
    ["image_dir":protected]=&gt; 
    string(43) "/Applications/MAMP/htdocs/prestashop/img/p/" 
    ["def":protected]=&gt; 
    array(6) { 
    ["table"]=&gt; 
    string(5) "image" 
    ["primary"]=&gt; 
    string(8) "id_image" 
    ["multilang"]=&gt; 
    bool(true) 
    ["fields"]=&gt; 
    array(3) { 
     ["id_product"]=&gt; 
     array(3) { 
     ["type"]=&gt; 
     int(1) 
     ["validate"]=&gt; 
     string(12) "isUnsignedId" 
     ["required"]=&gt; 
     bool(true) 
     } 
     ["position"]=&gt; 
     array(2) { 
     ["type"]=&gt; 
     int(1) 
     ["validate"]=&gt; 
     string(13) "isUnsignedInt" 
     } 
     ["cover"]=&gt; 
     array(3) { 
     ["type"]=&gt; 
     int(2) 
     ["validate"]=&gt; 
     string(6) "isBool" 
     ["shop"]=&gt; 
     bool(true) 
     } 
    } 
    ["classname"]=&gt; 
    string(5) "Image" 
    ["associations"]=&gt; 
    array(1) { 
     ["l"]=&gt; 
     array(3) { 
     ["type"]=&gt; 
     int(2) 
     ["field"]=&gt; 
     string(8) "id_image" 
     ["foreign_field"]=&gt; 
     string(8) "id_image" 
     } 
    } 
    } 
    ["update_fields":protected]=&gt; 
    NULL 
} 
                           You will notice that there is not value of link_rewrite. So you need to pass that from the controller. 
+0

謝謝:@arifur rahman – Kennedy

1

我想這樣做在PS 1.3版,我有問題太多:/當我展示{$ product.image |的var_dump}變量,我得到空

函數getImageLink($ product.link_rewrite,$ product.id_image,'small_default')工作良好,但問題是從變量$ product.link_rewrite和$ product.id_image獲取值,但不幸的是我不知道如何去做。

現在他們是空的等等鏈接圖像是不正確的

相關問題