looking desperately looking for storage or generation Products urls

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
I would like to how I can get the url of all products through a sql query.

I don't want to export all 10000s products in an excel file, I want to get the urls via SQL.

Regards
7 years ago
esouk wrote:
I would like to how I can get the url of all products through a sql query.

They're in the UrlRecord table so this would do it:

SELECT *
  FROM UrlRecord
WHERE EntityName = 'Product'
       AND IsActive = 1
7 years ago
Thank you very much @petemitch, I upvoted your answer.

Is it possible to tell me where I can find the images file path stored in the database?
7 years ago
esouk wrote:
Thank you very much @petemitch, I upvoted your answer.

Is it possible to tell me where I can find the images file path stored in the database?

There isn't a specific field with a file path as the images just get named by the Id field of the record in the Picture table so nop knows how to find them, see this post for a bit more detailed answer: https://www.nopcommerce.com/boards/t/45493/disable-image-renaming.aspx#180475
7 years ago
NopCommerce is storing images in either database OR as physical files.

There is setting in NopCommerce admin panel, we can configure it from here.

http://admin-demo.nopcommerce.com/Admin/Setting/Media



If images are stored in database, It actually stores image in binary format and on site we can see thumbnails url and If images are stored in file format, all images are stored in content/images folder.

Here I've prepared one query which get images and thumbnails URLs from database. Please note that if images are stored in database.

Note : This query is prepared for NopCommerce 3.80

Query:


use [NopCommerce380] -- Use your database name here
go

declare @URL nvarchar(400)
select @URL=URL from Store

--set @URL='http://localhost:380/'
-- here you can hardcode your url also
  
select p.Id 'ProductId',p.Name 'Product Name',
  @URL + 'content/images/' + FORMAT(ppm.PictureId, '0000000') + '_0' +
  CASE
     WHEN pic.MimeType='image/jpeg' THEN '.jpeg'
     WHEN pic.MimeType='image/pjpeg' THEN '.jpg'
     WHEN pic.MimeType='image/png' THEN '.png'
     --ELSE '.gif'
  END 'Image_URL',
@URL + 'content/images/thumbs/' + FORMAT(ppm.PictureId, '0000000') + '_' + u.Slug +
CASE
     WHEN pic.MimeType='image/jpeg' THEN '.jpeg'
     WHEN pic.MimeType='image/pjpeg' THEN '.jpg'
     WHEN pic.MimeType='image/png' THEN '.png'
     --ELSE '.gif'
  END 'Image_Thumnail_URL'

  from UrlRecord U
  join Product_Picture_Mapping PPM ON u.EntityId=ppm.ProductId
    join Product p on ppm.ProductId=p.Id
      join Picture pic on PPM.PictureId=pic.Id
        where u.EntityName='Product' and u.IsActive=1
          order by p.Id




Result:


Hope this helps.
7 years ago
Sorry I missed query result images in previous post.

Query Result:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.