Page 1 of 1
Product Manager with Image Gallery
Posted: Tue Nov 29, 2016 5:42 pm
by Edwin_IandD
This might already been posted, but I've tried every possible search I can think of and cannot find the answer here or on Google.. So my apologies if this is already been discussed and answered, but I am really stuck.
I am working on a e-commerce site for an artist who would like to sell her paintings online. Obviously the pictures are the main feature on this site, so I need to showcase them nicely.
I've been struggling with the different e-commerce extensions and I think I have them doing more or less what I want (not always 'simple' this CMSMS..), except for one thing:
I would like to show my products (i.e. paintings) in an image gallery as attached. Each thumbnail then needs to go to a details page where a customer can select the size of a print and add it to the basket (also as attached).
Whatever I am trying I cannot seem to get a picture to show up in the Product Manager, let alone generate a gallery like look.
It would be great if anybody could explain how to do this..
Re: Product Manager with Image Gallery
Posted: Tue Nov 29, 2016 7:56 pm
by Rolf
Something like this?
https://buispost.eu/image-library&tag=lamson
http://www.cmscanbesimple.org/blog/buil ... ade-simple
Just an example, there are dozens of methods to build something like this...
Re: Product Manager with Image Gallery
Posted: Tue Nov 29, 2016 11:00 pm
by velden
What is your main problem? Can't get the image shown at all?
Example part of a summary template from one of my websites:
Code: Select all
<ul class="products">
{foreach from=$items item=entry}
...
<img width="710" height="710" src="{CGSmartImage src1=$entry->file_location src2=$entry->fields.afbeelding->value filter_resizetofit='710,710,#ffffff' notag=1}" class="" alt="" />
...
{/foreach}
</ul>
Of course the Products Manager has an field definition defined with the name 'afbeelding'.
CGSmartImage is used to optimize the image for my purpose.
Re: Product Manager with Image Gallery
Posted: Wed Nov 30, 2016 10:45 am
by Edwin_IandD
Hello all,
Thanks for your replies so far. It seems like I was looking in the wrong directions and I never would have thought about using the CGSmartImage module with the Products module.
I'll have a good read through the
http://www.cmscanbesimple.org/blog/buil ... ade-simple article and give it an other go.
I was getting a bit desperate as CMSMS has always been like playing with Lego for me, just adding whatever module I needed and so far it always worked out.. This is going to be the first e-commerce site I am doing in CMSMS (used OpenCart before <- horrible to work with!) and I was hopeful it would be just as much fun! I am a bit more positive now an will give it another go!
Thanks again!
Re: Product Manager with Image Gallery
Posted: Mon Jan 16, 2017 3:09 pm
by Edwin_IandD
Hello all,
I got this to work, really well - but now I am in trouble with my next step..
I would like my Cart2 'viewcart' template to have a thumbnail for each item in the cart.
I have been messing around with this template:
Code: Select all
{* viewcartform template *}
<div class="viewcartform">
{* if the smarty variable orders_simpleviewcart is not set,
then don't provide a form for adjusting quantities
*}
{if !isset($cartitems) || count($cartitems) == 0 }
<div class="alert alert-warning">Your cart is empty</div>
{else}
{if isset($formstart) && !isset($orders_simpleviewcart)}{$formstart}{/if}
{$cartitems|print_r}
<table class="table" width="100%">
<thead>
<tr>
<th></th>
<th>{$Cart2->Lang('summary')}</th>
<th>{$Cart2->Lang('quantity')}</th>
<th>{$Cart2->Lang('unit_price')}</th>
<th>{$Cart2->Lang('unit_discount')}</th>
<th>{$Cart2->Lang('total')}</th>
<th width="1%">{$Cart2->Lang('remove')}</th>
</tr>
</thead>
<tbody>
{foreach from=$cartitems item='oneitem'}
<tr>
<td><img src="{CGSmartImage src=$oneitem->file_location src2=$oneitem->Product_image filter_watermark=1 notag=1}" class="w3-image" alt="" /></td>
<td>{$oneitem->summary}</td>
<td>
{if $oneitem->type != 1 || !isset($oneitem->quantity_box)}
{$oneitem->quantity}
{else}
{$oneitem->quantity_box}
{/if}
</td>
<td>{$currencysymbol}{$oneitem->unit_price|number_format:2}</td>
<td>{$currencysymbol}{$oneitem->unit_discount|number_format:2}</td>
<td>{$currencysymbol}{$oneitem->item_total|number_format:2}</td>
<td>{if isset($oneitem->remove_box)}{$oneitem->remove_box}{/if}</td>
</tr>
{/foreach}
</tbody>
<tfoot>
<tr>
<td colspan="5" align="right">{$Cart2->Lang('total_weight')}:</td>
<td>{$cartweight|number_format:2}{$weightunits}</td>
<td></td>
</tr>
<tr>
<td colspan="5" align="right">{$Cart2->Lang('subtotal')}:<br>
<em>({$Cart2->Lang('infosubtotal')})</em>
</td>
<td>{$currencysymbol}{$carttotal|number_format:2}</td>
<td></td>
</tr>
{if isset($formstart) && !isset($orders_simpleviewcart)}
<tr>
<td colspan="7">
<input type="submit" name="{$submit_name}" value="{$submit_text}"/>
<input type="submit" name="{$actionid}cart_empty_cart" value="{$Cart2->Lang('empty_cart')}"/>
</td>
</tr>
{/if}
</tfoot>
</table>
{if isset($formstart) && !isset($orders_simpleviewcart)}{$formend}{/if}
{/if}
</div>
This should work as far as I can imagine, but for some reason it doesn't... Any ideas?
Thanks a lot,
Ed
Re: Product Manager with Image Gallery
Posted: Mon Jan 16, 2017 3:30 pm
by velden
Try
somewhere inside the foreach loop to see what's available.
Re: Product Manager with Image Gallery
Posted: Mon Jan 16, 2017 4:56 pm
by Edwin_IandD
Thanks for the tip. I had already tried that and thought that I was using everything the way it should...
This is what came out of the print_r:
Code: Select all
stdClass Object
(
[source] => Products
[product_id] => 6
[sku] => 002_copy3_copy4-1
[quantity] => 1
[base_price] =>
[type] => 1
[estimated] =>
[pending] =>
[unit_weight] => 1
[unit_price] => 19
[summary] => Copy Of Copy Of Test23: A5
[item_total] => 19
[subscription] =>
[allow_quantity_adjust] => 1
[allow_remove] => 1
[unit_discount] => 0
[parent] => -1
[net_unit_price] => 19
[file_location] => http://www.thisnewwebsite.com/newdesign/uploads/Products/product_6
[flds] => Array
(
[Product_image] => stdClass Object
(
[id] => 2
[name] => Product_image
[prompt] => Product image
[type] => image
[options] => Array
(
)
[max_length] => 0
[value] => vase-fucshia.png
[fielddef_id] => 2
)
)
[categories] => Array
(
[0] => stdClass Object
(
[id] => 5
[name] => Bags & Cushions
[create_date] => 2017-01-04 12:01:05
[modified_date] => 2017-01-04 12:01:05
[value] =>
)
[1] => stdClass Object
(
[id] => 2
[name] => Glass & Ceramics
[create_date] => 2017-01-04 12:00:28
[modified_date] => 2017-01-04 12:00:28
[value] =>
)
[2] => stdClass Object
(
[id] => 4
[name] => Jewellery
[create_date] => 2017-01-04 12:00:54
[modified_date] => 2017-01-04 12:00:54
[value] =>
)
[3] => stdClass Object
(
[id] => 6
[name] => Murals & Interiors
[create_date] => 2017-01-04 12:01:17
[modified_date] => 2017-01-04 12:01:17
[value] =>
)
[4] => stdClass Object
(
[id] => 1
[name] => Oils
[create_date] => 2017-01-04 12:00:15
[modified_date] => 2017-01-04 12:00:15
[value] =>
)
[5] => stdClass Object
(
[id] => 3
[name] => Prints
[create_date] => 2017-01-04 12:00:43
[modified_date] => 2017-01-04 12:00:43
[value] =>
)
)
[quantity_box] =>
[remove_box] =>
)
1
So I cannot be that far off with my:
Code: Select all
<img src="{CGSmartImage src=$oneitem->file_location src2=$oneitem->Product_image filter_watermark=1 notag=1}" class="w3-image" alt="" />
Any ideas are welcome..
Re: Product Manager with Image Gallery
Posted: Mon Jan 16, 2017 5:06 pm
by velden
The idea is right there.
Code: Select all
stdClass Object
(
[source] => Products
...
[file_location] => http://www.thisnewwebsite.com/newdesign/uploads/Products/product_6
[flds] => Array
(
[Product_image] => stdClass Object
(
[id] => 2
...
[value] => vase-fucshia.png
Code: Select all
<img src="{CGSmartImage src=$oneitem->file_location src2=$oneitem->flds.Product_image->value filter_watermark=1 notag=1}" class="w3-image" alt="" />
Re: Product Manager with Image Gallery
Posted: Tue Jan 17, 2017 12:57 pm
by Edwin_IandD
That should work, shouldn't it.. But for some reason it doesn't all I am getting is this:
<img class="w3-image" src="" alt="">
The weird thing is that if I look at the values of
$oneitem->flds.Product_image->value and
$oneitem->file_location
This is what they are:
vase-fucshia.png <- which is correct
and
http://www.thisnewwebsite.com/newdesign ... b]Products[/b]/product_6
And this is actually incorrect.. Looking in the directory tree the
Productspart should be
_products
Unless this is somehow corrected later on somewhere by one of the modules.
Re: Product Manager with Image Gallery
Posted: Wed Jan 18, 2017 11:07 am
by Edwin_IandD
Anybody?

Re: Product Manager with Image Gallery
Posted: Wed Jan 18, 2017 11:30 am
by Rolf
My blog I posted before contains some code examples that work for me
Try first without CGSmartImage