Mage_Weee_Helper_Data Class Reference

Inheritance diagram for Mage_Weee_Helper_Data:

Mage_Core_Helper_Abstract

List of all members.

Public Member Functions

 getPriceDisplayType ($store=null)
 getListPriceDisplayType ($store=null)
 getSalesPriceDisplayType ($store=null)
 getEmailPriceDisplayType ($store=null)
 getAmount ($product, $shipping=null, $billing=null, $website=null, $calculateTaxes=false)
 typeOfDisplay ($product, $compareTo=null, $zone=null, $store=null)
 getProductWeeeAttributes ($product, $shipping=null, $billing=null, $website=null, $calculateTaxes=false)
 getApplied ($item)
 setApplied ($item, $value)
 isDiscounted ($store=null)
 isTaxable ($store=null)
 includeInSubtotal ($store=null)
 getProductWeeeAttributesForDisplay ($product)
 getAmountForDisplay ($product)
 getOriginalAmount ($product)
 processTierPrices ($product, &$tierPrices)
 isEnabled ($store=null)

Public Attributes

const XML_PATH_FPT_ENABLED = 'tax/weee/enable'

Protected Attributes

 $_storeDisplayConfig = array()


Detailed Description

WEEE data helper

Definition at line 30 of file Data.php.


Member Function Documentation

getAmount ( product,
shipping = null,
billing = null,
website = null,
calculateTaxes = false 
)

Definition at line 117 of file Data.php.

00118     {
00119         if ($this->isEnabled()) {
00120             return Mage::getSingleton('weee/tax')->getWeeeAmount($product, $shipping, $billing, $website, $calculateTaxes);
00121         }
00122         return 0;
00123     }

getAmountForDisplay ( product  ) 

Definition at line 226 of file Data.php.

00227     {
00228         if ($this->isEnabled()) {
00229             return Mage::getModel('weee/tax')->getWeeeAmount($product, null, null, null, $this->typeOfDisplay($product, 1));
00230         }
00231         return 0;
00232     }

getApplied ( item  ) 

if order item data is old enough then weee_tax_applied cab be not valid serialized data

Definition at line 170 of file Data.php.

00171     {
00172         if ($item instanceof Mage_Sales_Model_Quote_Item_Abstract) {
00173             if ($item->getHasChildren() && $item->isChildrenCalculated()) {
00174                 $result = array();
00175                 foreach ($item->getChildren() as $child) {
00176                     $childData = $this->getApplied($child);
00177                     if (is_array($childData)) {
00178                         $result = array_merge($result, $childData);
00179                     }
00180                 }
00181                 return $result;
00182             }
00183         }
00184 
00185         /**
00186          * if order item data is old enough then weee_tax_applied cab be
00187          * not valid serialized data
00188          */
00189         $data = $item->getWeeeTaxApplied();
00190         if (empty($data)){
00191             return array();
00192         }
00193         return unserialize($item->getWeeeTaxApplied());
00194     }

getEmailPriceDisplayType ( store = null  ) 

Definition at line 97 of file Data.php.

00098     {
00099         if (!is_null($store)) {
00100             if ($store instanceof Mage_Core_Model_Store) {
00101                 $key = $store->getId();
00102             } else {
00103                 $key = $store;
00104             }
00105         } else {
00106             $key = 'current';
00107         }
00108 
00109         if (!isset($this->_storeDisplayConfig[$key])) {
00110             $value = Mage::getStoreConfig('tax/weee/display_email', $store);
00111             $this->_storeDisplayConfig[$key] = $value;
00112         }
00113 
00114         return $this->_storeDisplayConfig[$key];
00115     }

getListPriceDisplayType ( store = null  ) 

Definition at line 57 of file Data.php.

00058     {
00059         if (!is_null($store)) {
00060             if ($store instanceof Mage_Core_Model_Store) {
00061                 $key = $store->getId();
00062             } else {
00063                 $key = $store;
00064             }
00065         } else {
00066             $key = 'current';
00067         }
00068 
00069         if (!isset($this->_storeDisplayConfig[$key])) {
00070             $value = Mage::getStoreConfig('tax/weee/display_list', $store);
00071             $this->_storeDisplayConfig[$key] = $value;
00072         }
00073 
00074         return $this->_storeDisplayConfig[$key];
00075     }

getOriginalAmount ( product  ) 

Definition at line 234 of file Data.php.

00235     {
00236         if ($this->isEnabled()) {
00237             return Mage::getModel('weee/tax')->getWeeeAmount($product, null, null, null, false, true);
00238         }
00239         return 0;
00240     }

getPriceDisplayType ( store = null  ) 

Definition at line 37 of file Data.php.

00038     {
00039         if (!is_null($store)) {
00040             if ($store instanceof Mage_Core_Model_Store) {
00041                 $key = $store->getId();
00042             } else {
00043                 $key = $store;
00044             }
00045         } else {
00046             $key = 'current';
00047         }
00048 
00049         if (!isset($this->_storeDisplayConfig[$key])) {
00050             $value = Mage::getStoreConfig('tax/weee/display', $store);
00051             $this->_storeDisplayConfig[$key] = $value;
00052         }
00053 
00054         return $this->_storeDisplayConfig[$key];
00055     }

