CMS Made Simple Forums
https://forum.cmsmadesimple.org/

[SOLVED] Products module / no images?
https://forum.cmsmadesimple.org/viewtopic.php?f=7&t=69654
Page 1 of 1

Author:  thomahawk [ Thu Mar 13, 2014 9:44 am ]
Post subject:  [SOLVED] Products module / no images?

I just installed CMSMS 1.11.10 and the Products module 2.20.1

First thing I try, add a product. Now there is no possibility to include an image which can be used small in listings, big in detail view. No field for a product image.

In setting it says: "Image processing functions are deprecated and will be removed in a future version. Use CGSmartImage for inline image processing." (Nevertheless, there are Settings for Images.)

I installed CGSmartImage, but still no entry field for a product image appears in the "add product" form.

What surprises me is, no one seems to have a problem with that, I can not find any post asking about how to make this work. And nothing about this in help either.

Who can lead me into the right direction here?

Or should I use another solution? I just want a product list, maybe 2-3 categories) and product detail view. Add to cart, Cart view and then a simple form for the address, who sends the order as an email, no real checkout/payment process.

I first tried the Articles 0.1.3 module, but its faulty, did not even show any entry fields in "add product".

Thanks in advance for any help.
Thom

Author:  velden [ Thu Mar 13, 2014 11:09 am ]
Post subject:  Re: Products module / no images?

Just installed the module to check.

Think you need to add a Field Definition of type image.

And then when you add the product there's a tab 'Fields' where you can upload your image.

In templates you can use CGSmartImage to create a thumb of the image.

Author:  thomahawk [ Thu Mar 13, 2014 1:55 pm ]
Post subject:  Re: Products module / no images?

Once again, velden raides to the rescue. Thank you!

Well, I have the image entry now under fields. So thats fine. But display it in the frontend, I could not. It appears in detail view, but not in the summary - which should be a products listing.

I took over this code which displays it in detail view
<img src="{$entry->file_location}/{$field->thumbnail}" alt="{$field->value}"/>

but its not working in the summary:

In detail view it displays correctly
...uploads/Products/product_3/thumb_resizedimage300417-Titel2010.jpg

In summary the links is not complete
...uploads/Products/product_3/

Is this an issue with Pretty URL? My first thought. But then, why does it work in detail view?

Author:  velden [ Thu Mar 13, 2014 3:49 pm ]
Post subject:  Re: Products module / no images?

I don't know which fields are available in the summary action but you should note that the $field variable comes with a foreach loop:

\$1:
{foreach from=$entry->fields key='name' item='field'}


You could try to use the foreach loop code from detail template or use it directly

\$1:
<img src="{$entry->file_location}/{$entry->fields.IMAGEFIELDALIASIDONTKNOW->thumbnail}" alt=""/>


If you don't know what fields are available try:

\$1:
<pre>{$entry|print_r}</pre>

\$1:
<pre>{$entry->fields|print_r}</pre>

etc
Adding {debug} at top of summary template can be helpful too

Author:  thomahawk [ Fri Mar 14, 2014 8:23 am ]
Post subject:  Re: Products module / no images?

Thank you velden, this did it:

<img src="{$entry->file_location}/{$entry->fields.produktbild->thumbnail}" alt=""/>

Author:  Rolf [ Fri Mar 14, 2014 11:47 am ]
Post subject:  Re: Products module / no images?

thomahawk \thomahawk:
Thank you velden, this did it:

<img src="{$entry->file_location}/{$entry->fields.produktbild->thumbnail}" alt=""/>
but that is the functionality that is deprecated like you mentioned in the first post... So will be removed in a next release! Use CGSI instead.

Author:  velden [ Fri Mar 14, 2014 1:11 pm ]
Post subject:  Re: [SOLVED] Products module / no images?

I don't think you get the complete picture.

I THINK that "Image processing functions" means the functions that e.g. make a thumbnail version of the original image. It makes sense from CG's perspective to NOT implement those functions in each and every module.

Probably (remember: I don't know this module) there's a {$entry->fields.produktbild->value} too.

Then you can use CGSmartImage in your template(s) to create the thumbnail:

{CGSmartImage src1={$entry->file_location} src2={$entry->fields.produktbild->value} filter_xxx...} (read CGSmartImage help for all the options). That gives you much more flexibility. You can use different thumbnail sizes for every template, watermark images, everything CGSmartImage supports.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/