Created
December 10, 2016 07:20
-
-
Save vgrish/5e77f10d5b92ff069dbfbaf944d4944f to your computer and use it in GitHub Desktop.
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 | |
/** @var $cost */ | |
/** @var $options */ | |
/** @var $modifications array */ | |
switch ($modx->event->name) { | |
case 'msopOnGetFullCost': | |
if (!$msoptionsprice = $modx->getService('msoptionsprice') | |
) { | |
return false; | |
} | |
$tkan = isset($options['tkan']) ? $options['tkan'] : 0; | |
if (!$tkan) { | |
return; | |
} | |
/** @var msProduct $product */ | |
if (!$tkan = $modx->getObject('msProduct', (int)$tkan)) { | |
return; | |
} | |
$optPrice = $tkan->get('price'); | |
if (!$optPrice) { | |
return; | |
} | |
$cost = $cost + $optPrice; | |
$cost = $msoptionsprice->formatPrice($cost, true, true); | |
$values = $modx->Event->returnedValues; | |
$values['cost'] = $cost; | |
$modx->event->returnedValues = $values; | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment