Skip to content

Instantly share code, notes, and snippets.

@vgrish
Created October 20, 2015 11:53
Show Gist options
  • Save vgrish/e2151f3949f5dd1333f6 to your computer and use it in GitHub Desktop.
Save vgrish/e2151f3949f5dd1333f6 to your computer and use it in GitHub Desktop.
<?php
/* @var miniShop2 $miniShop2 */
$miniShop2 = $modx->getService('minishop2');
$miniShop2->initialize($modx->context->key);
$cart = $miniShop2->cart->status();
$cart['total_cost'] = $miniShop2->formatPrice($cart['total_cost']);
$cart['total_weight'] = $miniShop2->formatWeight($cart['total_weight']);
$cart['total_my_count'] = count(array_count_values(array_values(array_map('array_shift',$_SESSION['minishop2']['cart']))))
return !empty($tpl) ? $modx->getChunk($tpl, $cart) : print_r($cart,1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment