Post by TheLizard » Tue Feb 28, 2012 5:04 pm

I am trying to run some PHP code inside my product.tpl ... Is this an opencart issue not allowing fopen? Pretty frustrating and would appreciate some help. I want to turn off warnings and errors in opencart basically.

Editing php.ini to allow_url_open = on;

I have tried placing error_reporting(0) at 0. I have tried ini_set('display_errors', 0) too. I still get a warning in my page. I also tried @fopen and file_get_contents... This is the code:

Code: Select all

<?php 
/**
*   Image Detect - Do we have images on the CDN v2
**/
    $cdnurl="http://www.****-cdn.com/";
    $pid=$product_info['sku']; // database variable decalred earlier in page
    $oldfile="".$cdnurl."catwalk/movies/".$pid.".flv";
    $newfile="".$cdnurl."assets/".$pid."/v/".$pid.".swf";
    $combi=0; // out variable
    if(@fopen($oldfile,"r")===TRUE){
        $combi=1;
    } else {
        if(@fopen($newfile,"r")===TRUE){
            $combi=2;
        } else {
            $combi=3;
        }
    }

?>
Warning : fopen(http://www.*-cdn.com/catwalk/movies/564_white.flv): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/www.sitedev.com/web/template.inc.php

Warning : file_get_contents(http://www.*-cdn.com/catwalk/movies/564_white.flv): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/www.sitedev.com/web/template.inc.php

These are the warnings... I have searched extensively and tried using ===FALSE and ==FALSE but I cannot hide the warning. I am aware the file does not exist but I just want it to skip, this code works on other servers and other cloud nginx servers that are the same setup.

Appreciate any help, my first question so go easy!

New member

Posts

Joined
Mon Feb 20, 2012 11:51 pm

Post by TheLizard » Tue Feb 28, 2012 5:35 pm

I fixed this

Open index.php

Find

Code: Select all

// Error Handler
set_error_handler('error_handler');
Replace with

Code: Select all

// Error Handler
//set_error_handler('error_handler');

New member

Posts

Joined
Mon Feb 20, 2012 11:51 pm

Post by jiblett1000 » Tue Jul 10, 2012 8:18 am

there should be an option to turn off errors and what not in the system settings in the opencart admin

Newbie

Posts

Joined
Tue Jul 10, 2012 8:07 am

Post by ecoleman » Wed Jul 11, 2012 3:00 pm

Edit your settings for the store in Admin and turn off "Display Errors"

Colour Code you orders by Order Status


Active Member

Posts

Joined
Tue Dec 06, 2011 3:34 am

Post by Arif Shaik » Thu Oct 18, 2012 6:10 pm

Hi!

Thank you very much for your support.

It works great. :dance: :dance:

Newbie

Posts

Joined
Tue Jul 03, 2012 2:26 pm
Who is online

Users browsing this forum: No registered users and 40 guests