function updateShippingInfo($objectID, $optionList) { $basket = eZBasket::currentBasket(); $shippingInfo = eZShippingManager::updateShippingInfo($basket->attribute('productcollection_id')); return array('status' => eZModuleOperationInfo::STATUS_CONTINUE); }
function updatePrices() { $productCollection = $this->attribute('productcollection'); if ($productCollection) { $currencyCode = ''; $items = $this->items(); $db = eZDB::instance(); $db->begin(); foreach ($items as $itemArray) { $item = $itemArray['item_object']; $productContentObject = $item->attribute('contentobject'); $priceObj = null; $price = 0.0; $attributes = $productContentObject->contentObjectAttributes(); foreach ($attributes as $attribute) { $dataType = $attribute->dataType(); if (eZShopFunctions::isProductDatatype($dataType->isA())) { $priceObj = $attribute->content(); $price += $priceObj->attribute('price'); break; } } if (!is_object($priceObj)) { break; } $currency = $priceObj->attribute('currency'); $optionsPrice = $item->calculatePriceWithOptions($currency); $price += $optionsPrice; $item->setAttribute("price", $price); if ($priceObj->attribute('is_vat_included')) { $item->setAttribute("is_vat_inc", '1'); } else { $item->setAttribute("is_vat_inc", '0'); } $item->setAttribute("vat_value", $priceObj->VATPercent($productContentObject)); $item->setAttribute("discount", $priceObj->attribute('discount_percent')); $item->store(); $currencyCode = $priceObj->attribute('currency'); } $productCollection->setAttribute('currency_code', $currencyCode); $productCollection->store(); $db->commit(); // update prices that are related to shipping values. eZShippingManager::updateShippingInfo($productCollection->attribute('id')); } }
if (is_numeric($removeItem) and $id != $removeItem or is_array($itemList) and !in_array($id, $itemList)) { $itemCountError = true; } } } $i++; } if (is_numeric($removeItem)) { $basket->removeItem($removeItem); } else { foreach ($itemList as $item) { $basket->removeItem($item); } } // Update shipping info after removing an item from the basket. eZShippingManager::updateShippingInfo($basket->attribute('productcollection_id')); $db->commit(); if ($itemCountError) { $module->redirectTo($module->functionURI("basket") . "/(error)/invaliditemcount"); return; } $module->redirectTo($module->functionURI("basket") . "/"); return; } } if ($http->hasPostVariable("StoreChangesButton")) { $itemCountList = $http->postVariable("ProductItemCountList"); $itemIDList = $http->postVariable("ProductItemIDList"); // We should check item count, all itemcounts must be greater than 0 foreach ($itemCountList as $itemCount) { // If item count of product <= 0 we should show the error