Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hey guys so I'm new to couch and php too so bear with me. Basically I've got an old site using a very old js plugin called simple cart it may be outdated but does the job and my client does not want it changed.

Anyways so I've made a structure like this:

Code: Select all

<cms:editable name="booking_item" label="Booking item" type="group" />
     
   
<h3><cms:editable
name='course_month'
label='Month'
desc='Enter month name'
                  group='booking_item'
type='text'>Example month</cms:editable></h3>


<div class="simpleCart_shelfItem">
       
  <p class="item_name">
     
      <cms:editable
name='course_info'
label='Course info'
desc='Enter course info'
                    group='booking_item'
type='text'>Example course information
     
      </cms:editable></p>
     
     
   
   
  <span class="item_price">
     
    <cms:editable
name='course_price'
label='Course price'
desc='Enter price'
                  group='booking_item'
type='text'>£0</cms:editable> 
     
     </span>
     
     
<a style="font-size: 15px;" class="item_add" href="javascript:;"> Book now </a>
 
</div>   
   



But what I'd like to do is make this is a repeatable region, I tried using the 'repeatable' code to no avail and I have a feeling this could be because of the mixed in HTML (that needs to stay there) but not entirely sure.

I also tried duplicating the group (changing the name as well) but that wound up with me only being able to expand one 'booking item' group CMS side - so that was no good either!

Finally general total beginner question.. is there a way I could just create that whole editable region not within the page and then plug in simply something like <cms:show booking_item /> ?


Hi, ponder and welcome!

Let me try to throw in something here.
Basically, your structure looks like this (this is intentionally simplified and is not a working code!)
<h3><cms:editable name='course_month' >Example month</cms:editable></h3>
<cms:editable name='course_info'>Example course information</cms:editable>
<cms:editable name='course_price'>£0</cms:editable>
<a> Book now </a>

Now, you have 3 constants, that you can reuse and show anywhere in the page with <cms:show .. /> But they are always the same! You probably want to have them duplicated unlimited times (by the courses number) and display different content each time. It is absolutely possible.
In Couch this is called as clonable page. You already have your code under management of Couch, now it is called template. So go ahead and make your template clonable with adding clonable='1' close to it's name.
Save it and revisit it in browser as superadmin to let Couch see the setting and adapt to changes.

Since that, you are free to create unlimited pages in admin, and specify different info for each course, month and price in every created page under this clonable template in admin panel.
When you done with samples, try this in the body of your file:
Code: Select all
<cms:pages>
<h3><cms: show course_month /></h3>
<p> <cms:show course_info /></p>
<p> <cms:show course_price />  </p>
<a> Book now </a>
</cms:pages>

And this working code will be repeated as many times, as many you have specified clonable pages in admin area. Of course, you are free to add any html and simple cart to style your data.
Let me know if this is what you desired.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
2 posts Page 1 of 1