• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Product Manager Summary Template with 3 Columns/Image
PostPosted: Fri Oct 19, 2012 3:57 am 
Offline
Forum Members
Forum Members

Joined: Tue Aug 02, 2011 5:00 am
Posts: 39
I have a client with an e-commerce site and he wanted to show 3 columns of products for a category display-each product with an image- that would then click through to the details page. I used this topic: http://forum.cmsmadesimple.org/viewtopic.php?f=7&t=63495 to add an image to each product (as a default image, not within the details editor), then googled smarty syntax and came up with this template:

Code:
{assign var='number' value=1}
{foreach from=$items item=entry}
{if isset($entry->categories)}
{foreach from=$entry->categories item='category'}
{if $number == 1}
<h3>{$category->name}</h3>
{/if}
{assign var='number' value=2}
{/foreach}
{/if}
{/foreach}

{foreach from=$items item=entry key=key}
   {*
     the summary template has access to custom fields via the $entry->fields hash
     and to categories via the $entry->categories array of objects.  Also
     attribute information is available via $entry->attributes.
     you should use the get_template_vars and the print_r modifier to see
     what is available
    *}
 
{capture name="column"}{math equation="x % 3" x=$key}{/capture}
{if $smarty.capture.column == "0"}
<table border="0" cellpadding="0" cellspacing="0" width="100%">
   <tr>
      <td width="33%" align="center" valign="middle">
        {foreach from=$entry->fields key='name' item='field'}
       {if $field->type == 'image' && isset($field->thumbnail)}
        <a href="{$entry->detail_url}"><img src="{$entry->file_location}/{$field->thumbnail}" alt="{$field->value}" border="0"/></a>
       {/if}
  {/foreach}

    <br />

<a href="{$entry->detail_url}">{$entry->product_name}</a>

</br />

Price: {$currency_symbol}{$entry->price|number_format:2}

  {* include the cart   *}
  {if isset($cart_module_tag)}
 
  {eval var=$cart_module_tag}
 
  {/if}

      </td>
{elseif  $smarty.capture.column == "1"}
      <td width="33%" align="center" valign="middle">
        {foreach from=$entry->fields key='name' item='field'}
       {if $field->type == 'image' && isset($field->thumbnail)}
        <a href="{$entry->detail_url}"><img src="{$entry->file_location}/{$field->thumbnail}" alt="{$field->value}" border="0"/></a>
       {/if}
  {/foreach}

    <br />

<a href="{$entry->detail_url}">{$entry->product_name}</a>

</br />

Price: {$currency_symbol}{$entry->price|number_format:2}
   
   {* include the cart   *}
  {if isset($cart_module_tag)}
 
  {eval var=$cart_module_tag}
 

  {/if}

      </td>
{elseif $smarty.capture.column == "2"}
      <td width="33%" align="center" valign="middle">
        {foreach from=$entry->fields key='name' item='field'}
       {if $field->type == 'image' && isset($field->thumbnail)}
        <a href="{$entry->detail_url}"><img src="{$entry->file_location}/{$field->thumbnail}" alt="{$field->value}" border="0"/></a>
       {/if}
  {/foreach}


    <br />

<a href="{$entry->detail_url}">{$entry->product_name}</a>

</br />

Price: {$currency_symbol}{$entry->price|number_format:2}
 
  {* include the cart   *}
  {if isset($cart_module_tag)}
 
  {eval var=$cart_module_tag}
 

  {/if}

      </td>
   </tr>
<tr colspan="3" height="20"></tr>
</table>
{/if}

{/foreach}

{if $smarty.capture.column != 2}
<!-- Close the table! -->
</tr></table>
{/if}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Product Manager Summary Template with 3 Columns/Image
PostPosted: Sat Oct 20, 2012 4:02 pm 
Offline
Power Poster
Power Poster

Joined: Thu Jan 11, 2007 9:16 pm
Posts: 260
Location: Colorado
This appears to be a great idea. Is there any way to view this or could you add a screenshot of how this appears?

Thanks,
Elkman


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Product Manager Summary Template with 3 Columns/Image
PostPosted: Sat Oct 20, 2012 4:25 pm 
Offline
Forum Members
Forum Members

Joined: Tue Aug 02, 2011 5:00 am
Posts: 39
Sure, it's on this test page right now:

http://wmwebdesigns.com/preparedness_zo ... products-1

Once the site is ready it will be moved, to a permanent URL, so I'm also including a screenshot if the above link doesn't work.
Attachment:
File comment: Screenshot
screenshot.jpg
screenshot.jpg [ 173.82 KiB | Viewed 3549 times ]


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Product Manager Summary Template with 3 Columns/Image
PostPosted: Sat Oct 20, 2012 5:17 pm 
Offline
Power Poster
Power Poster

Joined: Thu Jan 11, 2007 9:16 pm
Posts: 260
Location: Colorado
That's great. Thanks for the view. Going to try this over the weekend.

Elkman


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Product Manager Summary Template with 3 Columns/Image
PostPosted: Sat Oct 20, 2012 6:05 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 7966
Location: Fernie British Columbia, Canada
This is actually very simple with regular html, and css. The default uploads module has a template that does this.
Inline styling done just for example purposes.

Code:
<div>
  {foreach from=$items item='entry'}
  <div style="float: left; width: 32%;">
      {* the rest of the template stuff here *}
  </div>
  {/foreach}
  <div style="clear: both;">
</div>

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Product Manager Summary Template with 3 Columns/Image
PostPosted: Sat Oct 20, 2012 9:46 pm 
Offline
Forum Members
Forum Members

Joined: Tue Aug 02, 2011 5:00 am
Posts: 39
I haven't used the uploads module before-does it have to be installed in order for that template to work? That is a much simpler, less code-heavy way of accomplishing it and I'd like to use it. Thanks so much CalGuy!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting