1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_XmlConnect_Block_Catalog_Product_Price_Default extends Mage_Catalog_Block_Product_Price
35: {
36: 37: 38: 39: 40: 41:
42: public function collectProductPrices(
43: Mage_Catalog_Model_Product $product, Mage_XmlConnect_Model_Simplexml_Element $item
44: ) {
45: $this->setProduct($product)->setDisplayMinimalPrice(true)->setUseLinkForAsLowAs(false);
46:
47: $priceXmlObj = $item->addChild('price');
48: $_tierPrices = $this->_getTierPrices($product);
49: if (count($_tierPrices) > 0) {
50: $tierPricesTextArray = $this->_getTierPricesTextArray($_tierPrices, $product);
51: $item->addChild('price_tier', implode(PHP_EOL, $tierPricesTextArray));
52: }
53:
54:
55: $_coreHelper = $this->helper('core');
56:
57: $_weeeHelper = $this->helper('weee');
58:
59: $_taxHelper = $this->helper('tax');
60:
61: $_simplePricesTax = ($_taxHelper->displayPriceIncludingTax() || $_taxHelper->displayBothPrices());
62: $_minimalPriceValue = $product->getMinimalPrice();
63: $_minimalPrice = $_taxHelper->getPrice($product, $_minimalPriceValue, $_simplePricesTax);
64:
65: if (!$product->isGrouped()) {
66: $_weeeTaxAmount = $_weeeHelper->getAmountForDisplay($product);
67: if ($_weeeHelper->typeOfDisplay($product, array(1, 2, 4))) {
68: $_weeeTaxAmount = $_weeeHelper->getAmount($product);
69: $_weeeTaxAttributes = $_weeeHelper->getProductWeeeAttributesForDisplay($product);
70: }
71:
72: $_price = $_taxHelper->getPrice($product, $product->getPrice());
73: $_regularPrice = $_taxHelper->getPrice($product, $product->getPrice(), $_simplePricesTax);
74: $_finalPrice = $_taxHelper->getPrice($product, $product->getFinalPrice());
75: $_finalPriceInclTax = $_taxHelper->getPrice($product, $product->getFinalPrice(), true);
76: $_weeeHelper->getPriceDisplayType();
77: if ($_finalPrice == $_price) {
78: if ($_taxHelper->displayBothPrices()) {
79: 80: 81:
82: if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 0)) {
83: $priceXmlObj->addAttribute(
84: 'excluding_tax', $_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
85: );
86: $priceXmlObj->addAttribute(
87: 'including_tax', $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmount, true, false)
88: );
89: } elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 1)) {
90: 91: 92:
93: $priceXmlObj->addAttribute(
94: 'excluding_tax', $_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
95: );
96: $priceXmlObj->addAttribute(
97: 'including_tax', $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmount, true, false)
98: );
99: $weeeXmlObj = $priceXmlObj->addChild('weee');
100: $_weeeSeparator = ' + ';
101: $weeeXmlObj->addAttribute('separator', $_weeeSeparator);
102: foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
103: $weeeItemXmlObj = $weeeXmlObj->addChild('item');
104: $weeeItemXmlObj->addAttribute(
105: 'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
106: );
107: $weeeItemXmlObj->addAttribute(
108: 'amount', $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
109: );
110: }
111: } elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 4)) {
112: 113: 114:
115: $priceXmlObj->addAttribute(
116: 'excluding_tax', $_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
117: );
118: $priceXmlObj->addAttribute(
119: 'including_tax', $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmount, true, false)
120: );
121: $weeeXmlObj = $priceXmlObj->addChild('weee');
122: $_weeeSeparator = ' + ';
123: $weeeXmlObj->addAttribute('separator', $_weeeSeparator);
124: foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
125: $weeeItemXmlObj = $weeeXmlObj->addChild('item');
126: $weeeItemXmlObj->addAttribute(
127: 'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
128: );
129: $weeeItemXmlObj->addAttribute('amount', $_coreHelper->currency(
130: $_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, false
131: ));
132: }
133: } elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 2)) {
134: 135: 136:
137: $priceXmlObj->addAttribute('excluding_tax', $_coreHelper->currency($_price, true, false));
138: $weeeXmlObj = $priceXmlObj->addChild('weee');
139: foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
140: $weeeItemXmlObj = $weeeXmlObj->addChild('item');
141: $weeeItemXmlObj->addAttribute(
142: 'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
143: );
144: $weeeItemXmlObj->addAttribute(
145: 'amount', $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
146: );
147: }
148: $priceXmlObj->addAttribute('including_tax', $_coreHelper->currency(
149: $_finalPriceInclTax + $_weeeTaxAmount, true, false
150: ));
151: } else {
152: $priceXmlObj->addAttribute('excluding_tax', $_coreHelper->currency($_price, true, false));
153: $priceXmlObj->addAttribute(
154: 'including_tax', $_coreHelper->currency($_finalPriceInclTax, true, false)
155: );
156: }
157: 158: 159:
160: } else {
161: 162: 163:
164: if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 0)) {
165: $priceXmlObj->addAttribute('regular', $_coreHelper->currency(
166: $_price + $_weeeTaxAmount, true, false
167: ));
168: } elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 1)) {
169: 170: 171:
172: $priceXmlObj->addAttribute('regular', $_coreHelper->currency(
173: $_price + $_weeeTaxAmount, true, false
174: ));
175: $weeeXmlObj = $priceXmlObj->addChild('weee');
176: $_weeeSeparator = ' + ';
177: $weeeXmlObj->addAttribute('separator', $_weeeSeparator);
178: foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
179: $weeeItemXmlObj = $weeeXmlObj->addChild('item');
180: $weeeItemXmlObj->addAttribute(
181: 'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
182: );
183: $weeeItemXmlObj->addAttribute(
184: 'amount', $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
185: );
186: }
187: } elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 4)) {
188: 189: 190:
191: $priceXmlObj->addAttribute('regular', $_coreHelper->currency(
192: $_price + $_weeeTaxAmount, true, false
193: ));
194: $weeeXmlObj = $priceXmlObj->addChild('weee');
195: $_weeeSeparator = ' + ';
196: $weeeXmlObj->addAttribute('separator', $_weeeSeparator);
197: foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
198: $weeeItemXmlObj = $weeeXmlObj->addChild('item');
199: $weeeItemXmlObj->addAttribute(
200: 'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
201: );
202: $weeeItemXmlObj->addAttribute('amount', $_coreHelper->currency(
203: $_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, false
204: ));
205: }
206: } elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 2)) {
207: 208: 209:
210: $priceXmlObj->addAttribute(
211: 'regular', $_coreHelper->currency($_price, true, false)
212: );
213: $weeeXmlObj = $priceXmlObj->addChild('weee');
214: foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
215: $weeeItemXmlObj = $weeeXmlObj->addChild('item');
216: $weeeItemXmlObj->addAttribute(
217: 'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
218: );
219: $weeeItemXmlObj->addAttribute(
220: 'amount', $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
221: );
222: }
223: $priceXmlObj->addAttribute(
224: 'including_tax', $_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
225: );
226: } else {
227: $priceXmlObj->addAttribute('regular', $_coreHelper->currency($_price, true, false));
228: }
229: }
230: 231: 232:
233: } else {
234: $_originalWeeeTaxAmount = $_weeeHelper->getOriginalAmount($product);
235: 236: 237:
238: if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 0)) {
239: $priceXmlObj->addAttribute('regular', $_coreHelper->currency(
240: $_regularPrice + $_originalWeeeTaxAmount, true, false
241: ));
242: if ($_taxHelper->displayBothPrices()) {
243: $priceXmlObj->addAttribute('special_excluding_tax', $_coreHelper->currency(
244: $_finalPrice + $_weeeTaxAmount, true, false
245: ));
246: $priceXmlObj->addAttribute('special_including_tax', $_coreHelper->currency(
247: $_finalPriceInclTax + $_weeeTaxAmount, true, false
248: ));
249: } else {
250: $priceXmlObj->addAttribute('special', $_coreHelper->currency(
251: $_finalPrice + $_weeeTaxAmount, true, false
252: ));
253: }
254: } elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 1)) {
255: 256: 257:
258: $priceXmlObj->addAttribute('regular', $_coreHelper->currency(
259: $_regularPrice + $_originalWeeeTaxAmount, true, false
260: ));
261: $priceXmlObj->addAttribute('special_excluding_tax', $_coreHelper->currency(
262: $_finalPrice + $_weeeTaxAmount, true, false
263: ));
264: $weeeXmlObj = $priceXmlObj->addChild('weee');
265: $_weeeSeparator = ' + ';
266: $weeeXmlObj->addAttribute('separator', $_weeeSeparator);
267: foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
268: $weeeItemXmlObj = $weeeXmlObj->addChild('item');
269: $weeeItemXmlObj->addAttribute(
270: 'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
271: );
272: $weeeItemXmlObj->addAttribute('amount', $_coreHelper->currency(
273: $_weeeTaxAttribute->getAmount(), true, false
274: ));
275: }
276: $priceXmlObj->addAttribute('special_including_tax', $_coreHelper->currency(
277: $_finalPriceInclTax + $_weeeTaxAmount, true, false
278: ));
279: } elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 4)) {
280: 281: 282:
283: $priceXmlObj->addAttribute('regular', $_coreHelper->currency(
284: $_regularPrice + $_originalWeeeTaxAmount, true, false
285: ));
286: $priceXmlObj->addAttribute('special_excluding_tax', $_coreHelper->currency(
287: $_finalPrice + $_weeeTaxAmount, true, false
288: ));
289: $weeeXmlObj = $priceXmlObj->addChild('weee');
290: $_weeeSeparator = ' + ';
291: $weeeXmlObj->addAttribute('separator', $_weeeSeparator);
292: foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
293: $weeeItemXmlObj = $weeeXmlObj->addChild('item');
294: $weeeItemXmlObj->addAttribute(
295: 'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
296: );
297: $weeeItemXmlObj->addAttribute('amount', $_coreHelper->currency(
298: $_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, false
299: ));
300: }
301: $priceXmlObj->addAttribute('special_including_tax', $_coreHelper->currency(
302: $_finalPriceInclTax + $_weeeTaxAmount, true, false
303: ));
304: } elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 2)) {
305: 306: 307:
308: $priceXmlObj->addAttribute('regular', $_coreHelper->currency($_regularPrice, true, false));
309: $priceXmlObj->addAttribute(
310: 'special_excluding_tax', $_coreHelper->currency($_finalPrice, true, false)
311: );
312: $weeeXmlObj = $priceXmlObj->addChild('weee');
313: foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
314: $weeeItemXmlObj = $weeeXmlObj->addChild('item');
315: $weeeItemXmlObj->addAttribute(
316: 'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
317: );
318: $weeeItemXmlObj->addAttribute('amount', $_coreHelper->currency(
319: $_weeeTaxAttribute->getAmount(), true, false
320: ));
321: }
322: $priceXmlObj->addAttribute('special_including_tax', $_coreHelper->currency(
323: $_finalPriceInclTax + $_weeeTaxAmount, true, false
324: ));
325: } else {
326: 327: 328:
329: $priceXmlObj->addAttribute('regular', $_coreHelper->currency($_regularPrice, true, false));
330: if ($_taxHelper->displayBothPrices()) {
331: $priceXmlObj->addAttribute(
332: 'special_excluding_tax', $_coreHelper->currency($_finalPrice, true, false)
333: );
334: $priceXmlObj->addAttribute(
335: 'special_including_tax', $_coreHelper->currency($_finalPriceInclTax, true, false)
336: );
337: } else {
338: $priceXmlObj->addAttribute(
339: 'special', $_coreHelper->currency($_finalPrice, true, false)
340: );
341: }
342: }
343: }
344:
345: if ($this->getDisplayMinimalPrice()
346: && $_minimalPriceValue
347: && $_minimalPriceValue < $product->getFinalPrice()
348: ) {
349: $_minimalPriceDisplayValue = $_minimalPrice;
350:
351: if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, array(0, 1, 4))) {
352: $_minimalPriceDisplayValue = $_minimalPrice + $_weeeTaxAmount;
353: }
354:
355: if (!$this->getUseLinkForAsLowAs()) {
356: $priceXmlObj->addAttribute('as_low_as', $_coreHelper->currency(
357: $_minimalPriceDisplayValue, true, false
358: ));
359: }
360: }
361: 362: 363:
364: } else {
365: $_exclTax = $_taxHelper->getPrice($product, $_minimalPriceValue, null);
366: $_inclTax = $_taxHelper->getPrice($product, $_minimalPriceValue, true);
367:
368: if ($this->getDisplayMinimalPrice() && $_minimalPriceValue) {
369: if ($_taxHelper->displayBothPrices()) {
370: $priceXmlObj->addAttribute('starting_at_excluding_tax', $_coreHelper->currency(
371: $_exclTax, true, false
372: ));
373: $priceXmlObj->addAttribute('starting_at_including_tax', $_coreHelper->currency(
374: $_inclTax, true, false
375: ));
376: } else {
377: $_showPrice = $_inclTax;
378: if (!$_taxHelper->displayPriceIncludingTax()) {
379: $_showPrice = $_exclTax;
380: }
381: $priceXmlObj->addAttribute('starting_at', $_coreHelper->currency($_showPrice, true, false));
382: }
383: }
384: }
385: }
386:
387: 388: 389: 390: 391: 392:
393: protected function _getTierPrices(Mage_Catalog_Model_Product $product)
394: {
395: if (is_null($product)) {
396: return array();
397: }
398: $prices = $product->getFormatedTierPrice();
399:
400: $res = array();
401: if (is_array($prices)) {
402: foreach ($prices as $price) {
403: $price['price_qty'] = $price['price_qty']*1;
404: if ($product->getPrice() != $product->getFinalPrice()) {
405: if ($price['price'] < $product->getFinalPrice()) {
406: $price['savePercent'] = ceil(100 - ((100 / $product->getFinalPrice()) * $price['price']));
407: $price['formated_price'] = Mage::app()->getStore()->formatPrice(
408: Mage::app()->getStore()->convertPrice(
409: Mage::helper('tax')->getPrice($product, $price['website_price'])
410: ),
411: false
412: );
413: $price['formated_price_incl_tax'] = Mage::app()->getStore()->formatPrice(
414: Mage::app()->getStore()->convertPrice(
415: Mage::helper('tax')->getPrice($product, $price['website_price'], true)
416: ),
417: false
418: );
419: $res[] = $price;
420: }
421: } else {
422: if ($price['price'] < $product->getPrice()) {
423: $price['savePercent'] = ceil(100 - ((100 / $product->getPrice()) * $price['price']));
424: $price['formated_price'] = Mage::app()->getStore()->formatPrice(
425: Mage::app()->getStore()->convertPrice(
426: Mage::helper('tax')->getPrice($product, $price['website_price'])
427: ),
428: false
429: );
430: $price['formated_price_incl_tax'] = Mage::app()->getStore()->formatPrice(
431: Mage::app()->getStore()->convertPrice(
432: Mage::helper('tax')->getPrice($product, $price['website_price'], true)
433: ),
434: false
435: );
436: $res[] = $price;
437: }
438: }
439: }
440: }
441: return $res;
442: }
443:
444: 445: 446: 447: 448: 449: 450: 451:
452: protected function _getTierPricesTextArray($_tierPrices, $_product)
453: {
454: $pricesArray = array();
455: if (Mage::helper('weee')->typeOfDisplay($_product, array(1, 2, 4))) {
456: $_weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($_product);
457: }
458:
459: if ($_product->isGrouped()) {
460: $_tierPrices = $this->getTierPrices($_product);
461: }
462: Mage::helper('weee')->processTierPrices($_product, $_tierPrices);
463:
464: foreach ($_tierPrices as $_price) {
465: $s = '';
466: if ($this->helper('tax')->displayBothPrices()) {
467: if (Mage::helper('weee')->typeOfDisplay($_product, 0)) {
468: $s .= $this->__('Buy %1$s for %2$s (%3$s incl. tax) each', $_price['price_qty'], $_price['formated_price_incl_weee_only'], $_price['formated_price_incl_weee']);
469: } else if (Mage::helper('weee')->typeOfDisplay($_product, 1)) {
470: $s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']);
471: if ($_weeeTaxAttributes) {
472: $s .= '(' . $this->__('%1$s incl tax.', $_price['formated_price_incl_weee']);
473: $separator = ' + ';
474: foreach ($_weeeTaxAttributes as $_attribute) {
475: $s .= $separator . $_attribute->getName() . ': ';
476: $s .= Mage::helper('core')->currency($_attribute->getAmount());
477: }
478: $s .= ')';
479: }
480: $s .= $this->__('each');
481: } else if (Mage::helper('weee')->typeOfDisplay($_product, 4)) {
482: $s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']);
483: if ($_weeeTaxAttributes) {
484: $s .= '(' . $this->__('%1$s incl tax.', $_price['formated_price_incl_weee']);
485: $separator = ' + ';
486: foreach ($_weeeTaxAttributes as $_attribute) {
487: $s .= $separator . $_attribute->getName() . ': ';
488: $s .= Mage::helper('core')->currency(
489: $_attribute->getAmount() + $_attribute->getTaxAmount()
490: );
491: }
492: $s .= ')';
493: }
494: $s .= $this->__('each');
495: } else if (Mage::helper('weee')->typeOfDisplay($_product, 2)) {
496: $s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price']);
497: if ($_weeeTaxAttributes) {
498: $s .= '(';
499: foreach ($_weeeTaxAttributes as $_attribute) {
500: $s .= $_attribute->getName() . ': ';
501: $s .= Mage::helper('core')->currency($_attribute->getAmount());
502: }
503: $s .= $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee']) . ')';
504: }
505: $s .= $this->__('each');
506: } else {
507: $s .= $this->__('Buy %1$s for %2$s (%3$s incl. tax) each', $_price['price_qty'], $_price['formated_price'], $_price['formated_price_incl_tax']);
508: }
509: } else {
510: if ($this->helper('tax')->displayPriceIncludingTax()) {
511: if (Mage::helper('weee')->typeOfDisplay($_product, 0)) {
512: $s .= $this->__('Buy %1$s for %2$s each', $_price['price_qty'], $_price['formated_price_incl_weee']);
513: } else if (Mage::helper('weee')->typeOfDisplay($_product, 1)) {
514: $s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee']);
515: if ($_weeeTaxAttributes) {
516: $s .= '(';
517: $separator = '';
518: foreach ($_weeeTaxAttributes as $_attribute) {
519: $s .= $separator . $_attribute->getName() . ': ';
520: $s .= Mage::helper('core')->currency($_attribute->getAmount());
521: $separator = ' + ';
522: }
523: $s .= ')';
524: }
525: $s .= $this->__('each');
526: } else if (Mage::helper('weee')->typeOfDisplay($_product, 4)) {
527: $s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee']);
528: if ($_weeeTaxAttributes) {
529: $s .= '(';
530: $separator = '';
531: foreach ($_weeeTaxAttributes as $_attribute) {
532: $s .= $separator . $_attribute->getName() . ': ';
533: $s .= Mage::helper('core')->currency(
534: $_attribute->getAmount() + $_attribute->getTaxAmount()
535: );
536: $separator = ' + ';
537: }
538: $s .= ')';
539: }
540: $s .= $this->__('each');
541: } else if (Mage::helper('weee')->typeOfDisplay($_product, 2)) {
542: $s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_tax']);
543: if ($_weeeTaxAttributes) {
544: $s .= '(';
545: foreach ($_weeeTaxAttributes as $_attribute) {
546: $s .= $_attribute->getName() . ': ';
547: $s .= Mage::helper('core')->currency($_attribute->getAmount());
548: }
549: $s .= $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee']) . ')';
550: }
551: $s .= $this->__('each');
552: } else {
553: $s .= $this->__('Buy %1$s for %2$s each', $_price['price_qty'], $_price['formated_price_incl_tax']);
554: }
555: } else {
556: if (Mage::helper('weee')->typeOfDisplay($_product, 0)) {
557: $s .= $this->__('Buy %1$s for %2$s each', $_price['price_qty'], $_price['formated_price_incl_weee_only']);
558: } else if (Mage::helper('weee')->typeOfDisplay($_product, 1)) {
559: $s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']);
560: if ($_weeeTaxAttributes) {
561: $s .= '(';
562: $separator = '';
563: foreach ($_weeeTaxAttributes as $_attribute) {
564: $s .= $separator . $_attribute->getName() . ': ';
565: $s .= Mage::helper('core')->currency($_attribute->getAmount());
566: $separator = ' + ';
567: }
568: $s .= ')';
569: }
570: $s .= $this->__('each');
571: } else if (Mage::helper('weee')->typeOfDisplay($_product, 4)) {
572: $s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']);
573: if ($_weeeTaxAttributes) {
574: $s .= '(';
575: $separator = '';
576: foreach ($_weeeTaxAttributes as $_attribute) {
577: $s .= $separator . $_attribute->getName() . ': ';
578: $s .= Mage::helper('core')->currency(
579: $_attribute->getAmount() + $_attribute->getTaxAmount()
580: );
581: $separator = ' + ';
582: }
583: $s .= ')';
584: }
585: $s .= $this->__('each');
586: } else if (Mage::helper('weee')->typeOfDisplay($_product, 2)) {
587: $s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price']);
588: if ($_weeeTaxAttributes) {
589: $s .= '(';
590: foreach ($_weeeTaxAttributes as $_attribute) {
591: $s .= $_attribute->getName() . ': ';
592: $s .= Mage::helper('core')->currency($_attribute->getAmount());
593: }
594: $s .= $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee_only']) . ')';
595: }
596: $s .= $this->__('each');
597: } else {
598: $s .= $this->__('Buy %1$s for %2$s each', $_price['price_qty'], $_price['formated_price']);
599: }
600: }
601: }
602: if (!$_product->isGrouped()) {
603: $condition1 = ($_product->getPrice() == $_product->getFinalPrice()
604: && $_product->getPrice() > $_price['price']);
605:
606: $condition2 = ($_product->getPrice() != $_product->getFinalPrice()
607: && $_product->getFinalPrice() > $_price['price']);
608:
609: if ($condition1 || $condition2) {
610: $s .= ' ' . $this->__('and') . ' ' . $this->__('save') . ' ' . $_price['savePercent'] . '%';
611: }
612: }
613: $pricesArray[] = $s;
614: }
615: return $pricesArray;
616: }
617: }
618: