Issue
I'm an absolute newbie to Opencart, as well as Twig and SQL. Currently trying to add JSON-LD on categories page:
let min_price = $('input#filter_price_min').val();
let max_price = $('input#filter_price_max').val();
data = {
"@context": "https://schema.org/",
"@type": "Product",
"name": "{{ heading_title }}",
"image": "{{ products[0].thumb }}",
"offers": {
"@type": "AggregateOffer",
"lowPrice": min_price,
"highPrice": max_price,
"offerCount": "",
"priceCurrency": "RUB"
},
}
I've tried to edit Controller's category.php, but couldn't succeed
The question is - how to get this value: quantity of products of a certain category
Solution
Upd. Solved
Needed to add $data['product_total'] = $product_total;
right after $data['results'] = ... / $limit));
in /catalog/controller/product/category.php directory
and {{ product_total }}
to JSON LD
Another main thing to do is to update modificators in opencart admin panel (admin panel --> modules --> modificators)
Answered By - Nikita Kopot Answer Checked By - Gilberto Lyons (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.