Skip to content

Developer notes

Overview · Installation · Configuration · Usage · FAQ

  • Add-on id kv_google_customer_reviews, scheme 3.0, PHP 7.4 to 8.3, CS-Cart 4.17.2 to 4.21.x. No core files are changed.
  • Opt-in: controllers/frontend/checkout.post.php (mode complete) builds the data with Tygh\Addons\KvGoogleCustomerReviews\OptIn::build($order_info) and assigns it to the view. The template hook index:scripts prints a small script that defines renderOptIn and then adds https://apis.google.com/js/platform.js?onload=renderOptIn. The confirmation page is never served from the full page cache.
  • Store widget: the dispatch_before_display hook assigns the options; the template hook index:head_scripts prints https://www.gstatic.com/shopping/merchant/merchantwidget.js and merchantwidget.start(). The output depends on settings only.
  • Feed: index.php?dispatch=kv_google_customer_reviews.feed&token=<token>, streamed in batches of 500 reviews, Content-Type: application/xml, X-Robots-Tag: noindex. Element order follows product_reviews.xsd 2.4. Review ids: r<product_review_id> (Product reviews) or d<post_id> (Comments and reviews). The feed also answers while the storefront is closed.
  • Table ?:kv_gcr_optins (order_id, company_id, country, delivery_date, gtins, shown_at, views), listed in the full page cache ignore_cache_tags. The delete_order hook removes rows of deleted orders.
  • Hooks: delete_order, dispatch_before_display. Template hooks: index:scripts, index:head_scripts (responsive; Nova and Bright inherit them).
  • License gate: Config::isActive() (installed, enabled, licensed). When inactive: no opt-in, no widget, feed 404.