Problems, need help? Have a tip or advice? Post it here.
9 posts Page 1 of 1
I want to have a product list page which can be handled by couch admin.

I tried following the portfolio tutorial, but it got so confusing when it came to which page he was coding on. I ONLY want a list view of the products, i don't need a single page for reach of them.
There will be around 10 folders (categories) on one page.
I got a lot of dirty code at the moment, i've managed to make the admin panel thing,
This is my product.php file:
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<?php include('templates/header.php'); ?>

   <cms:template title="Produkter" clonable="1">
      <cms:editable name='Bilde'
         type='image'
         desc='Last opp et bilde av produktet her'
      />
      
      <cms:editable name='Informasjon'
         type='text'
      />
      
      <cms:editable name='Mer_info'
         type='text'
         desc='Link til mer informasjon om produktet'
      />
      
      <cms:editable name='Brukermanual'
         type='text'
         desc='Link til mer brukermanual til produktet'
      />
      <cms:folder name='ambulanse_baarer' title='Ambulanse bårer' />
   </cms:template>


   <cms:folders>
      <h1><cms:show k_folder_title/></h1>
      
      <section id="content">
         <article class="produkter">
            <a href=""><img src="<cms:show Bilde/>" alt="" /></a>
            <h2><cms:show k_page_title /></h2>
            <p><cms:show Informasjon /></p>
            <a class="readMore" href="<cms:show Mer_info />">Informasjon</a>
            <a class="manual" href="<cms:show Brukermanual />">Informasjon</a>
         </article>
      </section>
   </cms:folders>
   
   <div class="clearLeft"></div>
   <?php include('templates/footer.php') ?>
</body>
</html>
<?php COUCH::invoke(); ?>
hi Morgan, this is an example of the code I routinely use for a listing of the contents of folders/categories with sub-navigation on the page by folder/category.

The template:

Code: Select all
<cms:template title='Recordings' clonable='1' dynamic_folders='1' >
add whatever editable regions you need.

The folder navigation:

Code: Select all
<cms:set folder_count='0' />
<ul class="tabs clearfix">
<cms:set current_folder=k_folder_name />
   <cms:folders depth='1' orderby='weight' >           
      <cms:incr folder_count '1' />
      
      <cms:if folder_count=='1'><cms:set first_folder=k_folder_name 'global' /><cms:set folder_title=k_folder_title 'global' /><cms:set folder_desc=k_folder_desc 'global' /></cms:if>
      <cms:if k_is_home><cms:set current_folder=first_folder 'global' /></cms:if>
   <li>
      <a <cms:if k_folder_name==current_folder>class="current"</cms:if> href="<cms:show k_folder_link />" > <cms:show k_folder_title /></a>

      </li>
</cms:folders>
</ul>


and the listing

Code: Select all
<cms:if k_is_home><cms:set folder_name=first_folder /><cms:else /><cms:set folder_name=k_folder_name /><cms:set folder_title=k_folder_title /><cms:set folder_desc=k_folder_desc 'global' /></cms:if>

<cms:if k_is_list||k_is_home > 
   <ul class="data-listing clearfix">   
   <cms:pages masterpage="recordings.php" folder=folder_name include_subfolders='0' orderby='page_title, publish_date' order='asc, desc'>
       <li>
       
       
       ... show your data here ....
       
       
      </li>
   </cms:pages>
   </ul>
</cms:if>   


Hope it is helpful!
Thank you! I'm very new to php and this type of things (I'm mainly a front-end-dev) so doing this as freelance is quite difficult. Also, I am interested in buying the license, but do I need to provide a domain right away? As my client has some troubles with transferring his domain to his new host, hence I've been developing on the free version. Is there anything that'll break once I move from free to paid service?

Again, thank you for your assistance, I'm looking forward to check out the method. Just a future tip for the tutorials, maybe be clearer with which file is being coded in, and not use images to show the code, but a code block with line-numbers instead would be more helpful (just an idea from my point of view as someone new to this). I've been experimenting with several different CMS's and this is the one that I really found easy to use and flexible. Great work from the developers!

EDIT: In your code, how many files do you have? Could you please explain if you use only 1 file? or several ones such as a snippet file in the couch folder (products_list.html)?
Thanks for the suggestions, Morgan.
Will definitely keep those in mind for the future (in fact, if you see the later tutorials, they give the actual code rather than images).

Replying to your queries -
I am interested in buying the license, but do I need to provide a domain right away?
License is transferable so no problems if you buy a license with a different domain name.

Is there anything that'll break once I move from free to paid service?
No difference in the paid and free product except for the link requirement (and even that is configurable).

Hope this helps.
KK wrote: Thanks for the suggestions, Morgan.
Will definitely keep those in mind for the future (in fact, if you see the later tutorials, they give the actual code rather than images).

Replying to your queries -
I am interested in buying the license, but do I need to provide a domain right away?
License is transferable so no problems if you buy a license with a different domain name.

Is there anything that'll break once I move from free to paid service?
No difference in the paid and free product except for the link requirement (and even that is configurable).

Hope this helps.

It does help :)

it also says some 3 months of support. Does this include assistance of the query I got above? As in someone in support like helps me setup the page like I want? Or would this be something I need to hire you to do? As I said, I'm new to this back-end stuff, and so the logic can be a little difficult for me to get. As the above answered reply to my question, am not even sure which files we're speaking off.. I am grateful of all help, just I need it in with a teaspoon :)

Thanks for all posts. Appreciate it!
potato wrote: hi Morgan, this is an example of the code I routinely use for a listing of the contents of folders/categories with sub-navigation on the page by folder/category.

The template:

Code: Select all
<cms:template title='Recordings' clonable='1' dynamic_folders='1' >
add whatever editable regions you need.

The folder navigation:

Code: Select all
<cms:set folder_count='0' />
<ul class="tabs clearfix">
<cms:set current_folder=k_folder_name />
   <cms:folders depth='1' orderby='weight' >           
      <cms:incr folder_count '1' />
      
      <cms:if folder_count=='1'><cms:set first_folder=k_folder_name 'global' /><cms:set folder_title=k_folder_title 'global' /><cms:set folder_desc=k_folder_desc 'global' /></cms:if>
      <cms:if k_is_home><cms:set current_folder=first_folder 'global' /></cms:if>
   <li>
      <a <cms:if k_folder_name==current_folder>class="current"</cms:if> href="<cms:show k_folder_link />" > <cms:show k_folder_title /></a>

      </li>
</cms:folders>
</ul>


and the listing

Code: Select all
<cms:if k_is_home><cms:set folder_name=first_folder /><cms:else /><cms:set folder_name=k_folder_name /><cms:set folder_title=k_folder_title /><cms:set folder_desc=k_folder_desc 'global' /></cms:if>

<cms:if k_is_list||k_is_home > 
   <ul class="data-listing clearfix">   
   <cms:pages masterpage="recordings.php" folder=folder_name include_subfolders='0' orderby='page_title, publish_date' order='asc, desc'>
       <li>
       
       
       ... show your data here ....
       
       
      </li>
   </cms:pages>
   </ul>
</cms:if>   


Hope it is helpful!

I gotten around to work with this, only problem I got is that, only the first folder's visible, I'd like to have all folders opened. Is this possible? I'm trying to see how that would work, but with no luck...
First off, sorry for all the double posting etc.
So, after the help I've come much longer! Though I'm still 60% of where I want to be.

Currently my setup looks like this
1.png
How it currently looks like.
1.png (31.14 KiB) Viewed 6293 times

As you can see, all my folders are being listed as it's own list, and then the products of the first folder is displayed.
---
What I am looking for is having my products.php page showing all folders (without being linked (as in I don't want to access the folder itself on a new page) and all products underneath their respective folder. like this
2.png
How I want the products displayed. Show all folders, and their products beneath their folder
2.png (34.59 KiB) Viewed 6293 times

---
Code for current setup:
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Produkter' clonable='1' dynamic_folders='1'>
   
   <cms:editable name='Bilde'
      type='image'
      desc='Bilde av produktet'
   />
   
   <cms:editable name='Produkt'
      type='text'
      desc='Produktnavn'
   />
   <cms:editable name='Informasjon'
      type='text'
      desc='Beskrivelse av produkt'
   />
   
   <cms:editable name='Mer_info'
      type='text'
      desc='Link til mer informasjon om produktet'
   />
   
   <cms:editable name='Brukermanual'
      type='text'
      desc='Link til mer brukermanual til produktet'
   />
               
</cms:template>
<?php include('templates/header.php'); ?>

<cms:set folder_count='0' />
<ul class="tabs width100">
<cms:set current_folder=k_folder_name />
   <cms:folders depth='1' orderby='weight' >           
      <cms:incr folder_count '1' />
     
      <cms:if folder_count=='1'><cms:set first_folder=k_folder_name 'global' /><cms:set folder_title=k_folder_title 'global' /><cms:set folder_desc=k_folder_desc 'global' /></cms:if>
      <cms:if k_is_home><cms:set current_folder=first_folder 'global' /></cms:if>
   <li class="width100">
      <a <cms:if k_folder_name==current_folder>class="current"</cms:if> href="<cms:show k_folder_link />" id="<cms:show k_folder_title />" style="background:url('<cms:show k_folder_image />');" > <cms:show k_folder_title /></a>

      </li>
      <li class="width100">
         <cms:if k_folder_name==current_folder><cms:show k_folder_desc /></cms:if>
      </li>
</cms:folders>
</ul>
<cms:if k_is_home><cms:set folder_name=first_folder /><cms:else /><cms:set folder_name=k_folder_name /><cms:set folder_title=k_folder_title /><cms:set folder_desc=k_folder_desc 'global' /></cms:if>

<cms:if k_is_list > 
   <ul class="produktListContainer">   
      <cms:pages masterpage="products.php" folder=folder_name include_subfolders='0' orderby='page_title, publish_date' order='asc, desc'>
         <li class="produkter">
            <a href="#"><img src="<cms:show Bilde />" alt="<cms:show Produkt />"/></a>
            <h1><cms:show Produkt /></h1>
            <p><cms:show Informasjon /></p>
            <a class="readMore" href="<cms:show Mer_info />">Informasjon</a>
            <a class="manual" href="<cms:show Brukermanual />">Brukermanual</a>
         </li>
      </cms:pages>
   </ul>
</cms:if> 
<div class="clear"></div>
<?php include('templates/footer.php'); ?>

<?php COUCH::invoke(); ?>
Hi Morgan,

The example image was very helpful - I think the following is what you are aiming for:
Code: Select all
<cms:folders>
    <cms:if k_folder_pagecount>
        <h2><cms:show k_folder_title/></h2>

        <cms:pages folder=k_folder_name>
            <cms:if k_paginated_top>
                <ul class="produktListContainer">
            </cms:if>

            <li class="produkter">
                <img src="<cms:show Bilde/>" alt="<cms:show Produkt/>"/>
                <h1><cms:show Produkt/></h1>
                <p><cms:show Informasjon/></p>
                <a class="readMore" href="<cms:show Mer_info/>">Informasjon</a>
                <a class="manual" href="<cms:show Brukermanual/>">Brukermanual</a>
            </li>

            <cms:if k_paginated_bottom>
                </ul>
            </cms:if>
        </cms:pages>
    </cms:if>
</cms:folders>
Do let us know if you have any questions.
cheesypoof, thank you so much for the assistance! Just ran the code and whats generated looks exactly like what I am looking for. Again, thank you everyone for the help!
9 posts Page 1 of 1