Go to the documentation of this file.00001 <?php
00002
00006 class Wrapping extends oxUBase
00007 {
00008
00014 protected $_sThisTemplate = 'page/checkout/wrapping.tpl';
00015
00021 protected $_aBasketItemList = null;
00022
00028 protected $_oWrappings = null;
00029
00035 protected $_oCards = null;
00036
00037
00043 public function getBasketItems()
00044 {
00045 if ($this->_aBasketItemList === null) {
00046 $this->_aBasketItemList = false;
00047
00048
00049 if ($oBasket = $this->getSession()->getBasket()) {
00050 $this->_aBasketItemList = $oBasket->getBasketArticles();
00051 }
00052 }
00053
00054 return $this->_aBasketItemList;
00055 }
00056
00062 public function getWrappingList()
00063 {
00064 if ($this->_oWrappings === null) {
00065 $this->_oWrappings = new oxlist();
00066
00067
00068 if ($this->getViewConfig()->getShowGiftWrapping()) {
00069 $this->_oWrappings = oxNew('oxwrapping')->getWrappingList('WRAP');
00070 }
00071 }
00072
00073 return $this->_oWrappings;
00074 }
00075
00081 public function getCardList()
00082 {
00083 if ($this->_oCards === null) {
00084 $this->_oCards = new oxlist();
00085
00086
00087 if ($this->getViewConfig()->getShowGiftWrapping()) {
00088 $this->_oCards = oxNew('oxwrapping')->getWrappingList('CARD');
00089 }
00090 }
00091
00092 return $this->_oCards;
00093 }
00094
00106 public function changeWrapping()
00107 {
00108 $aWrapping = oxRegistry::getConfig()->getRequestParameter('wrapping');
00109
00110 if ($this->getViewConfig()->getShowGiftWrapping()) {
00111 $oBasket = $this->getSession()->getBasket();
00112
00113 if (is_array($aWrapping) && count($aWrapping)) {
00114 foreach ($oBasket->getContents() as $sKey => $oBasketItem) {
00115
00116 if (isset($aWrapping[$sKey])) {
00117 $oBasketItem->setWrapping($aWrapping[$sKey]);
00118 }
00119 }
00120 }
00121
00122 $oBasket->setCardMessage(oxRegistry::getConfig()->getRequestParameter('giftmessage'));
00123 $oBasket->setCardId(oxRegistry::getConfig()->getRequestParameter('chosencard'));
00124 $oBasket->onUpdate();
00125
00126 }
00127
00128 return 'order';
00129 }
00130 }