I have created Facebook pixels, which connected well. When I run a debug tool, it selects sample items and lists them but once I try connecting the catalog to the pixel, it shows that the pixel is not ready. Below is the code:
<?php
$current_url = base64_encode($url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
$results = $mysqli->query("SELECT products.id,products.image,products.name,products.description, product_variant.discounted_price, product_variant.price FROM products LEFT JOIN product_variant ON products.id = product_variant.product_id where subcategory_id = 41 ORDER BY id ASC LIMIT 12");
if ($results) {
//fetch results set as object and output HTML
while($obj = $results->fetch_object()) {
$a = $obj->price;
$b = $obj->discounted_price;
$epsilon = 0;
if(!$b == $epsilon) {
$price = number_format($b,0);
} else {
$price = number_format($a,0);
}
//Microdata Tags
echo '<div itemscope itemtype="http://schema.org/Product">
<meta itemprop="brand" content="'.$obj->made_in.'">
<meta itemprop="name" content="'.$obj->name.'">
<meta itemprop="description" content="'.$obj->description.'">
<meta itemprop="productID" content="'.$obj->id.'">
<meta itemprop="url" content="https://mgcmax.com/single.php?id='.$obj->id.'">
<meta itemprop="image" content="https://www.vendor.mgcmax.com/'.$obj->image.'">
<div itemprop="value" itemscope itemtype="http://schema.org/PropertyValue">
<span itemprop="propertyID" content="item_group_id"></span>
<meta itemprop="value" content="Electroics"></meta>
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<link itemprop="availability" href="http://schema.org/InStock">
<link itemprop="itemCondition" href="http://schema.org/NewCondition">
<meta itemprop="product:category" content="888">
<meta itemprop="price" content="'.$price.'">
<meta itemprop="priceCurrency" content="UGX">
</div>
</div>';
}
}
?>
What could be missing for the pixels not to connect, though the debug is working?