/** * Assigns general product parameters to oxbasketitem object: * - sProduct - oxarticle object ID; * - title - products title; * - sShopId - current shop ID; * - sNativeShopId - article shop ID; * * @param oxorderarticle $oOrderArticle order article */ protected function _setFromOrderArticle($oOrderArticle) { // overriding whole article $this->_oArticle = $oOrderArticle; // product ID $this->_sProductId = $oOrderArticle->getProductId(); // products title $this->_sTitle = $oOrderArticle->oxarticles__oxtitle->value; // shop Ids $this->_sShopId = $this->getConfig()->getShopId(); $this->_sNativeShopId = $oOrderArticle->oxarticles__oxshopid->value; }
/** * Adds order article to basket (method normally used while recalculating order) * * @param oxorderarticle $oOrderArticle order article to store in basket * * @return oxbasketitem */ public function addOrderArticleToBasket($oOrderArticle) { // adding only if amount > 0 if ($oOrderArticle->oxorderarticles__oxamount->value > 0 && !$oOrderArticle->isBundle()) { $sItemId = $oOrderArticle->getId(); //inserting new $this->_aBasketContents[$sItemId] = oxNew('oxbasketitem'); $this->_aBasketContents[$sItemId]->initFromOrderArticle($oOrderArticle); $this->_aBasketContents[$sItemId]->setWrapping($oOrderArticle->oxorderarticles__oxwrapid->value); $this->_aBasketContents[$sItemId]->setBundle($oOrderArticle->isBundle()); //calling update method $this->onUpdate(); return $this->_aBasketContents[$sItemId]; } elseif ($oOrderArticle->isBundle()) { // deleting bundles, they are handled automatically $oOrderArticle->delete(); } }
public function testOxOrderArticleSetAndGetPersParams() { $sValue = 'agentūrų Литовские für'; $oOrderArticle = new oxorderarticle(); $oOrderArticle->setId('_testOrderArticle'); $oOrderArticle->setPersParams($sValue); $oOrderArticle->save(); $oOrderArticle = new oxorderarticle(); $oOrderArticle->load('_testOrderArticle'); $this->assertEquals($sValue, $oOrderArticle->getPersParams()); }