/** * Add order tax information to select * * @param Mage_Sales_Model_Resource_Order_Collection $collection * @return Mage_Sales_Model_Api2_Order */ protected function _addTaxInfo(Mage_Sales_Model_Resource_Order_Collection $collection) { $taxInfoFields = array(); if ($this->_isTaxNameAllowed()) { $taxInfoFields['tax_name'] = 'order_tax.title'; } if ($this->_isTaxRateAllowed()) { $taxInfoFields['tax_rate'] = 'order_tax.percent'; } if ($taxInfoFields) { $collection->getSelect()->joinLeft(array('order_tax' => $collection->getTable('sales_order_tax')), 'main_table.entity_id = order_tax.order_id', $taxInfoFields); } return $this; }
/** * Render related orders grid information */ public function prepareRelatedOrdersFrontendGrid() { $this->_prepareRelatedOrders(array('increment_id', 'created_at', 'customer_firstname', 'customer_lastname', 'base_grand_total', 'status')); $this->_relatedOrders->addFieldToFilter('state', array('in' => Mage::getSingleton('Mage_Sales_Model_Order_Config')->getVisibleOnFrontStates())); $pager = $this->getLayout()->createBlock('Mage_Page_Block_Html_Pager')->setCollection($this->_relatedOrders)->setIsOutputRequired(false); $this->setChild('pager', $pager); $this->setGridColumns(array(new Varien_Object(array('index' => 'increment_id', 'title' => $this->__('Order #'), 'is_nobr' => true, 'width' => 1)), new Varien_Object(array('index' => 'created_at', 'title' => $this->__('Date'), 'is_nobr' => true, 'width' => 1)), new Varien_Object(array('index' => 'customer_name', 'title' => $this->__('Customer Name'))), new Varien_Object(array('index' => 'base_grand_total', 'title' => $this->__('Order Total'), 'is_nobr' => true, 'width' => 1, 'is_amount' => true)), new Varien_Object(array('index' => 'status', 'title' => $this->__('Order Status'), 'is_nobr' => true, 'width' => 1)))); $orders = array(); foreach ($this->_relatedOrders as $order) { $orders[] = new Varien_Object(array('increment_id' => $order->getIncrementId(), 'created_at' => $this->formatDate($order->getCreatedAt()), 'customer_name' => $order->getCustomerName(), 'base_grand_total' => Mage::helper('Mage_Core_Helper_Data')->formatCurrency($order->getBaseGrandTotal(), false), 'status' => $order->getStatusLabel(), 'increment_id_link_url' => $this->getUrl('sales/order/view/', array('order_id' => $order->getId())))); } if ($orders) { $this->setGridElements($orders); } }
/** * Get SQL for get record count * * @return Varien_Db_Select */ public function getSelectCountSql() { if ($this->getIsCustomerMode()) { $this->_renderFilters(); $unionSelect = clone $this->getSelect(); $unionSelect->reset(Zend_Db_Select::ORDER); $unionSelect->reset(Zend_Db_Select::LIMIT_COUNT); $unionSelect->reset(Zend_Db_Select::LIMIT_OFFSET); $countSelect = clone $this->getSelect(); $countSelect->reset(); $countSelect->from(array('a' => $unionSelect), 'COUNT(*)'); } else { $countSelect = parent::getSelectCountSql(); } return $countSelect; }
* to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento * @package Mage_Sales * @subpackage performance_tests * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ // Parse parameters $params = getopt('', array('beforeOutput:', 'scenarioExecutions:')); preg_match("/Num orders: (\\d+)/", $params['beforeOutput'], $matches); $numOrdersBefore = $matches[1]; $expectedOrdersCreated = $params['scenarioExecutions']; // Retrieve current number of orders and calculate number of orders created require_once __DIR__ . '/../../../../app/bootstrap.php'; Mage::app('', 'store'); $collection = new Mage_Sales_Model_Resource_Order_Collection(); $numOrdersNow = $collection->getSize(); $actualOrdersCreated = $numOrdersNow - $numOrdersBefore; // Compare number of new orders to the expected value if ($expectedOrdersCreated != $actualOrdersCreated) { echo "Failure: expected {$expectedOrdersCreated} new orders, while actually created {$actualOrdersCreated}"; exit(1); } echo "Verification successful, {$actualOrdersCreated} of {$expectedOrdersCreated} orders created";
/** * Model initialization * */ protected function _construct() { parent::_construct(); $this->setMainTable('sales_flat_order_grid'); }
/** * Script to retrieve number of orders before checkout scenario execution * * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento * @package Mage_Sales * @subpackage performance_tests * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require_once __DIR__ . '/../../../../app/bootstrap.php'; Mage::app('', 'store'); $collection = new Mage_Sales_Model_Resource_Order_Collection(); echo "Num orders: ", $collection->getSize(), PHP_EOL;
/** * Add order payment method field to select * * @param Mage_Sales_Model_Resource_Order_Collection $collection * @return Iways_PayPalPlus_Model_Api2_Order */ protected function _addPaymentMethodInfo(Mage_Sales_Model_Resource_Order_Collection $collection) { $collection->getSelect()->joinLeft(array('payment_method' => $collection->getTable('sales/order_payment')), 'main_table.entity_id = payment_method.parent_id', array('payment_method' => 'payment_method.method', 'ppp_pui_reference_number', 'ppp_pui_instruction_type', 'ppp_pui_payment_due_date', 'ppp_pui_note', 'ppp_pui_bank_name', 'ppp_pui_account_holder_name', 'ppp_pui_international_bank_account_number', 'ppp_pui_bank_identifier_code', 'ppp_pui_routing_number', 'ppp_pui_amount', 'ppp_pui_currency')); return $this; }
/** * @param Mage_Sales_Model_Resource_Order_Collection $collection * * @return $this */ public function appendPaymentInfoToOrderCollection(Mage_Sales_Model_Resource_Order_Collection &$collection) { $collection->getSelect()->joinLeft(array('payments' => $this->getMainTable()), 'payments.order_id = main_table.entity_id', array('rede_payment_id' => 'payment_id', 'rede_transaction_id' => 'transaction_id')); return $this; }