-
-
Save webinmd/0ad7af1c764e592a55e065b806e26c23 to your computer and use it in GitHub Desktop.
пересчет цены для минишопа в зависимости от курса из системной настройки current_rate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
пересчет цены в зависимости откурса | |
из системной настройки current_rate | |
плагин на событие минишопа msOnGetProductPrice | |
*/ | |
switch ($modx->event->name) { | |
case 'msOnGetProductPrice': | |
$values = & $modx->event->returnedValues; | |
// Цена может меняться несколькими плагинами сразу, поэтому проверяем: | |
if (isset($values['price'])) { | |
$price = $values['price']; | |
} | |
// пересчитываем цену | |
if( !$current_rate = $modx->getOption('current_rate') ){ | |
$current_rate = 1; | |
} | |
$values['price'] = $price * $current_rate; | |
break; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment