Products detailpage template not working

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Locked
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Products detailpage template not working

Post by montedavis »

I'm trying to use the Products module to display products by category, e.g. "bread", "buns", "rolls"

I'd like to be able to have a different detail page view for the different categories. I was hoping to use something like: {cms_module_hint action='details' module='Products' detailtemplate='55'} or {cms_module_hint action='details' module='Products' detailpage='40'} with Pretty URLs turned on but I'm not sure if this will work....for now I'm just trying to get the products module to work with pretty urls/url slugs turned off and to call a category specific detailpage='' or detailtemplate='' using the {products} tag. I think that just having the ability to call a category specific detailtemplate would allow me a category specific detail page view and would allow me to create different detail page views for each category, I don't think I even need a unique detailpage as the detail page would just be a wrapper around the detailtemplate. Category specific detail template ids/aliases could be called on category specific content pages.

I've read through the documentation for the products module and tried every way I can think of. Here is what I've gathered from the documentation...

You cannot call detailpage="foo" or detailtemplate="foo" on the {products} tag when using Pretty URLs or URL Slugs, e.g. the below code would not work with pretty urls or url slugs on. (I did have both of these settings turned on when I started but have turned them off.)

{Products category='Breads' summarytemplate='52' detailpage='36' detailtemplate='55'}

but you should be able to use detailpage="foo" or detailtemplate="foo" when you do not have pretty urls turned on, and/or do not have Slug URLs for product items.

Each time I try to call a detailpage="foo" for detailtemplate="foo" from the {products} the "default" template is returned.

I turned on the following on the product summary page (this only has a detailtemplate="40"):

