Function is called in my functions file.
function Get_Favourites($fields){
$member = $fields['fv_member'];
$sql = "SELECT * FROM favourites ";
$sql .= "WHERE FV_MEMBER='" . $member . "' ";
$sql .= "ORDER BY FV_PRODUCT";
return FetchSqlAsObjectArray($sql);
}
Functions file is called in my header and is working with other functions.
<?php
include_once("includes/session.php");
confirm_logged_in();
?>
<?php
include_once("../includes/masterinclude.php");
$pageTitle = 'Favourites';
$pageSubTitle='Favourites';
include_once("includes/header_sidebar.php");
$information = getInformationPage("Favourites");
$preferences = getPreferences();
$pageTitle = "Favourites";
$top_level="0"; $infopagename="";
$pageMetaDescription = $preferences->PREF_META_DESC;
$pageMetaKeywords = $preferences->PREF_META_KEYWORDS;
if(!isset($_POST['favourites'])){$_POST['favourites'] = "";}
if(isset($_POST['DELETE_FAVOURITE']) and $_POST['DELETE_FAVOURITE'] == 1){
//delete favourites entry
$rows = Delete_Favourite($_POST['ID_TO_DELETE']);
}
?>
<?php
//$name = $_GET['page'];
$information = getInformationPage("Favourites");
echo html_entity_decode($information->IN_DATA, ENT_QUOTES);
?>
</div>
<?php
$member = Get_Member($_SESSION['username']);
$fields = array("fv_member"=>$member->MB_ID);
$favourites = Get_Favourites($fields);
if(count($favourites) > 0){
echo "<div class=\"matter\">";
echo "<div class=\"container\">";
echo "<div class=\"row\">";
echo "<div class=\"col-md-12\">";
echo "<div class=\"padd\">";
echo "<form class=\"form-horizontal form-box\" role=\"form\" id=\"favourites\" action=\"favourites.php\" method=\"post\">";
echo "<h4 class=\"form-box-header\">My Favourites</h4>";
echo "<div class=\"form-box-content\">";
echo "<ol>";
//now scan down the favourites, read the product found and display it
foreach($favourites as $f){
$id = $f->FV_ID;
$p = getProductDetails($f->FV_PRODUCT);
$imagePathProd = "";
if(strlen($p->PR_IMAGE_FOLDER) > 0){$imagePathProd = $p->PR_IMAGE_FOLDER . "/";}
$imagePathProd .= $p->PR_IMAGE;
if(strlen($imagePathProd) == 0){
$imagePathProd = "/images/thumbnoimage.jpg";
}else{
$imagePathProd = "/images/" . $imagePathProd;
}
//$tree = getProductTree($p->PR_PRODUCT);
//$link = "/" . urlencode(html_entity_decode($p->PR_NAME, ENT_QUOTES)) . "/" . $tree . "/" . $p->PR_PRODUCT . ".htm";
//set link equal to the favourites table FV_URL (rather than generate it based on the product itself) since this represents the
//actual link clicked on ie. the same product may sit in different categories.
$link = $f->FV_URL;
echo
"<li class=\"search-li\" style=\"height: 145px;\">
<span>
<a class=\"thumbnail-search\" href=\"" . $link . "\">
<img src=\"" . $imagePathProd . "\" alt=\"" . $p->PR_IMAGE_ALT . "\" height=\"100\" />
</a>
<input name=\"DELETE_FAV_" . $id . "\" id=\"DELETE_FAV_" . $id . "\" type=\"button\"
style=\"float: left; margin: 5px 0 0 6px; font-size: 11px;\" class=\"btn btn-primary\" value=\"Delete Favourite\" />
</span>
<a class=\"thumbnail-search\" href=\"" . $link . "\">". html_entity_decode($p->PR_NAME, ENT_QUOTES) . "</a>
<br />" .
html_entity_decode($p->PR_DESC_SHORT, ENT_QUOTES) . "
</li>" . PHP_EOL;
}
echo "</ol>";
echo "<div class=\"form-control\">";
echo "<input name=\"DELETE_FAVOURITE\" id=\"DELETE_FAVOURITE\" type=\"hidden\" value=\"\" />";
echo "<input name=\"ID_TO_DELETE\" id=\"ID_TO_DELETE\" type=\"hidden\" value=\"\" />";
echo "</div>";
echo "</form>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
}
?>
<?php
include 'includes/footer_notificationbox.php';
?>
<script type="text/javascript">
$(document).ready(function(){
$(".delete_fav_button").click(function(){
var button_id = $(this).attr("name");
var fav_to_delete = button_id.replace("DELETE_FAV_", "");
$("#DELETE_FAVOURITE").val(1);
$("#ID_TO_DELETE").val(fav_to_delete);
$("#favourites").submit();
});
});
</script>
However I am getting the error message:
Fatal error: Call to undefined function get_favourites() in /home/download/domains/1ecommerce.com/public_html/dev/_cms/favourites.php on line 48
Any help would be really appreciated!