Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 10-15-2021 05:33:37

nigel
Member
From: Peterborough, UK
Registered: 04-27-2008
Posts: 418
Website

adding an include to the category description

most of my categories contain the same piece text in the description. Is it possible to use an include instead of having to write the full text, so when I want to make changes I only have to edit the include.php?
I am trying to add something like this:

$this->include_file('ecom','xprodshowdelivery.php');

Offline

 

#2 10-15-2021 08:38:08

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19738
Website

Re: adding an include to the category description

PHP in category descriptions is not supported out of the box.  To add PHP support to category descriptions:

Edit the file {private}/apps/ecom/ECOM/includes/catshow.php and locate this line:

Code:

if (!(empty($has_tags))) {$descfinal .= '<div class="kbotmarginfull">' . $catshow['description'] . '</div>' . $eol;}

Change to:

Code:

if (!(empty($has_tags))) {$descfinal .= '<div class="kbotmarginfull">' . $this->include_phptext($catshow['description']) . '</div>' . $eol;}

After you do that, provided {private}/apps/ecom/ECOM/includes/xprodshowdelivery.php exists, you'll be able to include it from your category descriptions with this PHP:

Code:

<?php $this->include_file('ecom','xprodshowdelivery.php'); ?>

Nick Hendler

Online

 

#3 10-15-2021 08:46:58

nigel
Member
From: Peterborough, UK
Registered: 04-27-2008
Posts: 418
Website

Re: adding an include to the category description

thanks Nick, works perfect.

Offline

 

#4 10-20-2021 08:40:33

nigel
Member
From: Peterborough, UK
Registered: 04-27-2008
Posts: 418
Website

Re: adding an include to the category description

can I do this with the product description? I have looked at prodshow.php but no sure how to insert the code

Offline

 

#5 10-21-2021 07:57:23

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19738
Website

Re: adding an include to the category description

Yes.  It's done basically the same way in prodshow.php.  Find the description, if it has tags, run it through $this->include_phptext().


Nick Hendler

Online

 

#6 10-28-2021 10:19:14

nigel
Member
From: Peterborough, UK
Registered: 04-27-2008
Posts: 418
Website

Re: adding an include to the category description

final question (hopefully)
Is it also possible to insert an include into the product options description? I have looked at all the include.php files but can't figure out which one I need to edt.

Last edited by nigel (10-28-2021 10:19:52)

Offline

 

#7 10-29-2021 08:23:07

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19738
Website

Re: adding an include to the category description

The options utilize functions that ultimate present a form, so look at {private}/core/CORE/includes/formfield_open.php and use $this->include_phptext() on form field descriptions that have tags in them.  That will make PHP available in EVERY form field description presented by the software.


Nick Hendler

Online

 

Board footer