{get_template_vars
<pre>{$entry|@print_r}</pre>

for my products list view I see the following:

$SCRIPT_NAME (string) = /index.php
$app_name (string) = callable
$sitename (string) = Klosterman Baking Company
$content_obj (object of type: Content) = {}
$content_id (string) = 35
$page_id (string) = bread
$page_alias (string) = bread
$lang (string) = en_US
$encoding (string) = utf-8
$page_title_product_name (string) = Bread
$product_breadcrumb (NULL) =
$product_meta_description_seo (string) = This is the content from the Bread page Description (title attribute)
$gcb_params (array) = [
.name (string) = CustomHeaderProductsDetail
]
$actionid (string) = m2f730
$actionparams (array) = [
.category (string) = Bread
.summarytemplate (string) = 52
.detailtemplate (string) = 40
.module (string) = Products
.action (string) = details
]
$returnid (string) = 35
$actionmodule (string) = Products
$mod (object of type: Products) = {
._colors (NULL) =
._actionid (string) = m2f730
._actionname (string) = default
->_image_directories (array) = [
.0 (string) = modules/Products/icons
]
._current_action (NULL) =
._errormsg (NULL) =
._returnid (NULL) =
}
$Products (object of type: Products) = {
._colors (NULL) =
._actionid (string) = m2f730
._actionname (string) = default
->_image_directories (array) = [
.0 (string) = modules/Products/icons
]
._current_action (NULL) =
._errormsg (NULL) =
._returnid (NULL) =
}
$module (string) = Products
$items (array) = [
[0] (object of type: Products\DisplayableProduct) = { }
[1] (object of type: Products\DisplayableProduct) = { }
[2] (object of type: Products\DisplayableProduct) = { }
[3] (object of type: Products\DisplayableProduct) = { }
[4] (object of type: Products\DisplayableProduct) = { }
]
$itemcount (integer) = 5
$totalcount (string) = 5
$pagecount (integer) = 1
$curpage (integer) = 1
$firstlink (string) = <<
$prevlink (string) = <
$lastlink (string) = >>
$nextlink (string) = >
$pagetext (string) = Page
$oftext (string) = Of
$currency_symbol (string) = $
$weight_units (string) = lb

but when I click on a product link I always end up on the default detail page using the default template.

The detail page and detail template I end up on are set as default in the template edit "advanced" tab and I do not have a default page set in the "advanced" section of the product module.

Thanks in advance for any help provided.

System settings below.


CMSMS Version 2.2.5

Installed Modules
AdminSearch 1.0.4
CGExtensions 1.61
CGSimpleSmarty 2.1.8
CMSContentManager 1.1.6
CMSMailer 6.2.14
CmsJobManager 0.1.2
DesignManager 1.1.4
FileManager 1.6.5
FilePicker 1.0.2
Gallery 2.3.2
JQueryTools 1.4.0.3
MenuManager 1.50.3
MicroTiny 2.2.2
ModuleManager 2.1.3
Navigator 1.0.8
News 2.51.3
Products 2.28.4
Search 1.51.2
TinyMCE 3.2-beta3

CMS Made Simple Config Settings
php_memory_limit
max_upload_size 8000000
url_rewriting none
page_extension
query_var page
auto_alias_content true
locale
set_names true
timezone America/New_York
permissive_smarty false
debug false


Performance and Tuning Information (recommended settings, but not required)
Allow Browser to Cache Pages Success On (True)
Browser Cache Expiry Period (minutes) Success 60
PHP 5.5+ Opcode Cache Success On (True)
Enable Smarty Caching Caution Off (False)
Enabling Smarty caching can have serious performance benefits for most websites.
Do a Compilation Check Success Off (False)
Remove cache files that are older than the specified number of days Success On (True)

PHP Information
Current PHP Version (phpversion) Success 5.6.36
md5 function (md5_function) Success On (True)
JSON functions (json_function) Success On (True)
GD version (gd_version) Success 2
tempnam function (tempnam_function) Success On (True)
Magic quotes in runtime (magic_quotes_runtime) Success Off (False)
Is E_ALL enabled in error_reporting (E_ALL) Success
Is E_STRICT disabled in error_reporting (E_STRICT) Caution E_STRICT is enabled in the error_reporting
Is E_DEPRECATED disabled in error_reporting (E_DEPRECATED) Caution E_DEPRECATED is enabled
Testing for time difference in the file system (test_file_timedifference) Success No time difference found
Testing for time difference in the database (test_db_timedifference) Success No time difference found
Checking if the HTTPD process can create a file inside of a directory it created (create_dir_and_file) Success 1
PHP Effective Memory Limit (memory_limit) Success 128M
Maximum Execution Time (max_execution_time) Success 300
PHP register_globals (register_globals) Success Off (False)
PHP output_buffering (output_buffering) Success 4096
disable_functions in PHP (disable_functions) Success
PHP Open Basedir (open_basedir) Success
Test for remote URL (test_remote_url) Success Success
fsockopen: Connection ok! Success
fopen: Connection ok! Success
File uploads (file_uploads) Success On (True)
Maximum Post Size (post_max_size) Caution 8M ?
Maximum Upload Size (upload_max_filesize) Caution 8M ?
Session Save Path (session_save_path) Success /opt/alt/php56/var/lib/php/session (0700)
Sessions are allowed to use Cookies (session_use_cookies) Success On (True)
Basic XML (expat) support (xml_function) Success On (True)
Checking for the XMLReader class (xmlreader_class) Success On (True)
Test ini_set (check_ini_set) Success On (True)
Test for the curl library (curl) Success On
Test curl version (curlversion) Success version 7.60.0, minimum recommended version is 7.19.7

Server Information
Server Software (server_software) litespeed
Server API (server_api) litespeed
Server Operating System (server_os) linux 2.6.32-531.1.2.lve1.2.54.el6.x86_64 on x86_64
Server Database (server_db_type) mysql (mysqli)
Server Database Version (server_db_version) Success 5.5.59
Check database access levels (server_db_grants) Success found a "grant all" statement that appears to be suitable


Copyright © CMS Made Simple™ 2.2.5 “Wawa”
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Products detailpage template not working

Post by calguy1000 »

You should be able to specify different detail pages on the Products module call.

And you can use {cms_module_hint} to basically say. If I am displaying a Products detail view on this page, use this template.

so: {Products category=foo detailpage=something}

then on your 'something' page you should be able to use {cms_module_hint module=Products detailtemplate=foo} in the "Smarty data or logic that is specific to this page" field.
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.
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Re: Products detailpage template not working

Post by montedavis »

OK.

I have a content page (35) named "Bread" with summary template (46). In the summary template I have the following:
{content}{Products category='Bread' summarytemplate='52' detailpage='36'}

The summary template displays all of the items in the Bread category. When I click on an item I'm sent to content page (35), I never get to detailpage='36' the returnid='35'.

I'm not sure why I can't get to the detailpage='36'....I did however add the following code to detailpage='36
{cms_module_hint module='Products' action='details' detailtemplate='40'}
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Re: Products detailpage template not working

Post by montedavis »

I meant to say...

OK.

I have a content page (35) named "Bread" with page template (46). In the page template (46) I have the following:
{content}{Products category='Bread' summarytemplate='52' detailpage='36'}

The summary template (52) loads and displays all of the items for the Bread category when the content page (35) loads. When I click on an item for the detail view I'm sent to content page (35), I never get to detailpage='36' the returnid='35' is always the returnid value, unless I set a detail page in the products preferences then the returnid will return the page set as the detail page everytime.

I'm not sure why I can't get to the detailpage='36'....I did however add the following code to detailpage='36
{cms_module_hint module='Products' action='details' detailtemplate='40'}

Thank you.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Products detailpage template not working

Post by velden »

I've never seen it used like this with page and template IDs.
Try with aliases

I didn't check the code but I don't think you'll find examples in the help where ID's are used.

I presume the aliases of your pages and templates are not numeric.

Further, numeric values shouldn't be quoted in general. Smarty/CMSMS may be forgiving, but it makes no sense.
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Re: Products detailpage template not working

Post by montedavis »

Thanks for your post.

I changed my products tag to:

{Products category='Bread' summarytemplate=52 detailpage='product-detail'}

I also tried the following but I did not see anywhere an alias is assigned to a template:

{Products category='Bread' summarytemplate='CustomProductsSampleListView' detailpage='product-detail'}

Neither of these worked.

from the module documentation "....detailpage="" - This specifies the pageid or alias..."

for some reason it appears the returnid is not being assigned to the product item links on the product summary page. Below is a link to the pages I'm working with and .htaccess user/pass to access the pages.

The pages have {get_template_vars} and <pre>{$entry|@print_r}</pre> turned on.

https://dev.klostermanbakery.com/index. ... eturnid=35

.htaccess user: kbcdev password: IE8wUa.vYd~D

Thank you for any input.
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Re: Products detailpage template not working

Post by montedavis »

I noted that there have been some changes in the recent update to the products module, WRT. the detailpage.

My problem appears to be stemming from the $entry->detail_url not returning the proper returnid value I set in the {products} tag by defining th e detailpage='foo'. The returnid value within the detail_url is always the current contentid value.
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Re: Products detailpage template not working

Post by montedavis »

I think the template values set as "default" in the Design Manager -> Edit Template -> Advanced Tab always overwrite the manually defined template in the {products detailtempte='foo'} tag.
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Re: Products detailpage template not working

Post by montedavis »

I was able to get the detailtemplate to work for the product detail pages by adding:

[removed]

I can now let the detail page default to the current page id and call a different detailtemplate for each category.

I'm still not able to get the detailpage to work when adding to the {Products} tag but I don't think it's necessary as the detail page will default to the current page as long as no detail page has been sent in the products mod. preferences.
Locked

Return to “The Lounge”