Steved
Ecommerce Template Guru
United Kingdom
1022 Posts Pre-sales questions only (More Details...)
|
Posted - 03/17/2021 : 01:11:24
Hi,
I use the category headers but there are some occasions when I would like to put some information after the products on the page.
Is there any way to achieve this?
Thanks,
Steve
|
Vince
Administrator
42874 Posts |
Posted - 03/17/2021 : 13:05:26
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 03/17/2021 : 14:04:01
I can whip up some javascript to put that category description there if you like..
David
|
Steved
Ecommerce Template Guru
United Kingdom
1022 Posts Pre-sales questions only (More Details...)
|
Posted - 03/18/2021 : 01:46:19
Hi Vince and David,
Just to clarify -I'm talking about having header and footer on the products.php page which is set up via categories.
As an example, if you take a look on the main site in my profile at /products/Yoga-Mat-Bags, you'll see I have some info within a css 'read more' button which I've had to include in the header. I'd really like to take all that 'read more' to the bottom of the page, probably below any pagination. Obviously each category has different info.
I'm not sure this is possible using the description section is it Vince, as wouldn't that only work on the categories.php page? If there is a way though, that would be very neat as I don't use the description area. Otherwise David, if this is feasible using javascipt, then that would be very useful alternative.
Many thanks,
Steve
Edited by - Steved on 03/18/2021 05:58:47
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 03/18/2021 : 07:18:07
I have an idea and I'll check my php test site this evening to see how it might work.
David
|
Steved
Ecommerce Template Guru
United Kingdom
1022 Posts Pre-sales questions only (More Details...)
|
Posted - 03/20/2021 : 02:45:49
Hi Vince and David,
The thought of using the category description got me thinking.
Is there some code that calls the category description that I can add towards the bottom of the products.php page? If that were possible I could also use css to hide it on the category page so it only appears on the products page.
I suspect though the reality is probably somewhat more complex...
Steve
Edited by - Steved on 03/20/2021 02:46:33
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 03/20/2021 : 10:12:46
Hi Steve, sorry I didn't work this out sooner, but it's quite easy to do this with javascript. I have a demo here - https://www.floridasurpluswarehouse.com/dev/products.php?cat=4In my demo, I have not hidden the category header up top there, but that's just an addition to the products page or your css file div.catheader {display:none;} Here is how you get the text on the bottom. Of course this could be done with a database query, but this is simple and should work fine. Open your products.php page in your html editor and add the following right after the include line <?php include "vsadmin/inc/incproducts.php" ?> <div id="cat-footer"></div> <script> if (document.getElementsByClassName('catheader')[0]){ document.getElementById('cat-footer').innerHTML = document.getElementsByClassName('catheader')[0].innerHTML; } </script> Upload the fine and you're all set. Let me know if you have questions or issues. For anyone reading, this should also work with .asp versions just fine. Thanks, David
Edited by - dbdave on 03/20/2021 10:14:43
|
Steved
Ecommerce Template Guru
United Kingdom
1022 Posts Pre-sales questions only (More Details...)
|
Posted - 03/20/2021 : 12:11:20
Hi David - thanks very much for taking the time to look into this for me.
Unfortunately, I need to have the ability for a header and/or footer.
Is there a way of modifying your code to call from say the category description for the footer. That way I can achieve exactly what I need?
Thanks again,
Steve
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 03/20/2021 : 12:35:00
Hi Steve, we would need to query the database for that, but before we go down that path, it is possible to have the info in the same header block there like so... Here is my updated test page https://www.floridasurpluswarehouse.com/dev/products.php?cat=4Here is the category html I have added - Notice the part in red there... Set to display none with a unique ID... <div class="cat-head">This is the category header html</div> <div id="ctft" style="display:none;">This is the category footer html</div>Then change the code to <div id="cat-footer"></div> <script> if (document.getElementById('ctft')){ document.getElementById('cat-footer').innerHTML = document.getElementById('ctft').innerHTML; } </script> I also have the following on the page for styling <style type="text/css"> div.cat-head,#cat-footer { font-weight:bold; font-size:20px; text-align:center; color:red; } </style> Can you work with that? David
|
Steved
Ecommerce Template Guru
United Kingdom
1022 Posts Pre-sales questions only (More Details...)
|
Posted - 03/20/2021 : 13:22:37
Hi David - that’s perfect and makes it possible for me to divide everything up within the header. A very neat and tidy way to address this. Thanks again for going the extra mile to help me out here. Steve 
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 03/21/2021 : 09:17:30
|
|
|