wrapping.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Wrapping extends oxUBase
00007 {
00013     protected $_sThisTemplate = 'wrapping.tpl';
00014 
00020     protected $_aBasketItemList = null;
00021 
00027     protected $_oWrappings = null;
00028 
00034     protected $_oCards = null;
00035 
00046     public function render()
00047     {
00048         parent::render();
00049 
00050         //for older templates
00051         $this->_aViewData['basketitemlist'] = $this->getBasketItems();
00052         $this->_aViewData['wrappings']      = $this->getWrappingList();
00053         $this->_aViewData['cards']          = $this->getCardList();
00054 
00055         return $this->_sThisTemplate;
00056     }
00057 
00063     public function getBasketItems()
00064     {
00065         if ( $this->_aBasketItemList === null ) {
00066             $this->_aBasketItemList = false;
00067 
00068             // passing basket articles
00069             if ( $oBasket = $this->getSession()->getBasket() ) {
00070                 $this->_aBasketItemList = $oBasket->getBasketArticles();
00071             }
00072         }
00073 
00074         return $this->_aBasketItemList;
00075     }
00076 
00082     public function getWrappingList()
00083     {
00084         if ( $this->_oWrappings === null ) {
00085             // load wrapping papers
00086             $this->_oWrappings = oxNew( 'oxwrapping' )->getWrappingList( 'WRAP' );
00087         }
00088         return $this->_oWrappings;
00089     }
00090 
00096     public function getCardList()
00097     {
00098         if ( $this->_oCards === null ) {
00099             // load gift cards
00100             $this->_oCards = oxNew( 'oxwrapping' )->getWrappingList( 'CARD' );
00101         }
00102 
00103         return $this->_oCards;
00104     }
00105 
00117     public function changeWrapping()
00118     {
00119         $oBasket   = $this->getSession()->getBasket();
00120         $aWrapping = oxConfig::getParameter( 'wrapping' );
00121 
00122         // setting wrapping info
00123         if ( is_array( $aWrapping ) ) {
00124             foreach ( $oBasket->getContents() as $sKey => $oBasketItem ) {
00125                 // wrapping ?
00126                 if ( isset( $aWrapping[$sKey] ) ) {
00127                     $oBasketItem->setWrapping( $aWrapping[$sKey] );
00128                 }
00129             }
00130         }
00131 
00132         $oBasket->setCardMessage( oxConfig::getParameter( 'giftmessage' ) );
00133         $oBasket->setCardId( oxConfig::getParameter( 'chosencard' ) );
00134 
00135         return 'order';
00136     }
00137 }

Generated on Wed Apr 22 12:26:32 2009 for OXID eShop CE by  doxygen 1.5.5