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