Post by deludeddonny » Thu Feb 17, 2011 10:04 am

Hello I have a php script which I need to add to the product page,

any ideas? php include does not work and crashes my website....

I think I will need to add it to catalog/model/catalog/product.php and then call it in the product.tpl file...

but I have no idea how to do that...

Newbie

Posts

Joined
Wed Feb 02, 2011 9:00 am

Post by Qphoria » Thu Feb 17, 2011 10:14 am

You can include directly from the tpl file

<?php include ('path/to/file.php'); ?>

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by deludeddonny » Thu Feb 17, 2011 10:42 am

I tried that, but it bombed my site... Dunno why but it didn't like it

Newbie

Posts

Joined
Wed Feb 02, 2011 9:00 am

Post by Qphoria » Thu Feb 17, 2011 10:46 am

well "bombed my site" means nothing.. maybe your script was garbage.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by deludeddonny » Thu Feb 17, 2011 10:56 am

Script runs fine if you view it in it's own page... When using php included it doesn't load the page and after 5 minutes of trying to load it gave a random SQL error first time and second time gave a 500 error, I am using the vqmod to display SKU on product page, could they be conflicting or something!

Newbie

Posts

Joined
Wed Feb 02, 2011 9:00 am

Post by Chones » Thu Feb 17, 2011 3:32 pm

Try putting the php code directly in the template file - I do that all the time.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by deludeddonny » Thu Feb 17, 2011 7:51 pm

I did try that but it only reognises the first few lines as php.

I have asked the people who designed the script to have a go at inserting it.
If they cant get it right (god help us all LOL) then I am going to remove vqmod and try php include again, I am fairly sure they were conflicting somehow...
???

Newbie

Posts

Joined
Wed Feb 02, 2011 9:00 am

Post by deludeddonny » Thu Feb 17, 2011 8:46 pm

ok they tried to do it,

still get 500 error, i removed vqmod but still not working... this is very strange :crazy:

Newbie

Posts

Joined
Wed Feb 02, 2011 9:00 am

Post by Xsecrets » Thu Feb 17, 2011 9:13 pm

well if their script runs on it's own it may be an issue of conflicting headers or something along those lines. Is the script designed to be embedded into other pages or to run on it's own?

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by deludeddonny » Thu Feb 17, 2011 9:27 pm

OK this is out my error log

2011-02-17 5:36:45 - PHP Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument in /home/content/40/7355040/html/shop/catalog/model/catalog/timer.php on line 90

and this is line 90 of the file in question...

if (in_array($dayDate, $holidays)) {
return false;

Well its a custom bit of script I have had made, they knew it was supposed to be embedded,

they edited it so I can use
<?php
include('timer.php');
echo(getCountDownTimerString());
?>

it works if i put that in a blank php file but gives 500 error when i add it to product.tpl

Newbie

Posts

Joined
Wed Feb 02, 2011 9:00 am

Post by Qphoria » Thu Feb 17, 2011 10:23 pm

There is no conflict that I can think of that would be caused by vQmod for this. vQmod makes its changes before the file is evaluated, so to vQmod, the include is just another string

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Xsecrets » Thu Feb 17, 2011 10:26 pm

deludeddonny wrote:OK this is out my error log

2011-02-17 5:36:45 - PHP Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument in /home/content/40/7355040/html/shop/catalog/model/catalog/timer.php on line 90

and this is line 90 of the file in question...

if (in_array($dayDate, $holidays)) {
return false;

Well its a custom bit of script I have had made, they knew it was supposed to be embedded,

they edited it so I can use
<?php
include('timer.php');
echo(getCountDownTimerString());
?>

it works if i put that in a blank php file but gives 500 error when i add it to product.tpl
well the most likely cause of that error is that the array is not set, which would mean backtracking through the program to figure out why not.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by deludeddonny » Fri Feb 18, 2011 12:48 am

OK odd but I think this is causing it...

Code: Select all

function isDayOK($ts) {
	global $holidays;
	global $daysWorking;
	$dayDate = date(DATE_FORMAT, $ts);
	$dayOfTheWeek = date('N', $ts);
	if (in_array($dayDate, $holidays)) {
		return false;
	}
	if (!$daysWorking[$dayOfTheWeek]) {
		return false;
	}	
	return true;
}

Here is the array

Code: Select all

$holidays = array(
	'01/01/2011',
	'25/12/2011'
	);

$daysWorking = array(
	'1' => true,
	'2' => true,
	'3' => true,
	'4' => true,
	'5' => true,
	'6' => false,
	'7' => false,
	);	

Newbie

Posts

Joined
Wed Feb 02, 2011 9:00 am
Who is online

Users browsing this forum: No registered users and 3 guests