If this is your first visit, check our documentation. To post, register or login.

Custom Content Display

Started by nick1973 on 14 Jan 2022, 1:58 PM · Views: 1,385

Results 1 to 5 of 5
14 Jan 2022, 1:58 PM
#1
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Custom Content Display

I have a category which contains products inside sub categories.

Each product has some custom content at the bottom of the page. Every product has the same custom content, apart from one.

I am using this PHP to display the custom content:

<?php if ($_GET['cPath'] == 172) { ?>My Custom Content<?php } ?>

This works fine, apart from it displays the wrong content on the product where it should be different content to the rest of the category.

How would I change this so that displays the right content? I was thinking target the product id rather than cPath

Something like:

<?php if ($_GET['cPath'] == 172) { ?>My Custom Content
<?php } elseif ($_GET['products_id'] == 9006) { ?>
My Product Custom Content<?php } ?>

But that doesn't work

Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk

14 Jan 2022, 3:18 PM
#2
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Custom Content Display

try reversing it:

<?php 
    if ($_GET['products_id'] == 9006) { 
        ?>
        My Product Custom Content
        <?php 
    } elseif ($_GET['cPath'] == 172) { 
        ?>
        My Custom Content
        <?php 
    } 

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

14 Jan 2022, 3:34 PM
#3
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Custom Content Display

Thanks Carl, that worked :-)

Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk

14 Jan 2022, 4:16 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Custom Content Display

Every product has the same custom content ...

Be sure you have defined the content once in a file or a configuration setting so you can update it in one place and get the results everywhere.

You might be able to use my boilerplate tip

https://www.thatsoftwareguy.com/zencart_boilerplate_in_description.html

or perhaps Define Page Anywhere:
https://www.thatsoftwareguy.com/zencart_define_page_anywhere.html

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

14 Jan 2022, 4:27 PM
#5
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Custom Content Display

swguy:

Every product has the same custom content ...

Be sure you have defined the content once in a file or a configuration setting so you can update it in one place and get the results everywhere.

You might be able to use my boilerplate tip

https://www.thatsoftwareguy.com/zencart_boilerplate_in_description.html

or perhaps Define Page Anywhere:
https://www.thatsoftwareguy.com/zencart_define_page_anywhere.html

Thanks, I don't think I need that though. The solution I was given easily works for me.

Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk