Post by istyfu » Fri Jul 11, 2014 5:00 pm

Hi there,

can anyone tell me why I am getting this error message after installing/adding a new language? With the default english I do not have any issues, only after adding and enabling other languages and switching between pages. Thanks in advance!

PHP Notice: Use of undefined constant php - assumed 'php' in /home/effect/public_html/catalog/view/theme/theme208/template/module/featured.tpl

New member

Posts

Joined
Thu Jul 03, 2014 2:47 pm

Post by melbagnato » Mon Jul 14, 2014 3:14 pm

Hi istyfu,

usually that error occurs when someone uses a variable without using a $ sign in front of it. PHP is smart enough to assume that it is a variable so it can keep moving.

Check that tpl file for a 'php' somewhere being used like a variable.

- Mel

http://online.enterpriseconsulting.com.au

Site with OpenCart extensions & code downloads, many new extensions coming soon!
Follow us on twitter for more updates

Image


User avatar
Active Member

Posts

Joined
Wed Jan 13, 2010 1:39 pm
Location - Melbourne

Post by istyfu » Tue Jul 15, 2014 8:27 pm

melbagnato wrote:Hi istyfu,

usually that error occurs when someone uses a variable without using a $ sign in front of it. PHP is smart enough to assume that it is a variable so it can keep moving.

Check that tpl file for a 'php' somewhere being used like a variable.

- Mel
Can you be a bit specific? I'm not an expert in PHP.

New member

Posts

Joined
Thu Jul 03, 2014 2:47 pm

Post by villagedefrance » Wed Jul 16, 2014 10:26 pm

PHP variables use the dollar sign ($) in front of the variable name:

Example: the variable "template" will be "$template"

Look in your "featured.tpl" file for a missing $ sign.
The error message gives you the location and should also give you the line number of the error.

OpenCart custom solutions @ https://villagedefrance.net


User avatar
Active Member

Posts

Joined
Wed Oct 13, 2010 10:35 pm
Location - UK

Post by swguy » Sat Aug 02, 2014 8:38 pm

I wonder if the <? characters were accidentally edited out of the php open tag, leaving just "php" ? If the error message includes a line number, please post the contents of that file around that line (say 5 before and 5 after).

Better Together: Buy one product, get another at a discount.
Discount Chooser: Buy a group of products, get another group at a discount.


User avatar
New member

Posts

Joined
Mon Apr 15, 2013 4:13 am

Post by jetmosquitoe » Fri Jul 22, 2016 5:54 pm

I have same error in error log

Code: Select all

				<div class="inner-indent">
						
						<?php if ($product['thumb']) { ?>
						<div class="image2">
							<a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a>
                            <a href="<?php echo $product['href']; ?>"   rel="colorbox" class="colorbox<?php echo $i;?> quick-view-button button"><span><?php echo $text_quick;?></span></a>
						</div>
						<?php } ?>
						<div class="name maxheight-feat"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
						<?php // if ($product['description']) {?>
						<div class="description"><?php// echo mb_substr($product['description1'],0,60,'UTF-8').'...';?></div>
						<?php// } ?>
						<div style="display:none;">
							<div  class="quick-view<?php echo $i;?> preview">
								<div class="wrapper marg">
									<div class="left">
										<?php if ($product['thumb1']) { ?>
											<div class="image3">
												<a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb1']; ?>" alt="<?php echo $product['name']; ?>" /></a>
												
											</div>
The lines which apeared in error log are these:

Code: Select all

62:						<?php // if ($product['description']) {?>
63:						<div class="description"><?php// echo mb_substr($product['description1'],0,60,'UTF-8').'...';?></div>
64:						<?php// } ?>
This error is accompanied to onother one:

Code: Select all

2016-07-22 16:03:56 - PHP Notice:  Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice:  Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice:  Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice:  Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice:  Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice:  Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice:  Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
Can we refresh this topic with new comments please :)

User avatar
Newbie

Posts

Joined
Mon Sep 21, 2015 10:04 pm

Post by ADD Creative » Fri Jul 22, 2016 6:58 pm

You may need to add a space between the php tag and the comment.

So change.

Code: Select all

<?php//
to

Code: Select all

<?php //

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by jetmosquitoe » Sat Jul 23, 2016 12:20 am

ADD Creative wrote:You may need to add a space between the php tag and the comment.

So change.

Code: Select all

<?php//
to

Code: Select all

<?php //
It worked with the first error! Thank you so much!

Can you help with the second error, it remains in error log:

2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408

Here is the line 408 from product.tpl:

Code: Select all

line 407:             <div class="cart">
line 408:                <a href="<?php echo $product['href']; ?>" class="button details btn_view"><span><?php echo $button_details; ?></span></a>
line 409:				<a data-id="<?php echo $product['product_id']; ?>;" class="button addToCart btn_cart"><span><?php echo $button_cart; ?></span></a>		
line 410:             </div>

User avatar
Newbie

Posts

Joined
Mon Sep 21, 2015 10:04 pm

Post by straightlight » Sat Jul 23, 2016 12:36 am

jetmosquitoe wrote:
ADD Creative wrote:You may need to add a space between the php tag and the comment.

So change.

Code: Select all

<?php//
to

Code: Select all

<?php //
It worked with the first error! Thank you so much!

Can you help with the second error, it remains in error log:

2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408
2016-07-22 16:03:56 - PHP Notice: Undefined variable: button_details in .../catalog/view/theme/theme222/template/product/product.tpl on line 408

Here is the line 408 from product.tpl:

Code: Select all

