PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 16, 2022

[FIXED] How to add Category Product Count to JSON-LD?

 October 16, 2022     opencart, php     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing