$product->is_discounted
): ?>
<span class="product-delivery-date">
<?= $deliveryDate ?>
<?= $deliveryDate ? ' — ' : '' ?>
</span>
<span class="product-delivery-cost">
<?php if ($product->is_discounted and in_array($regionId, [1,2])): ?>
1000 руб.
<?php elseif ($deliveryOptions['cost'] === null): ?>
<?php else: ?>
<?=
$deliveryOptions['cost'] === 0
? 'Бесплатно'
: $deliveryOptions['cost'] . ' руб' . (
$freeCost
? ', ' . $freeCost .
$deliveryOptions['freeCost'] . ' руб'
<?= $deliveryDate ?>
<?= $deliveryDate ? ' — ' : '' ?>
</span>
<span class="product-delivery-cost">
<?php if ($product->is_discounted and in_array($regionId, [1,2])): ?>
1000 руб.
<?php elseif ($deliveryOptions['cost'] === null): ?>
<?php else: ?>
<?=
$deliveryOptions['cost'] === 0
? 'Бесплатно'
: $deliveryOptions['cost'] . ' руб' . (
{
$_obInitialLevel_ = ob_get_level();
ob_start();
ob_implicit_flush(false);
extract($_params_, EXTR_OVERWRITE);
try {
require $_file_;
return ob_get_clean();
} catch (\Exception $e) {
while (ob_get_level() > $_obInitialLevel_) {
if (!@ob_end_clean()) {
ob_clean();
}
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]);
}
/* @var $renderer ViewRenderer */
$renderer = $this->renderers[$ext];
$output = $renderer->render($this, $viewFile, $params);
} else {
$output = $this->renderPhpFile($viewFile, $params);
}
$this->afterRender($viewFile, $params, $output);
}
array_pop($this->_viewFiles);
$this->context = $oldContext;
* @throws InvalidCallException if the view cannot be resolved.
* @see renderFile()
*/
public function render($view, $params = [], $context = null)
{
$viewFile = $this->findViewFile($view, $context);
return $this->renderFile($viewFile, $params, $context);
}
/**
* Finds the view file based on the given view name.
* @param string $view the view name or the [path alias](guide:concept-aliases) of the view file. Please refer to [[render()]]
* on how to specify this parameter.
* @param array $params the parameters (name-value pairs) that should be made available in the view.
* @return string the rendering result.
* @throws InvalidArgumentException if the view file does not exist.
*/
public function render($view, $params = [])
{
return $this->getView()->render($view, $params, $this);
}
/**
* Renders a view file.
* @param string $file the view file to be rendered. This can be either a file path or a [path alias](guide:concept-aliases).
* @param array $params the parameters (name-value pairs) that should be made available in the view.
/**
* @inheritdoc
*/
public function run()
{
return $this->render('index', [
'instance' => $this,
]);
}
}
try {
/* @var $widget Widget */
$config['class'] = get_called_class();
$widget = Yii::createObject($config);
$out = '';
if ($widget->beforeRun()) {
$result = $widget->run();
$out = $widget->afterRun($result);
}
} catch (\Exception $e) {
// close the output buffer opened above if it has not been closed already
if (ob_get_level() > 0) {
ob_end_clean();
*/
private function calculateValueLevel1(): void
{
// переносим БЛ из прошлого проекта
// OldProject: frontend/views/catalog/_deliveryDate.php
// через виджет OldProjectDeliveryInfoV1
$this->value = OldProjectDeliveryInfoV1::widget([
'config' => OldProjectDeliveryInfoV1Config::create()
->setDeliveryDate($this->card->deliveryDate)
->setDeliveryOptions($this->card->deliveryOptions)
->setBrand(
$this->di->get(
'commonBrandRepository'
/**
* @return void
*/
public function calculateValue(): void
{
$methodName = "calculateValueLevel{$this->dataLevel->value}";
$this->$methodName();
}
/**
* @return void
*/
public function getCalculatedValue(): mixed
/**
* @return void
*/
public function getCalculatedValue(): mixed
{
if ($this->value === null) {
$this->calculateValue();
}
return $this->value;
}
/**
* @return string
* @see __set()
*/
public function __get($name)
{
$getter = 'get' . $name;
if (method_exists($this, $getter)) {
return $this->$getter();
} elseif (method_exists($this, 'set' . $name)) {
throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
}
throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}
$config = DeliveryInfoV2Config::create()
->setRegionPart(
'г. ' . $this->di->get('activeRegion')->model->name
)
->setDeliveryPart(
$this->aggregate->deliveryInfo->calculatedValue
);
if ($this->aggregate->deliveryInfo->isSdekAvailable) {
// OldProject: frontend/views/catalog/product.php
// [searchBy: "if($modelVendor->isSdekAvailable):"]
$config->setPickupPart('
// (версия с RealModifierFieldValue)
// $this->setRealModifierSwitcher();
// новая версия работает с RealModifierV2FieldValue
$this->setRealModifierSwitcherV2();
$this->setVirtualModifierSwitcher();
$this->setGallery();
$this->setDelivery();
$this->setEnticeBlock();
$this->setBuyViaCredit();
$this->setBuyViaDolyameV2();
// $this->setBrandWidget();
$this->setAdditionalProductListV2();
$this->setMarketingMarkup();
* {@inheritDoc}
*/
public function init(): void
{
parent::init();
if ($this->isLazyGenerate === false) {
$this->generate();
}
}
}
*/
public function __construct($config = [])
{
if (!empty($config)) {
Yii::configure($this, $config);
}
$this->init();
}
/**
* Initializes the object.
* This method is invoked at the end of the constructor after the object is initialized with the
* given configuration.
$config = $this->resolveDependencies($config);
if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) {
// set $config as the last parameter (existing one will be overwritten)
$dependencies[count($dependencies) - 1] = $config;
return $reflection->newInstanceArgs($dependencies);
}
$object = $reflection->newInstanceArgs($dependencies);
foreach ($config as $name => $value) {
$object->$name = $value;
}
$class = $class->id;
}
if (isset($this->_singletons[$class])) {
// singleton
return $this->_singletons[$class];
} elseif (!isset($this->_definitions[$class])) {
return $this->build($class, $params, $config);
}
$definition = $this->_definitions[$class];
if (is_callable($definition, true)) {
$params = $this->resolveDependencies($this->mergeParams($class, $params));
$config = array_merge($definition, $config);
$params = $this->mergeParams($class, $params);
if ($concrete === $class) {
$object = $this->build($class, $params, $config);
} else {
$object = $this->get($concrete, $params, $config);
}
} elseif (is_object($definition)) {
return $this->_singletons[$class] = $definition;
} else {
throw new InvalidConfigException('Unexpected object definition type: ' . gettype($definition));
}
'productSkeletonDao' => $this->productSkeletonDao,
'categoryConfigSetDao' => $this->categoryConfigSetDao,
'titleType' => TitleTypeEnum::productPrefixBrandNameProductNameRealModifierName,
]
);
$this->configGenerator = $this->di->get(
class: 'productCardAggregateV12ProductCardV1ConfigGenerator',
config: [
'productSkeletonDao' => $this->productSkeletonDao,
'aggregate' => $this->aggregateGenerator->aggregate,
]
);
*/
public function __construct($config = [])
{
if (!empty($config)) {
Yii::configure($this, $config);
}
$this->init();
}
/**
* Initializes the object.
* This method is invoked at the end of the constructor after the object is initialized with the
* given configuration.
$config = $this->resolveDependencies($config);
if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) {
// set $config as the last parameter (existing one will be overwritten)
$dependencies[count($dependencies) - 1] = $config;
return $reflection->newInstanceArgs($dependencies);
}
$object = $reflection->newInstanceArgs($dependencies);
foreach ($config as $name => $value) {
$object->$name = $value;
}
$class = $class->id;
}
if (isset($this->_singletons[$class])) {
// singleton
return $this->_singletons[$class];
} elseif (!isset($this->_definitions[$class])) {
return $this->build($class, $params, $config);
}
$definition = $this->_definitions[$class];
if (is_callable($definition, true)) {
$params = $this->resolveDependencies($this->mergeParams($class, $params));
$config = array_merge($definition, $config);
$params = $this->mergeParams($class, $params);
if ($concrete === $class) {
$object = $this->build($class, $params, $config);
} else {
$object = $this->get($concrete, $params, $config);
}
} elseif (is_object($definition)) {
return $this->_singletons[$class] = $definition;
} else {
throw new InvalidConfigException('Unexpected object definition type: ' . gettype($definition));
}
$product,
$modifierSlug
);
}
/** @var ProductViewActivePage $activePage */
$activePage = Yii::$container->get(
class: 'productViewActivePage',
config: $activePageDepends,
);
// } catch (ProductForbiddenHttpException $e) {
} catch (\Throwable $e) {
$args = $this->controller->bindActionParams($this, $params);
Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__);
if (Yii::$app->requestedParams === null) {
Yii::$app->requestedParams = $args;
}
return call_user_func_array([$this->controller, $this->actionMethod], $args);
}
}
}
$result = null;
if ($runAction && $this->beforeAction($action)) {
// run the action
$result = $action->runWithParams($params);
$result = $this->afterAction($action, $result);
// call afterAction on modules
foreach ($modules as $module) {
/* @var $module Module */
$parts = $this->createController($route);
if (is_array($parts)) {
/* @var $controller Controller */
list($controller, $actionID) = $parts;
$oldController = Yii::$app->controller;
Yii::$app->controller = $controller;
$result = $controller->runAction($actionID, $params);
if ($oldController !== null) {
Yii::$app->controller = $oldController;
}
return $result;
}
$params = $this->catchAll;
unset($params[0]);
}
try {
Yii::debug("Route requested: '$route'", __METHOD__);
$this->requestedRoute = $route;
$result = $this->runAction($route, $params);
if ($result instanceof Response) {
return $result;
}
$response = $this->getResponse();
if ($result !== null) {
{
try {
$this->state = self::STATE_BEFORE_REQUEST;
$this->trigger(self::EVENT_BEFORE_REQUEST);
$this->state = self::STATE_HANDLING_REQUEST;
$response = $this->handleRequest($this->getRequest());
$this->state = self::STATE_AFTER_REQUEST;
$this->trigger(self::EVENT_AFTER_REQUEST);
$this->state = self::STATE_SENDING_RESPONSE;
$response->send();
require __DIR__ . '/../../common/config/main.php',
require __DIR__ . '/../../common/config/main-local.php',
require __DIR__ . '/../config/main.php',
require __DIR__ . '/../config/main-local.php'
);
(new yii\web\Application($config))->run();
$_GET = [
'productSlug' => 'namatrasnik-rasprodazha-aquaprotect-plus',
];
$_COOKIE = [
'activeRegionId' => '54',
];