public function __construct($arguments) { parent::__construct(); $this->_item = $item = $arguments['item']; $this->_parent_item = $parent_item = $arguments['parent_item']; $this->_get_options = $options = $arguments['options']; $this->_product = null; $this->_type = $parent_item ? $parent_item->getProduct()->getTypeId() : $item->getProduct()->getTypeId(); $this->_loaded_object = $this->_getItem('load_item_data_on_parent'); if (false) { echo '---------------------------------<br/>'; foreach ($this->_item->getData() as $index => $value) { $value = is_object($value) ? get_class($value) : (is_array($value) ? 'array' : $value); echo "{$index} = {$value}<br/>"; } if ($parent_item) { echo '----- parent -----<br/>'; foreach ($parent_item->getData() as $index => $value) { echo "{$index} = {$value}<br/>"; } } echo 'type:' . $this->_type . '<br/>'; echo 'sku:' . $this->sku . '<br/>'; } }
public function __construct($arguments = null) { parent::__construct(); if ($arguments && isset($argument['id'])) { $this->_store = Mage::app()->getStore((int) $argument['id']); } else { $this->_store = Mage::app()->getStore(); } }
public function __construct($arguments = null) { $customer_group_id = Mage::getSingleton('customer/session')->getCustomerGroupId(); if ($customer_group_id == 0) { // Pour les commandes depuis Adminhtml $customer_group_id2 = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getCustomerGroupId(); if (isset($customer_group_id2)) { $customer_group_id = $customer_group_id2; } } parent::__construct(array('id' => $customer_group_id)); }
public function __construct() { parent::__construct(); $this->_timestamp = (int) Mage::getModel('core/date')->timestamp(); }
public function __construct($arguments) { parent::__construct(); $request = $arguments['request']; $this->_options = $arguments['options']; $this->_data = array('price-tax+discount' => null, 'price-tax-discount' => null, 'price+tax+discount' => null, 'price+tax-discount' => null, 'weight' => $request->getData('package_weight'), 'qty' => $request->getData('package_qty'), 'free_shipping' => $request->getData('free_shipping')); $cart_items = array(); $items = $request->getAllItems(); $quote_total_collected = false; $bundle_process_children = isset($this->_options['bundle']['process_children']) && $this->_options['bundle']['process_children']; foreach ($items as $item) { $product = $item->getProduct(); if ($product instanceof Mage_Catalog_Model_Product) { $key = null; if ($item instanceof Mage_Sales_Model_Quote_Address_Item) { // Multishipping $key = $item->getQuoteItemId(); } else { if ($item instanceof Mage_Sales_Model_Quote_Item) { // Onepage checkout $key = $item->getId(); } } $cart_items[$key] = $item; } } // Do not use quote to retrieve values, totals are not available $total_incl_tax_without_discount = 0; $total_excl_tax_without_discount = 0; $total_incl_tax_with_discount = 0; $total_excl_tax_with_discount = 0; $this->_items = array(); foreach ($cart_items as $item) { $type = $item->getProduct()->getTypeId(); //echo $item->getProduct()->getTypeId().', '.$item->getQty().'<br/>'; $parent_item_id = $item->getData('parent_item_id'); $parent_item = isset($cart_items[$parent_item_id]) ? $cart_items[$parent_item_id] : null; $parent_type = isset($parent_item) ? $parent_item->getProduct()->getTypeId() : null; if ($type != 'configurable') { if ($type == 'bundle' && $bundle_process_children) { $this->_data['qty'] -= $item->getQty(); continue; } if ($parent_type == 'bundle') { if (!$bundle_process_children) { continue; } else { $this->_data['qty'] += $item->getQty(); } } $this->_items[] = Mage::getModel('owebia_shipping2/Os2_Data_CartItem', array('item' => $item, 'parent_item' => $parent_item, 'options' => $this->_options)); } //foreach ($item->getData() as $index => $value) echo "$index = $value<br/>\n"; $total_excl_tax_without_discount += $item->getData('base_row_total'); $total_excl_tax_with_discount += $item->getData('base_row_total') - $item->getData('base_discount_amount'); $total_incl_tax_with_discount += $item->getData('base_row_total') - $item->getData('base_discount_amount') + $item->getData('tax_amount'); $total_incl_tax_without_discount += $item->getData('base_row_total_incl_tax'); } $this->_data['price-tax+discount'] = $total_excl_tax_with_discount; $this->_data['price-tax-discount'] = $total_excl_tax_without_discount; $this->_data['price+tax+discount'] = $total_incl_tax_with_discount; $this->_data['price+tax-discount'] = $total_incl_tax_without_discount; //echo '<pre>Owebia_Shipping2_Model_Os2_Data_Abstract::__construct<br/>';foreach ($this->_data as $n => $v){echo "\t$n => ".(is_object($v) ? get_class($v) : (is_array($v) ? 'array' : $v))."<br/>";}echo '</pre>'; }