Version: current

     1 <?php
     2  // Виджет корзины
     3 class CartWidget extends SidebarWidget {
     4
     5     public $needObjects = array(
     6         'Cart' => 'Class'
     7     );
     8
     9     function Cart() {
    10         $cart = Cart::current_order();
    11         if ($cart->getTotalQuantity() > 0) {
    12             $result = new ArrayData(array(
    13                 'ItemName' => $cart->ItemName(),
    14                 'CountItems' => DBField::create('Int', $cart->getTotalQuantity()),
    15                 'TotalPrice' => $cart->getTotalPrice(),
    16                 'CheckoutLink' => CheckoutPage::find_link(),
    17                 'CartLink' => CartPage::find_link(),
    18                 'Currency' => SiteConfig::current_site_config()->CatalogCurrency,
    19             ));
    20             return $result;
    21         }
    22         return null;
    23     }
    24
    25     function hasContent() {
    26         // ?? if ($cart->getTotalQuantity() > 0) ??
    27         return true;
    28     }
    29 }
    30

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -