Created
July 29, 2013 18:21
-
-
Save deniscsz/6106419 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * calculates total value from quote | |
| * | |
| * @return int|float | |
| */ | |
| public function getShippingPrice() { | |
| /** | |
| * get quote items | |
| */ | |
| $items = Mage::getSingleton('checkout/cart')->getItems(); | |
| $sumMax = 0; | |
| if($items){ | |
| $contProdutos = 0; | |
| foreach ($items as $item){ | |
| /** | |
| * calculate price by items | |
| */ | |
| $priceByItem = $this->calculate($item); | |
| if($sumMax) { | |
| $contProdutos += 1; | |
| } | |
| if($sumMax < $priceByItem) { | |
| $sumMax = $priceByItem; | |
| } | |
| } | |
| } | |
| return $sumMax + $contProdutos; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment