parameters = $parameterStrategy; } /** * @param $code * @return string * * Возвращает скрипт ретага успешного оформления заказа по коду */ public function getCheckoutRetag($code) { return $this->getScript($code, 4, $this->parameters->getCheckoutRetagParams()); } /** * @param $code * @return string * * Возвращает скрипт ретага корзины по коду */ public function getCartRetag($code) { return $this->getScript($code, 3, $this->parameters->getCartRetagParams()); } /** * @param $code * @return string * * Возвращает скрипт ретага страницы товара по коду */ public function getProductRetag($code) { return $this->getScript($code, 2, $this->parameters->getProductRetagParams()); } /** * @param $code * @return string * * Возвращает скрипт ретага страницы категории по коду */ public function getCategoryRetag($code) { return $this->getScript($code, 1, $this->parameters->getCategoryRetagParams()); } /** * @param $code * @return string * * Возвращает скрипт ретага главной страницы по коду */ public function getMainRetag($code) { return $this->getScript($code, 0); } protected function getScript($code, $level, $params = array()) { $vars = ''; foreach ($params as $key => $value) { $vars .= 'window.' . $key . ' = ' . json_encode($value, JSON_UNESCAPED_UNICODE) . ';' . PHP_EOL; } $script = ' '; return $script; } }