Hi mc
I added your code first before the line and then after and after the breadcrumb menu, I just get a blank page.
Hi mc
I added your code first before the line and then after and after the breadcrumb menu, I just get a blank page.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Error Log
[09-May-2016 07:45:15 Europe/Berlin] PHP Warning: Cannot modify header information - headers already sent by (output started at path\to\oursite\includes\templates\dover_fine\templates\tpl_modules_mobile_categ ories_tabs.php:56) in path\to\oursite\includes\functions\functions_general.php on line 46
Okay, so how about this, considering a redirect is offered in the following file, we'll just do the applicable tests here and redirect before getting to the main_template_vars.php file:
In includes/modules/pages/index/header_php.php
After the following code and before the final notifier:
Add this code:Code:// if only one product in this category, go directly to the product page, instead of displaying a link to just one item: // if filter_id exists the 1 product redirect is ignored if (SKIP_SINGLE_PRODUCT_CATEGORIES=='True' and (!isset($_GET['filter_id']) and !isset($_GET['alpha_filter_id']))) { if ($listing->RecordCount() == 1) { zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id'])); } }
Code:if (($category_depth == 'products' || zen_check_url_get_terms()) && $listing->RecordCount() > 0) { zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id'])); }
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
It works!!! Thanks so much.
Good to hear. Now there are a few ways that you could proceed...
The file changed is basically a core file. That modification could be moved into a separate file as a sort of plugin to the store (observer) and applied/removed as necessary to suit the store owner's/developer's need.
The alternative is that the code could remain where it is but I would suggest adding comments (start a line with comments with // or if covering multiple lines start with /* and end with */). If the code stays in place in that file, on the next ZC upgrade, attention would need to be maintained in comparing the newly provided file(s) with this file.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
BTW, I was going to start to suggest the code to move this into an observer, but in review of this thread, I don't see mention of the current ZC version. There are two ways to apply the change, one better in a newer store requiring a single file and an older method requiring two files.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Create a new file in:
includes/classes/observers
titled: auto.display_first_product_in_cat.php
(The name is chosen to mean something, it can be changed here, but will need to be changed below where the same text is used but the underscores removed)
In the file (nothing to exist before the first <?php):
Code:<?php /** * Uses the observer class modified in ZC 1.5.3 to autoload the below code and not require additional files to obtain the desired result. * This is (was?) also PHP 7.0 compliant, though may survive for longer than that as well. * * This redirects the visitor to the product info page for the first product that is in the $listing query results. * This way, once a customer has dug into the category listing and the category is identified as having product that the first * product is displayed. * mc12345678 - 9 May 2016 **/ class zcObserverDisplayFirstProductInCat extends base { function __construct() { $attachThis = array(); $attachThis[] = 'NOTIFY_HEADER_END_INDEX'; $this->attach($this, $attachThis); } // end __construct // NOTIFY_HEADER_END_INDEX, Code below is to redirect customer to the "first" product identified in the $listing variable. // if that variable has been modified by another observer before this one, then it resets to the first item in the list. function updateNotifyHeaderEndIndex(&$callingClass, $notifier) { global $category_depth, $listing, $cPath; if (($category_depth == 'products' || zen_check_url_get_terms()) && $listing->RecordCount() > 0) { // This next section makes this code upgrade compatible to ZC 1.5.5+ and resets the listing in case some other // header listening observer gets run before this one does and it modifies the pointer to the results. :) if (method_exists($listing, 'rewind')) { reset($listing); } else { $listing->Move(0); $listing->MoveNext(); } zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . (int)$listing->fields['products_id'])); } // end if } // end function updateNotifyHeaderEndIndex } // end class definition
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Does this file change having the overrides in the 2 files that we changed?
Current ZC version is 1.5.4. I thought that was the thread that I posted in.
Regardless thanks for your help
Actually with this extra file you can restore the other two files to their original ZC grandness. :)
As previously identified the change made to $main_template_vars.php caused headers previously sent error, the change made to header_php.php is addressed by the above provided code.
As for your process of posting, you did tag the post as 1.5.4 and as might be visible in the below, the screenshot from my device, the "indicator" might be visible on the upper left instead of inline like DrByte showed.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Bookmarks