Mooseman
Advanced Member
166 Posts Pre-sales questions only (More Details...)
|
Posted - 04/28/2020 : 10:39:56
I changed:
languagefile_en.php $GLOBALS['xxClkPrd']='Please click on a category to view products.';
to
includes.php $GLOBALS['xxClkPrd']='Browse Fasteners by Category';
This works fine.
My next objective was to append the "Category Name" variable:
$GLOBALS['xxClkPrd']='Browse Fasteners by Category - <?php print $catname; ?>';
However, nothing after the hyphen displays.
Is there a method/solution for accomplishing this?
|
dbdave
ECT Moderator
USA
10409 Posts |
Posted - 04/28/2020 : 11:31:36
Hi, I wonder if it would work something like this.
$GLOBALS['xxClkPrd']='Browse Fasteners by Category - '$catname; or $GLOBALS['xxClkPrd']='Browse Fasteners by Category - 'print $catname;
David
Edited by - dbdave on 04/28/2020 11:32:23
|
Mooseman
Advanced Member
166 Posts Pre-sales questions only (More Details...)
|
Posted - 04/28/2020 : 11:59:03
Thank you for the suggestions.
Unfortunately both caused the entire page to fail.
In my further investigation on this (if I understand what am reading) there's some problem with declaring a variable within an include and that it first needs to be made a global.
While I have some knowledge of PHP, this level of coding is beyond my skill set.
Any other suggestions would be greatly appreciated.
Thanks!
|
Marshall
Ecommerce Template Guru
USA
1909 Posts |
Posted - 04/28/2020 : 12:30:30
I am not a PHP expert, but might the spaces and period be necessary? $GLOBALS['xxClkPrd']='Browse Fasteners by Category - ' . $catname; or $GLOBALS['xxClkPrd']='Browse Fasteners by Category - ' . print $catname;
Marshall CENLYT Productions - ms designs Affordable Web Design Custom Ecommerce Designs Responsive Websites Cenlyt.com
|
Mooseman
Advanced Member
166 Posts Pre-sales questions only (More Details...)
|
Posted - 04/28/2020 : 13:35:40
Thanks Marshall,
$GLOBALS['xxClkPrd']='Browse Fasteners by Category - ' . $catname;
output nothing after the hyphen
$GLOBALS['xxClkPrd']='Browse Fasteners by Category - ' . print $catname;
output: Browse Fasteners by Category - 1
Getting closer!
|
dbdave
ECT Moderator
USA
10409 Posts |
Posted - 04/28/2020 : 14:45:28
You could probably tackle it another way.
$GLOBALS['xxClkPrd']='Browse Fasteners by Category - <span id="catname"></span>';
Then use javascript in your categories.php page to get that info there. If you need help with the javascript, I can probably help work it out.
David
|
Marshall
Ecommerce Template Guru
USA
1909 Posts |
Posted - 04/28/2020 : 15:08:05
Not sure, but you might want
$GLOBALS['xxClkPrd']='Browse Fasteners by Category - ' . print $sectionname;
You made need a PHP script to call it up, comparing the cat # to the section name.
Marshall CENLYT Productions - ms designs Affordable Web Design Custom Ecommerce Designs Responsive Websites Cenlyt.com
Edited by - Marshall on 04/28/2020 15:10:04
|
dbdave
ECT Moderator
USA
10409 Posts |
Posted - 04/28/2020 : 16:55:04
I have this working on my test site here - https://www.floridasurpluswarehouse.com/dev/categories.php?cat=6
In your includes, this $GLOBALS['xxClkPrd']='Browse Products by Category - <span id="catname"></span>';
Then in categories.php, right after <?php include "vsadmin/inc/inccategories.php" ?> this
<script> if (document.getElementById("catname")) { document.getElementById("catname").innerHTML = '<?php print $sectionname ?>'; } </script>
|
Mooseman
Advanced Member
166 Posts Pre-sales questions only (More Details...)
|
Posted - 04/29/2020 : 10:06:24
I really appreciate all the suggestions, however I think we are drifting from my original objective.
Am hoping providing live links will better illustrate.
This page is the top-most level of categories: [url]https://www.ceramicfasteners.com/buy/categories.php[/url]
For this top-most level am fine with nothing after the hyphen in the page heading: "Browse Products by Category -"
+++
In the url above click-on "Alumina - Metric" to drill-down one level to: [url]https://www.ceramicfasteners.com/buy/categories.php?cat=8[/url]
The original objective from this level down was to display (after the hyphen) the Category Name just clicked.
In this instance appending "Alumina - Metric" after the hyphen in the page heading, so the complete page heading for this page is: Browse Products by Category - Alumina - Metric.
+++
From this point on everything is fine.
|
Marshall
Ecommerce Template Guru
USA
1909 Posts |
Posted - 04/29/2020 : 11:06:15
Assuming you are using <?php include "vsadmin/inc/metainfo.php" ?> in the <head>, why not forget the $GLOBALS['xxClkPrd']='Browse Fasteners by Category'; and have catmessage not display then hard code in the categories page above <div class="categories">
<h1>Browse Products by Category <?php if(!empty($pagetitle)) {print '-' . $pagetitle;} else if(!empty($sectionname)) {print '-' . $sectionname;} ?></h1>
I think I have that right. I may have an extra ' in there. Might want to check.
Marshall CENLYT Productions - ms designs Affordable Web Design Custom Ecommerce Designs Responsive Websites Cenlyt.com
|
Mooseman
Advanced Member
166 Posts Pre-sales questions only (More Details...)
|
Posted - 04/29/2020 : 12:17:32
If I EVER expected this to work, Marshall's last post remined me categories.php needed: <?php include "vsadmin/inc/metainfo.php" ?>
+++ SOLUTION +++++++++++++++++++++
ADDED: include "vsadmin/db_conn_open.php"; include "vsadmin/inc/metainfo.php";?> (Immediately after: ob_start();)
REMOVED: include "vsadmin/db_conn_open.php"; (which appeared farther down in page)
From here on I used dbDave's post: 04/28/2020 : 19:55:04, giving me exactly what I wanted.
Thank you everyone!
|
dbdave
ECT Moderator
USA
10409 Posts |
Posted - 04/29/2020 : 12:44:07
Seems like it took a team effort... Glad you got it going... David
|
Marshall
Ecommerce Template Guru
USA
1909 Posts |
Posted - 04/29/2020 : 16:19:22
quote: If I EVER expected this to work, Marshall's last post remined me categories.php needed: <?php include "vsadmin/inc/metainfo.php" ?>
Glade I could help, even if in a round about way. MarshallCENLYT Productions - ms designs Affordable Web Design Custom Ecommerce Designs Responsive Websites Cenlyt.com
|
|
|