line 407:             <div class="cart">
line 408:                <a href="<?php echo $product['href']; ?>" class="button details btn_view"><span><?php echo $button_details; ?></span></a>
line 409:				<a data-id="<?php echo $product['product_id']; ?>;" class="button addToCart btn_cart"><span><?php echo $button_cart; ?></span></a>		
line 410:             </div>
Theme222 is a custom theme. If you switch back to the default template from the admin - > systems - > settings - > edit store - > General tab - > Select Default template - > Save changes. Are you able to reproduce the same issue on the store-front end?

Note: I would suggest to post your site under temporary maintenance before trying the above solution from your admin - > systems - > settings - > edit store - > server tab - > Maintenance Mode.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jetmosquitoe » Sat Jul 23, 2016 1:24 am

straightlight wrote: Theme222 is a custom theme. If you switch back to the default template from the admin - > systems - > settings - > edit store - > General tab - > Select Default template - > Save changes. Are you able to reproduce the same issue on the store-front end?

Note: I would suggest to post your site under temporary maintenance before trying the above solution from your admin - > systems - > settings - > edit store - > server tab - > Maintenance Mode.
I switched to default OC theme, and checked. This error in error log file apears only in my custom theme. What would you recommend to do?

User avatar
Newbie

Posts

Joined
Mon Sep 21, 2015 10:04 pm

Post by straightlight » Sat Jul 23, 2016 1:28 am

jetmosquitoe wrote:
straightlight wrote: Theme222 is a custom theme. If you switch back to the default template from the admin - > systems - > settings - > edit store - > General tab - > Select Default template - > Save changes. Are you able to reproduce the same issue on the store-front end?

Note: I would suggest to post your site under temporary maintenance before trying the above solution from your admin - > systems - > settings - > edit store - > server tab - > Maintenance Mode.
I switched to default OC theme, and checked. This error in error log file apears only in my custom theme. What would you recommend to do?
I would suggest to contact the developer of the custom theme to resolved this issue. If the developer does not respond after sometime, you can always request a quote from the Commercial Support section of the forum.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jetmosquitoe » Sat Jul 23, 2016 4:20 pm

I will contact theme developer than, and comment here later on result, thank you!

User avatar
Newbie

Posts

Joined
Mon Sep 21, 2015 10:04 pm

Post by jetmosquitoe » Sun Jul 24, 2016 2:12 am

Here, what technical support of the theme developer have answered:
PHP Notices does not effect your site correct work. Navigate to System -> Settings -> Edit -> Server -> Display Errors -> No.
It is set No already :) Looks like the question is fixed.

After some time the log file will have so big size that the admin menu with error log will open because it will be too heavy :) I had to clear it manually recently because of this.

User avatar
Newbie

Posts

Joined
Mon Sep 21, 2015 10:04 pm

Post by straightlight » Sun Jul 24, 2016 2:14 am

jetmosquitoe wrote:Here, what technical support of the theme developer have answered:
PHP Notices does not effect your site correct work. Navigate to System -> Settings -> Edit -> Server -> Display Errors -> No.
It is set No already :) Looks like the question is fixed.

After some time the log file will have so big size that the admin menu with error log will open because it will be too heavy :) I had to clear it manually recently because of this.
That is correct. The error logs may be overloaded after a certain size as it may no longer be able to write on it unless manually cleared from the admin-end or by FTP / File manager's host console.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Cue4cheap » Sun Jul 24, 2016 4:24 am

Overall your theme developer doesn't seem very good..... There may be other issues, in fact I would be there are, but as a HACK to "fix" this issue:
change:

Code: Select all

line 408:  <a href="<?php echo $product['href']; ?>" class="button details btn_view"><span><?php echo $button_details; ?></span></a>
to

Code: Select all

line 408:  <a href="<?php echo $product['href']; ?>" class="button details btn_view"><span><?php if (isset($button_details)) { echo $button_details; } ?></span></a>
But as stated this is a hack and I wouldn't recommend to keep patching but I would recommend get support from the developer because to me their answer is bogus (and I hope you didn't pay for the theme).

Mike
Last edited by Cue4cheap on Tue Jul 26, 2016 10:57 am, edited 3 times in total.

cue4cheap not cheap quality


Active Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by jetmosquitoe » Sun Jul 24, 2016 3:39 pm

The offered hack did not work. But I decided to live with it ) it is OK for me at the moment, as long as it doesn't affect operation of the shop. Thank you so much for your help!

User avatar
Newbie

Posts

Joined
Mon Sep 21, 2015 10:04 pm

Post by Cue4cheap » Tue Jul 26, 2016 10:09 am

Try the one I changed it to in the post above.

Mike

cue4cheap not cheap quality


Active Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by jetmosquitoe » Tue Jul 26, 2016 3:57 pm

Cue4cheap wrote:Try the one I changed it to in the post above.

Mike
theme developers' support is currently doing smth with that error. I will try your offer a bit later, and return here with comments. Thank you )

User avatar
Newbie

Posts

Joined
Mon Sep 21, 2015 10:04 pm

Post by jetmosquitoe » Tue Jul 26, 2016 11:48 pm

Theme developer support have sent me a corrected product.tpl file and I replaced the one on the server. There error disapeared in log file. All looks working now.

The number of lines is also changed and the block looks like this now.

Code: Select all

404:             <div class="cart">
405:                <a href="<?php echo $product['href']; ?>" class="button details btn_view"></a>
406:				<a data-id="<?php echo $product['product_id']; ?>;" class="button addToCart btn_cart"><span><?php echo $button_cart; ?></span></a>		
407:             </div>
Looks like some code before this line has also been changed.

User avatar
Newbie

Posts

Joined
Mon Sep 21, 2015 10:04 pm
Who is online

Users browsing this forum: No registered users and 3 guests