Hey I just made an upgrade to 6.2 . Im getting a error on my website suddenly.
The following code No longer works:
<?php
// below details need to be taken from you configuration.php root
$db_host = 'secret';
$db_username = 'secret';
$db_password = 'secret';
$db_name = 'secret';//not going to tell you, lol
$mysqli = new mysqli($db_host, $db_username, $db_password, $db_name);
$products = array();
if (mysqli_connect_error()) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
$product_groups_query = "SELECT g.* FROM tblproductgroups g WHERE g.hidden !='on' ORDER BY g.order ASC";
if($product_groups = $mysqli->query($product_groups_query)) {
while ($row = $product_groups->fetch_assoc()) {
$group_products = array();
$group_id = $row['id'];
$pull_products_per_group_query = "
SELECT p.id AS product_id,
p.name AS plan_name,
p.description AS plan_description,
tp.monthly AS plan_monthly_price,
pc.prefix AS currency
FROM tblproducts p
LEFT JOIN tblpricing tp ON tp.relid = p.id AND tp.type = 'product'
LEFT JOIN tblcurrencies pc ON pc.id = tp.currency
WHERE p.gid = $group_id AND p.hidden !='on' ORDER BY p.order ASC";
$groups_products = $mysqli->query($pull_products_per_group_query);
while( $subrow = $groups_products->fetch_assoc()) {
$group_products[] = $subrow;
}
$products[] = array(
'group_name' => $row['name'],
'group_products' => $group_products );
}
}
$mysqli->close();
$this->assign('myproducts',$products);
?>
I tried switching "$this->assign('myproducts',$products);" to "$template->assign('myproducts',$products);", but I get the error "Call to a member function assign() on a non-object in /home/reaganm/public_html/hmchosting.com/templates/ultimate/config.php on line 48".
Please help a guy out. I dont want to have to revert my changes back to the old version of whmcs! If I remoe this, the site looks weird but is still functional.