getProductWeeeAttributes ( product,
shipping = null,
billing = null,
website = null,
calculateTaxes = false 
)

Definition at line 165 of file Data.php.

00166     {
00167         return Mage::getSingleton('weee/tax')->getProductWeeeAttributes($product, $shipping, $billing, $website, $calculateTaxes);
00168     }

getProductWeeeAttributesForDisplay ( product  ) 

Definition at line 217 of file Data.php.

00218     {
00219         if ($this->isEnabled()) {
00220             return $this->getProductWeeeAttributes($product, null, null, null, $this->typeOfDisplay($product, 1));
00221         }
00222         return array();
00223     }

getSalesPriceDisplayType ( store = null  ) 

Definition at line 77 of file Data.php.

00078     {
00079         if (!is_null($store)) {
00080             if ($store instanceof Mage_Core_Model_Store) {
00081                 $key = $store->getId();
00082             } else {
00083                 $key = $store;
00084             }
00085         } else {
00086             $key = 'current';
00087         }
00088 
00089         if (!isset($this->_storeDisplayConfig[$key])) {
00090             $value = Mage::getStoreConfig('tax/weee/display_sales', $store);
00091             $this->_storeDisplayConfig[$key] = $value;
00092         }
00093 
00094         return $this->_storeDisplayConfig[$key];
00095     }

includeInSubtotal ( store = null  ) 

Definition at line 212 of file Data.php.

00213     {
00214         return Mage::getStoreConfigFlag('tax/weee/include_in_subtotal', $store);
00215     }

isDiscounted ( store = null  ) 

Definition at line 202 of file Data.php.

00203     {
00204         return Mage::getStoreConfigFlag('tax/weee/discount', $store);
00205     }

isEnabled ( store = null  ) 

Check if fixed taxes are used in system

Returns:
bool

Definition at line 258 of file Data.php.

00259     {
00260         return Mage::getStoreConfig(self::XML_PATH_FPT_ENABLED, $store);
00261     }

isTaxable ( store = null  ) 

Definition at line 207 of file Data.php.

00208     {
00209         return Mage::getStoreConfigFlag('tax/weee/apply_vat', $store);
00210     }

processTierPrices ( product,
&$  tierPrices 
)

Definition at line 242 of file Data.php.

00243     {
00244         $weeeAmount = $this->getAmountForDisplay($product);
00245         foreach ($tierPrices as &$tier) {
00246             $tier['formated_price_incl_weee'] = Mage::app()->getStore()->formatPrice(Mage::app()->getStore()->convertPrice(Mage::helper('tax')->getPrice($product, $tier['website_price'], true)+$weeeAmount));
00247             $tier['formated_price_incl_weee_only'] = Mage::app()->getStore()->formatPrice(Mage::app()->getStore()->convertPrice(Mage::helper('tax')->getPrice($product, $tier['website_price'])+$weeeAmount));
00248             $tier['formated_weee'] = Mage::app()->getStore()->formatPrice(Mage::app()->getStore()->convertPrice($weeeAmount));
00249         }
00250         return $this;
00251     }

setApplied ( item,
value 
)

Definition at line 196 of file Data.php.

00197     {
00198         $item->setWeeeTaxApplied(serialize($value));
00199         return $this;
00200     }

typeOfDisplay ( product,
compareTo = null,
zone = null,
store = null 
)

Definition at line 125 of file Data.php.

00126     {
00127         $type = 0;
00128         switch ($zone) {
00129             case 'product_view':
00130             $type = $this->getPriceDisplayType($store);
00131             break;
00132 
00133             case 'product_list':
00134             $type = $this->getListPriceDisplayType($store);
00135             break;
00136 
00137             case 'sales':
00138             $type = $this->getSalesPriceDisplayType($store);
00139             break;
00140 
00141             case 'email':
00142             $type = $this->getEmailPriceDisplayType($store);
00143             break;
00144 
00145             default:
00146             if (Mage::registry('current_product')) {
00147                 $type = $this->getPriceDisplayType($store);
00148             } else {
00149                 $type = $this->getListPriceDisplayType($store);
00150             }
00151             break;
00152         }
00153 
00154         if (is_null($compareTo)) {
00155             return $type;
00156         } else {
00157             if (is_array($compareTo)) {
00158                 return in_array($type, $compareTo);
00159             } else {
00160                 return $type == $compareTo;
00161             }
00162         }
00163     }


Member Data Documentation

$_storeDisplayConfig = array() [protected]

Definition at line 35 of file Data.php.

const XML_PATH_FPT_ENABLED = 'tax/weee/enable'

Definition at line 33 of file Data.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:56 2009 for Magento by  doxygen 1.5.8