Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
design_area_ecommerce_cart.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/designs/design_area/design_area.inc';
18 
31 {
32 
33 
34  /*
35  * Outputs the var either as straight HTML or PHP code, depending on the type
36  *
37  * @param string $var the name of the var to print out
38  * @param Array $args array of any extra arguments that existed in the print command
39  * @param string $value_prefix PHP code to wrap put before the value before outputting it
40  * @param string $value_suffix PHP code to wrap put after the value before outputting it
41  *
42  * @return void
43  * @access public
44  */
45  function printVar($var, $args, $value_prefix='', $value_suffix='')
46  {
47  switch ($var) {
48  case 'cart_href' :
49  echo '<','?php';
50  ?>
51  $url = $GLOBALS['SQ_SYSTEM']->am->getAssetURL(<?php echo $this->attr('cart'); ?>);
52  echo $url;
53  <?php
54  echo '?','>';
55  break;
56 
57  case 'checkout_href' :
58  echo '<','?php';
59  ?>
60  $url = $GLOBALS['SQ_SYSTEM']->am->getAssetURL(<?php echo $this->attr('ecom_form'); ?>);
61  echo $url;
62  <?php
63  echo '?','>';
64  break;
65 
66  case 'items' :
67  echo '<','?php';
68  ?>
69  require_once SQ_PACKAGES_PATH.'/ecommerce/lib/ecommerce_cart_processor.inc';
70  $cart = new Ecommerce_Cart_Processor(<?php echo $this->attr('ecom_form'); ?>);
71  echo (($cart->getCount() == 1) ? translate('item') : translate('items'));
72  <?php
73  echo '?','>';
74  break;
75 
76  case 'count' :
77  echo '<','?php';
78  ?>
79  require_once SQ_PACKAGES_PATH.'/ecommerce/lib/ecommerce_cart_processor.inc';
80  $cart = new Ecommerce_Cart_Processor(<?php echo $this->attr('ecom_form'); ?>);
81  echo $cart->getCount();
82  <?php
83  echo '?','>';
84  break;
85 
86  case 'total' :
87  echo '<','?php';
88  ?>
89  require_once SQ_PACKAGES_PATH.'/ecommerce/lib/ecommerce_cart_processor.inc';
90  $cart = new Ecommerce_Cart_Processor(<?php echo $this->attr('ecom_form'); ?>);
91  echo number_format($cart->getTotal(), 2);
92  <?php
93  echo '?','>';
94  break;
95 
96 
97  default:
98  parent::printVar($var, $args);
99 
100  }
101 
102  }//end printVar()
103 
104 
105 }//end class
106 
107 ?>