Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Templates, Stylesheets, Page Layout / Can I use <img>tags in a description of a product (or how could i make this possible?

Can I use <img>tags in a description of a product (or how could i make this possible?

5 Feb 2017, 12:15 AM
#1
elvinhaak avatar

elvinhaak

New Zenner

Join Date:
Jan 2017
Location:
nearGoes Netherlands
Posts:
6
Plugin Contributions:
0

Post #1 by elvinhaak

Hi,
I'm pretty new to Zen Cart and I am setting up a local server and a startup-site at https://www.elfiets.xyz
This is with a whole big cart in another system, and actually I used the download here to put it into Dutch instead of English.
Sometimes this makes it difficult to find things and I believe some settings are not existing in the admin-tool but should be able to do directly in the database of course.
The old site is made in an old version of PHP and mysql and the hoster has shut down that versions so that all the scripts are not working anymore and so I'm kind of stuck with half a site so I'm now making a transition to Zen. I made a transsition-site on https://www.elfiets.nl with a large product list, but even that won't work anymore when updating to php 5.5...

My question: in the old site I'm translating there are 1000-s of articles that have a lot of linked images in it. In the database this is written something like which is translated to the right image and sub-image. This is besides the normal image that is related to the product.
I have seen that it should be possible to use the automatic display of pictures that have about the same name but the linked images can be entirely different place and name.
So, it would be helpfull if I could use some image-tags to point and display the image directly from the database (product-tables).

Is this possible somehow?

As you can see, I tried it but it shows up as regular text:
http://www.elfiets.xyz/index.php?main_page=product_info&cPath=1000_1100_1101&products_id=181

5 Feb 2017, 9:51 AM
#2
elvinhaak avatar

elvinhaak

New Zenner

Join Date:
Jan 2017
Location:
nearGoes Netherlands
Posts:
6
Plugin Contributions:
0

Post #2 by elvinhaak

To make clear:
the images that are shown in the old store (in a field in a table in the form of text with this kind of image-tags) are extra explanations.
So, sometimes they are in the middle of a sentence and are linked in the right order (so, first do this (picture), then do that (picture), then that (picture) and to finish (picture), sometimes they are extra pictures belonging to only one article (like the left side of a lamp instead of the front), sometimes they are the explanation for how to measure things like a bolt or screw.
In that last case, a lot of articles are showing the same picture.

in ZEN-cart, the last two things could be done with putting them into product-types and putting extra images with same filename to the article (although sometimes there would be double pictures ), but this cannot be done with auto-translation (in scripts in the temperary site), but the first thing (explaining the order with text) is only possible with these kind of tags I think.

5 Feb 2017, 10:07 AM
#3
elvinhaak avatar

elvinhaak

New Zenner

Join Date:
Jan 2017
Location:
nearGoes Netherlands
Posts:
6
Plugin Contributions:
0

Post #3 by elvinhaak

The field containing these links would be products_description since the whole text with the images is in one field in the original database.

mainly 3 things this way:
a) telling in which order things can be done.
for example first release screw (picture), then open (picture), then read (picture)
b) just simple extra pictures (sideview of a light instead of just front)
c) big explaination for measurement for a whole number of articles (can be in different categories in the shop)

I need to make some translation-script (write it in php, probably in the local temperary server) so i can make some adjustments

5 Feb 2017, 10:51 AM
#4
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Post #4 by website_rob

elvinhaak:

Hi,
I'm pretty new to Zen Cart and I am setting up a local server and a startup-site at www.elfiets.xyz
This is with a whole big cart in another system, and actually I used the download here to put it into Dutch instead of English.
Sometimes this makes it difficult to find things and I believe some settings are not existing in the admin-tool but should be able to do directly in the database of course.
The old site is made in an old version of PHP and mysql and the hoster has shut down that versions so that all the scripts are not working anymore and so I'm kind of stuck with half a site so I'm now making a transition to Zen. I made a transsition-site on www.elfiets.nl with a large product list, but even that won't work anymore when updating to php 5.5...

My question: in the old site I'm translating there are 1000-s of articles that have a lot of linked images in it. In the database this is written something like which is translated to the right image and sub-image. This is besides the normal image that is related to the product.
I have seen that it should be possible to use the automatic display of pictures that have about the same name but the linked images can be entirely different place and name.
So, it would be helpfull if I could use some image-tags to point and display the image directly from the database (product-tables).

Is this possible somehow?

As you can see, I tried it but it shows up as regular text:
http://www.elfiets.xyz/index.php?main_page=product_info&cPath=1000_1100_1101&products_id=181

Yes, you can do what you are asking but in this case "/images/ELF_Articles/no4.jpg" is an invalid path which is why no image.

There is a module Easy Populate that you will find helpful in what you are trying to accomplish. It allows you to use a Spreadsheet to setup many things then upload the Spreadsheet to enter the information into the database. Saves having to do one Product at a time. Will take so time and testing to learn it but well worth the effort.

Welcome to Zen Cart.

The learning is in the doing.

Potent Products

5 Feb 2017, 12:41 PM
#5
elvinhaak avatar

elvinhaak

New Zenner

Join Date:
Jan 2017
Location:
nearGoes Netherlands
Posts:
6
Plugin Contributions:
0

Post #5 by elvinhaak

Thanks for your reaction.

In the table, in table product_description, field product_description is written:

Dit is een testartikeltje in de aandrijving. Zal dit werken?
<img>/images/ELF_Articles/no4_.jpg</img><br><br><IMG>
ELF_Articles/no4_.jpg</IMG>

and when I look it up, the image is showing up with the URL:
https://www.elfiets.xyz/images/ELF_Articles/no4_.jpg

I did some renaming and I'm sure as you can see the image is there.

So what am I overlooking? Probably something quite simple.
I tried to rename the ELF_Articles-folder into ELFArticles but that didn't help eather.

I will try the Easy Populate module after I have this working... it might be very helpfull

5 Feb 2017, 1:07 PM
#6
elvinhaak avatar

elvinhaak

New Zenner

Join Date:
Jan 2017
Location:
nearGoes Netherlands
Posts:
6
Plugin Contributions:
0

Post #6 by elvinhaak

Trying out further and further, I found out that a direct complete html-code works (thus not like in forums and in my old site).
Like:
<img src="/images/ELF_Articles/no4_.jpg">

Will I get problems (security for example) if I fill the database with these codes without further escaping and such?

5 Feb 2017, 2:01 PM
#7
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,156
Plugin Contributions:
56

Post #7 by lat9

elvinhaak:

Trying out further and further, I found out that a direct complete html-code works (thus not like in forums and in my old site).
Like:
<img src="/images/ELF_Articles/no4_.jpg">

Will I get problems (security for example) if I fill the database with these codes without further escaping and such?
No security-related issues, but to ensure that you are generating valid HTML, you must include the alt-tag:

<img src="/images/ELF_Articles/no4_.jpg" [B]alt="textual description of the image"[/B]>
5 Feb 2017, 4:14 PM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #8 by mc12345678

Also be sure to use the lower case version of the img tag: <img> not <IMG> and generally speaking should also "close" the tag: ```
<img />

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

5 Feb 2017, 5:22 PM
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,156
Plugin Contributions:
56

Post #9 by lat9

Whether you close the tag depends on your template; if you're using an HTML5 template, then closing the img tag is not required.

10 Feb 2017, 7:24 AM
#10
elvinhaak avatar

elvinhaak

New Zenner

Join Date:
Jan 2017
Location:
nearGoes Netherlands
Posts:
6
Plugin Contributions:
0

Post #10 by elvinhaak

Thanks!
I'm going to use this way. Currently in proces of checking and where needed changing the existing url's... lots of work.

14 Feb 2017, 5:08 PM
#11
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Post #11 by schoolboy

This is basic HTML path structuring - not a zencart issue - so you look like you need to familiarise yourself with the basic HTML protocols of setting absolute and relative paths to whatever resource you are trying to parse.

Essentially, you can fill your textual inputs with almost any "standard" html and it will render faithfully in the browser. But there are considerations of course, and these relate to rendering remote content (is the remote server reliable) to things like pagespeed, http vs https ...

Far better to have all images on the same server as your site.

20 years a Zencart User

14 Feb 2017, 9:04 PM
#12
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #12 by mc12345678

elvinhaak:

Thanks!
I'm going to use this way. Currently in proces of checking and where needed changing the existing url's... lots of work.
As noted earlier there are tools that can be used to make changes to many items/product at one time instead of one-at-a-time.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...