Problems, need help? Have a tip or advice? Post it here.
10 posts Page 1 of 1
Hi

I have a requirement where I need to have some text content of the page which is editable (Regular richtext), however I also need this page to be clonable as it has a gallery with thumbnails which take the user to a different page.

The problem is when I declare the page as clonable the editable text part automatically becomes a part of the gallery.

Is there way to separate the 2
Hi :)

One way would be to declare the richtext region in a separate non-clonable template (e.g. the 'global' template used in the tutorial - http://docs.couchcms.com/tutorials/port ... bal-values).

Hope it helps.
Hi

I created the global template, however now there are 2 peculiar challenges.

Challenge 1

I have made the global template clonable, because I want a single page where the users can enter the product description & the image.

Now I need the product description & the image to be fetched according to a particular variable in the page. I have set a separate editable text field in the clonable template by the name of ID.So if the page id is 1 then display the description & image for 1 if its 2 then display for 2. However I have not been able to work that out. My code is given below

----------------------------------------x------------------------------------------
<cms:if prodID= '1' >

<cms:get_custom_field 'product_description' masterpage='productsdesc.php'/>
<cms:else />

<cms:if prodID= '2' >

<p class="text-justify"><cms:get_custom_field 'product_description' masterpage='productsdesc.php'/>

</cms:if>
</cms:if>

---------------------------------------------x--------------------------------------

Challenge 2

My page layout is such that the product description & the photo are on the top of the page and the thumbnails of the sub products (which I have defined as clonable) at the bottom in a gallery format.

When I click on the thumnail of the gallery it displays the sub product details however the top part of the page ( the main product photo & description taken from the global) remain right there. I do not want this to happen.

Is there a solution...
Hi, take a look - maybe a particular gallery of subproducts (with info and thumbs) can be assigned to each main product - the easy way:
viewtopic.php?p=16293#p16293
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
The product details I am putting on the top is just general information, all I want is to not show that part when the inner page of the gallery shows up.
Alok, I don't think we are able to grasp your use-case properly.

Could you please post some screenshots (or wireframe, mockups) showing exactly how want things to look like?

Thanks.
Firstly the second challenge has got resolved, I used the if else condition & the ignore tag.

Now the first one.

To put it in simple terms, I got 2 page

product.php (this page is clonable and has the product gallery)

in this page I needed a editable region (text & image) on the top of the gallery. For this part I declared these details in a separate template productsdesc.php

__________ Code of productdesc.php -------------------------------------
Code: Select all
<?php require_once'cp/cms.php'; ?>

<cms:template title='Product Description' executable='0' clonable = '1'>
   <cms:editable
      name='product_img'
      label='Image'
      desc='Upload product photograph'
      width='540'
      height='379'
      show_preview='1'
      preview_height='100'
      type='image'
   />
   
   <cms:editable
      name='product_description'
      label='Product Description'
      height='100'
      type='richtext'
   />      
   
   <cms:editable
      name='catg_titlename'
      label='Category Name'
      type='text'
   />   
               
</cms:template>

--------------------------------------------------------------------------

Now in the products.php page I need to pull the details from the productdesc.php & display them. For this I used the following code.

<cms:get_custom_field 'catg_titlename' masterpage='productsdesc.php'/>
<cms:get_custom_field 'product_description' masterpage='productsdesc.php'/>

I need to pull a field from a specific page in the template & display it.

Why I need this is because I have multiple products page and I cannot keep on make non clonable productdesc template for each of them.
@alokk2700, i have put [code] tag around your source to make it look better.

productsdesc.php is a clonable template, and in this case you must also provide a page name, which will be the data source of editable.
<cms:get_custom_field var='content' masterpage='blog.php' page='my_test_page' /


Also, you say:
I have multiple products page and I cannot keep on make non clonable productdesc template for each of them.

I see no need to make a non-clonable template for each product, because you can add more editable fields for each product in product.php. Why it wouldn't work this way?
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
Thanks a ton trendoman, it was so simple... Couch really makes it easy... :D
trendoman wrote: @alokk2700, i have put [code] tag around your source to make it look better.

productsdesc.php is a clonable template, and in this case you must also provide a page name, which will be the data source of editable.
<cms:get_custom_field var='content' masterpage='blog.php' page='my_test_page' /


If there is only one "my_test_page" I called this page "index", so will be clear that is a "global" field.
10 posts Page 1 of 1