普通网友 2014-10-13 16:07
浏览 23
已采纳

Prestashop:id_image是字符串“fr_default”而不是图像的ID

In my prestashop module i have to display product with image. I have my variable products which contain all products data, but id_image not contain the real id of the image of the product but a string which is : "fr_default"

I found where this string is send with the following stackoverflow topic : Product::getProductsProperties(): 'id_image' returns 'en_default', not image

But there's no solution, I always have the '?' and the url image is not working.

I'm on Prestashop 1.6.0.6 and i write my products variable with those line :

$products_partial = Product::getProducts($context->language->id, 0, 40, 'name', 'asc');
$products = Product::getProductsProperties($context->language->id, $products_partial);
  • 写回答

2条回答 默认 最新

  • doupixian1436 2014-10-13 16:25
    关注

    I developed a module in which I use this line to retrieve the images and links :

    $products_partial = Product::getProducts($context->language->id, 0, 40, 'name', 'asc');
    $products = Product::getProductsProperties($context->language->id, $products_partial);
    
    foreach ($products as $key => $product) {          
        $cover = Product::getCover($product['id_product']);
        $products[$key]["id_image"] = $cover["id_image"];     
    
    }
    

    I hope this can help you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况