在 prestashop 中获取图像 url [英] Get image url in prestashop

查看:41
本文介绍了在 prestashop 中获取图像 url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为我的网站制作供比较网站的供稿.它必须是一个sql语句.现在我有这个:

I need to make a feed for my site for a comparing site. It has to be a sql statement. For now I have this:

select  pl.name as Titel,
    ROUND(p.price*1.21,2) as Price,
    replace(concat('http://', ifnull(conf.value,'domain/'), cl.name, '/', p.id_product, '-' , pl.name, '.html'),' ','-') as Link,
     concat('http://', ifnull(conf.value,'domain'), '/img/p/', p.id_product, '-' , pi.id_image, '.jpg') as "Image-location",
     cl.name as Categorie,
    p.id_product AS ID
from dbrb_product p
left join dbrb_image pi on p.id_product = pi.id_product
left join dbrb_product_lang pl on p.id_product = pl.id_product
left join dbrb_category_lang cl on p.id_category_default = cl.id_category
left join dbrb_configuration conf on conf.name = 'dbrb_SHOP_DOMAIN'
left join dbrb_product_carrier x on p.id_product = x.id_product
group by p.id_product

但是现在使用新的 prestashop 1.6 版,图像不再起作用.

But now with the new prestashop version 1.6 the image doesn't work anymore.

现在图片路径为:domain.com/img/p/number/number/number/image.png我不明白其中的逻辑,有人能告诉我吗?

Now the image path is: domain.com/img/p/number/number/number/image.png I don't get the logic from it, can somebody tell me?

还有一个问题我要处理,因为有些产品的图片是一样的.

There is also another problem I have to deal with, because there are some products which have the same image.

有人可以完成 SQL 代码或进一步帮助我吗?

Can somebody complete the SQL code or help me further?

谢谢!

推荐答案

很简单,将查询中的 concat 替换为这个:

Is simple, replace concat from your query for this one:

concat('http://', ifnull(conf.value,'example.com'), '/img/p/',SUBSTRING(pi.id_image from -4 FOR 1),'/',SUBSTRING(pi.id_image from -3 FOR 1),'/',SUBSTRING(pi.id_image from -2 FOR 1),'/',SUBSTRING(pi.id_image from -1 FOR 1),'/', pi.id_image, '.jpg') 作为 product_image,

concat('http://', ifnull(conf.value,'example.com'), '/img/p/',SUBSTRING(pi.id_image from -4 FOR 1),'/',SUBSTRING(pi.id_image from -3 FOR 1),'/',SUBSTRING(pi.id_image from -2 FOR 1),'/',SUBSTRING(pi.id_image from -1 FOR 1),'/' , pi.id_image, '.jpg') as product_image,

这篇关于在 prestashop 中获取图像 url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