* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Adapter\Kpi; use ConfigurationKPI; use Context; use HelperKpi; use PrestaShop\PrestaShop\Core\Kpi\KpiInterface; /** * @internal */ final class ConversionRateKpi implements KpiInterface { /** * {@inheritdoc} */ public function render() { $translator = Context::getContext()->getTranslator(); $helper = new HelperKpi(); $helper->id = 'box-conversion-rate'; $helper->icon = 'assessment'; $helper->color = 'color1'; $helper->title = $translator->trans('Conversion Rate', [], 'Admin.Global'); $helper->subtitle = $translator->trans('30 days', [], 'Admin.Global'); if (ConfigurationKPI::get('CONVERSION_RATE') !== false) { $helper->value = ConfigurationKPI::get('CONVERSION_RATE'); } if (ConfigurationKPI::get('CONVERSION_RATE_CHART') !== false) { $helper->data = ConfigurationKPI::get('CONVERSION_RATE_CHART'); } $helper->source = Context::getContext()->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=conversion_rate'; $helper->refresh = (bool) (ConfigurationKPI::get('CONVERSION_RATE_EXPIRE') < time()); return $helper->generate(); } }