Sep 07, 2008, 02:05 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Featured Product on Every Page via TV on Homepage-Template  (Read 1827 times)
0 Members and 1 Guest are viewing this topic.
ihsv
Jr. Member
*
Posts: 11


« on: Apr 25, 2007, 04:06 PM »

I'm currently developing a site for a client using ModX, and am relying heavily on Ditto for displaying news items, featured articles, products, etc.

I have a problem that I hope someone can help me out with.  I've spent the last two weeks searching the forums, reading the documentation, testing and re-testing, and I think it's safe to say I've reached an impasse. Smiley

The client wants to be able to choose one product that will be a "featured product", and will be displayed on the sidebar of every page (multiple templates) on the site.  The method that I'm using to achieve this is having a TV on the home-page template that grabs a list of all the products under the product folder, and displays them in a list so the client can simply scroll down the list and choose a product to be featured.  I'm simply using a @SELECT binding to grab the list, as well as the delimited list widget.

Here's the @SELECT statement:

Code:
@SELECT pagetitle, id FROM site_content WHERE parent = 14

Here's the Ditto call I'm using to display the Featured Product on the Homepage

Code:
[!Ditto? &parents=`14` &depth=`1` &extenders=`summary,tagging` &summarize=`1` &tpl=`FeaturedBookTemplate` &hiddenTVs=`FeatureBookChoice` &filter=`id,[*FeatureBookChoice*],1` !]
"FeatureBookChoice" is the name of the TV on the homepage template that the client selects from.

It works fine on the homepage template, but I cannot for the life of me figure out how to get it to work with the other templates on the site.  It always shows up as "No documents found."  Using the Debug console shows that the other template-based pages aren't reading the "FeatureBookChoice" TV from the homepage.  It's like it doesn't exist for them.  I've tried using &appendTV, &hiddenTVs, etc., and I'm at a brick wall.

I'm using the latest version of ModX, and Ditto V. 2.0.1

I hope I've provided enough info here.  If not, please let me know.  Thanks so much for any help!
Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #1 on: Apr 25, 2007, 05:54 PM »

1. What does [*FeatureBookChoice*] return on the other pages?
2. Does the homepage have a different template than the other pages? If so is the tv accessable to the other template?
3. Make sure you update Ditto to 2.0.2.
Logged

ihsv
Jr. Member
*
Posts: 11


« Reply #2 on: Apr 25, 2007, 06:11 PM »

Mark,

Thanks for your quick reply.

[*FeatureBookChoice*] returns nothing on the other pages. 

The Homepage template is unique to the homepage.  There are (currently) two additional templates, one for content and another one for the products.  I tried making the TV accessible to these last two templates, but the result was highly undesirable.  The client would have to go through each individual page that the TV is accessible to and select the featured product, rather than just going to the homepage and selecting a single Featured Product that would be populated through all the pages site-wide.

The wife is calling, so I will upgrade to Ditto 2.0.2 after supper Smiley

Again, thanks for your help!
Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #3 on: Apr 25, 2007, 07:14 PM »

When you made the tv accessable to the other 2 templates did it work?
Logged

ihsv
Jr. Member
*
Posts: 11


« Reply #4 on: Apr 25, 2007, 07:23 PM »

Yes, it worked, but I had to go to each page on the site and select the same featured product.  Unless I selected the featured product on a given page, nothing would display.

By the way, I've upgraded to the latest version of Ditto. Smiley

Thanks again!
« Last Edit: Apr 25, 2007, 07:57 PM by ihsv » Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #5 on: Apr 25, 2007, 08:59 PM »

   1. Create a tv call ShowOnHomepage as a TEXT FIELD (so we can make sure everything is working). Assign its default value to 0.
   2. Use the following DItto call on the homepage: [!Ditto? &depth=`0` &parents=`0` &filter=`ShowOnHomepage,1`!]
   3. For any page you want on the homepage set the value of ShowOnHomepage to 1.
Logged

ihsv
Jr. Member
*
Posts: 11


« Reply #6 on: Apr 25, 2007, 09:28 PM »

Mark,

Thanks so much for your help!  This method gets the job done, so I'm able to move ahead.  I really do appreciate it Smiley  I've added the template chunk and made the selection a drop-down menu after testing it with the text field.  Works fine!

Thanks again!

Logged
myfriendscallmebill
Member
**
Posts: 75



« Reply #7 on: Apr 25, 2007, 09:37 PM »

I'm very interested in the outcome of this topic since I'm about to embark on a web site build for a client with similar needs.  Let me make some guesses about how you might proceed.

(1)  Every document has a "content" field, yet the content of that field is unique to each document, right?  Well as I understand it adding a TV to a template just adds another field you can put content in, but the content is unique to each document.  TVs are a way to extend the set built-in fields, not a way to share values across documents.

(2) One approach you might try is this:  create a folder, and under that folder create one document for each possible featured product.  On every template where you want a featured product to show, make a Ditto call that uses the folder (above) as the "parent", and set up the ditto call to display just one item.  then within the folder publish only the item you want featured, and unpublish all the rest.  Haven't tried it, but maybe this will work.

(3) Or, if you don't want to create special pages for your featured products, and if you already have your featured product pages in place, then add a TV to each of the pages that relate to your featured products.  Configure it with a checkbox, so you can set the field to TRUE or FALSE.  Then, as in (2) above, make a ditto call in each template where you want to display the featured product.  Set it to use the folder containing your product pages as the "parent".  Define a filter parameter that looks for documents where your TV (above) is set to TRUE.  Then you should be able to display that featured product on any page you want.  You just have to remember to have only one feature product with the TV set to TRUE.  

Do any of these idea help?

(oops, I see you already have an answer.  Congrats :-).
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!