Jump to content

Chyba ve skriptu - bílá stránka


pavell86
 Share

Recommended Posts

Zdravím, mohl by mi někdo poradit co je chybně na níže uvedeném skriptu ( využívám prestashop 1.5.6.2). Zobrazí se mi jen bílá stránka. Děkuji

error_reporting(0);
require "../classes/db/Db.php";
require "../config/defines.inc.php";

$db = new MySQL();
$db->connect();

function xmlentities($string) {
	$string = str_replace("&", "&", $string);
	$string = str_replace("<", "<", $string);
	$string = str_replace(">", ">", $string);
	$string = str_replace("\"", """, $string);
	$string = str_replace("'", "'", $string);

	return $string;
}

//get default lang ID
$query = "SELECT value FROM " . _DB_PREFIX_ . "configuration WHERE name='PS_LANG_DEFAULT'";
$result = $db->getRow($query) or die (mysql_error());
define("LANG", $result['value']);
unset($query, $result);

define("PRODUCT", _DB_PREFIX_ . "product");
define("PRODUCT_LANG", _DB_PREFIX_ . "product_lang");
define("CATEGORY_LANG", _DB_PREFIX_ . "category_lang");
define("IMAGE", _DB_PREFIX_ . "image");
define("MANUFACTURER", _DB_PREFIX_ . "manufacturer");

//get data
$query = "SELECT " . PRODUCT . ".id_product AS ID, " . PRODUCT_LANG . ".name AS PRODUCT, " . PRODUCT . ".price as PRICE, " . PRODUCT . ".reference as PRODUCTID, " . PRODUCT . ".quantity AS AVAILABILITY," . PRODUCT_LANG . ".link_rewrite AS PRODUCT_LINK, " . PRODUCT_LANG . ".description_short AS DESCRIPTION, " . CATEGORY_LANG . ".name AS CATEGORY, " . CATEGORY_LANG . ".link_rewrite AS CATEGORY_LINK, id_image AS IMAGEID, " . MANUFACTURER . ".name AS MANUFACTURER  FROM " . PRODUCT . " LEFT JOIN " . PRODUCT_LANG . " on (" . PRODUCT .".id_product=" . PRODUCT_LANG . ".id_product) LEFT JOIN " . CATEGORY_LANG . " on (" . CATEGORY_LANG . ".id_category=" . PRODUCT . ".id_category_default) LEFT JOIN " . IMAGE . " on(" . IMAGE . ".id_product=" . PRODUCT . ".id_product) LEFT JOIN " . MANUFACTURER . " on (" . MANUFACTURER . ".id_manufacturer=" . PRODUCT . ".id_manufacturer) WHERE " . PRODUCT_LANG  . ".id_lang='" . LANG . "' AND " . CATEGORY_LANG . ".id_lang='" . LANG . "'";

$products = $db->ExecuteS($query);


print_R($products);
Edited by pavell86 (see edit history)

Share this post


Link to post
Share on other sites

Pokud se vám zobrazuje jen prazdná stránka tak zkuste aktivovat výpis chyb jak v Prestě tak v tom skriptu...potažmo na serveru (v php.ini).

Děkuji, chyba byla v cestě. Ještě jsem však narazil na jeden problem. Při níže uvedené kodu, dostanu chybu Class 'Db' not found in. Netušíš čím by to mohlo být? Děkuji

require "./classes/db/MySQL.php";
require "./classes/db/Db.php";
require "./config/defines.inc.php";
require "./config/config.inc.php";

Share this post


Link to post
Share on other sites

Nejjednodušší je podívat se do těch konkrétních classes jak je to nadefinováno. Druhá věc je proč se nepodíváte do jiného modulu, který používá DB jak je to tam realizováno a prostě to neuděláte stejně? Chyba navíc může být stále i v definici cest (nebo v souborech které váš skript potřebuje), ale spíše v použití třídy...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More