OXID eShop CE  4.9.6
 All Classes Files Functions Variables Pages
wrapping.php
Go to the documentation of this file.
1 <?php
2 
6 class Wrapping extends oxUBase
7 {
8 
14  protected $_sThisTemplate = 'page/checkout/wrapping.tpl';
15 
21  protected $_aBasketItemList = null;
22 
28  protected $_oWrappings = null;
29 
35  protected $_oCards = null;
36 
37 
43  public function getBasketItems()
44  {
45  if ($this->_aBasketItemList === null) {
46  $this->_aBasketItemList = false;
47 
48  // passing basket articles
49  if ($oBasket = $this->getSession()->getBasket()) {
50  $this->_aBasketItemList = $oBasket->getBasketArticles();
51  }
52  }
53 
55  }
56 
62  public function getWrappingList()
63  {
64  if ($this->_oWrappings === null) {
65  $this->_oWrappings = new oxlist();
66 
67  // load wrapping papers
68  if ($this->getViewConfig()->getShowGiftWrapping()) {
69  $this->_oWrappings = oxNew('oxwrapping')->getWrappingList('WRAP');
70  }
71  }
72 
73  return $this->_oWrappings;
74  }
75 
81  public function getCardList()
82  {
83  if ($this->_oCards === null) {
84  $this->_oCards = new oxlist();
85 
86  // load gift cards
87  if ($this->getViewConfig()->getShowGiftWrapping()) {
88  $this->_oCards = oxNew('oxwrapping')->getWrappingList('CARD');
89  }
90  }
91 
92  return $this->_oCards;
93  }
94 
106  public function changeWrapping()
107  {
108  $aWrapping = oxRegistry::getConfig()->getRequestParameter('wrapping');
109 
110  if ($this->getViewConfig()->getShowGiftWrapping()) {
111  $oBasket = $this->getSession()->getBasket();
112  // setting wrapping info
113  if (is_array($aWrapping) && count($aWrapping)) {
114  foreach ($oBasket->getContents() as $sKey => $oBasketItem) {
115  // wrapping ?
116  if (isset($aWrapping[$sKey])) {
117  $oBasketItem->setWrapping($aWrapping[$sKey]);
118  }
119  }
120  }
121 
122  $oBasket->setCardMessage(oxRegistry::getConfig()->getRequestParameter('giftmessage'));
123  $oBasket->setCardId(oxRegistry::getConfig()->getRequestParameter('chosencard'));
124  $oBasket->onUpdate();
125 
126  }
127 
128  return 'order';
129  }
130 }